/* Hallmark · genre: editorial · macrostructure: Long Document · theme: Almanac
 * The journal is one continuous document. Dates, places and coordinates live in
 * the margin as marginalia — never as section eyebrows. Photographs break the
 * measure to the right; nothing is full-bleed. See tokens.css for the palette.
 */

@import url("tokens.css");

/* ── base ─────────────────────────────────────────────────────────────────── */

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

html, body { overflow-x: clip; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--color-paper);
  color: var(--color-ink);
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 400;
  line-height: 1.62;
  font-variant-numeric: oldstyle-nums;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-style: normal;
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
  min-width: 0;
  margin: 0;
}

p { margin: 0 0 var(--space-md); }
p:last-child { margin-bottom: 0; }

a { color: inherit; }

img, video { max-width: 100%; height: auto; display: block; }

:where(a, button, input, textarea, select, summary):focus-visible {
  outline: var(--rule-heavy) solid var(--color-focus);
  outline-offset: 3px;
  border-radius: var(--radius-xs);
}

::selection { background: var(--color-accent-wash); }

.datum-face {
  font-family: var(--font-datum);
  font-variant-numeric: tabular-nums;
  font-size: var(--text-xs);
  letter-spacing: 0.02em;
}

.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: var(--space-md);
  top: var(--space-md);
  z-index: var(--z-toast);
  background: var(--color-paper);
  padding: var(--space-xs) var(--space-sm);
  border: var(--rule-hair) solid var(--color-ink);
}

/* ── N6 · newspaper masthead ──────────────────────────────────────────────── */

.mast {
  padding: var(--space-lg) var(--page-gutter) 0;
  text-align: center;
}

.mast__line {
  font-family: var(--font-datum);
  font-variant-numeric: tabular-nums;
  font-size: var(--text-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin: 0 0 var(--space-xs);
}

.mast__name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2rem, 7vw, 3.5rem);
  line-height: 0.98;
  letter-spacing: -0.035em;
  margin: 0;
}
.mast__name a {
  text-decoration: none;
  display: inline-block;
}
.mast__name .amp {
  font-family: var(--font-display);
  font-weight: 400;
  color: var(--color-accent);
  padding-inline: 0.06em;
}

.mast__nav {
  margin-top: var(--space-sm);
}
.mast__nav ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: var(--space-md) var(--space-lg);
  list-style: none;
  padding: 0;
  margin: 0;
}
.mast__nav a,
.mast__nav button {
  font-family: var(--font-datum);
  font-size: var(--text-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  color: var(--color-muted);
  background: none;
  border: 0;
  padding: var(--space-3xs) 0;
  cursor: pointer;
  border-bottom: var(--rule-hair) solid transparent;
  transition: color var(--dur-micro) var(--ease-out),
              border-color var(--dur-micro) var(--ease-out);
}
.mast__nav a:hover,
.mast__nav button:hover {
  color: var(--color-ink);
  border-bottom-color: var(--color-accent);
}
.mast__nav a:active,
.mast__nav button:active { color: var(--color-accent); }
.mast__nav a[aria-current="page"] {
  color: var(--color-ink);
  border-bottom-color: var(--color-ink);
}

.mast__rule {
  border: 0;
  border-top: var(--rule-hair) solid var(--color-rule);
  border-bottom: var(--rule-hair) solid var(--color-rule);
  height: 3px;
  margin: var(--space-md) 0 0;
}

/* ── the journal · long document ──────────────────────────────────────────── */

.journal {
  padding: var(--space-3xl) var(--page-gutter) var(--space-4xl);
  max-width: 78rem;
  margin-inline: auto;
}

/* Chronological divider — a rule the month sits astride. */
.season {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  gap: var(--space-xl);
  align-items: center;
  margin: 0 0 var(--space-2xl);
}
.season:not(:first-child) { margin-top: var(--space-4xl); }
.season__label {
  font-family: var(--font-datum);
  font-size: var(--text-xs);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color-ink);
  text-align: right;
}
.season__rule {
  border: 0;
  border-top: var(--rule-hair) solid var(--color-rule);
  margin: 0;
}

