/* Connections Hint Daily — design system (see docs/stage-3-design-system.md)
   Signature element: the hint ladder (three reveal steps per group, light → strong).
   Everything else stays quiet. No web fonts, no framework. */

:root {
  --ink: #1C2333;
  --ink-soft: #3A4459;
  --muted: #5A6478;
  --paper: #F4F6F9;
  --surface: #FFFFFF;
  --line: #D9DEE7;
  --focus: #2F5BEA;
  --btn-bg: #1C2333;
  --btn-fg: #FFFFFF;
  --btn-hover: #3A4459;
  --ad-bg: #ECEEF2;
  --ad-line: #B9C0CC;

  /* Group colours (own shades): stripe, light tint, medium tint, strong tint */
  --yellow: #E9B93A; --yellow-1: #FDF6E3; --yellow-2: #FBEBBE; --yellow-3: #F2CF6B;
  --green:  #5E9C5B; --green-1:  #EAF4E8; --green-2:  #D3E8CF; --green-3:  #93C48E;
  --blue:   #4F7FCF; --blue-1:   #E8EFFB; --blue-2:   #CFDDF6; --blue-3:   #96B4E8;
  --purple: #8E5DB3; --purple-1: #F3ECF9; --purple-2: #E4D4F1; --purple-3: #C7A5DE;
  --on-tint: #1C2333;

  --serif: Charter, "Bitstream Charter", "Sitka Text", Cambria, "Iowan Old Style", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --step--1: 0.875rem;
  --step-0: 1rem;
  --step-1: 1.25rem;
  --step-2: 1.5625rem;
  --step-3: 1.953rem;
  --step-4: clamp(2.1rem, 1.4rem + 3vw, 3.2rem);

  --wrap: 72rem;
  --wrap-narrow: 46rem;
  --gutter: clamp(1rem, 4vw, 2rem);
  --section-space: clamp(3rem, 7vw, 5rem);
  --radius-lg: 14px;
  --radius-sm: 8px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #E7EAF1;
    --ink-soft: #C3C9D6;
    --muted: #97A0B3;
    --paper: #10141E;
    --surface: #171D2A;
    --line: #2C3446;
    --focus: #8FA9FF;
    --btn-bg: #E7EAF1;
    --btn-fg: #10141E;
    --btn-hover: #C3C9D6;
    --ad-bg: #1D2433;
    --ad-line: #3A4459;
    --yellow-1: #2E2818; --yellow-2: #4A3D17; --yellow-3: #E3BF55;
    --green-1:  #1B2A1C; --green-2:  #28412A; --green-3:  #86BA81;
    --blue-1:   #192338; --blue-2:   #243657; --blue-3:   #8FAEE6;
    --purple-1: #251C31; --purple-2: #3A2A4E; --purple-3: #C1A0DA;
  }
  .rung.rung-name, .answer-reveal .answer h3 { --on-tint: #10141E; }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body, h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; }
img, svg { display: block; max-width: 100%; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--step-0);
  line-height: 1.6;
}

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

p { max-width: 68ch; }
a { color: var(--ink); text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 2px; }
.muted { color: var(--muted); }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 4px; }

.skip-link {
  position: absolute; left: 1rem; top: -3rem; z-index: 10;
  padding: 0.5rem 1rem; background: var(--btn-bg); color: var(--btn-fg); border-radius: var(--radius-sm);
}
.skip-link:focus { top: 1rem; }

.preview-banner {
  background: #7A1F1F; color: #fff; text-align: center;
  padding: 0.5rem var(--gutter); font-size: var(--step--1); font-weight: 700;
}

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }
.wrap-narrow { max-width: var(--wrap-narrow); }

.g-yellow { --g: var(--yellow); --g1: var(--yellow-1); --g2: var(--yellow-2); --g3: var(--yellow-3); }
.g-green  { --g: var(--green);  --g1: var(--green-1);  --g2: var(--green-2);  --g3: var(--green-3); }
.g-blue   { --g: var(--blue);   --g1: var(--blue-1);   --g2: var(--blue-2);   --g3: var(--blue-3); }
.g-purple { --g: var(--purple); --g1: var(--purple-1); --g2: var(--purple-2); --g3: var(--purple-3); }
.fill-yellow { fill: var(--yellow); }
.fill-green  { fill: var(--green); }
.fill-blue   { fill: var(--blue); }
.fill-purple { fill: var(--purple); }

