/* Mohua - a naturalist's register.
   Visual model: a tipped-in plate from an 1870s monograph, bound into a ruled
   accession ledger. Grey-green plate-mount stock, iron-gall ink, feint ruling,
   a vermilion margin rule. No web fonts: the faces are the ones a Mac already
   has, which happen to be the right period. */

:root {
  --paper:     #dfe2d4;
  --paper-2:   #d7dbca;
  --leaf:      #eef0e5;
  --stock:     #fbfaf5;
  --ink:       #241f16;
  --ink-2:     #554e3d;
  --ink-3:     #776f5d;
  --feint:     #b6c1a8;
  --vermilion: #8f3325;
  --olive:     #67705c;
  --chrome:    #d4a017;
  --night:     #191710;

  --display: Didot, "Bodoni 72", "Playfair Display", "Hoefler Text", Georgia, serif;
  --body: "Iowan Old Style", "Hoefler Text", Baskerville, Palatino, Georgia, serif;

  --rule: 1px solid var(--ink);
  --hair: 1px solid rgba(36, 31, 22, .22);
  --lead: 32px;              /* the ledger's baseline */
  --measure: 66ch;
  --gutter: clamp(20px, 5vw, 76px);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background-color: var(--paper);
  /* the feint ruling of a register, plus the faintest bloom of foxing */
  background-image:
    repeating-linear-gradient(to bottom,
      transparent 0, transparent calc(var(--lead) - 1px),
      rgba(122, 142, 110, .17) calc(var(--lead) - 1px), rgba(122, 142, 110, .17) var(--lead)),
    radial-gradient(ellipse at 12% 8%, rgba(150, 106, 58, .07), transparent 55%),
    radial-gradient(ellipse at 88% 62%, rgba(150, 106, 58, .06), transparent 50%);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: var(--lead);
  font-variant-numeric: oldstyle-num;
  text-rendering: optimizeLegibility;
}

/* ── the page ──────────────────────────────────────────────────── */

.sheet {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 var(--gutter);
  position: relative;
}
/* the ledger's vermilion margin rule */
.sheet::before {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  left: calc(var(--gutter) - 18px);
  width: 1px;
  background: var(--vermilion);
  opacity: .5;
}
@media (max-width: 760px) { .sheet::before { display: none; } }

a { color: var(--vermilion); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--ink); }
:focus-visible { outline: 2px solid var(--vermilion); outline-offset: 3px; }

/* ── shared type ───────────────────────────────────────────────── */

.label {
  font-family: var(--body);
  font-size: 11.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-3);
  line-height: 1.4;
  font-variant-numeric: lining-nums;
}
.binomial { font-style: italic; }
.num { font-variant-numeric: lining-nums tabular-nums; }

p { max-width: var(--measure); margin: 0 0 var(--lead); }
.lede { font-size: 20px; line-height: 34px; }
.note { font-size: 15px; line-height: 27px; color: var(--ink-2); }

/* ── entries ───────────────────────────────────────────────────── */

.entry {
  padding-block: calc(var(--lead) * 2);
  border-top: var(--rule);
}
.entry-head {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 0 24px;
  align-items: baseline;
  margin-bottom: var(--lead);
}
.entry-no {
  font-family: var(--display);
  font-size: 15px;
  letter-spacing: .1em;
  color: var(--vermilion);
  border-bottom: 1px solid currentColor;
  padding-bottom: 4px;
  justify-self: start;
}
.entry-title {
  font-family: var(--display);
  font-size: clamp(30px, 4.6vw, 46px);
  line-height: 1.06;
  font-weight: 400;
  margin: 0;
  letter-spacing: -.01em;
}
.entry-sub { grid-column: 2; margin: 6px 0 0; }
@media (max-width: 620px) {
  .entry-head { grid-template-columns: 1fr; gap: 10px; }
  .entry-sub { grid-column: 1; }
}

