/* 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-graduation: #9A3412;
  --t-holidays: #97264C;
  --t-about: #14140F;

  --tab: var(--t-funeral);      /* fallback; the per-page class below sets it */
  --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-graduation: #F0A57A;
    --t-holidays: #F0A0B6; --t-about: #F4F1E6;
    --quiet: color-mix(in srgb, var(--tab) 55%, var(--ink));
  }
}


/* Per-page and per-tab colour. These are classes, not style attributes: the
   site is served with style-src 'self', so a style attribute is dropped by the
   browser without breaking the page — which is why every page rendered in
   funeral blue for two days and nothing looked broken enough to notice. */
html.t-funeral { --tab: var(--t-funeral); }
html.t-wedding { --tab: var(--t-wedding); }
html.t-birthday { --tab: var(--t-birthday); }
html.t-baby { --tab: var(--t-baby); }
html.t-thanks { --tab: var(--t-thanks); }
html.t-graduation { --tab: var(--t-graduation); }
html.t-holidays { --tab: var(--t-holidays); }
html.t-about { --tab: var(--t-about); }
.edge .tc-funeral { --tabc: var(--t-funeral); }
.edge .tc-wedding { --tabc: var(--t-wedding); }
.edge .tc-birthday { --tabc: var(--t-birthday); }
.edge .tc-baby { --tabc: var(--t-baby); }
.edge .tc-thanks { --tabc: var(--t-thanks); }
.edge .tc-graduation { --tabc: var(--t-graduation); }
.edge .tc-holidays { --tabc: var(--t-holidays); }
.edge .tc-about { --tabc: var(--t-about); }

.measure { max-width: 68ch; }

*, *::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; }
  /* Six sections do not fit a phone. Scroll the bar rather than the page. */
  .edge { position: static; width: auto; flex-direction: row; padding: 0; border-left: 0;
    border-bottom: var(--axis) solid var(--rule);
    overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; }
  .edge::-webkit-scrollbar { display: none; }
  .edge a { flex: 0 0 auto; min-width: 6.5rem; }
  .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 .gloss { margin: 0.3rem 0 0; font-size: 0.9rem; color: var(--quiet); font-style: italic; }
.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.5rem 0.45rem; margin: -0.5rem -0.45rem;
  min-height: 24px; 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%); }

/* On-page contents. Below 78rem it sits under the plate as a wrapped set of
   chips; above it, it moves into the margin the page was not using and sticks.
   Plain anchors either way — no script, and a crawler reads it as links. */
.onpage { margin-top: 1.6rem; }
.onpage h2 { font: 700 0.6875rem/1 Archivo, sans-serif; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--tab); margin: 0 0 0.7rem; border: 0; padding: 0; }
/* One scrolling row, not a stacked list. Seventeen chips wrapped down the page
   measured 600px tall on a phone and pushed the first example 2.9 screens
   down, on a site whose whole claim is that you are in a hurry. Same treatment
   as the tab strip. */
.onpage ol { list-style: none; margin: 0; padding: 0 0 0.3rem; display: flex; flex-wrap: nowrap;
  gap: 0.5rem; overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain; }
.onpage ol::-webkit-scrollbar { display: none; }
.onpage li { flex: 0 0 auto; }
.onpage a { white-space: nowrap; }
.onpage a { display: block; text-decoration: none; font-size: 0.8125rem; line-height: 1.3;
  padding: 0.35rem 0.6rem; min-height: 24px; border: 1px solid var(--tab); color: var(--ink); }
.onpage a:hover, .onpage a:focus-visible { background: var(--tab); color: var(--paper); }