/* Header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.5rem 2rem; min-height: 4.25rem; flex-wrap: wrap; padding-block: 0.75rem;
}
.brand { display: inline-flex; align-items: center; gap: 0.6rem; text-decoration: none; color: var(--ink); }
.brand-mark { width: 1.75rem; height: 1.75rem; }
.brand-name { font-family: var(--serif); font-size: var(--step-1); font-weight: 700; letter-spacing: -0.01em; }
.site-nav ul { display: flex; gap: 0.25rem 1rem; list-style: none; flex-wrap: wrap; }
.site-nav a {
  display: inline-block; padding-block: 0.35rem;
  color: var(--ink-soft); font-size: var(--step--1); font-weight: 600; text-decoration: none;
}
.site-nav a:hover { color: var(--ink); text-decoration: underline; }
.site-nav a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--ink); }

/* Breadcrumbs */
.breadcrumbs ol { display: flex; flex-wrap: wrap; gap: 0.25rem 0.5rem; list-style: none; padding-block: 0.9rem 0; font-size: var(--step--1); color: var(--muted); }
.breadcrumbs li + li::before { content: "/"; margin-right: 0.5rem; color: var(--line); }
.breadcrumbs a { color: var(--muted); }

/* Hero */
.hero { background: var(--surface); border-bottom: 1px solid var(--line); padding-block: clamp(2.25rem, 6vw, 4rem); }
.hero-inner { display: grid; gap: clamp(2rem, 5vw, 4rem); align-items: center; }
.hero-meta { color: var(--muted); font-size: var(--step--1); font-weight: 600; margin-bottom: 1rem; }
.meta-sep { margin-inline: 0.4rem; color: var(--line); }
.hero h1 { font-size: var(--step-4); max-width: 18ch; }
.hero-lede { margin-top: 1.1rem; font-size: var(--step-1); line-height: 1.5; color: var(--ink-soft); max-width: 44ch; }
.hero-intro { margin-top: 1.5rem; color: var(--ink-soft); max-width: 60ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.5rem; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 3rem; padding: 0.75rem 1.4rem; border-radius: 999px;
  font-weight: 700; text-decoration: none; border: 2px solid var(--btn-bg);
}
.btn-primary { background: var(--btn-bg); color: var(--btn-fg); }
.btn-primary:hover { background: var(--btn-hover); border-color: var(--btn-hover); }
.btn-quiet { background: transparent; color: var(--ink); }
.btn-quiet:hover { background: var(--paper); }
.byline { margin-top: 1.5rem; font-size: var(--step--1); color: var(--muted); display: flex; flex-wrap: wrap; gap: 0.25rem 0.5rem; align-items: center; }

.difficulty { display: inline-flex; align-items: center; gap: 0.45rem; }
.meter { display: inline-flex; gap: 3px; }
.meter-cell { width: 0.7rem; height: 0.7rem; border-radius: 2px; border: 1px solid var(--muted); }
.meter-cell.is-on { background: var(--ink); border-color: var(--ink); }

/* Word board: typeset, deliberately not tiles or colours */
.board { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: clamp(1rem, 3vw, 1.5rem); }
.board-caption { font-size: var(--step--1); font-weight: 600; color: var(--muted); margin-bottom: 0.75rem; }
.board-grid { display: grid; grid-template-columns: repeat(2, 1fr); list-style: none; border-top: 1px solid var(--line); }
.board-grid li {
  font-family: var(--serif); font-size: var(--step-1); line-height: 1.25;
  padding: 0.8rem 0.5rem; border-bottom: 1px solid var(--line); overflow-wrap: anywhere;
}
.board-grid li:nth-child(odd) { border-right: 1px solid var(--line); }

/* Sections */
.section { padding-block: var(--section-space); }
.section-tight { padding-block: clamp(2rem, 5vw, 3rem); }
.section-alt { background: var(--surface); border-block: 1px solid var(--line); }
.page-top { padding-top: clamp(1.5rem, 4vw, 2.5rem); }
.section-head { margin-bottom: 2rem; }
.section-head h1 { font-size: var(--step-4); }
.section-head h2 { font-size: var(--step-3); }
.section-head p { margin-top: 0.6rem; color: var(--ink-soft); }
.section h2:not(.section-head h2) { font-size: var(--step-2); margin-bottom: 0.6rem; }
.section-note { margin-top: 1.5rem; color: var(--muted); }
.section-link { margin-top: 1.75rem; font-weight: 700; }
.section p + p { margin-top: 0.6rem; }

