@layer reset, tokens, base, layout, components, utilities, motion;

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  html { scroll-behavior: smooth; }
  body, h1, h2, h3, p, figure, dl, dd { margin: 0; }
  img { display: block; max-width: 100%; height: auto; }
  button, input, textarea, select { font: inherit; }
}

@layer tokens {
  :root {
    --white: #ffffff;
    --ink: #000000;
    --midnight: #010120;
    --lavender: #bdbbff;
    --lavender-soft: #ecebff;
    --blue-soft: #dfe9ff;
    --glass: rgba(255, 255, 255, 0.78);
    --hairline: rgba(0, 0, 0, 0.08);
    --shadow: 0 22px 55px rgba(1, 1, 32, 0.10);
    --display: "Manrope", system-ui, sans-serif;
    --mono: "JetBrains Mono", ui-monospace, monospace;
    --grid: min(1280px, calc(100% - 3rem));
    --section-gap: clamp(4rem, 8vw, 8rem);
    --ease: 240ms ease-out;
  }
}

@layer base {
  body {
    min-width: 320px;
    color: var(--ink);
    background: var(--white);
    font-family: var(--display);
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.6;
    letter-spacing: -0.16px;
  }

  h1, h2, h3 {
    font-weight: 700;
    line-height: 1.08;
    letter-spacing: -0.04em;
    text-wrap: balance;
  }

  h1 { font-size: clamp(2.5rem, 5vw, 4rem); }
  h2 { font-size: clamp(1.75rem, 3vw, 2.25rem); }
  h3 { font-size: 1.5rem; }
  p, li, dd, a, button { font-size: 1rem; }
  p { max-width: 72ch; }
  a { color: inherit; text-underline-offset: 0.22em; }
  button { color: inherit; }
  :focus-visible { outline: 3px solid var(--lavender); outline-offset: 3px; }
}

@layer layout {
  [data-role="site-header"], main > section, [data-role="site-footer"] {
    width: var(--grid);
    margin-inline: auto;
  }

  [data-role="site-header"] {
    min-height: 88px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    position: relative;
    z-index: 20;
  }

  .hero {
    min-height: calc(100vh - 88px);
    min-height: calc(100svh - 88px);
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.92fr);
    gap: clamp(2rem, 6vw, 6rem);
    align-items: center;
    padding-block: clamp(2rem, 5vw, 5rem);
  }

  .compact-hero { min-height: auto; padding-block-end: var(--section-gap); }
  .hero-copy { max-width: 760px; }
  .section { padding-block: var(--section-gap); }
  .section-heading { display: grid; gap: 1rem; max-width: 760px; margin-bottom: clamp(2rem, 5vw, 4.5rem); }

  .zig-row {
    display: grid;
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
    gap: clamp(2rem, 6vw, 6rem);
    align-items: center;
    margin-top: clamp(2.5rem, 6vw, 6rem);
  }

  .zig-row.reverse > :first-child { order: 2; }
  .depth-copy { display: grid; gap: 1.15rem; max-width: 660px; }

  .dark-section {
    width: 100%;
    max-width: none;
    padding-inline: max(1.5rem, calc((100vw - 1280px) / 2));
    background: var(--midnight);
    color: var(--white);
  }

  .care-layout, .safety-layout, .split-note, .verify-pair, .source-grid, .cost-band {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(1.5rem, 4vw, 4rem);
  }

  .evidence-feature { display: grid; grid-template-columns: minmax(230px, 0.72fr) minmax(0, 1.28fr); }
  .next-panel { display: flex; align-items: center; justify-content: space-between; gap: 2rem; margin-block: var(--section-gap); padding: clamp(2rem, 5vw, 4rem); }

  [data-role="site-footer"] {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    padding-block: 2rem;
    border-top: 1px solid var(--hairline);
  }
}