.cols { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 0 clamp(28px, 5vw, 64px); }
@media (max-width: 860px) { .cols { grid-template-columns: 1fr; } }

/* ── I. the plate ──────────────────────────────────────────────── */

.plate-entry { padding-block: calc(var(--lead) * 1.5) 0; border-top: none; }

.masthead {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 20px; flex-wrap: wrap;
  padding-bottom: 10px; margin-bottom: calc(var(--lead) * 1.5);
  border-bottom: 3px double var(--ink);
}

.hero { display: grid; grid-template-columns: 1fr 0.85fr; gap: clamp(28px, 5vw, 60px); align-items: center; }
@media (max-width: 860px) { .hero { grid-template-columns: 1fr; } }

.title {
  font-family: var(--display);
  font-size: clamp(64px, 15vw, 142px);
  line-height: .84;
  margin: 0;
  letter-spacing: -.025em;
  font-weight: 400;
}
.title-rule { display: flex; align-items: center; gap: 14px; margin: 20px 0 18px; }
.title-rule::after { content: ""; flex: 1; height: 1px; background: var(--ink); opacity: .35; }

.epigraph {
  border-left: 2px solid var(--vermilion);
  padding-left: 20px;
  margin: 0 0 var(--lead);
  font-size: 19px;
  line-height: 31px;
  font-style: italic;
  color: var(--ink);
  max-width: 46ch;
}
.epigraph cite { display: block; font-style: normal; margin-top: 10px; }

/* the tipped-in plate */
.plate { margin: 0; }
.plate-mount {
  background: var(--stock);
  padding: 16px 16px 10px;
  border: 1px solid rgba(36,31,22,.28);
  box-shadow: 0 1px 0 rgba(255,255,255,.6) inset, 0 14px 30px -18px rgba(36,31,22,.55);
}
.plate-mount img { display: block; width: 100%; height: auto; }
.plate figcaption {
  text-align: center;
  margin-top: 14px;
  line-height: 1.6;
}
.plate figcaption .binomial { display: block; font-size: 14px; letter-spacing: .04em; color: var(--ink-2); text-transform: none; }

/* ── figures & charts ──────────────────────────────────────────── */

.figure { margin: 0 0 calc(var(--lead) * 1.5); }
.figure-head { display: flex; align-items: baseline; gap: 12px; padding-bottom: 8px; border-bottom: var(--rule); margin-bottom: 18px; }
.figure-head h3 { font-family: var(--body); font-size: 15px; letter-spacing: .16em; text-transform: uppercase; font-weight: 400; margin: 0; color: var(--ink); }
.figure-no { font-family: var(--display); font-size: 13px; letter-spacing: .1em; color: var(--vermilion); }