/* details/summary */
details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
details > summary::after { content: "+"; font-weight: 400; font-size: 1.25em; line-height: 1; margin-left: auto; padding-left: 1rem; }
details[open] > summary::after { content: "-"; }

/* Hint ladder — the signature element */
.ladder { display: grid; gap: 1rem; }
.rung-row {
  display: grid; gap: 1rem; background: var(--surface);
  border: 1px solid var(--line); border-left: 8px solid var(--g);
  border-radius: var(--radius-lg); padding: 1.25rem;
}
.rung-head h3 { font-size: var(--step-2); }
.rung-level { margin-top: 0.15rem; font-size: var(--step--1); color: var(--muted); }
.rungs { display: grid; gap: 0.6rem; align-items: start; }
.rung { border-radius: var(--radius-sm); background: var(--g1); border: 1px solid var(--g2); }
.rung:nth-child(2) { background: var(--g2); border-color: var(--g2); }
.rung.rung-name { background: var(--g3); border-color: var(--g3); color: var(--on-tint); }
.rung > summary { display: flex; align-items: center; min-height: 2.75rem; padding: 0.6rem 0.9rem; font-weight: 700; font-size: var(--step--1); }
.rung > p { padding: 0 0.9rem 0.9rem; }
.rung-name > p { font-family: var(--serif); font-size: var(--step-1); font-weight: 700; }

.trap, .meanings {
  margin-top: 1.25rem; background: var(--surface);
  border: 1px dashed var(--muted); border-radius: var(--radius-lg);
}
.meanings { margin-top: 0; border-style: solid; border-color: var(--line); }
.trap > summary, .meanings > summary { display: flex; align-items: center; min-height: 3rem; padding: 0.75rem 1.25rem; font-weight: 700; }
.trap > p { padding: 0 1.25rem 1rem; }
.trap-more { color: var(--muted); font-size: var(--step--1); }
.meaning-list { display: grid; gap: 1rem; padding: 0 1.25rem 1.25rem; }
.meaning dt { font-family: var(--serif); font-weight: 700; font-size: var(--step-1); }
.meaning dd { color: var(--ink-soft); max-width: 68ch; }

/* Answers */
.answer-reveal { background: var(--paper); border: 2px solid var(--ink); border-radius: var(--radius-lg); }
.answer-reveal > summary { display: flex; align-items: center; min-height: 3.5rem; padding: 1rem 1.25rem; font-weight: 700; font-size: var(--step-1); }
.answer-list { list-style: none; display: grid; gap: 0.75rem; padding: 0 1.25rem 1.25rem; }
.answer { background: var(--g1); border-left: 8px solid var(--g); border-radius: var(--radius-sm); padding: 1rem 1.1rem; }
.answer h3 { font-size: var(--step-1); }
.answer-words { margin-top: 0.25rem; font-weight: 700; }
.answer-why { margin-top: 0.35rem; color: var(--ink-soft); font-size: var(--step--1); }

/* Ad slots: neutral, labelled, space reserved, never group-coloured (N4, N5, E7, BA) */
/* Generous vertical margins keep every unit well clear of links and controls above and below (A1, N4). */
.ad-slot { max-width: calc(728px + 2 * var(--gutter)); margin: clamp(4rem, 9vw, 5.5rem) auto; padding-inline: var(--gutter); }
.ad-label { font-size: 0.75rem; color: var(--muted); text-align: center; margin: 0 auto 0.4rem; }
.ad-frame {
  display: flex; align-items: center; justify-content: center; min-height: 280px;
  background: var(--ad-bg); border: 1px dashed var(--ad-line); border-radius: var(--radius-sm);
}
.ad-unit { display: block; width: 100%; }
.ad-placeholder { font-size: var(--step--1); color: var(--muted); }