.leaf {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, var(--measure));
  gap: var(--space-xl);
  margin-bottom: var(--space-4xl);
}
.leaf:last-child { margin-bottom: 0; }

/* Marginalia — body-level micro-labels, right-aligned into the text block. */
.datum {
  text-align: right;
  font-family: var(--font-datum);
  font-variant-numeric: tabular-nums;
  font-size: var(--text-xs);
  line-height: 1.7;
  color: var(--color-muted);
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
  padding-top: var(--space-xs);
}
.datum__day {
  color: var(--color-ink);
  letter-spacing: 0.04em;
}
.datum__place {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-style: italic;
  letter-spacing: 0;
  color: var(--color-ink);
  line-height: 1.4;
}
.datum__geo { font-size: 0.6875rem; }
.datum__hand {
  color: var(--color-neutral);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.datum__pin {
  color: var(--color-accent);
  text-decoration: none;
  white-space: nowrap;
  border-bottom: var(--rule-hair) solid transparent;
  align-self: flex-end;
  transition: border-color var(--dur-micro) var(--ease-out);
}
.datum__pin:hover { border-bottom-color: var(--color-accent); }

.leaf__title {
  font-size: var(--text-xl);
  margin: 0 0 var(--space-sm);
}
.leaf__title a {
  text-decoration: none;
  background-image: linear-gradient(var(--color-accent), var(--color-accent));
  background-size: 0% var(--rule-heavy);
  background-repeat: no-repeat;
  background-position: 0 100%;
  transition: background-size var(--dur-short) var(--ease-out);
}
.leaf__title a:hover { background-size: 100% var(--rule-heavy); }

.prose { max-width: var(--measure); }
.prose p + p { margin-top: 0; }
.prose .lede::first-letter {
  font-family: var(--font-display);
  font-size: 3.1em;
  line-height: 0.82;
  font-weight: 500;
  float: left;
  padding: 0.06em var(--space-xs) 0 0;
  color: var(--color-ink-strong);
}

.leaf__more {
  font-family: var(--font-datum);
  font-size: var(--text-xs);
  letter-spacing: 0.06em;
  margin-top: var(--space-md);
}
.leaf__more a {
  color: var(--color-accent);
  text-decoration: none;
  white-space: nowrap;
  border-bottom: var(--rule-hair) solid var(--color-rule-soft);
  transition: border-color var(--dur-micro) var(--ease-out);
}
.leaf__more a:hover { border-bottom-color: var(--color-accent); }

/* ── the shelf · one row per journey ──────────────────────────────────────── */

/* A journey opens with its subtitle, set like a standfirst. */
.opening {
  max-width: var(--measure);
  margin: 0 0 var(--space-2xl);
  margin-left: calc(var(--rail) + var(--space-xl));
  font-size: var(--text-md);
  font-style: italic;
  color: var(--color-muted);
}

.voyage { margin-bottom: var(--space-3xl); }

.voyage__ink {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--ink);
  margin-left: var(--space-xs);
  vertical-align: 0.15em;
}

/* The cover is a strip, not a photograph on show — the journey is the subject. */
.voyage__plate {
  display: block;
  margin-top: var(--space-md);
  max-width: var(--measure);
  border: var(--rule-hair) solid var(--color-rule);
  border-radius: var(--radius-xs);
  overflow: hidden;
}
.voyage__plate img {
  width: 100%;
  aspect-ratio: 16 / 5;
  object-fit: cover;
  filter: saturate(0.92);
  transition: filter var(--dur-short) var(--ease-out);
}
.voyage__plate:hover img { filter: none; }

.voyage__empty {
  color: var(--color-neutral);
  font-size: var(--text-sm);
  margin-top: var(--space-sm);
}
.voyage__empty a { color: var(--color-accent); }

.leaf__more a + a { margin-left: var(--space-md); }
.shelf__add { margin-left: calc(var(--rail) + var(--space-xl)); }

/* ── plates · photographs break the measure to the right ──────────────────── */

