@layer reset, tokens, base, layout, components, accessibility;

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  body, h1, h2, h3, p, figure, ul, ol { margin: 0; }
  ul, ol { padding: 0; }
  svg { display: block; }
  input, button { font: inherit; }
  [hidden] { display: none !important; }
}

@layer tokens {
  :root {
    color-scheme: light;
    --paper: #fffaf3;
    --page: #fffdf9;
    --ink: #3f2e43;
    --quiet: #675468;
    --line: #b49cab;
    --rose: #f7dce4;
    --rose-ink: #74394f;
    --mint: #dceee5;
    --mint-ink: #285747;
    --lilac: #e8e1f4;
    --lilac-ink: #554371;
    --focus: #583083;
    --curve: 1.6rem;
    --font: 'Nunito', ui-rounded, system-ui, sans-serif;
  }
}

@layer base {
  html { scroll-padding-block-start: 1.5rem; }
  body {
    background-color: var(--paper);
    background-image: radial-gradient(#deccc8 0.75px, transparent 0.75px);
    background-size: 22px 22px;
    color: var(--ink);
    font-family: var(--font);
    font-size: 18px;
    font-weight: 450;
    line-height: 1.65;
    -webkit-text-size-adjust: 100%;
    text-rendering: optimizeLegibility;
  }
  h1, h2, h3 { line-height: 1.15; font-weight: 850; text-wrap: balance; }
  p { text-wrap: pretty; }
  a {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 44px;
    max-width: 100%;
    padding-block: 0.35rem;
    color: var(--rose-ink);
    font-size: inherit;
    font-weight: 750;
    line-height: 1.4;
    text-decoration-thickness: 1.5px;
    text-underline-offset: 0.25em;
    overflow-wrap: anywhere;
  }
  a:hover { text-decoration-thickness: 3px; }
  :focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
  ::selection { background: var(--lilac); color: var(--ink); }
  section[id], footer[id] { scroll-margin-block-start: 1.5rem; }
}

@layer layout {
  .masthead, .workbook__main, .desk-footer { width: min(1160px, calc(100% - 64px)); margin-inline: auto; }
  .masthead, .desk-footer { background-color: var(--paper); }
  .masthead { display: flex; align-items: center; justify-content: space-between; gap: 2rem; padding-block: 2.1rem 1.8rem; }
  .guide { display: grid; gap: 2.8rem; }
  .cover { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); align-items: center; gap: 3rem; }
  .cover__copy { min-width: 0; }
  .sheet { display: grid; grid-template-columns: 170px minmax(0, 1fr); }
  .sheet__body { padding: 2.5rem 3.2rem; min-width: 0; }
  .sheet__body > p, .sheet__body > ul, .sheet__body > .source-note { max-width: 68ch; }
  .sheet__body > * + * { margin-block-start: 1.1rem; }
  .sheet__body > .sheet__title { margin-block-start: 0.8rem; margin-block-end: 1.5rem; }
  .sheet__body > .sheet__subtitle { margin-block-start: 2.2rem; }
  .brand-notes { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.4rem; }
  .directory { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2rem; }
  .desk-footer { margin-block: 4.5rem 2.5rem; }
  .desk-footer__heading { margin-block-end: 2.4rem; }
}

