/* =====================================================================
   (C20) Crawlable explainer — editorial presentation layer.

   Loaded AFTER /styles.css by /why-was-i-liquidated/index.html only. The
   global stylesheet stays in force; every rule here is scoped under
   body.explainer-page so no other surface can change.

   (UX maturity slice 10, DIRECTION §3, §4, §5.3; amendment item 11) The
   page keeps its editorial layout (a two-column hero, an index of lessons
   with the heading beside the text, one decisive action, the notes row)
   but no longer carries a second visual system. The `--ex-*` namespace
   and its cyan accent are gone: every colour, radius, type size and width
   below is an app token from /styles.css, so the explainer reads as the
   same product as the landing, the calculator and the demo. One accent
   (`--accent`, the brand proposal's single steel blue); the conceptual
   liquidation line takes the risk ladder's caution amber; headings take
   600; the H1 is `--text-display`. No font is downloaded (the system
   stacks only; CSP `font-src 'self'`). Breakpoints are the §4 set: 480,
   640 and 767 as max-width, 768, 861 and 1121 as min-width.

   Presentation only. Every word, heading, disclosure and link is in the
   markup and readable with this file unavailable.
   ===================================================================== */

body.explainer-page {
  /* One content column shared by header, main and footer: the app's 1080 px
     column and gutter, so this page aligns with every other surface. */
  --explainer-pad: var(--gutter);

  color-scheme: dark;
  background: var(--surface-0);
  color: var(--text);
  font-family: var(--font);
  overflow-wrap: break-word;
}

/* ---------- Header ----------
   The app's header row: brand, the SIMULATION marker, then the four
   visitor links (DIRECTION §5.3). The skip link, focus ring and marker
   are the global ones; only the explainer's own layout is set here. */

body.explainer-page .site-header {
  min-height: 56px;
}

/* The app shell hides .brand-text at phone widths (styles.css, max-width
   640px) so the mark stands alone beside workspace controls. This page has no
   workspace controls, so the full visible wordmark is restored at every width.
   The markup's non-breaking spaces keep it on one line wherever it fits;
   `white-space: normal` plus `overflow-wrap: anywhere` only lets it break as a
   last resort on extreme narrow or zoomed viewports instead of overflowing. */
body.explainer-page .brand,
body.explainer-page .brand-link {
  min-width: 0;
}
body.explainer-page .brand-mark {
  flex: none;
}
body.explainer-page .brand-text {
  display: flex;
  min-width: 0;
}
body.explainer-page .brand-name {
  white-space: normal;
  overflow-wrap: anywhere;
}

/* The visitor links, with the app visitor navigation's look: 13 px / 500 on
   40 px targets, the current page marked by weight, the raised surface, a
   strong hairline and a 3 px inset accent edge as well as by colour. */
body.explainer-page .explainer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}
body.explainer-page .explainer-nav a {
  display: inline-flex;
  align-items: center;
  min-height: var(--control-h);
  padding: 0 var(--space-1);
  font-size: var(--text-nav);
  font-weight: 500;
  color: var(--text-soft);
  text-decoration: none;
  white-space: nowrap;
  border: 1px solid transparent;
  border-radius: var(--radius);
  transition: color var(--duration-fast) var(--ease),
    background-color var(--duration-fast) var(--ease);
}
body.explainer-page .explainer-nav a:hover {
  color: var(--text);
  background: var(--surface-2);
}
body.explainer-page .explainer-nav a[aria-current="page"] {
  color: var(--text);
  font-weight: 600;
  background: var(--surface-2);
  border-color: var(--border-strong);
  box-shadow: inset 3px 0 0 var(--accent);
}

/* ---------- Main column ---------- */

body.explainer-page .explainer-main {
  display: block;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--explainer-pad) var(--space-9);
}

/* ---------- Hero ---------- */

body.explainer-page .explainer-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-8);
  padding: var(--space-9) 0 var(--space-9);
  border-bottom: 1px solid var(--border);
}

