@layer reset, base, layout, sheets, utilities, print;

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  html { -webkit-text-size-adjust: 100%; }
  body, h1, h2, h3, p, ul, fieldset { margin: 0; }
  fieldset { padding: 0; border: 0; min-inline-size: 0; }
  button, textarea, input { font: inherit; }
  button, a, input, textarea { -webkit-tap-highlight-color: transparent; }
  [hidden] { display: none !important; }
}

@layer base {
  :root {
    --paper: #f8f1df;
    --white: #fffdf5;
    --ink: #49372d;
    --berry: #862b4b;
    --ochre: #eec467;
    --peach: #f3dac8;
    --line: #b9a58a;
    --soft: #eaddc6;
    --font: 'Trebuchet MS', Candara, 'Segoe UI', sans-serif;
    color: var(--ink);
    background: var(--paper);
    font-family: var(--font);
    font-size: 18px;
    line-height: 1.6;
    font-synthesis: none;
  }
  body { border-top: 10px solid var(--ochre); }
  h1, h2, h3 { line-height: 1.13; text-wrap: balance; }
  h1 { color: var(--berry); font-size: clamp(2.5rem, 5.1vw, 4.5rem); letter-spacing: -.045em; max-width: 17ch; }
  h2 { font-size: clamp(1.5rem, 2.6vw, 2rem); letter-spacing: -.025em; }
  h3 { font-size: 1.15rem; }
  p { max-width: 67ch; }
  p + p { margin-top: .7rem; }
  a { color: var(--berry); text-underline-offset: .2em; text-decoration-thickness: .08em; }
  a:hover { text-decoration-thickness: .15em; }
  :focus-visible { outline: 3px solid var(--berry); outline-offset: 5px; }
  textarea:focus-visible { outline-offset: 2px; }
  button { cursor: pointer; }
  textarea {
    display: block; width: 100%; min-height: 102px; resize: vertical;
    background: var(--white); color: var(--ink); border: 1.5px solid var(--line);
    border-radius: 12px; padding: .7rem .85rem; line-height: 1.65;
  }
  input[type='checkbox'] { width: 44px; height: 44px; margin: 0; flex: 0 0 44px; accent-color: var(--berry); }
  input[type='checkbox']:focus-visible { outline-offset: 4px; }
  legend { font-weight: 700; margin-bottom: .65rem; font-size: 1rem; }
  ::selection { background: var(--ochre); color: var(--ink); }
}

