/* widget-test.lahde.digitalist.me — digitalist.fi-lookalike showcase.
   Brand tokens per May 2025 guidelines (digitalist-presentation/css/digitalist.css):
   Space Grotesk headings, Roboto body, #b2f100 green, #303030 ink (never pure black). */

:root {
  --green: #b2f100;
  --pink: #ff66bf;
  --blue: #55d1ff;
  --yellow: #fafa00;
  --ink: #303030;
  --grey: #595959;
  --grey-light: #eeeeee;
  --bg: #ffffff;
  --hairline: #e2e2e2;
  --font-head: 'Space Grotesk', sans-serif;
  --font-body: 'Roboto', sans-serif;
  --measure: 46rem;
  --wide: 72rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.125rem;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-head);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 0.6em;
}

a {
  color: inherit;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

a:hover {
  text-decoration-color: var(--green);
}

:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}

img {
  max-width: 100%;
  height: auto;
}

/* ---- demo ribbon ------------------------------------------------------ */

.demo-ribbon {
  background: var(--green);
  color: var(--ink);
  font-size: 0.8125rem;
  font-weight: 500;
  text-align: center;
  padding: 6px 16px;
}

.demo-ribbon a {
  font-weight: 700;
}

/* ---- header ----------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--hairline);
}

.site-header .bar {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 32px;
}

.site-header .logo img {
  height: 26px;
  width: auto;
  display: block;
}

.site-header nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 26px;
}

.site-header nav a {
  font-weight: 500;
  font-size: 1rem;
  text-decoration: none;
  padding: 4px 0;
  border-bottom: 3px solid transparent;
}

.site-header nav a:hover {
  border-bottom-color: var(--green);
}

.site-header nav a[aria-current='page'] {
  border-bottom-color: var(--ink);
}

.btn-pill {
  display: inline-block;
  background: var(--green);
  color: var(--ink);
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  padding: 10px 24px;
  border-radius: 999px;
  border: 2px solid var(--green);
  transition:
    background 0.15s ease,
    color 0.15s ease;
}

.btn-pill:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--green);
}

/* ---- hero ------------------------------------------------------------- */

.hero {
  background: var(--ink);
  color: #fff;
  padding: 96px 24px 104px;
}

.hero .inner {
  max-width: var(--wide);
  margin: 0 auto;
}

.pill-h1 {
  display: inline;
  background: var(--green);
  color: var(--ink);
  font-size: clamp(2.2rem, 5.5vw, 3.6rem);
  font-weight: 700;
  line-height: 1.28;
  padding: 0.08em 0.45em;
  border-radius: 0.18em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.hero .lede {
  max-width: 36em;
  margin-top: 40px;
  font-size: 1.25rem;
  color: #d8d8d8;
}

.hero .actions {
  margin-top: 36px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.btn-ghost {
  display: inline-block;
  color: #fff;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  padding: 10px 24px;
  border-radius: 999px;
  border: 2px solid #6a6a6a;
  transition: border-color 0.15s ease;
}

.btn-ghost:hover {
  border-color: var(--green);
  color: var(--green);
}

/* ---- sections --------------------------------------------------------- */

.section {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 72px 24px;
}

.section > h2,
.section-head {
  font-size: 2rem;
}

.section-head {
  display: inline-block;
  background: var(--grey-light);
  padding: 0.15em 0.6em;
  border-radius: 0.2em;
  margin-bottom: 1.2em;
}

.section.tinted {
  max-width: none;
  background: #f7f7f4;
}

.section.tinted > .inner {
  max-width: var(--wide);
  margin: 0 auto;
}

.section-tight {
  padding-bottom: 0;
}

.section-intro {
  max-width: 42em;
  margin: -1em 0 2.5em;
  color: var(--grey);
}

.ask-slot {
  max-width: 46rem;
}

.grid-cta {
  margin-top: 2.5em;
}

/* ---- cards ------------------------------------------------------------ */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 28px;
}

.card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--hairline);
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
  transition:
    transform 0.15s ease,
    border-color 0.15s ease;
}