@layer components {
  .skip-link {
    position: fixed;
    left: 1rem;
    top: 1rem;
    transform: translateY(-180%);
    padding: 0.75rem 1rem;
    background: var(--midnight);
    color: var(--white);
    z-index: 100;
  }
  .skip-link:focus { transform: translateY(0); }

  .wordmark {
    min-height: 48px;
    min-width: 48px;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    text-decoration: none;
    letter-spacing: -0.03em;
  }
  .wordmark-mark { width: 36px; height: 36px; display: grid; place-items: center; background: var(--midnight); color: var(--white); }

  [data-role="menu"] { position: relative; }
  [data-role="menu"] summary {
    min-width: 132px;
    min-height: 48px;
    display: grid;
    place-items: center;
    padding: 0.65rem 1rem;
    border: 1px solid var(--ink);
    cursor: pointer;
    font-weight: 600;
    list-style: none;
  }
  [data-role="menu"] summary::-webkit-details-marker { display: none; }
  [data-role="menu"][open] summary { background: var(--midnight); color: var(--white); }
  [data-role="menu"] nav {
    position: absolute;
    right: 0;
    top: calc(100% + 0.5rem);
    width: 230px;
    padding: 0.5rem;
    background: var(--white);
    border: 1px solid var(--ink);
    box-shadow: var(--shadow);
  }
  [data-role="menu"] nav a { min-height: 48px; display: flex; align-items: center; padding: 0.65rem 0.75rem; text-decoration: none; }
  [data-role="menu"] nav a:hover, [data-role="menu"] nav a[aria-current="page"] { background: var(--lavender-soft); }

  .eyebrow, .card-label {
    font-family: var(--mono);
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.35;
    letter-spacing: -0.02em;
    text-transform: uppercase;
  }
  .card-label { font-size: 1rem; }
  .hero-lede { margin-top: 1.5rem; font-size: clamp(1.08rem, 2vw, 1.3rem); max-width: 60ch; }
  .button-row { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 2rem; }
  .button {
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.1rem;
    border: 1px solid var(--midnight);
    border-radius: 0;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: color var(--ease), background var(--ease), box-shadow var(--ease), transform var(--ease);
  }
  .button:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(1, 1, 32, 0.14); }
  .button-primary { background: var(--midnight); color: var(--white); }
  .button-quiet { background: var(--white); color: var(--ink); }

  .hero-art {
    min-width: 0;
    padding: clamp(1rem, 3vw, 2rem);
    background: linear-gradient(145deg, var(--lavender-soft), var(--blue-soft) 52%, var(--white));
    border: 1px solid var(--hairline);
    box-shadow: var(--shadow);
  }
  .hero-art img { width: 100%; aspect-ratio: 8 / 9; object-fit: cover; background: var(--lavender-soft); }
  .short-art img { aspect-ratio: 8 / 7; }
  .hero-art figcaption { margin-top: 0.85rem; padding: 0.6rem 0.85rem; font-size: 1rem; background: var(--white); }

  .summary-card, .return-card, .note-card, .warning-card, [data-role="source-card"], .work-card {
    border: 1px solid var(--hairline);
    background: var(--white);
    box-shadow: var(--shadow);
  }
  .summary-card { display: grid; gap: 1rem; padding: clamp(1.5rem, 4vw, 3rem); }
  .summary-card.lavender { background: var(--lavender-soft); }
  .text-button {
    min-height: 48px;
    justify-self: start;
    padding: 0;
    border: 0;
    border-bottom: 1px solid currentColor;
    background: transparent;
    font-weight: 700;
    cursor: pointer;
  }

  .term-list { display: grid; gap: 0.75rem; }
  .term-list div { padding: 1rem 0; border-top: 1px solid var(--hairline); }
  .term-list dt { font-weight: 700; }
  .term-list dd { margin-top: 0.25rem; }

  .steps { display: grid; }
  .steps article { display: grid; grid-template-columns: 48px 1fr; gap: 1rem; padding: 1.5rem 0; border-top: 1px solid rgba(255, 255, 255, 0.25); }
  .steps article:last-child { border-bottom: 1px solid rgba(255, 255, 255, 0.25); }
  .steps h3 { margin-bottom: 0.5rem; }
  .step-mark { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid var(--lavender); font-family: var(--mono); }
  .note-card { align-self: center; padding: clamp(1.5rem, 4vw, 3rem); color: var(--ink); }
  .note-big { margin-block: 1rem; font-size: clamp(1.6rem, 3vw, 2.5rem); font-weight: 700; line-height: 1.1; letter-spacing: -0.04em; }
  .inline-action { min-height: 44px; display: inline-flex; align-items: center; font-weight: 700; }

  .evidence-feature { border: 1px solid var(--midnight); box-shadow: var(--shadow); }
  .stat-block { display: grid; align-content: center; padding: clamp(1.5rem, 5vw, 4rem); background: var(--lavender); }
  .stat-block strong { font-size: clamp(3rem, 7vw, 6.5rem); line-height: 0.92; letter-spacing: -0.07em; }
  .stat-block span { margin-top: 1rem; font-family: var(--mono); font-size: 1rem; text-transform: uppercase; }
  .evidence-copy { display: grid; align-content: center; gap: 1rem; padding: clamp(1.5rem, 5vw, 4rem); }
  .return-card { margin-top: 1.5rem; padding: clamp(1.5rem, 4vw, 3rem); display: grid; gap: 1rem; }

  .wash-section { width: 100%; max-width: none; padding-inline: max(1.5rem, calc((100vw - 1280px) / 2)); background: var(--blue-soft); }
  .warning-card { padding: clamp(1.5rem, 4vw, 3rem); display: grid; align-content: start; gap: 1rem; }
  .safety-list { display: grid; }
  .safety-list article { padding: 1.35rem 0; border-top: 1px solid var(--hairline); }
  .safety-list h3 { margin-bottom: 0.5rem; }
  .wash-section > .button { margin-top: 2rem; }

  .cost-band { border: 1px solid var(--midnight); }
  .cost-band > div { padding: clamp(1.5rem, 4vw, 3rem); }
  .cost-band > div + div { border-left: 1px solid var(--midnight); background: var(--midnight); color: var(--white); }
  .cost-figure { margin-block: 0.75rem; font-size: clamp(2.5rem, 6vw, 5rem); font-weight: 700; line-height: 1; letter-spacing: -0.06em; }
  .fine-print { margin-top: 1rem; font-size: 1rem; }
  .split-note { margin-top: 2rem; }
  .split-note > div { padding-top: 1.5rem; border-top: 1px solid var(--ink); }
  .split-note h3 { margin-bottom: 0.75rem; }

  .source-section { border-top: 1px solid var(--hairline); }
  [data-role="source-card"] { padding: clamp(1.5rem, 4vw, 2.5rem); display: grid; gap: 1rem; }
  .source-section > .button { margin-top: 1.5rem; }
  .next-panel { background: var(--lavender); border: 1px solid var(--midnight); }
  .next-panel h2 { margin-block: 0.4rem 0.75rem; }

  .work-card { display: grid; grid-template-columns: minmax(0, 0.94fr) minmax(0, 1.06fr); margin-top: 2rem; }
  .work-card.reverse .work-summary { order: 2; }
  .work-summary { padding: clamp(1.5rem, 4vw, 3rem); background: var(--lavender-soft); }
  .work-summary h3 { margin-block: 0.8rem 1.25rem; }
  .work-depth { padding: clamp(1.5rem, 4vw, 3rem); display: grid; align-content: start; gap: 1rem; }
  .question-list { margin: 0; padding-left: 1.15rem; display: grid; gap: 0.8rem; }
  .question-list li { padding-left: 0.35rem; }
  .write-line { min-height: 64px; display: flex; align-items: end; border-bottom: 1px solid var(--ink); color: rgba(0, 0, 0, 0.68); }
  .plain-alert { padding: 1rem; border: 1px solid var(--ink); font-weight: 700; }

  .warning-stack { display: grid; }
  .warning-stack article { display: grid; grid-template-columns: 56px 1fr; gap: 1rem; padding: 1.5rem 0; border-top: 1px solid rgba(255, 255, 255, 0.25); }
  .warning-stack article:last-child { border-bottom: 1px solid rgba(255, 255, 255, 0.25); }
  .warning-stack h3 { margin-bottom: 0.5rem; }
  .warning-index { width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid var(--lavender); font-family: var(--mono); }

  dialog[data-role="evidence-drawer"] {
    width: min(560px, 100%);
    max-width: none;
    height: 100%;
    max-height: none;
    margin: 0 0 0 auto;
    padding: 0;
    border: 0;
    background: var(--white);
    color: var(--ink);
    box-shadow: -24px 0 70px rgba(1, 1, 32, 0.2);
  }
  dialog[data-role="evidence-drawer"]::backdrop { background: rgba(1, 1, 32, 0.68); }
  .drawer-head { position: sticky; top: 0; display: flex; justify-content: space-between; align-items: start; gap: 1rem; padding: 1.5rem; background: var(--white); border-bottom: 1px solid var(--hairline); }
  .drawer-head h2 { margin-top: 0.4rem; }
  .close-button { min-width: 64px; min-height: 48px; padding: 0.5rem; border: 1px solid var(--ink); background: var(--white); cursor: pointer; }
  .drawer-body { padding: 1.5rem; }
  .drawer-body article { display: grid; gap: 0.75rem; padding: 1.5rem 0; border-bottom: 1px solid var(--hairline); }

  [data-role="site-footer"] p { max-width: 62ch; }
  [data-role="site-footer"] nav { display: flex; flex-wrap: wrap; gap: 0.5rem; }
  [data-role="site-footer"] nav a { min-height: 44px; display: inline-flex; align-items: center; padding-inline: 0.65rem; }
}