@layer layout {
  .wrap { max-width: 1240px; margin-inline: auto; padding-inline: 44px; }
  .mast { display: grid; grid-template-columns: 1fr auto 1fr; gap: 30px; align-items: center; padding-block: 28px; }
  .nav { display: grid; grid-template-columns: repeat(4, max-content); align-items: center; gap: 3px; }
  .right { justify-content: end; }
  .nav a { min-height: 48px; min-width: 44px; display: inline-flex; align-items: center; justify-content: center; padding: 6px 11px; border-radius: 24px; font-size: 17px; text-decoration: none; }
  .nav a[aria-current='page'] { background: var(--ochre); color: var(--ink); }
  .nav a:hover { background: var(--soft); }
  .brand { display: flex; flex-direction: column; align-items: center; line-height: 1.18; text-decoration: none; padding: 8px 18px; border: 2px solid var(--berry); border-radius: 50%; min-width: 178px; min-height: 84px; justify-content: center; }
  .brand span:first-child { font-size: 28px; font-weight: 700; letter-spacing: -.03em; }
  .brand span:last-child { font-size: 16px; }
  .hero { position: relative; padding: 66px 0 52px; border-top: 2px solid var(--berry); }
  .hero h1 { margin-block: 18px 25px; }
  .hero:not(.home) { padding-right: 130px; }
  .hero:not(.home) h1 { max-width: 20ch; }
  .home { display: grid; grid-template-columns: 1.3fr 1fr; gap: 65px; align-items: center; padding-block: 62px 70px; }
  .home h1 { font-size: clamp(2.65rem, 4.8vw, 4rem); max-width: 14ch; }
  .kicker { color: var(--berry); font-size: 1rem; }
  .lead { font-size: 1.17rem; line-height: 1.55; max-width: 58ch; }
  .home .lead { margin-bottom: 28px; max-width: 44ch; }
  .mark { position: absolute; right: 10px; top: 66px; font-size: 5rem; line-height: 1; color: var(--berry); border-bottom: 8px solid var(--ochre); }
  .content { padding-bottom: 54px; }
  .read { max-width: 72ch; }
  .qa { margin-bottom: 42px; }
  .qa h2, .qa h3 { margin-bottom: 16px; max-width: 35ch; }
  .qa h3 { font-size: clamp(1.5rem, 2.6vw, 2rem); letter-spacing: -.025em; }
  .qa-part { margin-top: 42px; }
  .spread { display: grid; grid-template-columns: 1fr 1fr; gap: 60px; align-items: start; margin-top: 18px; }
  .spread .qa { margin-top: 12px; }
  .routes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin-top: 28px; }
  .route { position: relative; display: flex; flex-direction: column; gap: 14px; padding: 27px 27px 55px; border-radius: 26px; background: var(--peach); text-decoration: none; color: var(--ink); }
  .route:nth-child(2) { background: var(--ochre); }
  .route:nth-child(3) { background: var(--soft); }
  .route strong { color: var(--berry); font-size: 1.4rem; line-height: 1.15; }
  .route span { font-size: 1rem; }
  .route .tag { font-size: 1rem; }
  .route .arrow { position: absolute; right: 25px; bottom: 15px; font-size: 1.6rem; }
  .route:hover { outline: 2px solid var(--berry); outline-offset: 3px; }
  .turn { margin-top: 44px; display: grid; grid-template-columns: 1fr 1fr; border-block: 2px solid var(--berry); }
  .turn a { padding: 24px 16px; display: flex; flex-direction: column; gap: 6px; text-decoration: none; }
  .turn a + a { border-left: 2px solid var(--berry); }
  .turn a:hover { background: var(--soft); }
  .turn span { color: var(--ink); font-size: 16px; }
  .turn strong { font-size: 1.15rem; }
  .foot { padding-block: 32px 40px; display: flex; align-items: start; justify-content: space-between; gap: 30px; border-top: 8px solid var(--ochre); }
  .foot p { max-width: 46ch; font-size: 16px; }
  .links { display: flex; flex-wrap: wrap; gap: 6px 14px; }
  .links a { display: inline-flex; align-items: center; min-height: 44px; padding: 7px; font-size: 16px; }
  @media (max-width: 1100px) {
    .mast { gap: 16px; }
    .nav { grid-template-columns: repeat(2, max-content); }
    .left { justify-content: start; }
    .home { gap: 38px; }
    .spread { gap: 32px; }
    .foot { flex-direction: column; gap: 16px; }
  }
  @media (max-width: 700px) {
    .wrap { padding-inline: 22px; }
    .mast { grid-template-columns: 1fr 1fr; gap: 16px 8px; padding-block: 18px 22px; }
    .brand { grid-column: 1 / -1; grid-row: 1; justify-self: center; min-height: 68px; min-width: 166px; }
    .brand span:first-child { font-size: 25px; }
    .nav { gap: 2px; }
    .nav a { padding-inline: 12px; min-height: 46px; font-size: 16px; }
    .hero { padding-block: 36px 34px; }
    .hero:not(.home) { padding-right: 0; }
    .hero h1 { margin-block: 16px 20px; padding-right: 0; }
    .home { grid-template-columns: 1fr; padding-block: 34px 42px; gap: 36px; }
    .home h1 { font-size: 2.65rem; }
    .lead { font-size: 1.08rem; }
    .kicker { font-size: 16px; }
    .mark { display: none; }
    .spread { grid-template-columns: 1fr; gap: 0; }
    .qa { margin-bottom: 34px; }
    .qa-part { margin-top: 34px; }
    .routes { grid-template-columns: 1fr; gap: 16px; }
    .route { padding: 24px 24px 48px; }
    .turn a { padding: 20px 12px; }
    .turn strong { font-size: 1rem; }
    .foot { padding-block: 26px; }
    .links { gap: 2px 8px; }
    .content { padding-bottom: 34px; }
  }
}