.legend { display: flex; gap: 20px; flex-wrap: wrap; margin: 0 0 16px; padding: 0; list-style: none; }
.legend li { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.swatch { width: 22px; height: 9px; border-radius: 0 4px 4px 0; flex: none; }
.swatch.is-concern { background: var(--vermilion); }
.swatch.is-other { background: var(--olive); }

/* horizontal bars, ruled like a register */
.bars { margin: 0; }
.bar-row {
  display: grid;
  grid-template-columns: 15.5em 1fr 3.2em;
  gap: 0 14px;
  align-items: center;
  min-height: 30px;
  border-bottom: var(--hair);
  padding: 3px 0;
}
.bar-row:first-child { border-top: var(--hair); }
.bar-name { font-size: 14.5px; line-height: 1.25; }
.bar-track { position: relative; height: 11px; }
.bar-fill {
  position: absolute; inset: 0 auto 0 0;
  border-radius: 0 4px 4px 0;
  background: var(--olive);
  transform-origin: left center;
  transform: scaleX(var(--grow, 1));
  transition: transform .8s cubic-bezier(.22,.61,.36,1);
}
.bar-row.is-concern .bar-fill { background: var(--vermilion); }
.bar-val { text-align: right; font-size: 14.5px; font-variant-numeric: lining-nums tabular-nums; color: var(--ink); }
.bar-row:hover .bar-name, .bar-row:hover .bar-val { color: var(--vermilion); }
@media (max-width: 560px) { .bar-row { grid-template-columns: 10.5em 1fr 2.8em; } .bar-name { font-size: 13px; } }

/* ── figure counts ─────────────────────────────────────────────── */

.tally { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0; margin: 0 0 var(--lead); border-top: var(--rule); }
.tally div { padding: 16px 18px 14px 0; border-bottom: var(--hair); }
.tally dt { margin: 0 0 2px; }
.tally dd { margin: 0; font-family: var(--display); font-size: 40px; line-height: 1; font-variant-numeric: lining-nums; }
.tally dd small { font-family: var(--body); font-size: 14px; letter-spacing: .04em; color: var(--ink-2); display: block; margin-top: 8px; line-height: 1.4; font-variant-numeric: oldstyle-num; }

/* ── the slice ─────────────────────────────────────────────────── */

.slice { border-top: var(--rule); margin-bottom: var(--lead); }
.slice-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 20px; align-items: baseline; padding: 12px 0 11px; border-bottom: var(--hair); }
.slice-row .num { font-family: var(--display); font-size: 26px; }
.slice-row .note { margin: 0; font-size: 14px; line-height: 1.45; grid-column: 1 / -1; color: var(--ink-2); }

/* ── IV. the ledger of refusals (the signature) ────────────────── */

.ledger-wrap { overflow-x: auto; margin-bottom: var(--lead); }
.ledger { width: 100%; min-width: 640px; border-collapse: collapse; font-size: 15px; }
.ledger caption { text-align: left; padding-bottom: 10px; }
.ledger th {
  font-family: var(--body); font-weight: 400; text-align: left;
  font-size: 11.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3);
  padding: 0 12px 8px 0; border-bottom: var(--rule); white-space: nowrap;
}
.ledger td { padding: 9px 12px 8px 0; border-bottom: var(--hair); vertical-align: baseline; }
.ledger tbody tr:hover { background: rgba(143, 51, 37, .06); }
.ledger .col-n, .ledger .col-p { text-align: right; font-variant-numeric: lining-nums tabular-nums; white-space: nowrap; }
.ledger-name { position: relative; display: inline-block; }
/* the correcting hand: a struck entry */
.ledger-name::after {
  content: ""; position: absolute; left: -2px; right: -2px; top: 52%; height: 1px;
  background: var(--vermilion); transform: scaleX(var(--grow, 1)); transform-origin: left;
  transition: transform .5s ease;
}
.ledger-en { display: block; font-size: 12.5px; color: var(--ink-3); letter-spacing: .02em; }
.ledger .col-because { color: var(--ink-2); font-size: 14px; line-height: 1.4; }
.ledger .col-because b { font-weight: 400; color: var(--ink); font-style: italic; }
.kind { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--vermilion); white-space: nowrap; }

/* ── V. the night band ─────────────────────────────────────────── */