.card:hover {
  transform: translateY(-3px);
  border-color: var(--ink);
}

.card .thumb {
  aspect-ratio: 16 / 9;
  background: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card .thumb .mono {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 2.6rem;
  color: var(--green);
}

.card .body {
  padding: 22px 24px 26px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card h3 {
  font-size: 1.25rem;
  margin: 0;
}

.card h3 a {
  text-decoration: none;
}

.card h3 a::after {
  /* whole-card click target */
  content: '';
  position: absolute;
  inset: 0;
}

.card {
  position: relative;
}

.card p {
  margin: 0;
  font-size: 0.97rem;
  color: var(--grey);
}

.card .tag {
  align-self: flex-start;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--green);
  padding: 3px 10px;
  border-radius: 999px;
}

/* ---- article ---------------------------------------------------------- */

.article {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 64px 24px 48px;
}

.article-head h1 {
  font-size: clamp(1.9rem, 4vw, 2.7rem);
  font-weight: 700;
}

.article-head .meta {
  color: var(--grey);
  font-size: 0.9rem;
  margin-bottom: 2.4em;
}

.article-lede {
  font-size: 1.25rem;
  color: var(--grey);
}

.lede-rule {
  border: 0;
  height: 4px;
  width: 72px;
  background: var(--green);
  margin: 2.2em 0;
}

.article h2 {
  font-size: 1.6rem;
  margin-top: 1.8em;
}

.article h3 {
  font-size: 1.25rem;
  margin-top: 1.6em;
}

.article h4 {
  font-size: 1.05rem;
  margin-top: 1.4em;
}

.article figure {
  margin: 2em 0;
}

.article figure img {
  border-radius: 12px;
  border: 1px solid var(--hairline);
}

.article figcaption {
  font-size: 0.85rem;
  color: var(--grey);
  margin-top: 0.6em;
}

.article blockquote {
  margin: 1.8em 0;
  padding: 0.4em 0 0.4em 1.2em;
  border-left: 5px solid var(--green);
  font-family: var(--font-head);
  font-size: 1.2rem;
  font-weight: 500;
}

.article code {
  font-size: 0.9em;
  background: var(--grey-light);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

.article ul,
.article ol {
  padding-left: 1.4em;
}

.article li {
  margin-bottom: 0.4em;
}

/* the related-content slot under each post */
.article-aside {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 24px 72px;
}

/* ---- search page ------------------------------------------------------ */

.search-hero {
  background: var(--ink);
  padding: 72px 24px;
}

.search-hero .inner {
  max-width: var(--measure);
  margin: 0 auto;
}

.search-form {
  display: flex;
  gap: 10px;
  margin-top: 32px;
}

.search-form input[type='search'] {
  flex: 1;
  font: 500 1.1rem var(--font-body);
  color: var(--ink);
  background: #fff;
  border: 2px solid #fff;
  border-radius: 999px;
  padding: 14px 26px;
  min-width: 0;
}

.search-form input[type='search']:focus-visible {
  outline: 3px solid var(--green);
  outline-offset: 2px;
}

.search-form button {
  font: 600 1rem var(--font-head);
  color: var(--ink);
  background: var(--green);
  border: 2px solid var(--green);
  border-radius: 999px;
  padding: 14px 32px;
  cursor: pointer;
}

.search-form button:hover {
  background: var(--ink);
  border-color: var(--green);
  color: var(--green);
}

.search-results {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 48px 24px 96px;
  display: flex;
  flex-direction: column;
  gap: 36px;
}

.results-placeholder {
  border: 2px dashed var(--hairline);
  border-radius: 16px;
  padding: 40px 32px;
  color: var(--grey);
  text-align: center;
  font-size: 0.95rem;
}

.results-placeholder strong {
  display: block;
  font-family: var(--font-head);
  font-size: 1.1rem;
  color: var(--ink);
  margin-bottom: 6px;
}

/* ---- chat page -------------------------------------------------------- */

.chat-wrap {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 48px 24px 96px;
}

/* ---- widget gallery --------------------------------------------------- */

.gallery {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 64px 24px 96px;
  display: flex;
  flex-direction: column;
  gap: 72px;
}

.gallery-item {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 4fr);
  gap: 40px;
  align-items: start;
}

@media (max-width: 860px) {
  .gallery-item {
    grid-template-columns: 1fr;
  }
}

.gallery-item h2 {
  font-size: 1.5rem;
}

.gallery-item h2 code {
  font-family: var(--font-head);
  background: var(--green);
  padding: 0.05em 0.35em;
  border-radius: 0.2em;
}

.gallery-item .demo {
  border: 1px solid var(--hairline);
  border-radius: 16px;
  padding: 28px;
  background: #fff;
}

.gallery-item .demo-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--grey);
  margin: 0 0 14px;
}

