@layer reset, tokens, base, layout, typography, surfaces, controls, accessibility;

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  body, h1, h2, h3, h4, p, figure, ul { margin: 0; }
  img { display: block; max-width: 100%; }
  button { font: inherit; }
  [hidden] { display: none !important; }
}

@layer tokens {
  :root {
    --paper: #f8f3e8;
    --sheet: #fffdf5;
    --ink: #262720;
    --muted: #51534a;
    --lime: #d8f36a;
    --coral: #ed9b83;
    --rule: 2px solid var(--ink);
    --font-reading: 'Checklist Text', Georgia, serif;
    --font-label: ui-monospace, 'SFMono-Regular', Consolas, monospace;
  }
}

@layer base {
  @font-face {
    font-family: 'Checklist Text';
    src: url('../media/stix-two-text-variable.ttf') format('truetype');
    font-weight: 400 700;
    font-style: normal;
    font-display: swap;
  }
  html { scroll-padding-top: 32px; }
  body {
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-reading);
    font-size: 19px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
  }
  a { color: inherit; text-decoration-thickness: 1.5px; text-underline-offset: 4px; }
  a, button { -webkit-tap-highlight-color: #d8f36a77; }
  p { overflow-wrap: break-word; }
  ::selection { background: var(--lime); color: var(--ink); }
}