@layer utilities {
  body:has(dialog[open]) { overflow: hidden; }
}

@layer motion {
  [data-reveal] { animation: rise-in 420ms ease-out both; }
  [data-reveal]:nth-child(2) { animation-delay: 80ms; }
  [data-reveal]:nth-child(3) { animation-delay: 160ms; }
  dialog[data-role="evidence-drawer"][open] { animation: drawer-in 280ms ease-out both; }
  @keyframes rise-in { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
  @keyframes drawer-in { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: translateX(0); } }
}

@media (max-width: 767px) {
  :root { --grid: min(100% - 2rem, 1280px); }
  [data-role="site-header"] { min-height: 72px; }
  .wordmark span:last-child { display: none; }
  .wordmark { justify-content: center; }
  .hero { min-height: auto; grid-template-columns: 1fr; gap: 2rem; padding-top: 2.5rem; }
  .hero-art { padding: 0.75rem; }
  .zig-row, .care-layout, .safety-layout, .split-note, .verify-pair, .source-grid, .cost-band, .evidence-feature, .work-card { grid-template-columns: 1fr; }
  .zig-row.reverse > :first-child, .work-card.reverse .work-summary { order: 0; }
  .dark-section, .wash-section { padding-inline: 1rem; }
  .cost-band > div + div { border-left: 0; border-top: 1px solid var(--midnight); }
  .next-panel, [data-role="site-footer"] { align-items: stretch; flex-direction: column; }
  .next-panel .button { width: 100%; }
  dialog[data-role="evidence-drawer"] { width: 100%; }
  .drawer-head { padding: 1rem; }
  .drawer-body { padding: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0ms !important; transition-duration: 0.01ms !important; }
}

@media print {
  [data-role="site-header"], [data-role="site-footer"], .hero-art, dialog, .button, .text-button { display: none !important; }
  body { color: #000; background: #fff; }
  .hero { min-height: auto; display: block; }
  .section, .dark-section, .wash-section { width: 100%; padding: 1rem 0; color: #000; background: #fff; }
  .work-card { break-inside: avoid; box-shadow: none; }
}