/* explains a deliberately-collapsed widget (empty state), so the demo
   panel never looks broken when the element renders nothing */
.gallery-item .demo-note {
  font-size: 0.85rem;
  color: var(--grey);
  margin: 14px 0 0;
}

.snippet {
  background: var(--ink);
  color: #f2f2f2;
  border-radius: 12px;
  padding: 20px 22px;
  overflow-x: auto;
  font-size: 0.82rem;
  line-height: 1.6;
  margin: 0;
}

.snippet code {
  font-family: ui-monospace, 'SF Mono', 'Cascadia Code', Menlo, monospace;
  white-space: pre;
}

.snippet-solo {
  max-width: 46rem;
  margin-top: 1.2em;
}

/* ---- footer ----------------------------------------------------------- */

.site-footer {
  background: var(--ink);
  color: #c9c9c9;
  margin-top: 48px;
}

.site-footer .inner {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 56px 24px 40px;
  display: flex;
  flex-wrap: wrap;
  gap: 40px;
  align-items: flex-start;
  justify-content: space-between;
}

.site-footer img {
  height: 24px;
  width: auto;
}

.site-footer p {
  margin: 0.3em 0;
  font-size: 0.875rem;
  max-width: 38em;
}

.site-footer a {
  color: #fff;
}

.site-footer a:hover {
  color: var(--green);
}

/* ---- Lähde widget theming -------------------------------------------- */

lahde-ask,
lahde-chat,
lahde-search-summary,
lahde-recommend,
lahde-popular-searches {
  --lahde-accent: #303030;
  --lahde-border: #d4d4d4;
  --lahde-bg-subtle: #f7f7f4;
  --lahde-radius: 12px;
  --lahde-text-muted: #595959;
  --lahde-label: #595959;
}

/* reserve the summary card's space before the bundle upgrades the element,
   so keyword results below don't jump (see lahde-integration-nodejs docs) */
lahde-search-summary:not(:defined) {
  display: block;
  min-height: 96px;
}

lahde-search-summary::part(heading)::before,
lahde-recommend::part(heading)::before {
  content: '';
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green);
  margin-right: 8px;
}

lahde-popular-searches::part(pill) {
  border-radius: 999px;
  border: 2px solid var(--ink);
  font-weight: 500;
}

lahde-popular-searches::part(pill):hover {
  background: var(--green);
}

lahde-ask::part(submit),
lahde-chat::part(submit) {
  background: var(--green);
  color: var(--ink);
  border: 2px solid var(--green);
  border-radius: 999px;
  font-family: var(--font-head);
  font-weight: 600;
}

lahde-chat::part(panel) {
  border: 1px solid var(--hairline);
  border-radius: 16px;
  padding: 24px;
}

lahde-chat::part(log) {
  min-height: 360px;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .card,
  .btn-pill,
  .btn-ghost {
    transition: none;
  }
}