/* Entry lists (recent, archive) */
.entry-list { list-style: none; display: grid; border-top: 1px solid var(--line); }
.entry-list li { border-bottom: 1px solid var(--line); padding: 0.9rem 0.25rem; }
.entry-list a { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 1rem; text-decoration: none; }
.entry-list a:hover .entry-date { text-decoration: underline; }
.entry-num { font-family: var(--serif); font-weight: 700; font-size: var(--step-1); min-width: 4.5rem; }
.entry-date { color: var(--ink); font-weight: 600; }
.entry-diff { color: var(--muted); font-size: var(--step--1); }
.entry-teaser { margin-top: 0.3rem; color: var(--ink-soft); font-size: var(--step--1); }
.filter { display: grid; gap: 0.4rem; margin-bottom: 1.5rem; max-width: 28rem; }
.filter label { font-weight: 700; font-size: var(--step--1); }
.filter input {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 2px solid var(--line); border-radius: var(--radius-sm); padding: 0.65rem 0.8rem; min-height: 3rem;
}
.filter input:focus-visible { border-color: var(--focus); }
.filter-empty { margin-top: 1rem; color: var(--muted); }
.month-list, .guide-list { list-style: none; display: grid; gap: 0.6rem; }
.guide-list li { border-bottom: 1px solid var(--line); padding-bottom: 1rem; }
.guide-list a { font-family: var(--serif); font-weight: 700; font-size: var(--step-1); }
.guide-list p { margin-top: 0.3rem; color: var(--ink-soft); }

.pager { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.5rem; }
.pager-link {
  display: inline-flex; align-items: center; min-height: 2.75rem; padding: 0.5rem 1rem;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  text-decoration: none; font-weight: 600;
}
.pager-link:hover { border-color: var(--ink); }

/* Articles (guides, trust pages) */
.prose h1 { font-size: var(--step-4); margin-bottom: 0.75rem; }
.prose h2 { font-size: var(--step-2); margin-top: 2.25rem; margin-bottom: 0.6rem; }
.prose h3 { font-size: var(--step-1); margin-top: 1.5rem; margin-bottom: 0.4rem; }
.prose p, .prose ul, .prose ol { margin-top: 0.8rem; }
.prose ul, .prose ol { padding-left: 1.3rem; }
.prose li + li { margin-top: 0.4rem; }
.prose .lede { font-size: var(--step-1); line-height: 1.55; color: var(--ink-soft); margin-top: 1.25rem; }
.article-meta { color: var(--muted); font-size: var(--step--1); }
.related { margin-top: 3rem; padding: 1.25rem 1.5rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.related h2 { margin-top: 0; font-size: var(--step-1); }

/* FAQ */
.faq { border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
  display: flex; align-items: center; min-height: 3.25rem; padding: 1rem 0.25rem;
  font-family: var(--serif); font-size: var(--step-1); font-weight: 700; line-height: 1.3;
}
.faq details > p { padding: 0 0.25rem 1.25rem; color: var(--ink-soft); }

/* Footer (always dark) */
.site-footer { background: #1C2333; color: #D6DBE6; padding-top: 3rem; }
.site-footer a { color: #fff; }
.footer-inner { display: grid; gap: 2rem; padding-bottom: 2rem; border-bottom: 1px solid #333D55; }
.brand-footer { color: #fff; }
.footer-brand p { margin-top: 0.75rem; max-width: 40ch; }
.footer-cols { display: grid; gap: 1.5rem; }
.footer-heading { font-weight: 700; color: #fff; margin-bottom: 0.5rem; }
.footer-cols ul { list-style: none; display: grid; gap: 0.5rem; }
.footer-cols a { text-decoration: none; }
.footer-cols a:hover { text-decoration: underline; }
.footer-legal { padding-block: 1.5rem 2rem; font-size: var(--step--1); color: #AEB6C7; display: grid; gap: 0.5rem; }
.site-footer :focus-visible { outline-color: #9DB4FF; }

@media (min-width: 40rem) {
  .site-nav ul { column-gap: 1.5rem; }
  .board-grid { grid-template-columns: repeat(4, 1fr); }
  .board-grid li:nth-child(odd) { border-right: 0; }
  .board-grid li:not(:nth-child(4n)) { border-right: 1px solid var(--line); }
  .board-grid li { font-size: var(--step-0); }
  .rungs { grid-template-columns: repeat(3, 1fr); }
  .footer-cols { grid-template-columns: repeat(2, auto); column-gap: 3rem; justify-content: start; }
}

@media (min-width: 60rem) {
  .hero-inner { grid-template-columns: 1.1fr 0.9fr; }
  .rung-row { grid-template-columns: 11rem 1fr; align-items: start; }
  .footer-inner { grid-template-columns: 1fr auto; }
  .ad-frame { min-height: 250px; }
}

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