body.explainer-page .hero-eyebrow {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0 0 var(--space-5);
  font-family: var(--mono);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: var(--tracking-caps);
  color: var(--accent);
}
body.explainer-page .hero-eyebrow::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  background: var(--accent);
}

/* (Amendment item 11) The H1 is the display size at 600, not a light 72 px. */
body.explainer-page .page-title {
  margin: 0 0 var(--space-6);
  max-width: 16ch;
  font-family: var(--font);
  font-weight: 600;
  font-size: var(--text-display);
  line-height: 1.15;
  letter-spacing: var(--tracking-tight);
  color: var(--text);
  text-wrap: balance;
}

body.explainer-page .explainer-title-accent {
  color: var(--accent);
}

body.explainer-page .page-intro {
  margin: 0 0 var(--space-7);
  max-width: var(--w-prose);
  font-size: var(--text-lg);
  line-height: var(--leading-body);
  color: var(--text-soft);
}

/* The paper-only posture: the notice family's info edge, at body size. */
body.explainer-page .explainer-posture {
  max-width: var(--w-prose);
  margin: 0;
  padding: var(--space-4) var(--space-5);
  font-size: var(--text-base);
  line-height: var(--leading-body);
  color: var(--text-soft);
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
}
body.explainer-page .explainer-posture strong {
  color: var(--text);
  font-weight: 600;
}

/* ---------- Conceptual figure ---------- */

body.explainer-page .explainer-figure {
  margin: 0;
  min-width: 0;
  padding: var(--space-5);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

body.explainer-page .explainer-figure-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-4);
  margin-bottom: var(--space-4);
  font-family: var(--mono);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
}
body.explainer-page .explainer-figure-kicker {
  color: var(--text-dim);
}
body.explainer-page .explainer-figure-tag {
  color: var(--text-soft);
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px var(--space-2);
}

body.explainer-page .explainer-figure-art {
  display: block;
  width: 100%;
  height: auto;
  background: var(--surface-0);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
body.explainer-page .explainer-figure-art * {
  vector-effect: non-scaling-stroke;
}
body.explainer-page .ex-grid line {
  stroke: var(--border);
  stroke-width: 1;
}
body.explainer-page .ex-room {
  fill: var(--tint-accent);
}
body.explainer-page .ex-entry {
  stroke: var(--accent);
  stroke-width: 1.5;
}
body.explainer-page .ex-liquidation {
  stroke: var(--caution);
  stroke-width: 1.5;
}
body.explainer-page .ex-path {
  fill: none;
  stroke: var(--text);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
body.explainer-page .ex-later {
  fill: none;
  stroke: var(--text-dim);
  stroke-width: 1.5;
  stroke-dasharray: 4 6;
  stroke-linecap: round;
}
body.explainer-page .ex-close {
  fill: var(--surface-0);
  stroke: var(--caution);
  stroke-width: 2;
}
body.explainer-page .ex-close-tick {
  stroke: var(--caution);
  stroke-width: 1;
  stroke-dasharray: 2 3;
}

body.explainer-page .explainer-figure-legend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
  gap: var(--space-2) var(--space-6);
  margin: var(--space-4) 0 0;
  padding: 0;
  list-style: none;
  font-size: var(--text-sm);
  line-height: var(--leading-snug);
  color: var(--text-soft);
}
body.explainer-page .explainer-figure-legend li {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
}
body.explainer-page .ex-swatch {
  flex: none;
  position: relative;
  top: -0.2em;
  width: 22px;
  height: 0;
  border-top: 2px solid var(--text);
}
body.explainer-page .ex-swatch-entry {
  border-top-color: var(--accent);
}
body.explainer-page .ex-swatch-liquidation {
  border-top-color: var(--caution);
}
body.explainer-page .ex-swatch-later {
  border-top: 2px dashed var(--text-dim);
}

body.explainer-page .explainer-figure-caption {
  margin: var(--space-4) 0 0;
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--text-dim);
}

/* ---------- Teaching sections ----------
   An editorial index rather than stacked cards: one hairline per section,
   the heading as a strong left column and the explanation at a reading
   measure beside it on wide screens. The h2 tags stay plain; styling comes
   from the wrapper. */

