/* THE THUMB INDEX — occasionhandbook.com
   A cut-tab reference manual. You open it at the tab, you do not scroll it from
   the top. The tabs stand down the fore-edge on every page and never move, so
   the book tells you where you are before you have read a word. */

:root {
  /* Absolute tonal commitment — no grey hedging. Ink and paper are true. */
  --paper: #FFFFFF;
  --paper-2: #F4F2ED;          /* the block edge, where the pages stack */
  --ink: #14140F;
  --rule: #14140F;

  /* Tab colours. One per occasion; nothing else on the site is coloured. */
  --t-funeral: #2D4E8A;
  --t-wedding: #B23A1E;
  --t-birthday: #9A6B00;
  --t-baby: #1F6F5C;
  --t-thanks: #6B3FA0;
  --t-about: #14140F;

  --tab: var(--t-funeral);      /* set per page */
  --quiet: color-mix(in srgb, var(--tab) 62%, var(--ink));

  --measure: 68ch;
  --axis: 2px;
  --lead: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: light dark;
}

/* The same book under low light. Paper darkens; the tabs keep their ink. */
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #16150F;
    --paper-2: #201E16;
    --ink: #F4F1E6;
    --rule: #F4F1E6;
    --t-funeral: #8FB4EE; --t-wedding: #EE9377; --t-birthday: #E0B44A;
    --t-baby: #6FC6AC; --t-thanks: #BB98E8; --t-about: #F4F1E6;
    --quiet: color-mix(in srgb, var(--tab) 55%, var(--ink));
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: Archivo, ui-sans-serif, system-ui, sans-serif;
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem); line-height: 1.6;
  font-synthesis-weight: none; text-rendering: optimizeLegibility;
}

::selection { background: var(--tab); color: var(--paper); }
:focus-visible { outline: 2px solid var(--tab); outline-offset: 3px; }
::-webkit-scrollbar { width: 12px; }
::-webkit-scrollbar-track { background: var(--paper-2); }
::-webkit-scrollbar-thumb { background: var(--tab); border: 4px solid var(--paper-2); }
:root { scrollbar-color: var(--tab) var(--paper-2); scrollbar-width: thin; }