@media (min-width: 78rem) {
  main .wrap.doc { width: min(100% - 2.5rem, 74rem); display: grid; gap: 0 3rem;
    grid-template-columns: minmax(0, 1fr) 12rem; align-items: start; }
  main .wrap.doc > * { grid-column: 1; min-width: 0; }
  /* A negative row line counts only in the EXPLICIT grid, and this grid declares
     columns only — so `1 / -1` resolved to row 1 alone and stretched it to the
     rail's full height, pushing the plate 397px down the page. Span instead.
     Empty implicit rows are auto-sized to zero and row-gap is 0, so the spare
     span costs nothing. */
  main .wrap.doc > .onpage { grid-column: 2; grid-row: 1 / span 200; align-self: start;
    position: sticky; top: 1.25rem; margin-top: 0.4rem; }
  .onpage ol { flex-direction: column; flex-wrap: nowrap; gap: 0; overflow-x: visible; padding: 0; }
  .onpage a { white-space: normal; }
  .onpage a { border: 0; border-left: 2px solid transparent; padding: 0.3rem 0 0.3rem 0.7rem; }
  .onpage a:hover, .onpage a:focus-visible { background: none; color: var(--tab);
    border-left-color: var(--tab); }
}

/* Hero plate. Every page opens on a drawing of its own subject, carrying the
   page's own first example as the handwriting. Six drawings, 140 plates. */
.plate-hero { margin-top: clamp(1.5rem, 3vw, 2.25rem); background: var(--paper-2);
  padding: clamp(0.9rem, 2vw, 1.6rem); }
.plate-hero svg { display: block; width: 100%; height: auto; max-width: 40rem; margin: 0 auto;
  overflow: visible; }

.plate-hero .ink path { fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-linejoin: round; }
.plate-hero .ink .fold { stroke-dasharray: 5 6; opacity: 0.45; }
.plate-hero .accent path { fill: var(--tab); stroke: none; }
/* The printed half: a hairline frame, the shop's own greeting set centred in
   the tab colour, and one ornament rule under it. */
.plate-hero .printed .frame { fill: none; stroke: var(--tab); stroke-width: 1; opacity: 0.5; }
.plate-hero .printed .set { fill: var(--tab); text-anchor: middle;
  font: 400 21px/1 Vollkorn, Georgia, serif; letter-spacing: 0.02em; }
.plate-hero .printed .orn line { stroke: var(--tab); stroke-width: 1; opacity: 0.7; }
.plate-hero .printed .orn path { fill: var(--tab); stroke: none; opacity: 0.85; }
.plate-hero .lines line { stroke: var(--ink); stroke-width: 1.1; opacity: 0.26; }
.plate-hero .spec { fill: var(--ink); font: italic 400 19px/1 Vollkorn, Georgia, serif; }
.plate-hero .lbl { fill: var(--quiet); font: 700 10px/1 Archivo, sans-serif; letter-spacing: 0.16em; }
.plate-hero .lbl.mid { text-anchor: middle; }
.plate-hero .num { fill: var(--tab); }
.plate-hero .numt { fill: var(--paper); font: 700 12px/1 Archivo, sans-serif;
  text-anchor: middle; dominant-baseline: central; }
/* The index plate shows the whole tab set, so it uses the palette, not one tab. */
.plate-hero .tabs rect { stroke: none; }
.plate-hero .tabs .t1 { fill: var(--t-funeral); }
.plate-hero .tabs .t2 { fill: var(--t-birthday); }
.plate-hero .tabs .t3 { fill: var(--t-baby); }
.plate-hero .tabs .t4 { fill: var(--t-wedding); }

/* The plate draws itself: the ink arrives as a line being drawn.
   NOTHING that carries words is animated. An earlier version faded the
   specimen wording in from opacity 0 with fill-mode `both`, which leaves real
   content invisible for as long as the animation has not run — a rendering
   engine that never runs it sees hidden text, and hidden text is a spam
   signal. Strokes are decoration and may arrive late; words may not. */
@media (prefers-reduced-motion: no-preference) {
  .plate-hero .ink path { animation: plate-draw 1s var(--lead) both; }
  .plate-hero .lines line { animation: plate-draw 0.7s var(--lead) 0.45s both; }
  @keyframes plate-draw { from { stroke-dasharray: 1400; stroke-dashoffset: 1400; }
                            to { stroke-dasharray: 1400; stroke-dashoffset: 0; } }
}

/* 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; }
/* 24px minimum hit area (WCAG 2.5.8). These measured 22px tall on a phone. */
footer nav a { display: inline-flex; align-items: center; min-height: 24px; }
footer a { text-decoration: none; }
footer a:hover { text-decoration: underline; }