.plate {
  margin: var(--space-lg) 0 0;
  display: grid;
  gap: var(--space-xs);
  width: min(100%, calc(var(--measure) + 8vw));
}
.plate[data-n="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.plate[data-n="3"] {
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
  grid-template-rows: repeat(2, minmax(0, 1fr));
}
.plate[data-n="3"] > :first-child { grid-row: span 2; }
.plate[data-n="4"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.plate[data-n="many"] { grid-template-columns: repeat(auto-fit, minmax(min(11rem, 100%), 1fr)); }

/* figure → button → img all stretch, so a spanning plate fills its two rows. */
.plate figure,
.plate button.shot { margin: 0; position: relative; display: grid; min-height: 0; }

.plate img,
.plate video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  aspect-ratio: 4 / 3;
  background: var(--color-paper-3);
  border-radius: var(--radius-xs);
}
/* A lone photograph keeps its own shape, but a tall one can’t run the page. */
.plate[data-n="1"] img,
.plate[data-n="1"] video {
  aspect-ratio: auto;
  object-fit: contain;
  max-height: 38rem;
}

/* The spanning plate fills the two stacked beside it rather than sitting short. */
.plate[data-n="3"] > :first-child img,
.plate[data-n="3"] > :first-child video { aspect-ratio: auto; }

.plate button.shot {
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
  width: 100%;
}
.plate button.shot img {
  transition: opacity var(--dur-short) var(--ease-out);
}
.plate button.shot:hover img { opacity: 0.9; }

.plate .film::after {
  content: "FILM";
  position: absolute;
  left: var(--space-xs);
  bottom: var(--space-xs);
  font-family: var(--font-datum);
  font-size: 0.625rem;
  letter-spacing: 0.14em;
  color: var(--color-paper);
  background: var(--color-scrim);
  padding: var(--space-3xs) var(--space-2xs);
  border-radius: var(--radius-xs);
  pointer-events: none;
}

/* ── single entry ─────────────────────────────────────────────────────────── */

.sheet {
  padding: var(--space-2xl) var(--page-gutter) var(--space-3xl);
  max-width: 78rem;
  margin-inline: auto;
  display: grid;
  grid-template-columns: var(--rail) minmax(0, var(--measure));
  gap: var(--space-xl);
}

.sheet__title {
  font-size: var(--text-2xl);
  margin: 0 0 var(--space-lg);
}

.sheet__map {
  margin-top: var(--space-xl);
  height: 15rem;
  border: var(--rule-hair) solid var(--color-rule);
  border-radius: var(--radius-xs);
}

.turn {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-md);
  margin-top: var(--space-2xl);
  padding-top: var(--space-md);
  border-top: var(--rule-hair) solid var(--color-rule);
  font-family: var(--font-datum);
  font-size: var(--text-xs);
  letter-spacing: 0.04em;
}
.turn a {
  color: var(--color-muted);
  text-decoration: none;
  max-width: 30ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color var(--dur-micro) var(--ease-out);
}
.turn a:hover { color: var(--color-accent); }

/* ── the map ──────────────────────────────────────────────────────────────── */

.atlas {
  display: grid;
  grid-template-columns: 22rem minmax(0, 1fr);
  min-height: 68vh;
  border-top: var(--rule-hair) solid var(--color-rule);
}