@layer layout {
  .page-width { width: min(1280px, calc(100% - 96px)); margin-inline: auto; }
  .header-row { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding-block: 25px; }
  .hero-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 36px; align-items: center; padding-block: 62px 88px; }
  .hero-copy { position: relative; z-index: 1; }
  .hero-copy > .lead-type { margin-block: 30px 26px; max-width: 46ch; }
  .hero-postscript { margin-top: 18px; }
  .collage-frame { min-width: 0; margin-top: 42px; }
  .collage-image { width: 100%; height: auto; }
  .collage-caption { margin-top: 10px; padding-left: 24px; }
  .reading-grid { display: grid; grid-template-columns: 244px minmax(0, 1fr); gap: 60px; align-items: start; }
  .contents-rail { position: sticky; top: 30px; padding-top: 37px; }
  .rail-heading { margin-bottom: 15px; }
  .rail-list { list-style: none; padding: 0; }
  .rail-note { margin-top: 24px; }
  .reading-column { min-width: 0; padding-bottom: 90px; }
  .chapter-space { padding-block: 34px 58px; scroll-margin-top: 0; }
  .chapter-space + .chapter-space { padding-top: 46px; }
  .chapter-label { margin-bottom: 15px; }
  .chapter-type { margin-bottom: 20px; }
  .opener-type { max-width: 57ch; margin-bottom: 30px; }
  .date-note { margin-bottom: 22px; }
  .text-measure { max-width: 66ch; }
  .body-stack > * + * { margin-top: 18px; }
  .prompt-space { margin-block: 28px; padding: 28px 30px; }
  .prompt-space > .subheading-type { margin-bottom: 15px; }
  .prompt-space > p { margin-top: 18px; }
  .check-list { list-style: none; padding: 0; max-width: 66ch; }
  .check-list > li { position: relative; padding-left: 32px; }
  .check-list > li + li { margin-top: 13px; }
  .product-stack { margin-block: 32px; }
  .product-row { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 22px; padding-block: 24px; }
  .product-row > div { max-width: 66ch; }
  .product-row > div > * + * { margin-top: 12px; }
  .note-coral { margin-block: 28px; padding: 26px 30px; }
  .note-coral > * + * { margin-top: 13px; }
  .note-coral > p { max-width: 66ch; }
  .source-note { margin-block: 26px; }
  .source-note > p:last-child:not(:first-child) { max-width: 65ch; margin-top: 8px; }
  .lookup-row { display: flex; flex-wrap: wrap; column-gap: 22px; margin-top: 15px; }
  .comparison-space { margin-block: 40px; }
  .comparison-space > p { margin-top: 12px; }
  .compare-switch { display: flex; flex-wrap: wrap; gap: 8px; margin-block: 20px; }
  .comparison-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 22px; }
  .comparison-grid:has([hidden]) { grid-template-columns: 1fr; }
  .visit-paper { padding: 24px; min-width: 0; }
  .visit-type { margin-block: 10px 18px; }
  .plain-list { padding-left: 21px; }
  .plain-list > li + li { margin-top: 13px; }
  .cost-strip { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; padding-block: 22px; margin-bottom: 26px; }
  .stop-list { list-style: none; padding: 0; margin-block: 28px 36px; }
  .stop-list > li { padding: 23px 0 23px 28px; }
  .stop-list > li > p { margin-top: 10px; max-width: 64ch; }
  .urgent-rule { margin-block: 32px; padding: 25px 28px; }
  .urgent-rule > p { margin-top: 13px; max-width: 66ch; }
  .recap-rule { margin-top: 32px; padding-top: 18px; display: grid; grid-template-columns: 108px minmax(0, 1fr); gap: 18px; align-items: baseline; }
  .question-sheet { padding: 30px; margin-top: 30px; }
  .question-list { list-style: none; padding: 0; margin-top: 18px; }
  .question-list > li { padding-block: 14px; }
  .question-close { margin-top: 24px; }
  .return-link { margin-top: 26px; }
  .footer-grid { display: grid; grid-template-columns: 1fr auto; column-gap: 36px; row-gap: 26px; align-items: center; padding-block: 48px; }
  .footer-note { max-width: 64ch; }
  .domain-type { align-self: end; }
  .missing-space { min-height: 68vh; padding-block: 68px 100px; }
  .missing-space > * + * { margin-top: 30px; }

  @media (min-width: 1300px) {
    .hero-grid { gap: 50px; }
  }
  @media (max-width: 1100px) {
    .page-width { width: calc(100% - 64px); }
    .reading-grid { grid-template-columns: 205px minmax(0, 1fr); gap: 36px; }
    .hero-grid { gap: 20px; }
    .comparison-grid { grid-template-columns: 1fr; }
    .footer-grid { grid-template-columns: 1fr; }
  }
  @media (max-width: 800px) {
    .page-width { width: calc(100% - 40px); }
    .header-row { padding-block: 18px; }
    .header-link { display: none; }
    .hero-grid { grid-template-columns: 1fr; padding-block: 38px 42px; gap: 28px; }
    .hero-copy > .lead-type { margin-top: 24px; }
    .collage-frame { margin-top: 0; max-width: 560px; width: 100%; justify-self: center; }
    .collage-caption { padding-left: 14px; }
    .reading-grid { grid-template-columns: 1fr; gap: 22px; }
    .contents-rail { position: static; padding-block: 18px; }
    .rail-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 18px; }
    .rail-note { margin-top: 16px; }
    .rail-note br { display: none; }
    .chapter-space { padding-top: 30px; padding-bottom: 45px; }
    .chapter-space + .chapter-space { padding-top: 36px; }
    .prompt-space, .note-coral, .question-sheet { padding: 23px; }
    .product-row { gap: 15px; }
    .comparison-grid { grid-template-columns: 1fr; }
    .recap-rule { grid-template-columns: 1fr; gap: 8px; }
    .cost-strip { gap: 11px; }
    .urgent-rule { padding: 22px; }
    .reading-column { padding-bottom: 35px; }
    .missing-space { padding-block: 50px 80px; }
  }
}