@layer components {
  .masthead__identity { display: flex; align-items: center; gap: 0.85rem; }
  .masthead__mark { flex: 0 0 48px; }
  .masthead__mark-back { fill: var(--mint); stroke: var(--ink); stroke-width: 1.6; }
  .masthead__mark-front { fill: var(--rose); stroke: var(--ink); stroke-width: 1.6; }
  .masthead__mark-line { fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
  .masthead__words { display: grid; }
  .masthead__name { font-size: 18px; font-weight: 850; line-height: 1.35; }
  .masthead__purpose { font-size: 16px; color: var(--quiet); }
  .masthead__directory { flex-shrink: 0; font-size: 16px; color: var(--ink); border-bottom: 1px dashed var(--quiet); text-decoration: none; }
  .cover {
    position: relative;
    isolation: isolate;
    padding: 3.25rem 3.5rem 3.5rem 4.5rem;
    background: var(--page);
    border: 2px solid var(--ink);
    border-radius: 0.9rem var(--curve) var(--curve) 0.9rem;
    box-shadow: 9px 10px 0 var(--mint);
  }
  .cover::before {
    content: '';
    position: absolute;
    inset: 1.5rem auto 1.5rem 1.3rem;
    width: 6px;
    background: radial-gradient(var(--quiet) 2.5px, transparent 2.8px) center top / 6px 22px repeat-y;
  }
  .cover__tab {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem;
    padding: 0.45rem 0.95rem;
    border: 1px solid var(--rose-ink);
    border-radius: 0.75rem 0.75rem 0.75rem 0.2rem;
    background: var(--rose);
    color: var(--rose-ink);
    font-size: 16px;
    font-weight: 750;
    line-height: 1.6;
  }
  .cover__title { margin-block-start: 1.6rem; font-size: clamp(44px, 5.8vw, 76px); letter-spacing: -0.045em; line-height: 1.06; }
  .cover__title-line { display: block; }
  .cover__deck { max-width: 24ch; margin-block-start: 1.1rem; font-size: 28px; font-weight: 700; line-height: 1.3; }
  .cover__scenario { max-width: 46ch; margin-block-start: 1.5rem; }
  .cover__intro { max-width: 44ch; margin-block-start: 0.9rem; color: var(--quiet); }
  .cover__start { margin-block-start: 1.5rem; padding: 0.8rem 1.1rem; border: 1.5px solid var(--ink); border-radius: 0.8rem; background: var(--rose); color: var(--ink); text-decoration: none; }
  .cover__start:hover { background: #f1cbd7; }
  .question-map { position: relative; padding: 1.5rem 1.1rem 1.1rem; border: 1px dashed var(--quiet); border-radius: 1.2rem; background: var(--paper); transform: rotate(1.4deg); }
  .question-map::before { content: '✳'; position: absolute; inset-block-start: -1.6rem; inset-inline-end: 0.5rem; color: var(--rose-ink); font-size: 46px; line-height: 1; background: var(--page); border-radius: 50%; }
  .question-map__caption { margin-block-end: 1.4rem; font-size: 18px; font-weight: 850; text-align: center; }
  .question-map__path { display: grid; gap: 1.5rem; list-style: none; }
  .question-map__stop { position: relative; display: grid; gap: 0.2rem; padding: 1rem 1.05rem; border: 1.5px solid var(--ink); border-radius: 1rem 1rem 1rem 0.25rem; }
  .question-map__stop:not(:last-child)::after { content: '↓'; position: absolute; inset-block-start: 100%; inset-inline-start: calc(50% - 0.5rem); line-height: 1.5rem; font-size: 23px; }
  .question-map__stop--rose { background: var(--rose); }
  .question-map__stop--mint { background: var(--mint); }
  .question-map__stop--lilac { background: var(--lilac); }
  .question-map__topic { font-size: 16px; font-weight: 650; }
  .question-map__question { font-size: 20px; font-weight: 850; line-height: 1.3; }
  .question-map__closing { margin-block-start: 1.2rem; font-size: 16px; color: var(--quiet); text-align: center; }
  .sheet { background: var(--page); border: 1.5px solid var(--line); border-radius: var(--curve); overflow: clip; box-shadow: 0 4px 0 #ece1db; }
  .sheet__label { display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 2rem; padding: 2.5rem 1.5rem; background: var(--rose); border-right: 1px dashed var(--rose-ink); }
  .sheet--mint .sheet__label { background: var(--mint); border-color: var(--mint-ink); }
  .sheet--lilac .sheet__label { background: var(--lilac); border-color: var(--lilac-ink); }
  .sheet__label-text { max-width: 12ch; font-size: 18px; font-weight: 850; line-height: 1.35; }
  .sheet__label-symbol { font-size: 58px; line-height: 1; color: var(--rose-ink); }
  .sheet--mint .sheet__label-symbol { color: var(--mint-ink); }
  .sheet--lilac .sheet__label-symbol { color: var(--lilac-ink); }
  .sheet__scenario { padding-inline-start: 1rem; border-inline-start: 3px solid var(--line); color: var(--quiet); font-size: 18px; }
  .sheet__title { max-width: 26ch; font-size: clamp(28px, 3vw, 36px); letter-spacing: -0.025em; }
  .sheet__subtitle { font-size: 25px; letter-spacing: -0.015em; }
  .brand-notes__entry { padding: 1.35rem; border: 1px solid var(--line); border-radius: 1rem; background: var(--paper); }
  .brand-notes__name { margin-block-end: 0.85rem; font-size: 24px; }
  .brand-notes__entry p + p { margin-block-start: 0.85rem; }
  .ask-slip { position: relative; display: grid; gap: 0.25rem; padding: 1.2rem 1.5rem; border: 1.5px solid var(--rose-ink); border-radius: 0.85rem 0.85rem 0.85rem 0.25rem; background: var(--rose); }
  .ask-slip__label { font-size: 16px; font-weight: 700; color: var(--rose-ink); }
  .ask-slip__question { font-size: 21px; font-weight: 750; line-height: 1.45; }
  .source-note { padding: 1rem 1.1rem 0.75rem; border-top: 1px dashed var(--line); border-bottom: 1px dashed var(--line); }
  .source-note__tag { display: inline-block; padding: 0.1rem 0.65rem; border-radius: 50px; background: var(--mint); color: var(--mint-ink); font-size: 16px; font-weight: 800; }
  .source-note__text { margin-block-start: 0.45rem; color: var(--quiet); font-size: 16px; line-height: 1.55; }
  .source-note__link { margin-block-start: 0.2rem; color: var(--mint-ink); font-size: 16px; }
  .product-map { display: grid; gap: 0.85rem; padding-inline-start: 1.3rem; border-inline-start: 2px dashed var(--lilac-ink); }
  .product-map__route { position: relative; padding: 1.2rem 1.4rem; border: 1px solid var(--line); border-radius: 1rem; background: #f7f3fb; }
  .product-map__route::before { content: ''; position: absolute; inset-inline-start: -1.65rem; inset-block-start: 1.5rem; width: 10px; height: 10px; border: 2px solid var(--lilac-ink); border-radius: 50%; background: var(--page); }
  .product-map__heading { margin-block-end: 0.75rem; font-size: 23px; }
  .product-map__route p + p { margin-block-start: 0.7rem; }
  .care-path { display: flex; align-items: center; gap: 0.8rem; padding: 1.25rem; border-radius: 1rem; background: var(--mint); }
  .care-path__step { flex: 1; text-align: center; font-size: 18px; font-weight: 750; line-height: 1.4; }
  .care-path__arrow { color: var(--mint-ink); font-size: 26px; }
  .next-desk { display: flex; flex-direction: column; align-items: flex-start; width: fit-content; gap: 0.4rem; padding: 1rem 1.4rem; border: 1.5px solid var(--ink); border-radius: 0.9rem; background: var(--mint); color: var(--ink); text-decoration: none; }
  .next-desk:hover { background: #c9e3d6; }
  .next-desk__label { font-size: 16px; font-weight: 550; }
  .next-desk__title { font-size: 19px; font-weight: 850; }
  .cover--help { padding-block: 2.6rem; box-shadow: 9px 10px 0 var(--lilac); }
  .cover--help .cover__tab, .cover--help .cover__start { background: var(--mint); }
  .cover--help .cover__tab { color: var(--mint-ink); border-color: var(--mint-ink); }
  .cover__title--help { max-width: 15ch; font-size: clamp(40px, 4.4vw, 58px); }
  .check-map { padding: 1.25rem 1rem; border: 1px dashed var(--quiet); border-radius: 1.2rem; background: var(--paper); }
  .check-map__caption { font-size: 18px; font-weight: 850; text-align: center; }
  .check-map__diagram { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-block-start: 1.25rem; }
  .check-map__part { position: relative; padding: 0.6rem; border: 1px solid var(--ink); border-radius: 0.9rem; font-size: 16px; font-weight: 750; text-align: center; }
  .check-map__part--rose { background: var(--rose); }
  .check-map__part--mint { background: var(--mint); }
  .check-map__part--lilac { background: var(--lilac); grid-column: 1 / -1; width: 60%; justify-self: center; }
  .check-map__centre { grid-column: 1 / -1; padding: 0.75rem; border: 1px dashed var(--quiet); border-radius: 0.9rem; font-size: 18px; font-weight: 850; text-align: center; }
  .check-map__centre::before { content: '↓'; display: block; margin-block-start: -1.6rem; margin-block-end: 0.5rem; color: var(--quiet); font-size: 22px; }
  .check-map__closing { margin-block-start: 1rem; font-size: 16px; color: var(--quiet); text-align: center; }
  .check-sheet { padding: 1.4rem; border: 1.5px dashed var(--rose-ink); border-radius: 1.1rem; background: #fdf2f5; }
  .check-sheet__title { font-size: 23px; margin-block-end: 1rem; }
  .check-sheet__list { list-style: none; }
  .check-sheet__item + .check-sheet__item { border-top: 1px solid #d6b9c6; }
  .check-sheet__label { display: flex; align-items: flex-start; gap: 0.9rem; min-height: 54px; padding-block: 0.75rem; cursor: pointer; }
  .check-sheet__box { flex: 0 0 44px; width: 44px; height: 44px; margin: 0; accent-color: var(--rose-ink); cursor: pointer; }
  .check-sheet__text { font-size: 18px; }
  .sheet__resource { color: var(--rose-ink); font-size: 16px; }
  .question-list { list-style: none; padding-inline-start: 0; }
  .question-list__item { position: relative; padding: 0.9rem 0.8rem 0.9rem 2.2rem; border-bottom: 1px dashed var(--line); font-size: 18px; }
  .question-list__item::before { content: '?'; position: absolute; inset-inline-start: 0.25rem; font-weight: 850; color: var(--rose-ink); }
  .price-note { padding: 1.5rem; border: 1.5px solid var(--lilac-ink); border-radius: 1rem; background: #f3edf9; }
  .price-note > * + * { margin-block-start: 0.85rem; }
  .price-note__range { font-size: 21px; font-weight: 800; line-height: 1.5; }
  .cost-sheet { width: 100%; table-layout: fixed; border-spacing: 0; border-collapse: separate; overflow: hidden; border: 1px solid var(--line); border-radius: 1rem; background: var(--paper); font-size: 18px; }
  .cost-sheet__caption { margin-block-end: 0.7rem; color: var(--quiet); text-align: left; font-size: 16px; font-weight: 600; }
  .cost-sheet__term { width: 25%; padding: 1.1rem; text-align: left; vertical-align: top; font-weight: 800; }
  .cost-sheet__question { padding: 1.1rem; vertical-align: top; }
  .cost-sheet__row:not(:last-child) > * { border-bottom: 1px solid var(--line); }
  .cost-sheet__blank { display: block; margin-block-start: 1.5rem; border-bottom: 1px dotted var(--quiet); }
  .urgent-note { padding: 1.5rem; border: 2px solid var(--rose-ink); border-radius: 1rem; background: #fff4e7; }
  .urgent-note__title { margin-block-end: 0.8rem; font-size: 23px; }
  .urgent-note__source { margin-block-start: 1rem; font-size: 16px; color: var(--quiet); }
  .urgent-note__link { margin-block-start: 0.4rem; font-size: 16px; }
  .desk-footer__eyebrow { color: var(--quiet); font-size: 16px; }
  .desk-footer__title { margin-block-start: 0.55rem; font-size: 34px; letter-spacing: -0.025em; }
  .directory__desk { position: relative; padding: 1.5rem 2rem; border: 1.5px solid var(--ink); border-radius: 0 1.25rem 1.25rem 1.25rem; background: var(--rose); }
  .directory__desk::before { content: ''; position: absolute; inset-block-end: 100%; inset-inline-start: -1.5px; width: 9rem; height: 1rem; border: 1.5px solid var(--ink); border-bottom: 0; border-radius: 0.6rem 0.6rem 0 0; background: inherit; }
  .directory__desk--mint { background: var(--mint); }
  .directory__name { display: flex; justify-content: space-between; width: 100%; color: var(--ink); font-size: 26px; line-height: 1.3; text-decoration: none; }
  .directory__name[aria-current] { text-decoration: underline; text-decoration-style: dotted; }
  .directory__description { max-width: 38ch; margin-block: 0.65rem 0.9rem; font-size: 18px; }
  .directory__links { list-style: none; }
  .directory__item { border-top: 1px dashed var(--quiet); }
  .directory__link { display: flex; width: 100%; min-height: 48px; padding-block: 0.7rem; color: var(--ink); font-size: 16px; line-height: 1.45; text-decoration: none; }
  .directory__link:hover { text-decoration: underline; }
  .desk-footer__identity { max-width: 70ch; margin-block-start: 2rem; font-size: 16px; color: var(--quiet); }
  .desk-footer__return { margin-block-start: 0.6rem; font-size: 16px; color: var(--ink); }
  .reading { position: fixed; z-index: 5; inset: 0 0 auto; height: 5px; pointer-events: none; }
  .reading__bar { display: block; width: 100%; height: 5px; appearance: none; border: 0; background: var(--mint); color: var(--rose-ink); }
  .reading__bar::-webkit-progress-bar { background: var(--mint); }
  .reading__bar::-webkit-progress-value { background: var(--rose-ink); }
  .reading__bar::-moz-progress-bar { background: var(--rose-ink); }
  .missing-desk { max-width: 800px; margin-inline: auto; padding: 3rem; border: 1.5px solid var(--ink); border-radius: var(--curve); background: var(--page); box-shadow: 8px 8px 0 var(--lilac); }
  .missing-desk__tab { font-size: 16px; color: var(--quiet); }
  .missing-desk__title { margin-block: 1rem 1.5rem; font-size: clamp(36px, 5vw, 54px); letter-spacing: -0.025em; }
  .missing-desk__link { margin-block-start: 1.5rem; }

  @media (max-width: 1020px) {
    .cover { gap: 2rem; padding-inline: 3.5rem 2.5rem; }
    .cover__title { font-size: clamp(44px, 6.5vw, 64px); }
    .cover__title--help { font-size: clamp(38px, 5.2vw, 56px); }
    .sheet { grid-template-columns: 125px minmax(0, 1fr); }
    .sheet__label { padding-inline: 1.2rem; }
    .sheet__body { padding: 2.3rem; }
    .brand-notes { grid-template-columns: 1fr; }
  }
  @media (max-width: 760px) {
    .masthead, .workbook__main, .desk-footer { width: min(100% - 32px, 620px); }
    .masthead { gap: 1rem; flex-wrap: wrap; padding-block: 1.2rem 1.4rem; }
    .masthead__directory { margin-inline-start: 3.85rem; }
    .guide { gap: 2rem; }
    .cover { grid-template-columns: 1fr; gap: 2.1rem; padding: 2rem 1.4rem 2rem 2.15rem; box-shadow: 5px 6px 0 var(--mint); }
    .cover::before { inset-inline-start: 0.8rem; width: 4px; background-size: 4px 21px; }
    .cover__title { font-size: clamp(40px, 10.2vw, 60px); letter-spacing: -0.05em; }
    .cover__title--help { font-size: clamp(37px, 9.4vw, 54px); }
    .cover__deck { font-size: 25px; }
    .question-map { width: calc(100% - 0.3rem); margin-inline: auto; transform: none; }
    .question-map::before { font-size: 34px; inset-block-start: -1.2rem; }
    .question-map__stop { padding-block: 0.85rem; }
    .sheet { grid-template-columns: 1fr; border-radius: 1.2rem; }
    .sheet__label { flex-direction: row; align-items: center; padding: 0.85rem 1.3rem; border-right: 0; border-bottom: 1px dashed var(--rose-ink); }
    .sheet__label-text { max-width: none; font-size: 16px; }
    .sheet__label-symbol { font-size: 30px; }
    .sheet__body { padding: 1.6rem 1.25rem 1.8rem; }
    .sheet__title { font-size: 30px; }
    .brand-notes__entry { padding: 1.1rem; }
    .ask-slip { padding: 1rem 1.1rem; }
    .ask-slip__question { font-size: 20px; }
    .source-note { padding-inline: 0.45rem; }
    .product-map { padding-inline-start: 1rem; }
    .product-map__route { padding: 1rem; }
    .product-map__route::before { inset-inline-start: -1.34rem; }
    .product-map__heading { font-size: 22px; }
    .care-path { flex-direction: column; gap: 0.5rem; }
    .care-path__arrow { line-height: 1.3; transform: rotate(90deg); }
    .check-sheet { padding: 1.1rem; }
    .check-sheet__label { gap: 0.7rem; }
    .price-note { padding: 1.1rem; }
    .price-note__range { font-size: 20px; }
    .cost-sheet__term { width: 30%; padding: 1rem 0.75rem; font-size: 16px; }
    .cost-sheet__question { padding: 1rem 0.75rem; font-size: 18px; }
    .urgent-note { padding: 1.15rem; }
    .directory { grid-template-columns: 1fr; gap: 2.2rem; }
    .directory__desk { padding: 1.25rem 1.4rem; }
    .desk-footer { margin-block-start: 3.25rem; }
    .desk-footer__title { font-size: 30px; }
    .missing-desk { padding: 2rem 1.4rem; }
  }
  @media print {
    body { background: white; font-size: 16px; }
    .masthead, .workbook__main { width: 100%; }
    .masthead__directory, .desk-footer, .cover__start, .next-desk, .reading, .skip-link { display: none; }
    .cover { box-shadow: none; padding: 1.4rem 2.5rem; }
    .cover__title { font-size: 40px; }
    .guide { gap: 1.4rem; }
    .sheet { box-shadow: none; overflow: visible; break-inside: auto; }
    .sheet__body { padding: 1.2rem; }
    .question-map, .check-map, .check-sheet, .price-note, .urgent-note, .brand-notes__entry { break-inside: avoid; }
    .sheet__title, .sheet__subtitle { break-after: avoid; }
    .cost-sheet__row { break-inside: avoid; }
    a { color: var(--ink); }
  }
}

@layer accessibility {
  .skip-link { position: fixed; z-index: 10; inset-block-start: 1rem; inset-inline-start: 1rem; padding: 0.8rem 1rem; border: 2px solid var(--ink); border-radius: 0.6rem; background: var(--page); color: var(--ink); transform: translateY(-200%); clip-path: inset(50%); }
  .skip-link:focus { transform: translateY(0); clip-path: none; }
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
  }
  @media (forced-colors: active) {
    .sheet, .cover, .price-note, .urgent-note, .directory__desk, .check-sheet { border-color: CanvasText; box-shadow: none; }
    .check-sheet__box { forced-color-adjust: auto; }
  }
}