.atlas__index {
  border-right: var(--rule-hair) solid var(--color-rule);
  padding: var(--space-lg) var(--space-lg) var(--space-2xl);
  max-height: 78vh;
  overflow-y: auto;
}
.atlas__index h2 {
  font-size: var(--text-md);
  margin-bottom: var(--space-md);
}
.atlas__index ol {
  list-style: none;
  margin: 0;
  padding: 0;
}
.stop {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr);
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-xs);
  border-bottom: var(--rule-hair) solid var(--color-rule-soft);
  cursor: pointer;
  background: none;
  border-left: 0;
  border-right: 0;
  border-top: 0;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  transition: background-color var(--dur-micro) var(--ease-out);
}
.stop:hover, .stop.is-active { background: var(--color-paper-2); }
.stop:active { background: var(--color-paper-3); }
.stop:disabled { opacity: 0.55; cursor: not-allowed; }
.stop.is-active .stop__n { background: var(--color-accent); color: var(--color-paper); }
.stop__n {
  font-family: var(--font-datum);
  font-variant-numeric: tabular-nums;
  font-size: var(--text-xs);
  width: 1.75rem;
  height: 1.75rem;
  display: grid;
  place-items: center;
  border: var(--rule-hair) solid var(--color-ink);
  border-radius: 50%;
  transition: background-color var(--dur-micro) var(--ease-out),
              color var(--dur-micro) var(--ease-out);
}
.stop__title { display: block; font-size: var(--text-sm); line-height: 1.35; }
.stop__meta {
  display: block;
  font-family: var(--font-datum);
  font-variant-numeric: tabular-nums;
  font-size: 0.6875rem;
  color: var(--color-muted);
  margin-top: var(--space-3xs);
}

/* The world map's index: journeys rather than stops, each with its ink. */
.legend {
  list-style: none;
  margin: 0;
  padding: 0;
}
.legend li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-xs);
  border-bottom: var(--rule-hair) solid var(--color-rule-soft);
}
.legend .stop { border-bottom: 0; }
.legend__ink {
  width: 0.9rem;
  height: 0.9rem;
  justify-self: center;
  border-radius: 50%;
  background: color-mix(in oklab, var(--ink) 45%, transparent);
  border: var(--rule-hair) solid var(--ink);
}
.legend .stop.is-active .legend__ink { background: var(--ink); }
.legend__go {
  font-family: var(--font-datum);
  font-size: var(--text-xs);
  color: var(--color-muted);
  text-decoration: none;
  white-space: nowrap;
  padding: var(--space-xs);
}
.legend__go:hover { color: var(--color-accent); }

.atlas__index .hint {
  font-size: var(--text-sm);
  color: var(--color-neutral);
  margin-top: var(--space-md);
}

#atlas-canvas { min-height: 68vh; }

/* Warm the tiles toward the paper so the map belongs to the page. */
.leaflet-tile-pane { filter: sepia(0.32) saturate(0.72) contrast(0.96) brightness(1.02); }
.leaflet-container {
  background: var(--color-paper-2);
  font-family: var(--font-body);
}
.leaflet-control-attribution {
  font-family: var(--font-datum);
  font-size: 0.625rem;
  background: var(--color-paper);
  color: var(--color-muted);
}
.leaflet-control-attribution a { color: var(--color-muted); }
.leaflet-bar a {
  font-family: var(--font-datum);
  color: var(--color-ink);
  background: var(--color-paper);
  border-bottom-color: var(--color-rule);
}
.leaflet-bar a:hover { background: var(--color-paper-2); }

.pin {
  display: grid;
  place-items: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: var(--color-paper);
  border: var(--rule-heavy) solid var(--color-ink);
  color: var(--color-ink);
  font-family: var(--font-datum);
  font-variant-numeric: tabular-nums;
  font-size: 0.6875rem;
  transition: transform var(--dur-short) var(--ease-out),
              background-color var(--dur-micro) var(--ease-out);
}
/* Hover fills; only the selected stop also grows. One signal per state. */
.leaflet-marker-icon:hover .pin,
.pin.is-active {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-paper);
}
.pin.is-active { transform: scale(1.18); }

.leaflet-popup-content-wrapper {
  background: var(--color-paper);
  color: var(--color-ink);
  border-radius: var(--radius-sm);
  box-shadow: 0 1px 2px var(--color-shade);
}
.leaflet-popup-tip { background: var(--color-paper); }
.leaflet-popup-content { margin: var(--space-sm); font-size: var(--text-sm); }
.leaflet-popup-content strong { font-family: var(--font-display); font-weight: 600; }
.leaflet-popup-content .datum-face { color: var(--color-muted); display: block; }
.leaflet-popup-content a { color: var(--color-accent); }

/* ── the gate ─────────────────────────────────────────────────────────────── */

