/* Type roles come from the document: Caslon italic for headings (the page
   headers), Public Sans for interface text, Courier Prime for transcribed values. */
@font-face { font-family: "Public Sans"; font-weight: 400; font-display: swap; src: url("../vendor/fonts/public-sans-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+2010-203A; }
@font-face { font-family: "Public Sans"; font-weight: 400; font-display: swap; src: url("../vendor/fonts/public-sans-latin-ext-400-normal.woff2") format("woff2"); unicode-range: U+0100-024F, U+1E00-1EFF; }
@font-face { font-family: "Public Sans"; font-weight: 400; font-style: italic; font-display: swap; src: url("../vendor/fonts/public-sans-latin-400-italic.woff2") format("woff2"); unicode-range: U+0000-00FF, U+2010-203A; }
@font-face { font-family: "Public Sans"; font-weight: 600; font-display: swap; src: url("../vendor/fonts/public-sans-latin-600-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+2010-203A; }
@font-face { font-family: "Public Sans"; font-weight: 700; font-display: swap; src: url("../vendor/fonts/public-sans-latin-700-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+2010-203A; }
@font-face { font-family: "Public Sans"; font-weight: 800; font-display: swap; src: url("../vendor/fonts/public-sans-latin-800-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+2010-203A; }
@font-face { font-family: "Libre Caslon Text"; font-weight: 400; font-display: swap; src: url("../vendor/fonts/libre-caslon-text-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+2010-203A; }
@font-face { font-family: "Libre Caslon Text"; font-weight: 400; font-style: italic; font-display: swap; src: url("../vendor/fonts/libre-caslon-text-latin-400-italic.woff2") format("woff2"); unicode-range: U+0000-00FF, U+2010-203A; }
@font-face { font-family: "Libre Caslon Text"; font-weight: 700; font-display: swap; src: url("../vendor/fonts/libre-caslon-text-latin-700-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+2010-203A; }
@font-face { font-family: "Courier Prime"; font-weight: 400; font-display: swap; src: url("../vendor/fonts/courier-prime-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+2010-203A; }
@font-face { font-family: "Courier Prime"; font-weight: 400; font-display: swap; src: url("../vendor/fonts/courier-prime-latin-ext-400-normal.woff2") format("woff2"); unicode-range: U+0100-024F, U+1E00-1EFF; }
@font-face { font-family: "Courier Prime"; font-weight: 700; font-display: swap; src: url("../vendor/fonts/courier-prime-latin-700-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+2010-203A; }

:root {
  /* Security paper, the seal pink printed on it, and the stamp inks. */
  --paper: oklch(0.945 0.022 205);
  --paper-deep: oklch(0.875 0.042 205);
  --paper-edge: oklch(0.80 0.045 210);
  --sticker: oklch(0.975 0.014 95);
  --seal: oklch(0.80 0.075 5);
  --seal-wash: oklch(0.905 0.045 5);
  --ink: oklch(0.27 0.045 265);
  --ink-soft: oklch(0.44 0.04 255);
  --pencil: oklch(0.50 0.015 250);
  --stamp-red: oklch(0.53 0.19 27);
  --stamp-violet: oklch(0.45 0.14 300);
  --stamp-green: oklch(0.47 0.10 160);
  --numeral: oklch(0.992 0.006 205);
  --rule: oklch(0.27 0.045 265 / 0.16);

  --serif: "Libre Caslon Text", "Iowan Old Style", Georgia, serif;
  --sans: "Public Sans", "Helvetica Neue", Arial, sans-serif;
  --typed: "Courier Prime", "Courier New", ui-monospace, monospace;

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-md: 1rem;
  --text-lg: 1.25rem;
  --text-xl: 1.75rem;
  --text-2xl: 2.5rem;

  --space-2xs: 4px;
  --space-xs: 8px;
  --space-sm: 12px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  /* --top-h is measured by app.js; narrow screens set --head-h to 0 because nothing is pinned there. */
  --head-h: var(--top-h, 124px);
  /* What is left of the window under the header: the side panel is at most this tall and the map exactly this. */
  --below-head: calc(100vh - var(--head-h) - var(--space-lg) - var(--space-md));
}

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

html { scroll-padding-top: calc(var(--head-h) + var(--space-md)); }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--text-md)/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}

/* The printed seals that sit behind every page of the passport. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    repeating-radial-gradient(circle at 104% 96%, transparent 0 15px, oklch(0.80 0.075 5 / 0.20) 15px 17px, transparent 17px 30px, oklch(0.80 0.075 5 / 0.11) 30px 31px),
    repeating-radial-gradient(circle at -6% 8%, transparent 0 21px, oklch(0.80 0.075 5 / 0.14) 21px 23px);
  mask-image:
    radial-gradient(circle at 104% 96%, #000 0 300px, transparent 301px),
    radial-gradient(circle at -6% 8%, #000 0 260px, transparent 261px);
  -webkit-mask-image:
    radial-gradient(circle at 104% 96%, #000 0 300px, transparent 301px),
    radial-gradient(circle at -6% 8%, #000 0 260px, transparent 261px);
}

h1, h2, h3, p, ol, ul, dl, dd, figure { margin: 0; }
ol, ul { padding: 0; list-style: none; }
img { display: block; max-width: 100%; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--stamp-violet); outline-offset: 2px; }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.typed { font-family: var(--typed); }
.hint { font-size: var(--text-xs); color: var(--ink-soft); }

.link { background: none; border: 0; padding: 0; color: var(--stamp-red); text-decoration: underline; text-underline-offset: 3px; font-size: inherit; }
.link:hover { color: var(--ink); }

.eyebrow {
  display: flex; align-items: center; gap: var(--space-sm);
  font-size: var(--text-xs); font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-soft);
}

/* The big pale numerals printed on each passport page. */
.numeral {
  font: 800 4.25rem/0.9 var(--sans);
  letter-spacing: -0.03em;
  color: var(--numeral);
  text-shadow: 0 1px 0 oklch(0.58 0.06 215 / 0.55), 0 0 1px oklch(0.58 0.06 215 / 0.5);
  white-space: nowrap;
}

/* ---------- masthead and filters ---------- */

.top { position: sticky; top: 0; z-index: 20; background: var(--paper); border-bottom: 1px solid var(--rule); }

.masthead {
  display: grid; grid-template-columns: auto 1fr minmax(220px, 340px); align-items: end; gap: var(--space-xl);
  padding: var(--space-md) var(--space-lg) var(--space-sm);
}

.title { display: grid; text-decoration: none; }
.title-main { font: italic 400 var(--text-xl)/1.1 var(--serif); }
.title-sub { font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); }

.views { display: flex; gap: var(--space-lg); align-items: baseline; }
.views a {
  font: italic 400 var(--text-lg)/1.2 var(--serif);
  text-decoration: none; color: var(--ink-soft);
  padding-bottom: var(--space-2xs); border-bottom: 2px solid transparent;
  transition: color 160ms var(--ease-out), border-color 160ms var(--ease-out);
}
.views a:hover { color: var(--ink); }
.views a[aria-current] { color: var(--ink); border-bottom-color: var(--stamp-red); }
.views-count:not(:empty) {
  display: inline-block; min-width: 1.6em; padding: 1px 5px; margin-left: 2px;
  font: 700 var(--text-xs)/1.3 var(--typed); font-style: normal; text-align: center;
  color: var(--stamp-red); border: 1.5px solid var(--stamp-red); border-radius: 999px;
  vertical-align: 0.2em;
}

.search input {
  width: 100%; padding: var(--space-xs) var(--space-sm);
  background: var(--sticker); border: 1px solid var(--paper-edge); border-radius: 2px;
  font-size: var(--text-sm);
}
.search input::placeholder { color: var(--ink-soft); }
.search input:focus { border-color: var(--ink); }

.filters {
  display: flex; flex-wrap: wrap; align-items: end; gap: var(--space-sm) var(--space-lg);
  padding: var(--space-xs) var(--space-lg) var(--space-sm);
}

.filter-group { display: flex; flex-wrap: wrap; gap: var(--space-2xs); }
.chip {
  display: inline-flex; align-items: baseline; gap: 6px;
  padding: 3px var(--space-xs);
  background: transparent; border: 1px solid var(--paper-edge); border-radius: 2px;
  font-size: var(--text-sm);
  transition: background 140ms var(--ease-out), color 140ms var(--ease-out), border-color 140ms var(--ease-out);
}
.chip:hover { border-color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.chip-n { font: 400 var(--text-xs) var(--typed); opacity: 0.7; }

.filter-country select {
  max-width: 190px; padding: 4px var(--space-xs); background: var(--sticker); border: 1px solid var(--paper-edge); border-radius: 2px; font-size: var(--text-sm);
}

.years { display: flex; align-items: end; gap: 2px; }
.year {
  display: grid; justify-items: center; gap: 2px; width: 26px; padding: 0;
  background: none; border: 0;
}
.year-bar {
  width: 100%; height: 26px;
  background: linear-gradient(to top, var(--ink-soft) calc(var(--n) * 100%), transparent 0);
  border-bottom: 1px solid var(--ink-soft);
  opacity: 0.55;
  transition: opacity 140ms var(--ease-out);
}
.year:hover .year-bar { opacity: 0.85; }
.year-label { font: 400 var(--text-xs)/1 var(--typed); color: var(--ink-soft); }
.year[aria-pressed="true"] .year-bar { opacity: 1; background: linear-gradient(to top, var(--stamp-red) calc(var(--n) * 100%), transparent 0); border-bottom-color: var(--stamp-red); }
.year[aria-pressed="true"] .year-label { color: var(--stamp-red); font-weight: 700; }

.tally { margin-left: auto; font-size: var(--text-sm); color: var(--ink-soft); }
.tally output { font-family: var(--typed); color: var(--ink); margin-right: var(--space-xs); }

/* ---------- frame ---------- */

main {
  display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: var(--space-xl);
  align-items: start;
  padding: var(--space-lg) var(--space-lg) var(--space-3xl);
}
#view { min-width: 0; outline: none; }

/* The side panel is one visa sticker pasted on the page. */
#side {
  position: sticky; top: calc(var(--head-h) + var(--space-md));
  max-height: var(--below-head); overflow: auto;
  background: var(--sticker);
  border: 1px solid var(--paper-edge);
  border-radius: 3px;
  padding: var(--space-lg);
}
#side:empty { display: none; }

.empty { max-width: 46ch; padding: var(--space-3xl) 0; display: grid; gap: var(--space-sm); justify-items: start; }
.empty h2 { font: italic 400 var(--text-xl)/1.2 var(--serif); }
.empty code { font-family: var(--typed); background: var(--sticker); padding: 1px 5px; }
.loading { color: var(--ink-soft); font-style: italic; }

.btn {
  padding: var(--space-xs) var(--space-md);
  background: transparent; border: 1px solid var(--ink); border-radius: 2px;
  font-size: var(--text-sm); font-weight: 600;
  transition: background 140ms var(--ease-out), color 140ms var(--ease-out);
}
.btn:hover { background: var(--ink); color: var(--sticker); }
.btn-primary { background: var(--stamp-red); border-color: var(--stamp-red); color: var(--sticker); }
.btn-primary:hover { background: var(--ink); border-color: var(--ink); }

.turn {
  width: 36px; height: 36px; flex: none;
  background: transparent; border: 1px solid var(--paper-edge); border-radius: 2px;
  font: 400 var(--text-lg)/1 var(--serif);
  transition: border-color 140ms var(--ease-out), background 140ms var(--ease-out);
}
.turn:hover:not(:disabled) { border-color: var(--ink); background: var(--sticker); }
.turn:disabled { opacity: 0.35; cursor: default; }

.check { display: inline-flex; align-items: center; gap: var(--space-xs); font-size: var(--text-sm); }
.check input { accent-color: var(--stamp-red); }

.mark { font-size: var(--text-xs); letter-spacing: 0; text-transform: none; white-space: nowrap; }
.mark-doubt { font: italic 400 var(--text-xs)/1.2 var(--serif); color: var(--pencil); border-bottom: 1px dashed var(--pencil); }
.mark-confirmed { font-weight: 700; color: var(--stamp-green); letter-spacing: 0.06em; text-transform: uppercase; }

.doubt { text-decoration: underline dashed var(--pencil); text-underline-offset: 4px; }
.doubt::after { content: " ?"; color: var(--pencil); }

.gloss { font: italic 400 var(--text-sm)/1.5 var(--serif); color: var(--ink-soft); }

/* ---------- pages ---------- */

.book { display: grid; gap: var(--space-md); }
.book-bar { display: flex; align-items: center; gap: var(--space-md); }
.book-where { flex: 1; display: flex; align-items: center; gap: var(--space-lg); min-width: 0; }
.book-where h2 { font: italic 400 var(--text-lg)/1.3 var(--serif); }
.book-where p { font-size: var(--text-sm); color: var(--ink-soft); max-width: 70ch; }

.spread { position: relative; overflow: hidden; border-radius: 6px; box-shadow: 0 1px 0 var(--paper-edge), 0 14px 28px -18px oklch(0.27 0.045 265 / 0.55); background: var(--paper-deep); }
.spread > img { width: 100%; height: auto; }
/* In the pages view the whole spread and the filmstrip should fit one screen. */
.book .spread { width: fit-content; max-width: 100%; justify-self: center; }
.book .spread > img { width: auto; max-width: 100%; max-height: max(360px, calc(100vh - var(--head-h) - 290px)); }
.boxes { position: absolute; inset: 0; }
.box {
  position: absolute; padding: 0;
  background: transparent; border: 1.5px solid transparent; border-radius: 2px;
  transition: border-color 120ms var(--ease-out), background 120ms var(--ease-out);
}
.is-outlined .box { border: 1.5px dashed oklch(0.53 0.19 27 / 0.6); }
.is-outlined .box.is-doubt { border-color: oklch(0.27 0.045 265 / 0.55); }
.box.is-dimmed { opacity: 0.25; }
button.box:hover, button.box:focus-visible { border: 2px solid var(--stamp-red); background: oklch(0.99 0.01 95 / 0.12); z-index: 3; opacity: 1; }
.spread-caption {
  position: absolute; left: var(--space-xs); bottom: var(--space-xs); z-index: 4;
  padding: 3px var(--space-xs);
  background: var(--ink); color: var(--sticker);
  font: 400 var(--text-sm)/1.4 var(--typed); border-radius: 2px;
  pointer-events: none;
}
.spread-caption:empty { display: none; }
.box.is-selected { border: 2.5px solid var(--stamp-red); z-index: 2; box-shadow: 0 0 0 200vmax oklch(0.27 0.045 265 / 0.42); opacity: 1; }

.book-tools { display: flex; align-items: center; justify-content: space-between; }

.filmstrip { display: flex; gap: var(--space-xs); overflow-x: auto; padding: var(--space-xs) 2px var(--space-sm); scrollbar-width: thin; }
.filmstrip a { position: relative; display: block; width: 92px; text-decoration: none; border: 1.5px solid transparent; border-radius: 3px; padding: 2px; transition: border-color 120ms var(--ease-out); }
.filmstrip a:hover { border-color: var(--paper-edge); }
.filmstrip a[aria-current] { border-color: var(--stamp-red); }
.filmstrip a.is-dimmed { opacity: 0.32; }
.filmstrip img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 2px; }
.film-label { display: block; margin-top: 3px; font: 400 var(--text-xs)/1.2 var(--typed); color: var(--ink-soft); text-align: center; }
.film-n { position: absolute; top: 5px; right: 5px; min-width: 18px; padding: 0 4px; font: 700 0.6875rem/1.5 var(--typed); text-align: center; background: var(--ink); color: var(--sticker); border-radius: 2px; }

/* ---------- side lists and the record card ---------- */

.side-list { display: grid; gap: var(--space-xs); }
.side-list h2, .card h2 { font: italic 400 var(--text-xl)/1.15 var(--serif); }
.side-note { font-size: var(--text-sm); color: var(--ink-soft); margin-bottom: var(--space-xs); }

.row {
  display: grid; grid-template-columns: 84px 1fr auto; align-items: center; gap: var(--space-sm);
  width: 100%; padding: var(--space-xs); text-align: left;
  background: transparent; border: 0; border-top: 1px solid var(--rule);
  transition: background 120ms var(--ease-out);
}
.row:hover { background: oklch(0.905 0.045 5 / 0.45); }
.row[aria-current] { background: var(--seal-wash); }
.row-crop { height: 52px; display: grid; place-items: center; }
.row-crop img { max-height: 52px; max-width: 84px; width: auto; border-radius: 1px; }
.row-text { display: grid; min-width: 0; }
.row-title { font-weight: 600; }
.row-sub { font-size: var(--text-xs); color: var(--ink-soft); }
.row-date { font-size: var(--text-sm); }
.row-doubt { font: italic 400 var(--text-lg)/1 var(--serif); color: var(--pencil); }

.ranks { display: grid; }
.rank {
  display: grid; grid-template-columns: 1fr auto 3ch; align-items: baseline; gap: var(--space-sm);
  width: 100%; padding: 6px var(--space-xs); text-align: left;
  background: transparent; border: 0; border-top: 1px solid var(--rule);
}
.rank:hover { background: oklch(0.905 0.045 5 / 0.45); }
.rank-name { font-weight: 600; }
.rank-span { font-size: var(--text-xs); color: var(--ink-soft); }
.rank-n { text-align: right; }
.unmapped { margin-top: var(--space-md); }
.unmapped summary { font-size: var(--text-sm); cursor: pointer; color: var(--ink-soft); }

.card { display: grid; gap: var(--space-md); }
.card-head { display: grid; gap: 2px; }
.card-where { color: var(--ink-soft); }
.card-crop { display: grid; place-items: center; padding: var(--space-sm); background: var(--paper); border-radius: 2px; }
.card-crop img { max-height: 300px; width: auto; border-radius: 1px; box-shadow: 0 6px 14px -10px oklch(0.27 0.045 265 / 0.7); }

.fields { display: grid; grid-template-columns: max-content 1fr; gap: 6px var(--space-md); align-items: baseline; }
.fields dt, .card h3 { font-size: var(--text-xs); font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-soft); }
.fields dd { overflow-wrap: anywhere; }

.card-text, .card-notes { display: grid; gap: var(--space-xs); padding-top: var(--space-sm); border-top: 1px solid var(--rule); }
.card-text .typed { font-size: var(--text-sm); line-height: 1.55; overflow-wrap: anywhere; }
.card-notes p { font-size: var(--text-sm); }
.card-changed { font-size: var(--text-xs); color: var(--stamp-green); }
.card-links { display: flex; flex-wrap: wrap; gap: var(--space-xs) var(--space-md); padding-top: var(--space-sm); border-top: 1px solid var(--rule); font-size: var(--text-sm); }
.card-links a { color: var(--stamp-red); text-underline-offset: 3px; }
.card-links a:hover { color: var(--ink); }
.card-links .link { margin-left: auto; color: var(--ink-soft); }

/* ---------- timeline ---------- */

.ledger { display: grid; gap: var(--space-2xl); max-width: 860px; }
.ledger-year { display: grid; gap: var(--space-md); }
.ledger-year > header {
  display: grid; grid-template-columns: auto 1fr; align-items: end; column-gap: var(--space-lg);
  padding: var(--space-sm) var(--space-md) var(--space-xs);
  background: var(--paper-deep); border-radius: 3px;
}
.ledger-year > header p { font-size: var(--text-sm); color: var(--ink-soft); padding-bottom: var(--space-xs); }
.ledger-month { display: grid; grid-template-columns: 7.5rem 1fr; gap: var(--space-md); }
.ledger-month h3 { font: italic 400 var(--text-md)/1.4 var(--serif); color: var(--ink-soft); padding-top: var(--space-sm); position: sticky; top: calc(var(--head-h) + var(--space-xs)); align-self: start; }

.entry {
  display: grid; grid-template-columns: 2.25rem 7.5rem 1fr auto; align-items: center; gap: var(--space-md);
  width: 100%; padding: 6px var(--space-xs); text-align: left;
  background: transparent; border: 0; border-top: 1px solid var(--rule);
  transition: background 120ms var(--ease-out);
}
.entry:hover { background: oklch(0.975 0.014 95 / 0.7); }
.entry[aria-current] { background: var(--seal-wash); }
.entry-day { font-size: var(--text-lg); text-align: right; }
.entry-crop { height: 58px; display: grid; place-items: center start; }
.entry-crop img { max-height: 58px; max-width: 7.5rem; width: auto; border-radius: 1px; }
.entry-text { display: grid; min-width: 0; }
.entry-title { font-weight: 600; }
.entry-sub { font-size: var(--text-sm); color: var(--ink-soft); }

/* Stories in the ledger: a typed dateline where a stamp's crop would be. */
a.entry { text-decoration: none; }
.entry-story { background: oklch(0.975 0.014 95 / 0.55); }
.entry-story:hover { background: var(--sticker); }
.entry-dateline { font-size: var(--text-xs); letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-soft); overflow-wrap: anywhere; }
.entry-story .entry-title { font: italic 400 var(--text-md)/1.35 var(--serif); }

/* A photograph in the ledger: wider than a stamp crop, with its caption beside it. */
.entry-photo { grid-template-columns: 2.25rem 11rem 1fr; align-items: start; padding-block: var(--space-sm); }
.entry-photo:hover, .entry-photo[aria-current] { background: var(--sticker); }
.entry-shot img { width: 11rem; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 2px; }
.entry-caption { font: italic 400 var(--text-sm)/1.5 var(--serif); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- photographs ---------- */

.photo-strip { display: grid; gap: var(--space-md); }
.photo-strip figure { display: grid; gap: var(--space-xs); }
.photo-strip img { width: 100%; height: auto; border-radius: 2px; }
.photo-strip figcaption { font: italic 400 var(--text-xs)/1.5 var(--serif); color: var(--ink-soft); display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.side-list .photo-strip { margin-bottom: var(--space-md); }
.photo-full img { width: 100%; height: auto; border-radius: 2px; }
.photo-caption { font: italic 400 var(--text-sm)/1.55 var(--serif); }
.photo-credit { font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); }
.photo-card .card-links .link:first-child { margin-left: 0; color: var(--stamp-red); }

/* ---------- stories ---------- */

/* Kind is a property of stamps, so those chips rest while the stories are showing. */
body[data-view="stories"] #kinds { opacity: 0.35; pointer-events: none; }

.story { display: grid; gap: var(--space-md); max-width: 68ch; }
.story .back { font-size: var(--text-sm); color: var(--stamp-red); text-underline-offset: 3px; }
.story h2 { font: italic 400 var(--text-xl)/1.2 var(--serif); }
.story-folder { font-weight: 400; letter-spacing: 0; text-transform: none; }
.story-meta { font-size: var(--text-sm); }
.story-check { font: italic 400 var(--text-sm)/1.5 var(--serif); color: var(--ink-soft); }
.story-research { display: grid; gap: var(--space-xs); padding: var(--space-sm) var(--space-md); border: 1px dashed var(--pencil); border-radius: 3px; font-size: var(--text-sm); }
.story-research ul { display: grid; gap: 2px; padding-left: var(--space-md); list-style: disc; }
.story-research a { color: var(--stamp-red); text-underline-offset: 3px; overflow-wrap: anywhere; }
.story-body { display: grid; gap: var(--space-sm); padding: var(--space-lg); background: var(--sticker); border: 1px solid var(--paper-edge); border-radius: 3px; font-size: var(--text-sm); line-height: 1.65; }
.story-source { font-size: var(--text-xs); color: var(--ink-soft); overflow-wrap: anywhere; }
a.row { text-decoration: none; }
.card-stories { display: grid; gap: var(--space-xs); font-size: var(--text-sm); }
.card-stories a { color: var(--stamp-red); text-underline-offset: 3px; }
.card-stories .typed { color: var(--ink-soft); font-size: var(--text-xs); }

/* ---------- map ---------- */

.map { display: grid; gap: var(--space-sm); }
.map-tools { display: flex; align-items: center; justify-content: space-between; gap: var(--space-md); }
.map-zoom { display: inline-flex; align-items: center; gap: var(--space-xs); font-size: var(--text-sm); }
.map-frame { border: 1px solid var(--paper-edge); border-radius: 3px; overflow: hidden; background: var(--paper-deep); }
.map-frame svg { display: block; width: 100%; height: auto; cursor: grab; }
.map-frame svg:active { cursor: grabbing; }
/* Beside the panel the map ends level with it, whatever the window's shape, and gives up height to the bar when that opens. */
@media (min-width: 1041px) {
  .map { display: flex; flex-direction: column; height: var(--below-head); min-height: 22rem; }
  .map-frame { position: relative; flex: 1 1 0; min-height: 0; }
  .map-frame svg { position: absolute; inset: 0; height: 100%; }
}
.sphere { fill: var(--paper-deep); }
.graticule { fill: none; stroke: var(--numeral); stroke-width: 0.5; vector-effect: non-scaling-stroke; opacity: 0.6; }
.land { fill: var(--sticker); stroke: oklch(0.27 0.045 265 / 0.3); stroke-width: 0.5; vector-effect: non-scaling-stroke; }
.land.has-records { fill: var(--seal-wash); stroke: oklch(0.45 0.09 5 / 0.6); cursor: pointer; }
.land.has-records:hover { fill: var(--seal); }
.route { fill: none; stroke: var(--stamp-violet); stroke-width: 1; vector-effect: non-scaling-stroke; opacity: 0.5; pointer-events: none; }
.pin { fill: var(--ink); fill-opacity: 0.82; stroke: var(--sticker); stroke-width: 1; vector-effect: non-scaling-stroke; cursor: pointer; transition: fill 120ms var(--ease-out); }
.pin:hover { fill: var(--stamp-red); fill-opacity: 1; }
.pin.is-picked, .pin.is-selected { fill: var(--stamp-red); fill-opacity: 1; stroke: var(--ink); stroke-width: 1.5; }
.label { font-family: var(--sans); font-weight: 600; fill: var(--ink); paint-order: stroke; stroke: var(--sticker); stroke-width: 3; vector-effect: non-scaling-stroke; stroke-linejoin: round; pointer-events: none; }

/* Datelines the stories were filed from: rings, where the stamps are dots. */
.dateline { fill: var(--sticker); fill-opacity: 0.8; stroke: var(--stamp-violet); stroke-width: 1.75; vector-effect: non-scaling-stroke; cursor: pointer; }
.dateline:hover, .dateline.is-picked { stroke: var(--stamp-red); fill-opacity: 1; }
.dateline.is-picked { stroke-width: 2.5; }
.dlabel { font-family: var(--typed); font-weight: 400; }
.side-list h2.side-second { margin-top: var(--space-lg); }
.side-list h2.dateline-name, .travel-place.is-dateline { font: 400 var(--text-lg)/1.3 var(--typed); letter-spacing: 0.02em; }
.rank-name.typed { font-weight: 400; }

/* Full screen: the map takes the whole window; the tools, the bar and the card lie over it like slips on a desk. */
.map-title { display: none; font: italic 400 var(--text-lg)/1 var(--serif); }
body.is-wide[data-view="map"] { overflow: hidden; }
body.is-wide[data-view="map"] .top { display: none; }
body.is-wide[data-view="map"] main { display: block; padding: 0; }
.is-wide .map { position: fixed; inset: 0; display: block; height: auto; min-height: 0; background: var(--paper-deep); }
.is-wide .map-frame { position: absolute; inset: 0; border: 0; border-radius: 0; }
.is-wide .map-frame svg { width: 100%; height: 100%; }
.is-wide .map-tools, .is-wide .travel, body.is-wide[data-view="map"] #side {
  z-index: 2; background: oklch(0.945 0.022 205 / 0.94); border: 1px solid var(--paper-edge); border-radius: 3px;
  box-shadow: 0 14px 30px -18px oklch(0.27 0.045 265 / 0.75);
}
.is-wide .map-tools { position: absolute; top: var(--space-md); left: var(--space-md); justify-content: flex-start; gap: var(--space-lg); padding: var(--space-xs) var(--space-md); }
.is-wide .map-title { display: inline; }
.is-wide .travel { position: absolute; left: var(--space-md); right: calc(380px + 2 * var(--space-md)); bottom: var(--space-md); padding: var(--space-sm) var(--space-lg) 0; }
body.is-wide[data-view="map"] #side {
  position: fixed; top: var(--space-md); right: var(--space-md); width: 380px;
  max-height: calc(100vh - 2 * var(--space-md)); background: var(--sticker);
}
body.is-wide[data-view="map"]:not(.has-card) #side { display: none; }
@media (max-width: 900px) {
  .is-wide .travel { right: var(--space-md); }
  body.is-wide[data-view="map"] #side { top: auto; bottom: 150px; left: var(--space-md); width: auto; max-height: 38vh; }
}

/* The travels: the dated border stamps and stories joined in order, the last few legs in stamp red. */
.map-idle { display: inline-flex; align-items: center; gap: var(--space-lg); }
.map-idle[hidden], .travel[hidden] { display: none; }
.trail { fill: none; stroke: var(--stamp-violet); stroke-width: 1; vector-effect: non-scaling-stroke; opacity: 0.4; pointer-events: none; }
.trail-new { stroke: var(--stamp-red); stroke-width: 2.25; opacity: 0.9; stroke-linecap: round; stroke-linejoin: round; }
/* Travel the passport does not record: the legs into and out of Iraq and North Korea. */
.trail-off { stroke-dasharray: 5 5; }
.trail-new.trail-off { stroke-dasharray: 7 6; stroke-linecap: butt; }
.here { fill: var(--stamp-red); stroke: var(--sticker); stroke-width: 1.5; vector-effect: non-scaling-stroke; pointer-events: none; }
.here-ring { fill: none; stroke: var(--stamp-red); stroke-width: 1.25; vector-effect: non-scaling-stroke; pointer-events: none; }
/* A story or photograph coming up at its own place, apart from the marker. */
.pop { pointer-events: none; }
.pop-ring, .pop-echo { fill: none; stroke: var(--stamp-violet); stroke-width: 2.25; vector-effect: non-scaling-stroke; transform-box: fill-box; transform-origin: center; }
.pop-ring { animation: pop-in 420ms var(--ease-out) both; }
.pop-echo { stroke-width: 1.25; animation: pop-echo 900ms var(--ease-out) both; }
.pop-label { font-family: var(--typed); font-weight: 700; fill: var(--stamp-violet); }
.pop.is-photo .pop-ring, .pop.is-photo .pop-echo { stroke: var(--ink); }
.pop.is-photo .pop-label { font-family: var(--serif); font-style: italic; font-weight: 400; fill: var(--ink); }
@keyframes pop-in { from { transform: scale(0.3); opacity: 0; } }
@keyframes pop-echo { from { transform: scale(1); opacity: 0.9; } to { transform: scale(3.2); opacity: 0; } }
/* Photographs pinned where they were taken, like prints on a wall map. */
.snap { cursor: pointer; }
.snap rect { fill: var(--sticker); stroke: var(--ink); stroke-opacity: 0.35; stroke-width: 0.75; }
.snap-in { animation: snap-in 380ms var(--ease-out) both; }
.snap:hover rect, .snap:focus-visible rect { stroke: var(--stamp-red); stroke-opacity: 1; stroke-width: 1.5; }
.snap:focus-visible { outline: none; }
@keyframes snap-in { from { transform: scale(0.6); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .pop-ring, .pop-echo, .snap-in { animation: none; } .pop-echo { display: none; } }
.travel-says { padding: var(--space-sm) var(--space-md); background: var(--seal-wash); border-radius: 3px; font-size: var(--text-sm); line-height: 1.5; }
.is-travelling .labels, .is-travelling .dlabels { display: none; }
.is-travelling .dateline { opacity: 0.18; }
.is-travelling .dateline.is-reached { opacity: 1; }
.is-travelling .pin { fill-opacity: 0.14; stroke-opacity: 0.35; }
.is-travelling .pin.is-reached { fill-opacity: 0.82; stroke-opacity: 1; }

.travel { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; align-items: center; gap: var(--space-sm) var(--space-lg); }
.travel-play { min-width: 7.5em; }
.travel-year { font-size: 3.5rem; min-width: 2.3em; }
.travel-now { display: grid; min-width: 0; }
.travel-date { font-size: var(--text-lg); line-height: 1.2; }
.travel-place { font: italic 400 var(--text-lg)/1.3 var(--serif); }
.travel-place span { font: 400 var(--text-sm)/1 var(--sans); color: var(--ink-soft); margin-left: var(--space-sm); }
.travel-home { min-height: 1.5em; font-size: var(--text-xs); font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-soft); }
.travel-opts { display: inline-flex; align-items: center; gap: var(--space-lg); font-size: var(--text-sm); }
.travel-scrub { grid-column: 1 / -1; position: relative; padding-bottom: 1.5rem; }
.travel-scrub input { display: block; width: 100%; margin: 0; accent-color: var(--stamp-red); }
/* A range thumb stops half its width short of each end, so the ticks do too. */
.travel-ticks button {
  position: absolute; bottom: 0; left: calc(8px + (100% - 16px) * var(--at)); transform: translateX(-50%);
  padding: 0 var(--space-2xs); background: none; border: 0;
  font: 400 var(--text-sm)/1.2 var(--typed); color: var(--ink-soft);
}
.travel-ticks button:hover { color: var(--stamp-red); }
.travel-stamp { display: grid; place-items: center; min-height: 190px; padding: var(--space-md); background: var(--paper-deep); border: 0; border-radius: 3px; }
.travel-stamp img { max-height: 170px; max-width: 100%; width: auto; border-radius: 1px; box-shadow: 0 6px 14px -10px oklch(0.27 0.045 265 / 0.7); }
.travel-dateline { padding: var(--space-lg) var(--space-md); background: var(--paper-deep); border-radius: 3px; font: 400 var(--text-lg)/1.35 var(--typed); overflow-wrap: anywhere; }
.travel-about { margin-top: var(--space-sm); }

/* ---------- review ---------- */

.review { display: grid; gap: var(--space-lg); max-width: 900px; }
.review-bar { display: flex; align-items: center; gap: var(--space-md); }
.review-bar > div { flex: 1; }
.review-bar h2 { font: italic 400 var(--text-lg)/1.3 var(--serif); }
.review-bar p { font-size: var(--text-sm); color: var(--ink-soft); }
.review-crop { display: grid; justify-items: center; gap: var(--space-md); padding: var(--space-lg); background: var(--paper-deep); border-radius: 3px; }
/* As wide as the column, or as wide as 62vh of height allows: --ar is the crop's width over its height. */
.review-crop img { width: min(100%, calc(62vh * var(--ar, 1.6))); height: auto; box-shadow: 0 10px 24px -14px oklch(0.27 0.045 265 / 0.7); }
.looks { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--space-xs); }
.look-dial { display: flex; align-items: center; gap: var(--space-sm); width: min(100%, 560px); font-size: var(--text-sm); }
.look-dial[hidden] { display: none; }
.look-dial input { flex: 1; accent-color: var(--ink); }
.look-dial output { min-width: 13ch; font: 400 var(--text-xs) var(--typed); color: var(--ink-soft); }
.review-text { font-size: var(--text-sm); line-height: 1.6; overflow-wrap: anywhere; max-width: 75ch; }
.review-context { display: grid; gap: var(--space-xs); }
.review-context figcaption { font-size: var(--text-sm); color: var(--ink-soft); }
.review-context a { color: var(--stamp-red); }
.review-context .spread { max-width: 620px; }
.review-context .box.is-selected { box-shadow: 0 0 0 200vmax oklch(0.27 0.045 265 / 0.3); }

.review-form { display: grid; gap: var(--space-md); }
.review-form label { display: grid; gap: var(--space-2xs); }
.review-form label > span { font-size: var(--text-xs); font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-soft); }
.review-form input, .review-form select, .review-form textarea {
  width: 100%; padding: var(--space-xs) var(--space-sm);
  background: var(--paper); border: 1px solid var(--paper-edge); border-radius: 2px;
}
.review-form input:focus, .review-form select:focus, .review-form textarea:focus { border-color: var(--ink); }
.review-form small { font-size: var(--text-xs); color: var(--ink-soft); }
.in-doubt { font-size: var(--text-sm); }
.in-doubt strong { font-family: var(--typed); }
.reader-note { font: italic 400 var(--text-sm)/1.5 var(--serif); color: var(--ink-soft); }
.form-error { font-size: var(--text-sm); color: var(--stamp-red); font-weight: 600; }
.form-actions { display: flex; align-items: center; gap: var(--space-sm); }

/* ---------- toast ---------- */

#toast {
  position: fixed; left: 50%; bottom: var(--space-lg); transform: translateX(-50%); z-index: 40;
  padding: var(--space-xs) var(--space-md);
  background: var(--ink); color: var(--sticker); border-radius: 2px; font-size: var(--text-sm);
}

/* ---------- foot of the page ---------- */

.colophon {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--space-xs) var(--space-xl);
  margin: 0 var(--space-lg); padding: var(--space-md) 0 var(--space-xl);
  border-top: 1px solid var(--rule);
  font-size: var(--text-xs); color: var(--ink-soft);
}
.colophon p { max-width: 75ch; }
.colophon a { color: var(--stamp-red); text-underline-offset: 3px; }
.colophon a:hover { color: var(--ink); }
/* The note describes the copy put online; on this machine the stories are whole. */
html:not([data-public]) .colophon-note { display: none; }
body.is-wide[data-view="map"] .colophon { display: none; }

/* ---------- narrow screens ---------- */

@media (max-width: 1040px) {
  :root { --head-h: 0px; }
  .top { position: static; }
  .masthead { grid-template-columns: 1fr; gap: var(--space-sm); align-items: start; }
  .tally { margin-left: 0; }
  main { grid-template-columns: minmax(0, 1fr); padding: var(--space-md) var(--space-md) var(--space-2xl); }
  .colophon { margin: 0 var(--space-md); }
  #side { position: static; max-height: none; }
  .ledger-month { grid-template-columns: 1fr; gap: 0; }
  .ledger-month h3 { position: static; }
  .entry { grid-template-columns: 1.75rem 5.5rem 1fr; gap: var(--space-sm); }
  .entry-photo { grid-template-columns: 1.75rem 7rem 1fr; }
  .entry-shot img { width: 7rem; }
  .entry .mark { grid-column: 3; justify-self: start; }
  .numeral { font-size: 3rem; }
  .book-where { gap: var(--space-sm); }
  .map-tools { flex-wrap: wrap; }
  .travel { grid-template-columns: auto minmax(0, 1fr); }
  .travel-year { display: none; }
  .travel-opts { grid-column: 1 / -1; flex-wrap: wrap; }
}

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