@layer typography {
  .masthead-name { font-family: var(--font-reading); font-weight: 700; font-size: 27px; line-height: 1.1; display: block; }
  .masthead-domain { display: block; font-family: var(--font-label); font-size: 16px; line-height: 1.4; margin-top: 5px; }
  .display-type { font-size: clamp(64px, 6.55vw, 98px); font-weight: 700; line-height: .98; letter-spacing: -.055em; margin-top: 25px; }
  .lead-type { font-size: 22px; line-height: 1.4; }
  .chapter-type { font-weight: 700; font-size: clamp(36px, 3.5vw, 49px); line-height: 1.08; letter-spacing: -.028em; max-width: 25ch; }
  .subheading-type { font-weight: 700; font-size: 25px; line-height: 1.2; letter-spacing: -.015em; }
  .opener-type { font-size: 22px; line-height: 1.4; }
  .label-type, .chapter-label { font-family: var(--font-label); font-size: 16px; font-weight: 400; line-height: 1.45; }
  .chapter-label { text-transform: uppercase; letter-spacing: .035em; }
  .guide-tag { font-family: var(--font-label); font-size: 16px; line-height: 1.45; }
  .hero-postscript, .collage-caption { font-size: 18px; color: var(--muted); }
  .rail-note { font-size: 18px; line-height: 1.4; color: var(--muted); }
  .date-note { font-family: var(--font-label); font-size: 16px; line-height: 1.55; color: var(--muted); }
  .source-note { font-size: 17px; line-height: 1.5; }
  .source-note > .label-type { color: var(--muted); }
  .visit-type { font-size: 30px; font-weight: 700; line-height: 1.1; }
  .cost-strip { font-family: var(--font-label); font-size: 17px; }
  .recap-type { font-size: 21px; line-height: 1.35; font-weight: 700; }
  .question-close { font-size: 25px; line-height: 1.25; font-weight: 700; }
  .footer-title { font-size: 36px; line-height: 1.1; font-weight: 700; letter-spacing: -.025em; }
  .footer-note { font-size: 19px; line-height: 1.5; }
  .domain-type { font-family: var(--font-label); font-size: 16px; }

  @media (max-width: 800px) {
    .display-type { font-size: clamp(54px, 11.85vw, 83px); letter-spacing: -.045em; }
    .masthead-name { font-size: 25px; }
    .lead-type, .opener-type { font-size: 21px; }
    .chapter-type { font-size: 38px; }
    .subheading-type { font-size: 25px; }
    .footer-title { font-size: 32px; }
  }
}