.gate {
  min-height: 82vh;
  display: grid;
  align-content: center;
  padding: var(--space-2xl) var(--page-gutter);
  max-width: 46rem;
  margin-inline: 0;
  margin-left: min(12vw, 9rem);
}
.gate h1 {
  font-size: var(--text-display-s);
  margin-bottom: var(--space-md);
}
.gate p { max-width: 46ch; color: var(--color-muted); }
.gate form {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-top: var(--space-xl);
}
.gate input { min-width: min(18rem, 100%); }
/* Reserved even when empty, so an error never shoves the form upward. */
.gate__error {
  color: var(--color-error);
  font-family: var(--font-datum);
  font-size: var(--text-xs);
  margin-top: var(--space-sm);
  min-height: 1lh;
}

/* ── forms ────────────────────────────────────────────────────────────────── */

.compose {
  padding: var(--space-2xl) var(--page-gutter) var(--space-3xl);
  max-width: 62rem;
  margin-inline: auto;
}
.compose h1 { font-size: var(--text-xl); margin-bottom: var(--space-xl); }

.field { margin-bottom: var(--space-lg); }
.field > label,
.legend {
  display: block;
  font-family: var(--font-datum);
  font-size: var(--text-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin-bottom: var(--space-2xs);
}
.field .hint,
.compose > .hint {
  font-size: var(--text-sm);
  color: var(--color-neutral);
  margin: var(--space-2xs) 0 0;
}
/* A standfirst for a form that needs one sentence of orientation. */
.compose > .hint--lede {
  max-width: var(--measure);
  color: var(--color-muted);
  margin: calc(-1 * var(--space-md)) 0 var(--space-xl);
}

input[type="text"],
input[type="password"],
input[type="date"],
input[type="search"],
input[type="file"],
select,
textarea {
  width: 100%;
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-ink);
  background: var(--color-paper-2);
  border: var(--rule-hair) solid var(--color-rule-firm);
  border-radius: var(--radius-xs);
  padding: var(--space-sm) var(--space-md);
  transition: border-color var(--dur-micro) var(--ease-out),
              background-color var(--dur-micro) var(--ease-out);
}
input:hover, select:hover, textarea:hover { border-color: var(--color-neutral); }
input:focus, select:focus, textarea:focus { background: var(--color-paper); }
input::placeholder, textarea::placeholder { color: var(--color-neutral); }
input:disabled, textarea:disabled, select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
input[aria-invalid="true"], textarea[aria-invalid="true"] {
  border-color: var(--color-error);
}
textarea { min-height: 16rem; line-height: 1.6; resize: vertical; }

input[type="file"] { padding: var(--space-xs); cursor: pointer; }
input[type="file"]::file-selector-button {
  font-family: var(--font-datum);
  font-size: var(--text-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-ink);
  background: var(--color-paper);
  border: var(--rule-hair) solid var(--color-rule);
  border-radius: var(--radius-xs);
  padding: var(--space-xs) var(--space-md);
  margin-right: var(--space-md);
  cursor: pointer;
  transition: border-color var(--dur-micro) var(--ease-out),
              color var(--dur-micro) var(--ease-out);
}
input[type="file"]::file-selector-button:hover {
  color: var(--color-accent);
  border-color: var(--color-accent);
}
input[type="date"] { font-family: var(--font-datum); font-variant-numeric: tabular-nums; }

.row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(14rem, 100%), 1fr));
  gap: var(--space-md);
}

.btn {
  font-family: var(--font-datum);
  font-size: var(--text-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--color-paper);
  background: var(--color-ink);
  border: var(--rule-hair) solid var(--color-ink);
  border-radius: var(--radius-xs);
  padding: var(--space-sm) var(--space-lg);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: background-color var(--dur-micro) var(--ease-out),
              transform var(--dur-micro) var(--ease-out);
}
.btn:hover { background: var(--color-accent); border-color: var(--color-accent); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  background: var(--color-neutral);
  border-color: var(--color-neutral);
}
.btn[data-state="loading"] { opacity: 0.75; cursor: progress; }
.btn[data-state="loading"]::after {
  content: " ·";
  animation: ellipsis 1.1s steps(4, end) infinite;
}
@keyframes ellipsis {
  0%   { content: " ·"; }
  33%  { content: " ··"; }
  66%  { content: " ···"; }
  100% { content: " ·"; }
}