@layer sheets {
  .paper { background: var(--white); border: 2px solid var(--line); border-radius: 34px 34px 16px 16px; }
  .open { position: relative; background: var(--peach); border-color: var(--peach); padding: 42px 34px 25px; }
  .open h2 { font-size: 1.8rem; color: var(--berry); max-width: 16ch; margin-bottom: 20px; }
  .open p { font-size: 1rem; }
  .glyph { display: block; color: var(--berry); font-size: 6rem; font-weight: 700; line-height: .9; margin-bottom: 25px; }
  .sheet { position: relative; padding: 36px; margin-block: 34px 46px; border-top: 10px solid var(--ochre); }
  .sheet h2 { color: var(--berry); margin-block: 10px 15px; }
  .sheet > p { margin-bottom: 22px; }
  .tab { display: inline-block; padding: 4px 16px; background: var(--ochre); color: var(--ink); border-radius: 0 0 14px 14px; margin-top: -38px; transform: translateY(-9px); font-size: 16px; }
  .field { margin-top: 22px; min-width: 0; }
  .field label { display: block; margin-bottom: 8px; font-weight: 700; font-size: 1rem; line-height: 1.4; }
  .field .hint { margin: -2px 0 10px; font-size: 16px; }
  .note { display: none; }
  .checks { list-style: none; padding: 0; margin-top: 18px; }
  .checks li { border-top: 1px solid var(--soft); }
  .checks label { min-height: 60px; display: flex; align-items: start; gap: 16px; padding: 16px 6px; cursor: pointer; font-size: 1rem; }
  .checks label:hover { background: var(--paper); }
  .checks label:has(input:checked) { color: var(--berry); background: var(--paper); }
  .picks { margin-top: 26px; }
  .status { background: var(--paper); padding: 14px 18px; border-radius: 14px; margin-top: 20px; font-size: 1rem; }
  .actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 20px; }
  .picked { background: var(--paper); padding: 26px; border-radius: 20px; margin-top: 24px; }
  .picked h3 { margin-bottom: 16px; color: var(--berry); }
  .picked ul { padding-left: 24px; }
  .picked li { padding-block: 7px; }
  .quote, .pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 26px; }
  .part { padding-block: 26px; border-top: 2px solid var(--soft); }
  .part:first-child { margin-top: 32px; }
  .part h3 { color: var(--berry); margin-bottom: 10px; }
  .part p { font-size: 1rem; }
  .urgent { background: var(--peach); padding: 26px; border-radius: 22px; border-left: 7px solid var(--berry); }
  .sources { padding-top: 26px; border-top: 2px solid var(--line); }
  .sources h2 { font-size: 1.25rem; margin-bottom: 16px; }
  .notes { list-style: none; padding: 0; max-width: 72ch; }
  .notes li { scroll-margin-top: 20px; }
  .notes a { display: block; min-height: 48px; padding-block: 11px; font-size: 16px; overflow-wrap: anywhere; }
  @media (max-width: 700px) {
    .open { padding: 30px 26px 22px; }
    .glyph { font-size: 5rem; }
    .sheet { padding: 28px 22px; border-radius: 28px 28px 14px 14px; }
    .tab { margin-top: -30px; }
    .quote, .pair { grid-template-columns: 1fr; }
    .picked { padding: 22px; }
    .urgent { padding: 22px; }
    .actions .btn { width: 100%; }
  }
}

@layer utilities {
  .btn { display: inline-flex; gap: 18px; align-items: center; justify-content: center; min-height: 52px; padding: 12px 24px; border: 2px solid var(--berry); border-radius: 32px; background: var(--berry); color: var(--white); text-decoration: none; font-size: 1rem; line-height: 1.3; font-weight: 700; }
  .btn:hover { background: var(--ink); border-color: var(--ink); }
  .alt { background: transparent; color: var(--berry); }
  .alt:hover { background: var(--peach); border-color: var(--berry); }
  .ref { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px; font-size: 16px; vertical-align: middle; border-radius: 50%; }
  .ref:hover { background: var(--ochre); }
  .skip { position: fixed; left: 12px; top: -160px; z-index: 20; background: var(--white); color: var(--berry); border: 3px solid var(--berry); padding: 14px 22px; min-height: 48px; border-radius: 28px; }
  .skip:focus { top: 12px; }
  main:focus { outline: none; }
  @media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; } }
}

@layer print {
  @media print {
    :root { font-size: 12pt; background: white; color: #29211b; }
    body { border: 0; }
    .wrap { max-width: none; padding: 0; }
    .mast, .skip, .foot, .turn, .actions, .status, .mark, .glyph { display: none !important; }
    .hero, .home { display: block; padding: 0 0 18pt; border-top: 0; }
    .hero:not(.home) { padding-right: 0; }
    h1, .home h1 { font-size: 28pt; max-width: 24ch; }
    h2, .qa h3 { font-size: 18pt; }
    h1, h2, h3, label, legend { break-after: avoid; }
    .lead { font-size: 12pt; }
    .spread, .routes { display: block; }
    .sheet, .open { border: 1pt solid #b9a58a; border-radius: 0; background: white; padding: 16pt; margin-block: 14pt; }
    .tab { background: white; padding: 0; margin: 0; transform: none; }
    .field, .part, .checks li { break-inside: avoid; }
    .note { display: block; min-height: 52pt; border-bottom: 1pt solid #b9a58a; white-space: pre-wrap; overflow-wrap: anywhere; padding: 8pt 0; }
    .print textarea { display: none; }
    textarea { min-height: 60pt; }
    .picked { background: white; border: 1pt solid #b9a58a; }
    .chosen .picks { display: none; }
    .ref, .notes a { min-height: 0; min-width: 0; padding: 0; }
    .sources { margin-top: 18pt; }
    .notes li { padding-block: 5pt; }
    .urgent { background: white; border: 1pt solid #862b4b; }
  }
}