body.explainer-page .explainer-lessons {
  padding-top: var(--space-5);
}

body.explainer-page .explainer-block {
  max-width: none;
  margin: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
}

body.explainer-page .explainer-lesson {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4);
  padding: var(--space-8) 0;
  border-bottom: 1px solid var(--border);
}
body.explainer-page .explainer-lesson:last-child {
  border-bottom: 0;
}

body.explainer-page .explainer-lesson > h2 {
  margin: 0;
  max-width: 22ch;
  font-family: var(--font);
  font-size: var(--text-2xl);
  font-weight: 600;
  line-height: var(--leading-heading);
  letter-spacing: var(--tracking-tight);
  color: var(--text);
  text-wrap: balance;
}
body.explainer-page .explainer-lesson > h2::before {
  content: "";
  display: block;
  width: 24px;
  height: 2px;
  margin-bottom: var(--space-5);
  background: var(--accent);
}

body.explainer-page .explainer-lesson > p {
  margin: 0;
  max-width: var(--w-prose);
  font-size: var(--text-lg);
  line-height: 1.7;
  color: var(--text-soft);
  text-wrap: pretty;
}

/* ---------- The one decisive action ----------
   A panel like every other panel; its two links ride the shared button
   family (the gradient primary and the secondary) from /styles.css. */

body.explainer-page .explainer-cta {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4);
  margin-top: var(--space-7);
  padding: var(--space-8) var(--space-6);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
}
body.explainer-page .explainer-cta > h2 {
  margin: 0;
  font-family: var(--font);
  font-size: var(--text-2xl);
  font-weight: 600;
  line-height: var(--leading-heading);
  letter-spacing: var(--tracking-tight);
  color: var(--text);
}
body.explainer-page .explainer-cta > p {
  margin: 0;
  max-width: var(--w-prose);
  font-size: var(--text-base);
  line-height: var(--leading-body);
  color: var(--text-soft);
}

body.explainer-page .explainer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin: var(--space-2) 0 0;
}

/* Both actions keep a 44 px target at every width (C20 §6). */
body.explainer-page .landing-cta-primary,
body.explainer-page .landing-cta-secondary {
  min-height: var(--control-h-touch);
}

/* ---------- Usage and support disclosures ---------- */

body.explainer-page .explainer-notes {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4);
  margin-top: var(--space-8);
  padding-top: var(--space-5);
  border-top: 1px solid var(--border);
}

body.explainer-page .explainer-usage-note {
  max-width: var(--w-prose);
  margin: 0;
  padding: 0;
  border-top: 0; /* the notes row already carries the hairline */
  font-family: var(--font);
  font-size: var(--text-base);
  line-height: var(--leading-body);
  /* (Slice 10 review r1) Tier 3 note ink is --text-soft (§6), not dimmer. */
  color: var(--text-soft);
}

body.explainer-page .explainer-support {
  max-width: var(--w-prose);
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-1) var(--space-4);
}
body.explainer-page .public-support-link {
  min-height: 44px;
  padding: var(--space-3) 0;
  font-size: var(--text-base);
  color: var(--link);
}
body.explainer-page .public-support-note {
  flex: 1 1 18rem;
  font-size: var(--text-base);
  line-height: var(--leading-body);
  color: var(--text-dim);
}

/* ---------- Footer ----------
   The app footer (tier 2: 14 px in --text-soft) with 44 px links. */

body.explainer-page .site-footer .disclaimer {
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--text-soft);
}
body.explainer-page .footer-links {
  margin: 0;
  gap: var(--space-1) var(--space-5);
}
body.explainer-page .footer-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: var(--text-sm);
  color: var(--text-soft);
}
body.explainer-page .footer-links a:hover {
  color: var(--link);
}

/* ---------- Wider layouts (§4: 768, 861, 1121) ---------- */

@media (min-width: 768px) {
  body.explainer-page .explainer-cta {
    padding: var(--space-8) var(--space-7);
  }
}