.btn--quiet {
  background: none;
  color: var(--color-muted);
  border-color: var(--color-rule);
}
.btn--quiet:hover {
  background: none;
  color: var(--color-accent);
  border-color: var(--color-accent);
}
.btn--danger { background: none; color: var(--color-error); border-color: var(--color-error); }
.btn--danger:hover { background: var(--color-error); color: var(--color-paper); }

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-md);
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
  border-top: var(--rule-hair) solid var(--color-rule);
}
.actions .spacer { flex: 1 1 auto; }

/* location picker */
#picker {
  height: 20rem;
  border: var(--rule-hair) solid var(--color-rule);
  border-radius: var(--radius-xs);
  margin-top: var(--space-xs);
}
.search {
  display: flex;
  gap: var(--space-xs);
  align-items: stretch;
}
.search input { flex: 1 1 auto; }
.results {
  list-style: none;
  margin: var(--space-xs) 0 0;
  padding: 0;
  border: var(--rule-hair) solid var(--color-rule);
  border-radius: var(--radius-xs);
  background: var(--color-paper-2);
}
.results:empty { display: none; }
.results li + li { border-top: var(--rule-hair) solid var(--color-rule-soft); }
.results button {
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  font: inherit;
  font-size: var(--text-sm);
  color: var(--color-ink);
  padding: var(--space-xs) var(--space-sm);
  cursor: pointer;
}
.results button:hover { background: var(--color-paper-3); }
.results button:active { color: var(--color-accent); }
.results button:disabled { opacity: 0.55; cursor: not-allowed; }

.attached {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(8rem, 100%), 1fr));
  gap: var(--space-xs);
  margin-top: var(--space-xs);
}
.attached figure { margin: 0; position: relative; }
.attached img, .attached video {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: var(--color-paper-3);
  border-radius: var(--radius-xs);
}
.attached .drop {
  position: absolute;
  top: var(--space-2xs);
  right: var(--space-2xs);
  font-family: var(--font-datum);
  font-size: 0.625rem;
  line-height: 1;
  padding: var(--space-2xs) var(--space-xs);
  color: var(--color-paper);
  background: var(--color-scrim);
  border: 0;
  border-radius: var(--radius-xs);
  cursor: pointer;
}
.attached .drop:hover { background: var(--color-error); }
.attached .rank {
  position: absolute;
  left: var(--space-2xs);
  bottom: var(--space-2xs);
  display: flex;
  align-items: center;
  gap: var(--space-2xs);
  font-family: var(--font-datum);
  font-size: 0.625rem;
  line-height: 1;
  padding: var(--space-2xs);
  color: var(--color-paper);
  background: var(--color-scrim);
  border-radius: var(--radius-xs);
}
.attached[data-many="no"] .rank { display: none; }
.attached .nudge {
  font: inherit;
  line-height: 1;
  padding: 0 var(--space-2xs);
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}
.attached .nudge:disabled { opacity: 0.35; cursor: default; }
.attached .ord { font-variant-numeric: tabular-nums; }

/* ── empty state — typographic, never fake photographs ────────────────────── */

.nothing {
  grid-column: 1 / -1;
  max-width: 48ch;
  padding: var(--space-2xl) 0;
}
.nothing h2 { font-size: var(--text-lg); margin-bottom: var(--space-sm); }
.nothing p { color: var(--color-muted); }

/* ── Ft4 · dense colophon ─────────────────────────────────────────────────── */

.colophon {
  border-top: var(--rule-hair) solid var(--color-rule);
  padding: var(--space-lg) var(--page-gutter) var(--space-2xl);
  font-family: var(--font-datum);
  font-variant-numeric: tabular-nums;
  font-size: var(--text-xs);
  line-height: 1.85;
  color: var(--color-muted);
  max-width: 78rem;
  margin-inline: auto;
}
.colophon p { max-width: 72ch; margin: 0; }
.colophon a { color: var(--color-muted); text-decoration-color: var(--color-rule); }
.colophon a:hover { color: var(--color-accent); }