a { color: inherit; text-decoration-color: var(--tab); text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

.wrap { width: min(100% - 2.5rem, 60rem); margin-inline: auto; }

/* ── Running head. Every page says where it sits. ─────────────────────────── */
.rh { border-bottom: var(--axis) solid var(--rule); }
.rh .wrap { display: flex; align-items: baseline; gap: 1rem; padding: 0.7rem 0;
  font-size: 0.6875rem; letter-spacing: 0.16em; text-transform: uppercase; font-weight: 600; }
.rh a { text-decoration: none; }
.rh .bk { font-weight: 700; letter-spacing: 0.08em; }
.rh .sec { color: var(--tab); }
.rh .fol { margin-left: auto; color: var(--quiet); font-variant-numeric: tabular-nums; }

/* ── The fore-edge. Cut tabs, always visible, never moving. ───────────────── */
.edge { position: fixed; top: 0; right: 0; bottom: 0; width: 2.5rem;
  background: var(--paper-2); border-left: 1px solid var(--rule);
  display: flex; flex-direction: column; gap: 2px; padding: 3.2rem 0 1rem; z-index: 3; }
.edge a { flex: 1; display: grid; place-items: center; text-decoration: none;
  background: var(--tabc); color: #FFF; writing-mode: vertical-rl; text-orientation: mixed;
  font-size: 0.625rem; letter-spacing: 0.18em; text-transform: uppercase; font-weight: 700;
  border-left: 4px solid transparent; }
.edge .edge-soon { flex: 1; display: grid; place-items: center; background: var(--paper-2);
  color: var(--quiet); writing-mode: vertical-rl; text-orientation: mixed;
  font-size: 0.625rem; letter-spacing: 0.18em; text-transform: uppercase; font-weight: 700;
  border-left: 4px solid transparent; opacity: 0.5; }
.edge a[aria-current="page"] { border-left-color: var(--ink); transform: translateX(-0.55rem); }
.edge a:hover { transform: translateX(-0.35rem); }
@media (prefers-reduced-motion: no-preference) { .edge a { transition: transform 0.18s var(--lead); } }
body { padding-right: 2.5rem; }
@media (max-width: 46rem) {
  body { padding-right: 0; }
  .edge { position: static; width: auto; flex-direction: row; padding: 0; border-left: 0;
    border-bottom: var(--axis) solid var(--rule); }
  .edge a, .edge .edge-soon { writing-mode: horizontal-tb; padding: 0.55rem 0.3rem; border-left: 0; border-bottom: 4px solid transparent; }
  .edge .edge-soon { display: none; }
  .edge a[aria-current="page"] { border-bottom-color: var(--ink); transform: none; }
  .edge a:hover { transform: none; }
}

/* ── The head. The answer starts in the first clause after it. ────────────── */
.head { padding: clamp(2.25rem, 5vw, 3.5rem) 0 0; }
.head h1 { font-size: clamp(2rem, 1.35rem + 3.1vw, 3.5rem); line-height: 1.04;
  letter-spacing: -0.035em; font-weight: 700; margin: 0; max-width: 20ch; text-wrap: balance; }
.standfirst { margin: 1rem 0 0; max-width: 56ch; font-size: 1.0625rem; color: var(--quiet); }
@media (prefers-reduced-motion: no-preference) {
  .head h1 { animation: open 0.45s var(--lead) both; }
  @keyframes open { from { opacity: 0; transform: translateY(0.35rem); } to { opacity: 1; transform: none; } }
}

/* ── The axis. One rule down the page; every clause hangs off it. ─────────── */
section { margin-top: clamp(2.5rem, 5vw, 4rem); }
section > h2 { font-size: clamp(1.2rem, 1rem + 0.9vw, 1.6rem); letter-spacing: -0.02em;
  font-weight: 700; margin: 0 0 0.4rem; text-wrap: balance; }
section > .note { margin: 0 0 1.4rem; max-width: var(--measure); color: var(--quiet); }

.clauses { list-style: none; margin: 0; padding: 0 0 0 3.25rem;
  border-left: var(--axis) solid var(--rule); display: grid; gap: 1.6rem; }
.clauses > li { position: relative; }
.clauses > li > .n { position: absolute; left: -3.25rem; top: 0.1rem; width: 2.4rem;
  text-align: right; font-variant-numeric: tabular-nums; font-size: 0.8125rem;
  font-weight: 600; color: var(--tab); }
.clauses q { quotes: none; display: block; font-family: Vollkorn, Georgia, serif;
  font-size: 1.1875rem; line-height: 1.5; max-width: var(--measure); }
.clauses .meta { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 0.45rem;
  font-size: 0.6875rem; letter-spacing: 0.14em; text-transform: uppercase; font-weight: 600; color: var(--quiet); }
.clauses .meta b { color: var(--ink); font-weight: 700; }

.pull { background: none; border: 0; padding: 0; cursor: pointer; color: var(--tab);
  font: 700 0.6875rem/1 Archivo, sans-serif; letter-spacing: 0.14em; text-transform: uppercase;
  display: inline-flex; gap: 0.4rem; align-items: center; }
.pull:hover { text-decoration: underline; text-underline-offset: 0.3em; }
.pull .tick { width: 9px; height: 9px; border: 1.5px solid currentColor; display: block; }
/* State is a mark, not a hue: a struck box reads in greyscale. */
.pull[data-struck="1"] .tick { background:
  linear-gradient(to top right, transparent 42%, currentColor 42%, currentColor 58%, transparent 58%),
  linear-gradient(to bottom right, transparent 42%, currentColor 42%, currentColor 58%, transparent 58%); }

/* Quick answer — the reassurance block. */
.quick { margin-top: 2rem; border-top: var(--axis) solid var(--rule); padding-top: 1.4rem; }
.quick dl { margin: 0; display: grid; gap: 1.4rem 2.5rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); }
.quick dt { font: 700 0.6875rem/1 Archivo, sans-serif; letter-spacing: 0.16em; text-transform: uppercase; color: var(--tab); margin-bottom: 0.5rem; }
.quick dd { margin: 0; font-family: Vollkorn, Georgia, serif; font-size: 1.0625rem; line-height: 1.5; }