@media (min-width: 861px) {
  body.explainer-page .explainer-lesson {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    column-gap: var(--space-9);
    padding: var(--space-9) 0;
  }
  body.explainer-page .explainer-lesson > p {
    padding-top: 22px; /* sits level with the heading, below its 2 px rule */
  }

  body.explainer-page .explainer-cta {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "title actions"
      "body actions";
    column-gap: var(--space-9);
    align-items: start;
  }
  body.explainer-page .explainer-cta > h2 {
    grid-area: title;
  }
  body.explainer-page .explainer-cta > p {
    grid-area: body;
  }
  body.explainer-page .explainer-cta > .explainer-actions {
    grid-area: actions;
    flex-direction: column;
    align-self: center;
    margin: 0;
  }

  body.explainer-page .explainer-notes {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    column-gap: var(--space-9);
  }
}

@media (min-width: 1121px) {
  body.explainer-page .explainer-hero {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    column-gap: var(--space-9);
    align-items: center;
  }
}

/* ---------- Compact header (≤ 1120, the shell's one compact width) ----------
   The four links take their own full-width row under the brand and the
   marker, as 44 px targets. They stay visible: this static page has no
   Menu button, and its links must work with scripting switched off. */

@media (max-width: 1120px) {
  body.explainer-page .explainer-nav {
    flex-basis: 100%;
  }
  body.explainer-page .explainer-nav a {
    min-height: var(--control-h-touch);
    padding: 0 var(--space-2);
  }
}

/* ---------- Phones (§4: 640) ---------- */

@media (max-width: 640px) {
  body.explainer-page .explainer-hero {
    gap: var(--space-7);
    padding: var(--space-8) 0 var(--space-8);
  }
  body.explainer-page .explainer-figure {
    padding: var(--space-4);
  }
  body.explainer-page .explainer-lesson {
    padding: var(--space-7) 0;
  }
  body.explainer-page .explainer-cta {
    padding: var(--space-7) var(--space-5);
  }
  body.explainer-page .explainer-actions {
    flex-direction: column;
  }
  /* One scrolling row of links edge to edge, the on-page rail's pattern
     (DIRECTION §5.5): nothing wraps into a three-row header at 320 px, and
     the trailing fade is the cue that the row continues. */
  body.explainer-page .explainer-nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
    margin-inline: calc(-1 * var(--explainer-pad));
    padding-inline: var(--explainer-pad);
    /* (Slice 10 review r1) The trailing padding covers the 48 px fade, so the
       last link clears it when scrolled to the end, and the block padding keeps
       the 2 px focus ring inside the scroll box (overflow clips it otherwise). */
    padding-inline-end: calc(var(--explainer-pad) + var(--space-8));
    padding-block: var(--space-1);
    -webkit-mask-image: linear-gradient(to right, currentColor calc(100% - 48px), transparent);
    mask-image: linear-gradient(to right, currentColor calc(100% - 48px), transparent);
  }
  body.explainer-page .explainer-nav a {
    flex: none;
    scroll-snap-align: start;
  }
}

/* Narrow phones get an intentional header: the full brand on the first row,
   the simulation marker directly beneath it, left-aligned, then the links. */
@media (max-width: 480px) {
  body.explainer-page .site-header {
    gap: var(--space-2);
  }
  body.explainer-page .brand {
    flex: 1 1 100%;
  }
}

/* ---------- Forced colours: keep the figure legible ---------- */

@media (forced-colors: active) {
  body.explainer-page .ex-swatch,
  body.explainer-page .ex-swatch-later {
    border-top-color: CanvasText;
  }
  body.explainer-page .explainer-figure-art .ex-entry,
  body.explainer-page .explainer-figure-art .ex-liquidation,
  body.explainer-page .explainer-figure-art .ex-path,
  body.explainer-page .explainer-figure-art .ex-later,
  body.explainer-page .explainer-figure-art .ex-close,
  body.explainer-page .explainer-figure-art .ex-close-tick {
    stroke: CanvasText;
  }
  body.explainer-page .explainer-figure-art .ex-room {
    fill: none;
  }
  body.explainer-page .explainer-nav {
    -webkit-mask-image: none;
    mask-image: none;
  }
}