/* ── lightbox ─────────────────────────────────────────────────────────────── */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background: var(--color-scrim);
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  place-items: center;
  padding: var(--space-lg);
  border: 0;
  opacity: 0;
  animation: lift var(--dur-long) var(--ease-out) forwards;
}
.lightbox[hidden] { display: none; }
.lightbox img, .lightbox video {
  max-height: 82vh;
  max-width: 100%;
  object-fit: contain;
  border-radius: var(--radius-xs);
}
.lightbox__bar {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  padding-top: var(--space-md);
  font-family: var(--font-datum);
  font-variant-numeric: tabular-nums;
  font-size: var(--text-xs);
  color: var(--color-paper);
}
.lightbox__bar button {
  font: inherit;
  background: none;
  border: var(--rule-hair) solid var(--color-paper);
  color: var(--color-paper);
  border-radius: var(--radius-xs);
  padding: var(--space-2xs) var(--space-sm);
  cursor: pointer;
  white-space: nowrap;
}
.lightbox__bar button:hover { background: var(--color-paper); color: var(--color-ink); }
.lightbox__bar button:disabled { opacity: 0.4; cursor: not-allowed; }

@keyframes lift {
  from { opacity: 0; transform: scale(0.965); }
  to   { opacity: 1; transform: none; }
}

/* ── one orchestrated entrance ────────────────────────────────────────────── */

.reveal {
  opacity: 0;
  transform: translateY(8px);
  animation: reveal var(--dur-long) var(--ease-out) forwards;
  animation-delay: calc(var(--i, 0) * 55ms);
}
@keyframes reveal {
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 150ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 150ms !important;
  }
  .reveal, .lightbox { animation: fade 150ms linear forwards; }
  @keyframes fade { to { opacity: 1; transform: none; } }
}

/* ── narrower than the rail ───────────────────────────────────────────────── */

@media (max-width: 60rem) {
  .atlas { grid-template-columns: minmax(0, 1fr); }
  .atlas__index {
    border-right: 0;
    border-top: var(--rule-hair) solid var(--color-rule);
    max-height: none;
    order: 2;
  }
  #atlas-canvas { min-height: 56vh; order: 1; }
}

@media (max-width: 48rem) {
  :root { --rail: 0; }

  .journal { padding-top: var(--space-2xl); }

  .leaf, .sheet, .season {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-md);
  }
  .leaf { margin-bottom: var(--space-3xl); }
  .opening, .shelf__add { margin-left: 0; }
  .season:not(:first-child) { margin-top: var(--space-3xl); }
  .season__label { text-align: left; }
  .season__rule { display: none; }

  /* Marginalia folds into a single line above the entry. */
  .datum {
    text-align: left;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: baseline;
    gap: var(--space-2xs) var(--space-sm);
    padding-top: 0;
    padding-bottom: var(--space-2xs);
    border-bottom: var(--rule-hair) solid var(--color-rule-soft);
  }
  .datum__pin { align-self: baseline; margin-left: auto; }

  .plate { width: 100%; }
  .plate[data-n="3"] {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: none;
  }
  .plate[data-n="3"] > :first-child { grid-row: auto; grid-column: span 2; }
  .plate[data-n="3"] > :first-child img,
  .plate[data-n="3"] > :first-child video { aspect-ratio: 4 / 3; }

  .gate { margin-left: 0; min-height: 70vh; }
  .sheet__title { font-size: var(--text-xl); }
}

@media (max-width: 26rem) {
  .mast__nav ul { gap: var(--space-sm) var(--space-md); }
  .plate[data-n="4"], .plate[data-n="many"] { grid-template-columns: minmax(0, 1fr); }
  .lightbox__bar { gap: var(--space-sm); }
}

@media print {
  .mast__nav, .lightbox, .turn { display: none; }
  body { background: none; }
}