@layer surfaces {
  .header-rule { border-bottom: var(--rule); }
  .guide-tag { display: inline-block; padding: 7px 12px; border: var(--rule); background: var(--sheet); box-shadow: 4px 4px 0 var(--ink); }
  .highlight-lime { background: var(--lime); box-shadow: 8px 0 0 var(--lime), -4px 0 0 var(--lime); }
  .chapter-space { border-top: var(--rule); }
  .rail-list { border-top: var(--rule); }
  .rail-list > li { border-bottom: 1px solid var(--ink); }
  .paper-sheet { background: var(--sheet); border: var(--rule); box-shadow: 6px 6px 0 var(--ink); }
  .check-list > li::before { content: ''; position: absolute; top: .4em; left: 0; width: 16px; height: 16px; border: 1.5px solid var(--ink); background: var(--paper); }
  .product-row { border-top: 1px solid var(--ink); }
  .product-row:last-child { border-bottom: 1px solid var(--ink); }
  .shape-disc { width: 25px; height: 25px; margin-top: 2px; border: var(--rule); background: var(--lime); border-radius: 50%; }
  .shape-square { width: 25px; height: 25px; margin-top: 2px; border: var(--rule); background: var(--coral); }
  .shape-triangle { width: 27px; height: 25px; margin-top: 2px; background: var(--ink); clip-path: polygon(50% 0, 100% 100%, 0 100%); }
  .note-coral { background: var(--coral); border: var(--rule); }
  .visit-paper { border: var(--rule); background: var(--sheet); }
  .visit-paper[data-visit='online'] { border-top: 9px solid var(--ink); }
  .visit-paper[data-visit='room'] { border-top: 9px solid #7c452f; background: #f4dfce; }
  .cost-strip { border-top: var(--rule); border-bottom: var(--rule); }
  .stop-list > li { border-left: 6px solid var(--ink); border-bottom: 1px solid var(--ink); }
  .stop-list > li:nth-child(even) { border-left-color: #7c452f; }
  .urgent-rule { background: #f3dfd4; border: var(--rule); }
  .recap-rule { border-top: 1px dashed var(--ink); }
  .question-sheet { background: var(--lime); border: var(--rule); box-shadow: 8px 8px 0 var(--ink); }
  .question-list > li { border-bottom: 1px solid #738138; }
  .footer-ink { background: var(--ink); color: var(--paper); border-top: var(--rule); }
}

@layer controls {
  .masthead-link { display: inline-flex; align-items: center; gap: 14px; text-decoration: none; min-height: 52px; }
  .masthead-mark { display: grid; place-items: center; width: 50px; height: 50px; font-family: var(--font-label); font-size: 36px; line-height: 1; color: var(--paper); background: var(--ink); }
  .header-link { min-height: 44px; align-items: center; display: inline-flex; gap: 18px; font-family: var(--font-label); font-size: 16px; }
  .action-link { display: inline-flex; align-items: center; justify-content: space-between; gap: 24px; background: var(--lime); border: var(--rule); box-shadow: 5px 5px 0 var(--ink); min-height: 54px; padding: 11px 21px; font-family: var(--font-label); font-size: 17px; text-decoration: none; }
  .action-link > span { font-size: 26px; line-height: 1; }
  .rail-link { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 51px; padding-block: 10px; font-size: 18px; line-height: 1.25; text-decoration: none; }
  .rail-link:hover { text-decoration: underline; }
  .source-link { display: inline-flex; align-items: center; min-height: 44px; padding-block: 7px; margin-right: 18px; font-size: 17px; line-height: 1.35; gap: 8px; }
  .source-link:hover { background: var(--lime); }
  .compare-button { min-height: 48px; padding: 9px 17px; border: var(--rule); background: var(--sheet); color: var(--ink); font-family: var(--font-label); font-size: 16px; line-height: 1.4; cursor: pointer; border-radius: 0; }
  .compare-button[aria-pressed='true'] { background: var(--ink); color: var(--paper); box-shadow: 3px 3px 0 #a4b848; }
  .compare-button:hover { text-decoration: underline; text-underline-offset: 4px; }
  .return-link { display: inline-flex; align-items: center; gap: 20px; min-height: 48px; padding-block: 9px; font-size: 18px; }
  .footer-link { display: inline-flex; gap: 20px; align-items: center; min-height: 48px; padding-block: 9px; font-size: 19px; }
  .footer-link:hover { color: var(--lime); }
  .action-link:active { transform: translate(2px, 2px); box-shadow: 3px 3px 0 var(--ink); }

  @media (max-width: 800px) {
    .header-link { display: none; }
    .rail-link { font-size: 17px; min-height: 58px; }
    .source-link { margin-right: 0; }
  }
}

@layer accessibility {
  :focus-visible { outline: 3px solid var(--ink); outline-offset: 5px; }
  .footer-ink :focus-visible { outline-color: var(--lime); }
  .screen-reader { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .skip-link { position: fixed; left: 20px; top: -160px; z-index: 10; display: flex; align-items: center; min-height: 48px; padding: 12px 18px; font-size: 18px; background: var(--lime); border: var(--rule); }
  .skip-link:focus { top: 16px; }
  @media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .action-link:active { transform: none; }
  }
  @media (forced-colors: active) {
    .compare-button[aria-pressed='true'] { border-width: 4px; }
    .highlight-lime { text-decoration: underline; }
  }
  @media print {
    body { font-size: 16px; background: white; color: black; }
    .page-width { width: 100%; }
    .header-link, .contents-rail, .compare-switch, .collage-frame, .action-link, .return-link, .footer-link { display: none; }
    .hero-grid, .reading-grid { display: block; padding-block: 20px; }
    .display-type { font-size: 48px; }
    .chapter-type { font-size: 30px; }
    .chapter-space { padding-block: 25px; }
    .comparison-grid { display: block; }
    .visit-paper { display: block !important; margin-bottom: 20px; }
    .paper-sheet, .question-sheet { box-shadow: none; }
    .footer-ink { background: white; color: black; }
    .footer-grid { display: block; }
  }
}