/* ── Figure plates ─────────────────────────────────────────────────────────
   Drawn for this site, inline so they inherit the ink and the page's tab and
   invert with the theme. A reference manual has plates, not photographs. */
.plate-fig { margin-top: clamp(2rem, 4vw, 3rem); border-top: var(--axis) solid var(--rule); padding-top: 1.25rem; }
.plate-fig figure { margin: 0; display: grid; gap: 1.5rem 2.5rem; align-items: start;
  grid-template-columns: minmax(min(100%, 15rem), 22rem) 1fr; }
@media (max-width: 44rem) { .plate-fig figure { grid-template-columns: 1fr; } }

.plate-fig .drawing { background: var(--paper-2); padding: 1rem; }
.plate-fig svg { display: block; width: 100%; height: auto; overflow: visible; }

.plate-fig .ink path { fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linejoin: round; }
.plate-fig .ink .shoe { fill: var(--ink); }
.plate-fig .accent path, .plate-fig .accent rect { fill: var(--tab); stroke: none; opacity: 0.9; }

.plate-fig .lead { stroke: var(--tab); stroke-width: 1; stroke-dasharray: 2 3; }
.plate-fig .dot { fill: var(--tab); }
.plate-fig .num { fill: var(--tab); }
.plate-fig .numt { fill: var(--paper); font: 700 11px/1 Archivo, sans-serif; text-anchor: middle; dominant-baseline: central; }
.plate-fig .numt.in { fill: var(--ink); }        /* unfilled segment: ink on paper */
.plate-fig .numt.in.on { fill: var(--paper); }   /* filled segment: knocked out of the tab colour */

.plate-fig .bar rect { fill: none; stroke: var(--ink); stroke-width: 1.4; }
.plate-fig .bar rect.fill { fill: var(--tab); stroke: var(--tab); }
.plate-fig .rule { stroke: var(--ink); stroke-width: var(--axis); }
.plate-fig .lines line { stroke: var(--ink); stroke-width: 1.2; opacity: 0.45; }
.plate-fig .sw rect { stroke: var(--ink); stroke-width: 1; }
.plate-fig .sw rect.hollow { fill: none; }   /* SVG defaults fill to black, which vanishes in dark mode */
.plate-fig .strike line { stroke: var(--ink); stroke-width: 1.6; }
.plate-fig .lbl { fill: var(--quiet); font: 700 9px/1 Archivo, sans-serif; letter-spacing: 0.14em; text-transform: uppercase; }
.plate-fig .lbl.mid { text-anchor: middle; }
.plate-fig .lbl.end { text-anchor: end; }
.plate-fig .lbl.on { fill: var(--paper); }   /* label sitting on a filled bar */

/* Same motion as the hero plate: the drawing arrives as a drawing. Fill mode
   `both` means the static end state is what shows when motion is off. */
/* Same rule as the hero: strokes draw, words do not move. The callout numerals
   in .marks are referenced by the numbered list beside the plate, so they are
   content and are never faded. */
@media (prefers-reduced-motion: no-preference) {
  .plate-fig .ink path { animation: plate-draw-long 1.2s var(--lead) both; }
  .plate-fig .lines line, .plate-fig .lead { animation: plate-draw-long 0.8s var(--lead) 0.5s both; }
  @keyframes plate-draw-long { from { stroke-dasharray: 3000; stroke-dashoffset: 3000; }
                                 to { stroke-dasharray: 3000; stroke-dashoffset: 0; } }
}

.plate-fig figcaption { font-family: Vollkorn, Georgia, serif; font-size: 1.0625rem; line-height: 1.5;
  margin: 0 0 1rem; max-width: 46ch; }
.plate-fig ol { list-style: none; margin: 0; padding: 0 0 0 2.25rem; border-left: var(--axis) solid var(--rule);
  display: grid; gap: 0.7rem; }
.plate-fig ol li { position: relative; font-size: 0.9375rem; color: var(--quiet); max-width: 46ch; }
.plate-fig ol li b { position: absolute; left: -2.25rem; width: 1.4rem; text-align: right;
  font-variant-numeric: tabular-nums; font-size: 0.75rem; font-weight: 700; color: var(--tab); }