.night {
  background: var(--night);
  color: #e8e3d4;
  margin-top: calc(var(--lead) * 2);
  border-top: 3px double var(--ink);
}
.night .sheet::before { background: var(--chrome); opacity: .35; }
.night-inner { padding-block: calc(var(--lead) * 2); }
.night .entry-title { color: var(--chrome); }
.night .entry-no { color: var(--chrome); }
.night .label { color: #a49b80; }
.night p { color: #d8d2c0; }
.night .note { color: #a49b80; }
.night a { color: var(--chrome); }
.night a:hover { color: #fff; }

.gauge { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 28px clamp(24px,4vw,56px); margin: calc(var(--lead) * 1.2) 0 var(--lead); }
.gauge > div { border-top: 1px solid rgba(212,160,23,.4); padding-top: 14px; }
.gauge dt { margin: 0 0 6px; }
.gauge dd { margin: 0; font-family: var(--display); font-size: clamp(42px, 6vw, 58px); line-height: 1; color: var(--chrome); font-variant-numeric: lining-nums; }
.gauge dd small { display: block; font-family: var(--body); font-size: 14px; line-height: 1.45; color: #a49b80; margin-top: 10px; font-variant-numeric: oldstyle-num; }

/* ── VI. standing ──────────────────────────────────────────────── */

.standings { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: var(--lead) clamp(28px,4vw,52px); margin: calc(var(--lead) * 1.2) 0 var(--lead); }
.standing { border-top: 3px solid var(--ink); padding-top: 14px; }
.standing.is-probable { border-top-color: var(--olive); }
.standing.is-possible { border-top-color: var(--ink-3); border-top-style: dashed; border-top-width: 2px; }
.standing h3 { font-family: var(--display); font-size: 30px; font-weight: 400; margin: 0 0 6px; }
.standing p { font-size: 15px; line-height: 26px; margin: 0 0 12px; }
.standing .evidence { font-size: 13px; line-height: 22px; color: var(--ink-2); border-top: var(--hair); padding-top: 10px; margin: 0; }

.forbidden {
  border: 1px solid var(--vermilion);
  border-left-width: 3px;
  padding: 22px 26px;
  background: rgba(143, 51, 37, .05);
  max-width: var(--measure);
}
.forbidden p:last-child { margin-bottom: 0; }
.struck { color: var(--vermilion); text-decoration: line-through; text-decoration-color: var(--vermilion); }

/* ── colophon ──────────────────────────────────────────────────── */

.colophon { padding-block: calc(var(--lead) * 2) calc(var(--lead) * 2.5); border-top: 3px double var(--ink); }
.colophon-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--lead) clamp(24px,4vw,52px); }
.colophon h3 { font-family: var(--body); font-size: 11.5px; letter-spacing: .16em; text-transform: uppercase; font-weight: 400; color: var(--ink-3); margin: 0 0 10px; padding-bottom: 8px; border-bottom: var(--hair); }
.colophon ul { list-style: none; margin: 0; padding: 0; font-size: 14.5px; line-height: 25px; }
.colophon li { margin-bottom: 7px; }
.colophon .note { max-width: 62ch; }

.imprint { margin-top: calc(var(--lead) * 1.5); padding-top: 16px; border-top: var(--rule); display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; align-items: center; }
.imprint img { width: 34px; height: 34px; display: block; mix-blend-mode: multiply; }
.imprint-l { display: flex; align-items: center; gap: 14px; }

/* ── motion ────────────────────────────────────────────────────── */

/* Only hide when JS is present to un-hide it; a plain page stays legible. */
.js .reveal .bar-fill, .js .reveal .ledger-name::after { --grow: 0; }
.js .reveal.is-in .bar-fill, .js .reveal.is-in .ledger-name::after { --grow: 1; }

@media (prefers-reduced-motion: reduce) {
  .js .reveal .bar-fill, .js .reveal .ledger-name::after { --grow: 1; }
  .bar-fill, .ledger-name::after { transition: none; }
}

@media print {
  body { background: #fff; }
  .night { background: #fff; color: #000; }
  .night .entry-title, .night .entry-no, .gauge dd { color: #000; }
  .bar-fill { --grow: 1 !important; }
}

code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: .85em;
  background: rgba(36, 31, 22, .06);
  padding: 1px 4px;
  border-radius: 2px;
}

/* On a phone the ledger drops its Verdict column rather than scrolling out of
   reach - the "because" text already distinguishes a named confuser from an
   inconclusive one, so nothing is lost but the restatement. */
@media (max-width: 720px) {
  .ledger { min-width: 0; font-size: 14px; }
  .ledger th:last-child, .ledger td:last-child { display: none; }
  .ledger th, .ledger td { padding-right: 8px; }
  .ledger .col-because { font-size: 13px; }
  .ledger-en { font-size: 11.5px; }
}

/* ── the appendix ──────────────────────────────────────────────────
   The ledger of refusals in full: 30 rows is a reference table, not a
   thing to read straight through, so it is folded away until asked for. */

.appendix { border-bottom: var(--rule); margin-bottom: calc(var(--lead) * 1.5); }
.appendix summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 16px 0;
  border-top: var(--rule);
}
.appendix summary::-webkit-details-marker { display: none; }
.appendix summary:hover .appendix-title { color: var(--vermilion); }
.appendix-label {
  font-size: 11.5px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--vermilion); border-bottom: 1px solid currentColor; padding-bottom: 3px;
  flex: none;
}
.appendix-title { font-family: var(--display); font-size: clamp(20px, 2.6vw, 27px); line-height: 1.15; flex: 1; }
/* Decorative only - <summary> already announces its own expanded state. */
.appendix-cue { flex: none; color: var(--ink-3); }
.appendix-cue::after { content: "show \002B"; }
.appendix[open] .appendix-cue::after { content: "hide \2212"; }
.appendix-body { padding-bottom: calc(var(--lead) * 0.75); }
.appendix-body .figure { margin-bottom: 0; }
.appendix:target summary .appendix-title { color: var(--vermilion); }

/* Development status. Ruled top and bottom so it reads as a stamp on the sheet
   rather than another line of body copy. Not uppercased: "iOS" must keep its
   lowercase i. */
.status {
  display: flex;
  align-items: baseline;
  gap: 11px;
  max-width: 50ch;
  margin: 0 0 26px;
  padding: 9px 0;
  border-top: 1px solid rgba(143, 51, 37, .35);
  border-bottom: 1px solid rgba(143, 51, 37, .35);
  font-size: 14px;
  line-height: 23px;
  color: var(--vermilion);
  font-variant-numeric: lining-nums;
}
.status-mark {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--vermilion);
  transform: translateY(-2px);
}

/* ── Plate II: the app itself ──────────────────────────────────────
   Mounted the same way as the Keulemans plate, so a screen photographed
   in 2026 and a lithograph from 1873 are presented as the same kind of
   object: a plate tipped into the page. */

.screens { margin-bottom: calc(var(--lead) * 2); }
.screens-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(18px, 3vw, 46px);
  align-items: start;
}
.screen { margin: 0; }
.screen-mount {
  background: var(--stock);
  padding: 10px 10px 9px;
  border: 1px solid rgba(36, 31, 22, .28);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .6) inset,
              0 12px 26px -18px rgba(36, 31, 22, .55);
}
.screen-mount img { display: block; width: 100%; height: auto; }
.screen figcaption {
  margin-top: 11px;
  text-transform: none;
  letter-spacing: .01em;
  font-size: 13px;
  line-height: 20px;
  color: var(--ink-2);
}
.screen figcaption b {
  font-family: var(--display);
  font-weight: 400;
  font-style: italic;
  color: var(--vermilion);
  margin-right: 5px;
}
.screens-note { margin-top: 22px; max-width: 68ch; }
.screens-note strong { font-weight: 400; color: var(--vermilion); }

@media (max-width: 700px) {
  .screens-row { grid-template-columns: 1fr; gap: var(--lead); max-width: 330px; }
}

/* The plain-language opening to Plate II: what the app does, for someone who
   has not read any of the rest of this page. */
.screens-lede { max-width: 44ch; margin-bottom: calc(var(--lead) * 0.75); }
.screens-intro { margin-bottom: calc(var(--lead) * 1.25); }
/* Only the final paragraph of the block, not the last of each column -
   stacked on a phone, a per-column rule closes up a real paragraph break. */
.screens-intro > div:last-child > p:last-child { margin-bottom: 0; }