/* Fill-in template. */
.template { border-left: var(--axis) solid var(--tab); padding-left: 1.4rem; }
.template p { font-family: Vollkorn, Georgia, serif; font-size: 1.1875rem; line-height: 1.8; margin: 0 0 1rem; max-width: var(--measure); }
.template p:last-child { margin-bottom: 0; }
.template .blank { border-bottom: 1.5px solid var(--tab); padding: 0 0.45rem; color: var(--quiet); font-style: italic; }

/* The warning. The only place the tab colour fills a field. */
.warn { margin-top: clamp(2.5rem, 5vw, 4rem); background: var(--tab); color: var(--paper); padding: clamp(1.5rem, 3.5vw, 2.5rem) 0; }
.warn h2 { margin: 0 0 1.1rem; font-size: clamp(1.2rem, 1rem + 0.9vw, 1.6rem); letter-spacing: -0.02em; }
.warn ol { margin: 0; padding: 0 0 0 3.25rem; border-left: var(--axis) solid var(--paper); list-style: none; display: grid; gap: 1.1rem; }
.warn li { position: relative; max-width: var(--measure); }
.warn li .n { position: absolute; left: -3.25rem; top: 0.15rem; width: 2.4rem; text-align: right;
  font-variant-numeric: tabular-nums; font-size: 0.8125rem; font-weight: 700; opacity: 0.75; }
.warn b { display: block; font-weight: 700; margin-bottom: 0.15rem; }
.warn i { font-style: normal; opacity: 0.88; }

/* FAQ */
.faq { border-top: 1px solid var(--rule); }
.faq details { border-bottom: 1px solid var(--rule); padding: 0.95rem 0; }
.faq summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; gap: 0.8rem; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before { content: "+"; color: var(--tab); font-weight: 700; }
.faq details[open] summary::before { content: "\2212"; }
.faq p { margin: 0.7rem 0 0 1.6rem; max-width: var(--measure); color: var(--quiet); }

/* See also — the cross-reference at the foot of a manual entry. */
.rail { margin-top: clamp(2.5rem, 5vw, 4rem); border-top: var(--axis) solid var(--rule); padding-top: 1rem; }
.rail h2 { font: 700 0.6875rem/1 Archivo, sans-serif; letter-spacing: 0.16em; text-transform: uppercase; color: var(--quiet); margin: 0 0 0.5rem; }
.rail ul { list-style: none; margin: 0; padding: 0; }
.rail li { border-bottom: 1px solid var(--rule); }
.rail a { display: flex; gap: 1rem; align-items: baseline; padding: 0.8rem 0; text-decoration: none; }
.rail a b { font-weight: 600; }
.rail a:hover b { text-decoration: underline; text-underline-offset: 0.2em; }
.rail a span { margin-left: auto; font-size: 0.6875rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--quiet); }

footer { margin-top: clamp(3rem, 6vw, 5rem); border-top: var(--axis) solid var(--rule); padding: 1.25rem 0 3rem; font-size: 0.875rem; color: var(--quiet); }
footer nav { display: flex; gap: 1.4rem; flex-wrap: wrap; margin-bottom: 0.6rem; }
footer a { text-decoration: none; }
footer a:hover { text-decoration: underline; }
