/* Hortus Antjanus — a herbarium redesign of antjanus.com */

:root {
  --paper: #f3eee2;
  --sheet: #fbf8f0;
  --label-paper: #fffdf5;
  --ink: #26241c;
  --ink-soft: #3d3a2f;
  --muted: #5b5545;
  --rule: #cdc3aa;
  --rule-strong: #a99d80;
  --leaf: #3b5a34;
  --leaf-soft: #dfe6d2;
  --madder: #973826;
  --indigo: #364f6a;
  --indigo-hover: #243a52;
  --tape: rgba(222, 208, 170, 0.78);
  --code-bg: #f7f2e4;
  --shadow: 0 1px 0 rgba(60, 50, 30, 0.08), 0 8px 24px -14px rgba(60, 50, 30, 0.35);
  --focus: #973826;
  --img-filter: grayscale(0.85) sepia(0.35) contrast(1.02);
  --grain-opacity: 0.35;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --paper: #141712;
  --sheet: #1b1f19;
  --label-paper: #22271f;
  --ink: #ebe6d6;
  --ink-soft: #d6d0bd;
  --muted: #b3ad99;
  --rule: #3a4134;
  --rule-strong: #59624f;
  --leaf: #a3c690;
  --leaf-soft: #28331f;
  --madder: #e6937b;
  --indigo: #a5bfdc;
  --indigo-hover: #c9dbef;
  --tape: rgba(120, 112, 86, 0.55);
  --code-bg: #171b15;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.4), 0 10px 28px -16px rgba(0, 0, 0, 0.9);
  --focus: #e6937b;
  --img-filter: grayscale(0.85) sepia(0.3) brightness(0.88);
  --grain-opacity: 0.12;
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #141712;
    --sheet: #1b1f19;
    --label-paper: #22271f;
    --ink: #ebe6d6;
    --ink-soft: #d6d0bd;
    --muted: #b3ad99;
    --rule: #3a4134;
    --rule-strong: #59624f;
    --leaf: #a3c690;
    --leaf-soft: #28331f;
    --madder: #e6937b;
    --indigo: #a5bfdc;
    --indigo-hover: #c9dbef;
    --tape: rgba(120, 112, 86, 0.55);
    --code-bg: #171b15;
    --shadow: 0 1px 0 rgba(0, 0, 0, 0.4), 0 10px 28px -16px rgba(0, 0, 0, 0.9);
    --focus: #e6937b;
    --img-filter: grayscale(0.85) sepia(0.3) brightness(0.88);
    --grain-opacity: 0.12;
    color-scheme: dark;
  }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 5rem; }
body {
  margin: 0;
  background-color: var(--paper);
  color: var(--ink-soft);
  font-family: "EB Garamond", Garamond, "Times New Roman", serif;
  font-size: 1.1875rem;
  line-height: 1.6;
  overflow-x: hidden;
  position: relative;
}
body::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .38 0 0 0 0 .22 0 0 0 .22 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
img { max-width: 100%; display: block; }
a { color: var(--indigo); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--indigo-hover); text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 2px; }
h1, h2, h3, h4 {
  font-family: "IM Fell English", "EB Garamond", serif;
  font-weight: 400;
  color: var(--ink);
  line-height: 1.12;
  margin: 0 0 0.5em;
  letter-spacing: -0.005em;
}
h1 { font-size: clamp(2.5rem, 5.4vw, 4.4rem); }
h2 { font-size: clamp(1.9rem, 3.2vw, 2.6rem); }
h3 { font-size: 1.5rem; line-height: 1.2; }
p { margin: 0 0 1em; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 1rem; top: -4rem; background: var(--ink); color: var(--paper); padding: 0.6rem 1rem; z-index: 50; }
.skip:focus { top: 1rem; }

.wrap { width: min(1240px, 100% - 2.5rem); margin-inline: auto; }
@media (max-width: 600px) { .wrap { width: calc(100% - 2rem); } }

.mono, .label, .plate-no, .meta { font-family: "Courier Prime", "Courier New", monospace; }
.eyebrow {
  font-family: "IM Fell English", serif;
  font-style: italic;
  font-size: 1.2rem;
  color: var(--leaf);
  margin: 0 0 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.eyebrow::before { content: ""; width: 1.8rem; height: 1px; background: currentColor; }
.plate-no { font-size: 0.9375rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.lede { font-size: clamp(1.3rem, 2vw, 1.5rem); line-height: 1.5; color: var(--ink-soft); max-width: 40ch; }
.muted { color: var(--muted); }

/* ---------- header / nav ---------- */
.site-head { border-bottom: 1px solid var(--rule); background: color-mix(in srgb, var(--paper) 92%, transparent); position: sticky; top: 0; z-index: 30; backdrop-filter: blur(6px); }
.head-inner { display: flex; align-items: center; gap: 1rem; min-height: 4.5rem; }
.brand { display: flex; align-items: center; gap: 0.75rem; text-decoration: none; color: var(--ink); margin-right: auto; }
.brand:hover { color: var(--ink); }
.brand svg { width: 3rem; height: 3rem; flex: none; color: var(--leaf); }
.brand-name { font-family: "IM Fell English", serif; font-size: 1.55rem; line-height: 1; display: block; }
.brand-sub { white-space: nowrap; font-family: "Courier Prime", monospace; font-size: 0.8125rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); display: block; margin-top: 0.2rem; }
.nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 0.25rem; align-items: center; }
.nav a {
  display: inline-flex; align-items: baseline; gap: 0.35rem;
  padding: 0.55rem 0.5rem; min-height: 44px; align-items: center;
  text-decoration: none; color: var(--ink-soft); font-size: 1.125rem;
  border-bottom: 2px solid transparent;
}
.nav a .num { font-family: "Courier Prime", monospace; font-size: 0.8125rem; color: var(--muted); }
.nav a:hover { color: var(--ink); border-bottom-color: var(--rule-strong); }
.nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--madder); }
.nav a.nav-ai { font-style: italic; color: var(--leaf); }
.head-tools { display: flex; align-items: center; gap: 0.25rem; }
.icon-btn {
  width: 44px; height: 44px; display: inline-grid; place-items: center;
  border: 1px solid var(--rule); background: var(--sheet); color: var(--ink);
  border-radius: 50%; cursor: pointer;
}
.icon-btn:hover { border-color: var(--rule-strong); }
.icon-btn svg { width: 20px; height: 20px; }
.menu-btn { display: none; }
.theme-btn .moon { display: none; }
:root[data-theme="dark"] .theme-btn .sun { display: none; }
:root[data-theme="dark"] .theme-btn .moon { display: block; }
.search-form { display: flex; }
.search-form input {
  font: inherit; font-size: 1rem; width: 7.5rem; padding: 0.45rem 0.7rem; min-height: 44px;
  border: 1px solid var(--rule); border-right: 0; background: var(--label-paper); color: var(--ink); border-radius: 22px 0 0 22px;
}
.search-form input::placeholder { color: var(--muted); }
.search-form button { font-family: "Courier Prime", monospace; font-size: 0.875rem; padding: 0 0.8rem; border: 1px solid var(--rule); background: var(--sheet); color: var(--ink); border-radius: 0 22px 22px 0; cursor: pointer; min-height: 44px; }

@media (max-width: 1380px) {
  .search-form.in-head { display: none; }
}
@media (max-width: 480px) {
  .brand-sub { display: none; }
  .head-inner { gap: 0.75rem; }
}
@media (max-width: 1080px) {
  .menu-btn { display: inline-grid; }
  html.js .nav { display: none; position: absolute; left: 0; right: 0; top: 100%; background: var(--sheet); border-bottom: 1px solid var(--rule); padding: 0.75rem 1.25rem 1.25rem; box-shadow: var(--shadow); }
  html.js .nav.open { display: block; }
  .nav ul { flex-direction: column; align-items: stretch; }
  .nav a { width: 100%; border-bottom: 1px dotted var(--rule); font-size: 1.25rem; }
  .nav .search-form { margin-top: 0.75rem; }
  .nav .search-form input { width: 100%; flex: 1; }
  html:not(.js) .head-inner { flex-wrap: wrap; }
  html:not(.js) .nav ul { flex-direction: row; flex-wrap: wrap; }
}
@media (min-width: 1081px) { .nav .search-form { display: none; } }

/* ---------- reading progress ---------- */
.progress { position: fixed; top: 0; left: 0; height: 4px; width: 100%; z-index: 40; pointer-events: none; }
.progress span { display: block; height: 100%; width: 0; background: var(--leaf); position: relative; }
.progress span::after { content: ""; position: absolute; right: -7px; top: -4px; width: 12px; height: 8px; background: var(--leaf); border-radius: 0 100% 0 100%; }

/* ---------- sections ---------- */
section { padding-block: clamp(3rem, 6vw, 5.5rem); }
.section-head { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 1rem 2rem; margin-bottom: 2rem; border-bottom: 1px solid var(--rule); padding-bottom: 1rem; }
.section-head h2 { margin: 0; }
.section-head p { margin: 0.4rem 0 0; color: var(--muted); }
.section-head .more { font-family: "Courier Prime", monospace; font-size: 0.9375rem; text-transform: uppercase; letter-spacing: 0.08em; white-space: nowrap; }
@media (max-width: 640px) { .section-head { grid-template-columns: 1fr; } }
.ruled-top { border-top: 1px solid var(--rule); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem; min-height: 48px;
  padding: 0.65rem 1.4rem; font-family: "Courier Prime", monospace; font-size: 1rem; letter-spacing: 0.05em;
  text-transform: uppercase; text-decoration: none; border: 1.5px solid var(--ink); cursor: pointer;
  transition: background-color 150ms, color 150ms;
}
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover { background: var(--leaf); border-color: var(--leaf); color: var(--paper); }
:root[data-theme="dark"] .btn-primary:hover { color: #141712; }
.btn-secondary { background: transparent; color: var(--ink); }
.btn-secondary:hover { background: var(--leaf-soft); color: var(--ink); }
.link-tertiary { font-family: "Courier Prime", monospace; font-size: 1rem; color: var(--muted); text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
.link-tertiary:hover { color: var(--ink); text-decoration: underline; }
.cta-row { display: flex; flex-wrap: wrap; gap: 0.75rem 1.25rem; align-items: center; }

/* ---------- specimen sheet ---------- */
.sheet {
  position: relative; background: var(--sheet); border: 1px solid var(--rule);
  box-shadow: var(--shadow); padding: clamp(1rem, 2.2vw, 1.75rem);
}
.mount { position: relative; }
.mount img { width: 100%; height: 100%; object-fit: cover; filter: var(--img-filter); transition: filter 400ms ease; }
.mount::before, .mount::after {
  content: ""; position: absolute; width: 4.2rem; height: 1.3rem; background: var(--tape); z-index: 2;
  box-shadow: 0 1px 2px rgba(0,0,0,.08);
}
.mount::before { top: -0.55rem; left: 12%; transform: rotate(-4deg); }
.mount::after { bottom: -0.55rem; right: 14%; transform: rotate(3deg); }
a:hover .mount img, a:focus-visible .mount img, .mount.coloured img, .mount:hover img { filter: none; }
.colour-note { font-family: "Courier Prime", monospace; font-size: 0.8125rem; color: var(--muted); }

.label {
  background: var(--label-paper); border: 1px solid var(--rule-strong);
  padding: 0.8rem 1rem; font-size: 0.9375rem; line-height: 1.45; color: var(--ink);
  position: relative;
}
.label::before { content: ""; position: absolute; inset: 3px; border: 1px solid var(--rule); pointer-events: none; }
.label-title { font-family: "IM Fell English", serif; font-style: italic; font-size: 1.2rem; display: block; margin-bottom: 0.3rem; line-height: 1.25; }
.label dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 0.1rem 0.75rem; }
.label dt { color: var(--muted); }
.label dd { margin: 0; }
.label-head { display: flex; justify-content: space-between; gap: 0.5rem; font-size: 0.8125rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--rule); padding-bottom: 0.3rem; margin-bottom: 0.5rem; }

/* growth stage */
.stage { display: inline-flex; align-items: center; gap: 0.35rem; font-family: "Courier Prime", monospace; font-size: 0.875rem; color: var(--leaf); }
.stage svg { width: 1.2rem; height: 1.2rem; }

/* ---------- specimen cards ---------- */
.grid { display: grid; gap: clamp(1.5rem, 3vw, 2.5rem); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 460px), 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); }

.specimen {
  display: flex; flex-direction: column; text-decoration: none; color: inherit;
  background: var(--sheet); border: 1px solid var(--rule); box-shadow: var(--shadow);
  padding: 2.4rem 1.25rem 1.1rem; position: relative; transition: transform 200ms ease, border-color 200ms;
}
.specimen:hover { color: inherit; border-color: var(--rule-strong); transform: translateY(-3px); }
.specimen .mount { aspect-ratio: 16 / 10; margin-bottom: 1.1rem; background: var(--leaf-soft); }
.specimen .mount.drawn { display: grid; place-items: center; color: var(--leaf); }
.specimen .mount.drawn svg { width: 70%; height: 88%; }
.specimen .tab { position: absolute; top: 0.65rem; right: 0.9rem; font-family: "Courier Prime", monospace; font-size: 0.8125rem; color: var(--muted); letter-spacing: 0.1em; }
.specimen h3 { font-size: 1.45rem; margin-bottom: 0.4rem; color: var(--ink); }
.specimen:hover h3 { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.15em; }
.specimen p { margin: 0 0 1rem; color: var(--ink-soft); font-size: 1.1rem; }
.specimen .label { margin-top: auto; font-size: 0.875rem; }
.specimen .label dl { grid-template-columns: auto 1fr; }

/* index (catalogue) rows */
.index-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.index-row { border-bottom: 1px solid var(--rule); }
.index-row a {
  display: grid; grid-template-columns: 4.5rem 1fr auto; gap: 0.25rem 1.5rem; padding: 1.2rem 0.5rem;
  text-decoration: none; color: inherit; align-items: baseline;
}
.index-row a:hover { background: color-mix(in srgb, var(--leaf-soft) 55%, transparent); color: inherit; }
.index-row .no { font-family: "Courier Prime", monospace; color: var(--muted); font-size: 0.9375rem; }
.index-row h3 { font-size: 1.45rem; margin: 0 0 0.25rem; }
.index-row a:hover h3 { text-decoration: underline; text-decoration-thickness: 1px; }
.index-row p { margin: 0; color: var(--ink-soft); font-size: 1.1rem; }
.index-row .side { text-align: right; font-family: "Courier Prime", monospace; font-size: 0.9375rem; color: var(--muted); display: flex; flex-direction: column; align-items: flex-end; gap: 0.3rem; }
.index-row .fam { font-family: "IM Fell English", serif; font-style: italic; color: var(--leaf); font-size: 1.05rem; }
@media (max-width: 640px) {
  .index-row a { grid-template-columns: 1fr; }
  .index-row .no { order: -1; }
  .index-row .side { flex-direction: row; flex-wrap: wrap; justify-content: flex-start; text-align: left; gap: 0.3rem 1rem; }
}

/* seed packets */
.packet {
  position: relative; display: flex; flex-direction: column; gap: 0.4rem; text-decoration: none; color: inherit;
  background: var(--label-paper); border: 1px solid var(--rule-strong); padding: 2.6rem 1.25rem 1.25rem;
  clip-path: polygon(0 1.4rem, 12% 0, 88% 0, 100% 1.4rem, 100% 100%, 0 100%);
}
.packet::before { content: ""; position: absolute; left: 0; right: 0; top: 1.4rem; border-top: 1px dashed var(--rule-strong); }
.packet:hover { background: var(--leaf-soft); color: inherit; }
.packet .kind { font-family: "Courier Prime", monospace; font-size: 0.8125rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--madder); }
.packet h3 { font-size: 1.35rem; margin: 0; }
.packet p { margin: 0; font-size: 1.05rem; }
.packet .sow { font-family: "Courier Prime", monospace; font-size: 0.875rem; color: var(--muted); margin-top: auto; padding-top: 0.5rem; }
.packet svg { width: 2.4rem; height: 2.4rem; color: var(--leaf); }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; list-style: none; padding: 0; margin: 0; }
.chip { font-family: "Courier Prime", monospace; font-size: 0.875rem; padding: 0.15rem 0.6rem; border: 1px solid var(--rule-strong); border-radius: 999px; color: var(--ink-soft); background: var(--label-paper); }
button.chip, a.chip { cursor: pointer; min-height: 36px; text-decoration: none; }
button.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
button.chip[aria-pressed="true"]::before { content: "✓ "; }

/* ---------- hero plate ---------- */
.hero { padding-block: clamp(2rem, 5vw, 4rem) clamp(3rem, 6vw, 5rem); position: relative; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(2rem, 5vw, 5rem); align-items: center; }
.hero-sheet { padding: 1.5rem 1.5rem 1.25rem; transform: rotate(-0.8deg); }
.hero-sheet .mount { aspect-ratio: 4 / 5; }
.hero-sheet .mount img { object-position: 20% 30%; }
.hero-sheet .label { z-index: 3; position: absolute; right: -1.25rem; bottom: -2rem; width: min(19rem, 80%); transform: rotate(1.4deg); box-shadow: var(--shadow); }
.hero-fern { position: absolute; left: -3.5rem; top: -2rem; width: 9rem; height: 24rem; color: var(--leaf); opacity: 0.8; z-index: 3; pointer-events: none; }
.hero-copy h1 { margin-bottom: 0.3em; }
.hero-copy .lede { margin-bottom: 1.8rem; }
.hero-annot { font-family: "Courier Prime", monospace; font-size: 0.875rem; color: var(--muted); margin-bottom: 1rem; }
@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-sheet { max-width: 26rem; margin-inline: auto 2.5rem; }
  .hero-fern { left: auto; right: -0.75rem; width: 6rem; height: 16rem; }
}
@media (max-width: 500px) { .hero-sheet { margin-inline: 0.25rem 1.5rem; } .hero-sheet .label { right: -0.4rem; } }

/* measurements / scale bar stats */
.measures { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0 0 2rem; border-top: 2px solid var(--ink); position: relative; max-width: 34rem; }
.measures::before { content: ""; position: absolute; top: -2px; left: 0; right: 0; height: 8px; background: repeating-linear-gradient(90deg, var(--ink) 0 1px, transparent 1px 10%); }
.measure { padding: 0.9rem 0.8rem 0 0; }
.measure b { display: block; font-family: "IM Fell English", serif; font-weight: 400; font-size: clamp(2rem, 4vw, 2.8rem); color: var(--ink); line-height: 1; }
.measure span { font-family: "Courier Prime", monospace; font-size: 0.875rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }

/* page header plate (inner pages) */
.page-plate { padding-block: clamp(2.5rem, 5vw, 4.5rem) clamp(2rem, 4vw, 3rem); border-bottom: 1px solid var(--rule); }
.page-plate-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(2rem, 5vw, 4.5rem); align-items: center; }
.page-plate h1 { margin-bottom: 0.25em; }
.page-plate .sheet { transform: rotate(1deg); }
.page-plate .sheet .mount { aspect-ratio: 3 / 2; }
.page-plate .caption { font-family: "IM Fell English", serif; font-style: italic; font-size: 1.05rem; color: var(--muted); margin-top: 0.8rem; text-align: center; }
@media (max-width: 860px) { .page-plate-grid { grid-template-columns: 1fr; } .page-plate .sheet { max-width: 30rem; } }

/* slips (bottom row, notices) */
.slip { background: var(--label-paper); border: 1px solid var(--rule-strong); padding: 1.5rem; position: relative; }
.slip h3 { font-size: 1.45rem; }
.slip ul { list-style: none; padding: 0; margin: 0; }
.slip li { border-bottom: 1px dotted var(--rule-strong); }
.slip li:last-child { border-bottom: 0; }
.slip li a { display: flex; justify-content: space-between; gap: 1rem; padding: 0.6rem 0; min-height: 44px; align-items: center; text-decoration: none; }
.slip li a:hover span:first-child { text-decoration: underline; }
.slip .aside { font-family: "Courier Prime", monospace; font-size: 0.875rem; color: var(--muted); }
.slip-dark { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.slip-dark h3 { color: var(--paper); }
.slip-dark .btn-secondary { border-color: var(--paper); color: var(--paper); }
.slip-dark .btn-secondary:hover { background: var(--paper); color: var(--ink); }

.notice { display: flex; gap: 1rem; align-items: flex-start; background: var(--leaf-soft); border-left: 4px solid var(--leaf); padding: 1.1rem 1.4rem; }
.notice p { margin: 0; }
.notice svg { width: 2rem; height: 2rem; flex: none; color: var(--leaf); }

/* ---------- footer ---------- */
.site-foot { border-top: 1px solid var(--rule); background: var(--sheet); margin-top: 3rem; padding-block: 3.5rem 2rem; }
.foot-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1.4fr; gap: 2.5rem; }
.site-foot h2 { font-size: 1.35rem; margin-bottom: 0.75rem; }
.site-foot ul { list-style: none; margin: 0; padding: 0; }
.site-foot li a { display: inline-block; padding: 0.3rem 0; text-decoration: none; color: var(--ink-soft); }
.site-foot li a:hover { color: var(--ink); text-decoration: underline; }
.foot-bottom { margin-top: 3rem; padding-top: 1.25rem; border-top: 1px solid var(--rule); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem; font-family: "Courier Prime", monospace; font-size: 0.875rem; color: var(--muted); }
@media (max-width: 900px) { .foot-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .foot-grid { grid-template-columns: 1fr; } }
.news-form { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }
.news-form input[type="email"] { flex: 1 1 12rem; font: inherit; font-size: 1.05rem; padding: 0.55rem 0.8rem; min-height: 48px; border: 1px solid var(--rule-strong); background: var(--label-paper); color: var(--ink); }
.news-form input::placeholder { color: var(--muted); }
.news-status { font-family: "Courier Prime", monospace; font-size: 0.9375rem; color: var(--leaf); min-height: 1.4em; margin: 0.5rem 0 0; }

/* ---------- writing page ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 1rem 2rem; align-items: center; margin-bottom: 1.5rem; }
.filter-group { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.filter-group .legend { font-family: "Courier Prime", monospace; font-size: 0.875rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-right: 0.3rem; }
.year-head { font-family: "IM Fell English", serif; font-size: 2rem; color: var(--leaf); margin: 2.5rem 0 0.5rem; display: flex; align-items: baseline; gap: 1rem; }
.year-head small { font-family: "Courier Prime", monospace; font-size: 0.875rem; color: var(--muted); }
.empty { text-align: center; padding: 3rem 1rem; border: 1px dashed var(--rule-strong); }
.empty svg { width: 5rem; height: 5rem; color: var(--leaf); margin: 0 auto 1rem; }
.count-line { font-family: "Courier Prime", monospace; font-size: 0.9375rem; color: var(--muted); }

.twin { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
@media (max-width: 780px) { .twin { grid-template-columns: 1fr; } }

/* ---------- about ---------- */
.vine { position: relative; list-style: none; margin: 2rem 0 0; padding: 0 0 0 3rem; }
.vine::before { content: ""; position: absolute; left: 0.9rem; top: 0.5rem; bottom: 0.5rem; width: 2px; background: var(--leaf); }
.vine > li { position: relative; padding-bottom: 2.5rem; }
.vine > li:last-child { padding-bottom: 0; }
.vine .node { position: absolute; left: -3rem; top: 0.1rem; width: 2rem; height: 2rem; color: var(--leaf); background: var(--paper); }
.vine h3 { margin-bottom: 0.2rem; }
.vine .period { font-family: "Courier Prime", monospace; font-size: 0.9375rem; color: var(--madder); }
.vine ul { margin: 0.6rem 0 0; padding-left: 1.1rem; }
.rings { display: flex; height: auto; border: 1px solid var(--rule-strong); margin: 1.5rem 0; flex-wrap: wrap; }
.rings span { flex: var(--w) 1 0; min-width: 7rem; padding: 0.6rem 0.7rem; border-right: 1px solid var(--rule-strong); font-family: "Courier Prime", monospace; font-size: 0.875rem; line-height: 1.3; background: var(--label-paper); }
.rings span b { display: block; font-family: "EB Garamond", serif; font-size: 1.05rem; font-weight: 600; color: var(--ink); }
.rings span:nth-child(odd) { background: var(--leaf-soft); }
details.history > summary { list-style: none; cursor: pointer; display: inline-flex; }
details.history > summary::-webkit-details-marker { display: none; }
details.history[open] > summary .when-closed, details.history:not([open]) > summary .when-open { display: none; }

.aphorisms { counter-reset: aph; list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem; }
.aphorisms li { counter-increment: aph; display: grid; grid-template-columns: 4rem 1fr; gap: 1rem; align-items: baseline; border-bottom: 1px solid var(--rule); padding-bottom: 1rem; }
.aphorisms li::before { content: counter(aph, upper-roman) "."; font-family: "IM Fell English", serif; font-size: 1.6rem; color: var(--madder); text-align: right; }
.aphorisms blockquote { margin: 0; font-family: "IM Fell English", serif; font-style: italic; font-size: clamp(1.4rem, 2.4vw, 1.8rem); color: var(--ink); line-height: 1.3; }

.key { list-style: none; padding: 0; margin: 0; }
.key > li { display: grid; grid-template-columns: 3.5rem 1fr; gap: 0.5rem 1rem; padding: 1.4rem 0; border-bottom: 1px dotted var(--rule-strong); }
.key .couplet { font-family: "Courier Prime", monospace; font-size: 1rem; color: var(--madder); padding-top: 0.2rem; }
.key .lead { font-size: 1.2rem; color: var(--ink); margin: 0 0 0.4rem; }
.key .lead .dots { color: var(--muted); }
.key .lead strong { font-family: "IM Fell English", serif; font-weight: 400; font-style: italic; font-size: 1.4rem; color: var(--leaf); }

/* ---------- article ---------- */
.art-head { padding-block: clamp(2rem, 4vw, 3.5rem) 2rem; }
.breadcrumb { font-family: "Courier Prime", monospace; font-size: 0.9375rem; margin-bottom: 1.25rem; display: flex; gap: 0.5rem; flex-wrap: wrap; color: var(--muted); }
.art-head-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(2rem, 4vw, 4rem); align-items: end; }
.art-head h1 { font-size: clamp(2.4rem, 5vw, 4rem); }
.art-plate { padding: 1.25rem; transform: rotate(-0.6deg); }
.art-plate .mount { aspect-ratio: auto; }
.art-plate .mount img { height: auto; }
.art-plate .label { margin-top: 1.25rem; }
@media (max-width: 860px) { .art-head-grid { grid-template-columns: 1fr; } }

.art-layout { display: grid; grid-template-columns: 15rem minmax(0, 1fr); gap: clamp(2rem, 4vw, 4rem); padding-block: 2rem 3rem; }
.toc { position: sticky; top: 6rem; align-self: start; }
.toc h2 { font-size: 1.2rem; font-style: italic; color: var(--leaf); margin-bottom: 0.6rem; }
.toc ol { list-style: none; margin: 0; padding: 0; counter-reset: toc; border-left: 1px solid var(--rule); }
.toc li { counter-increment: toc; }
.toc a { display: block; padding: 0.4rem 0 0.4rem 0.75rem; text-decoration: none; color: var(--ink-soft); font-size: 1.05rem; line-height: 1.3; margin-left: -1px; border-left: 2px solid transparent; }
.toc a::before { content: "Fig. " counter(toc); display: block; font-family: "Courier Prime", monospace; font-size: 0.8125rem; color: var(--muted); }
.toc a:hover { color: var(--ink); }
.toc a[aria-current="true"] { border-left-color: var(--madder); color: var(--ink); }
.toc-mobile { display: none; }
@media (max-width: 1000px) {
  .art-layout { grid-template-columns: minmax(0, 1fr); }
  .toc { display: none; }
  .toc-mobile { display: block; border: 1px solid var(--rule-strong); background: var(--label-paper); margin-bottom: 2rem; }
  .toc-mobile summary { padding: 0.8rem 1rem; cursor: pointer; font-family: "Courier Prime", monospace; text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.9375rem; min-height: 44px; }
  .toc-mobile ol { margin: 0; padding: 0 1rem 1rem 2.5rem; }
  .toc-mobile a { display: inline-block; padding: 0.25rem 0; }
}

.prose { font-size: 1.3125rem; line-height: 1.68; color: var(--ink-soft); max-width: 42rem; }
.prose > * + * { margin-top: 1.1em; }
.prose p { margin-bottom: 0; }
.prose h2 { font-size: clamp(1.9rem, 3vw, 2.4rem); margin: 2.4em 0 0.5em; display: flex; align-items: baseline; gap: 0.8rem; flex-wrap: wrap; }
.prose h2 .fig { font-family: "Courier Prime", monospace; font-size: 0.9rem; color: var(--madder); letter-spacing: 0.08em; }
.prose ol, .prose ul { padding-left: 1.4em; }
.prose li + li { margin-top: 0.35em; }
.prose code { font-family: "JetBrains Mono", "Courier Prime", monospace; font-size: 0.8em; background: var(--leaf-soft); padding: 0.08em 0.35em; border-radius: 3px; color: var(--ink); }
.prose em { font-style: italic; }
.prose strong { color: var(--ink); }
.prose blockquote { margin: 1.6em 0; padding: 1rem 1.25rem; border-left: 3px solid var(--rule-strong); background: var(--label-paper); font-size: 1.15rem; }
.prose blockquote p { margin: 0; }
.callout { position: relative; padding: 2.1rem 1.4rem 1.1rem !important; border: 1px solid var(--rule-strong) !important; border-left-width: 1px !important; }
.callout .slip-tag { position: absolute; top: -0.85rem; left: 1rem; background: var(--paper); padding: 0.1rem 0.6rem; font-family: "Courier Prime", monospace; font-size: 0.875rem; letter-spacing: 0.1em; text-transform: uppercase; border: 1px solid var(--rule-strong); }
.callout.nota { background: var(--leaf-soft) !important; }
.callout.nota .slip-tag { color: var(--leaf); }
.callout.quaeritur { background: var(--label-paper) !important; border-style: dashed !important; }
.callout.quaeritur .slip-tag { color: var(--madder); }
.callout.skill { border-left: 4px solid var(--indigo) !important; }
.callout.skill .slip-tag { color: var(--indigo); }

.code {
  margin: 1.8em 0; border: 1px solid var(--rule-strong); background: var(--code-bg); position: relative;
  width: min(100%, 48rem);
}
.code-head { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--rule); padding: 0.35rem 0.5rem 0.35rem 1rem; font-family: "Courier Prime", monospace; font-size: 0.875rem; color: var(--muted); }
.copy-btn { font-family: "Courier Prime", monospace; font-size: 0.875rem; border: 1px solid var(--rule-strong); background: var(--label-paper); color: var(--ink); padding: 0.3rem 0.8rem; min-height: 36px; cursor: pointer; }
.copy-btn:hover { border-color: var(--ink); }
.code pre { margin: 0; padding: 1rem 1.1rem; overflow-x: auto; font-family: "JetBrains Mono", monospace; font-size: 0.9375rem; line-height: 1.6; color: var(--ink); tab-size: 2; }
.code .tok-c { color: var(--muted); font-style: italic; }
.code .tok-s { color: var(--leaf); }
.code .tok-k { color: var(--madder); }
.code .tok-t { color: var(--indigo); }

.art-after { border-top: 1px solid var(--rule); padding-top: 2.5rem; margin-top: 3rem; max-width: 42rem; }
.share-row { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 1rem 0 2rem; }
.share-row .btn { font-size: 0.9375rem; min-height: 44px; padding: 0.5rem 1rem; }

/* ---------- patterns ---------- */
.three-ways { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; border: 1px solid var(--rule-strong); background: var(--label-paper); }
.three-ways > div { padding: 1.4rem 1.5rem; border-right: 1px solid var(--rule); }
.three-ways > div:last-child { border-right: 0; }
.three-ways h3 { font-size: 1.4rem; display: flex; gap: 0.5rem; align-items: baseline; }
.three-ways h3 .mono { font-size: 0.875rem; color: var(--madder); }
.three-ways p { margin: 0; }
.three-ways .foot { grid-column: 1 / -1; border-top: 1px solid var(--rule); border-right: 0; font-style: italic; }
@media (max-width: 800px) { .three-ways { grid-template-columns: 1fr; } .three-ways > div { border-right: 0; border-bottom: 1px solid var(--rule); } }

.pat-tools { display: grid; gap: 1rem; margin: 2.5rem 0 1.5rem; }
.pat-search { display: flex; }
.pat-search input { flex: 1; font: inherit; font-size: 1.15rem; padding: 0.8rem 1rem; min-height: 52px; border: 1.5px solid var(--rule-strong); background: var(--label-paper); color: var(--ink); min-width: 0; }
.pat-search input::placeholder { color: var(--muted); }
.pat-bar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; align-items: center; }
.pat-bar select { font: inherit; font-size: 1rem; padding: 0.4rem 0.6rem; min-height: 44px; background: var(--label-paper); color: var(--ink); border: 1px solid var(--rule-strong); }
.pat-bar .ghost { background: none; border: 0; font-family: "Courier Prime", monospace; color: var(--indigo); text-decoration: underline; cursor: pointer; font-size: 0.9375rem; min-height: 44px; }

.plate-card { display: flex; flex-direction: column; text-decoration: none; color: inherit; background: var(--sheet); border: 1px solid var(--rule); box-shadow: var(--shadow); transition: transform 200ms; }
.plate-card:hover { color: inherit; transform: translateY(-3px); border-color: var(--rule-strong); }
.plate-card .art { aspect-ratio: 16 / 9; border-bottom: 1px solid var(--rule); display: grid; place-items: center; color: var(--leaf); background:
  linear-gradient(var(--rule) 1px, transparent 1px) 0 0 / 100% 2rem, var(--label-paper); position: relative; }
.plate-card .art svg { width: 58%; height: 78%; }
.plate-card .art .tabno { position: absolute; left: 0.75rem; top: 0.5rem; font-family: "Courier Prime", monospace; font-size: 0.8125rem; color: var(--muted); letter-spacing: 0.1em; }
.plate-card .body { padding: 1.1rem 1.25rem 1.3rem; display: flex; flex-direction: column; gap: 0.45rem; flex: 1; }
.plate-card .fam { font-family: "IM Fell English", serif; font-style: italic; color: var(--leaf); font-size: 1.05rem; display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.badge { font-family: "Courier Prime", monospace; font-style: normal; font-size: 0.8125rem; letter-spacing: 0.08em; text-transform: uppercase; padding: 0.05rem 0.45rem; border: 1px solid currentColor; color: var(--madder); }
.badge.new { background: var(--madder); color: var(--paper); border-color: var(--madder); }
.plate-card h2 { font-size: 1.45rem; margin: 0; }
.plate-card:hover h2 { text-decoration: underline; text-decoration-thickness: 1px; }
.plate-card p { margin: 0; font-size: 1.08rem; }
.plate-card .good { font-size: 1rem; color: var(--muted); }
.plate-card .date { font-family: "Courier Prime", monospace; font-size: 0.875rem; color: var(--muted); }

/* pattern detail */
.use-list { columns: 2 16rem; padding-left: 1.2rem; margin: 0.5rem 0 1.5rem; }
.panes { border: 1px solid var(--rule-strong); background: var(--sheet); margin-top: 2rem; }
.pane-bar { display: flex; justify-content: space-between; flex-wrap: wrap; border-bottom: 1px solid var(--rule-strong); background: var(--label-paper); }
.pane-tabs { display: flex; flex-wrap: wrap; }
.pane-tabs button { font-family: "Courier Prime", monospace; font-size: 0.9375rem; background: none; border: 0; border-right: 1px solid var(--rule); color: var(--ink-soft); padding: 0.7rem 1.1rem; min-height: 48px; cursor: pointer; border-bottom: 3px solid transparent; }
.pane-tabs button[aria-selected="true"] { color: var(--ink); background: var(--sheet); border-bottom-color: var(--madder); }
.pane-actions { display: flex; gap: 0.5rem; padding: 0.4rem 0.6rem; align-items: center; }
.pane { padding: 1.5rem; }
.pane[hidden] { display: none; }
.pane pre { margin: 0; font-family: "JetBrains Mono", monospace; font-size: 0.9375rem; line-height: 1.6; overflow-x: auto; color: var(--ink); background: var(--code-bg); padding: 1rem; border: 1px solid var(--rule); }
.pane .note { font-size: 1.05rem; margin-bottom: 1rem; }
.prompt-text { max-width: 44rem; font-size: 1.15rem; }

/* hairline stat strip demo — tokens mirror the pattern library's */
.demo { --d-ground: var(--paper); --d-surface: var(--label-paper); --d-border: var(--rule-strong); --d-ink: var(--ink); --d-dim: var(--muted); --d-accent: var(--indigo); background: var(--d-ground); padding: 1.25rem; border: 1px dashed var(--rule); }
.demo .cap { font-size: 1.05rem; color: var(--d-dim); margin: 0 0 0.75rem; font-style: italic; }
.hss-strip { display: grid; gap: 1px; background: var(--d-border); border: 1px solid var(--d-border); border-radius: 6px; overflow: hidden; grid-template-columns: 1fr; margin-bottom: 1.5rem; }
@media (min-width: 21rem) { .hss-strip { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 42rem) { .hss-strip { grid-template-columns: repeat(4, 1fr); } }
.hss-strip.five { grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); }
.hss-tile { background: var(--d-surface); padding: 0.9rem 1rem; display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; text-align: left; border: 0; font: inherit; color: var(--d-ink); }
.hss-tile .k { font-family: "Courier Prime", monospace; font-size: 0.8125rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--d-dim); }
.hss-tile .v { font-family: "EB Garamond", serif; font-weight: 700; font-size: 1.7rem; font-variant-numeric: tabular-nums; line-height: 1.1; }
.hss-tile .v.none { color: var(--d-dim); font-weight: 400; }
.hss-tile .u { font-size: 0.95rem; color: var(--d-dim); }
button.hss-tile { cursor: pointer; min-height: 44px; }
button.hss-tile:hover { background: color-mix(in srgb, var(--d-accent) 7%, var(--d-surface)); }
button.hss-tile[aria-pressed="true"] { background: color-mix(in srgb, var(--d-accent) 16%, var(--d-surface)); box-shadow: inset 0 -3px 0 var(--d-accent); }
button.hss-tile:focus-visible { outline-offset: -4px; }
.dl-list { list-style: none; padding: 0; margin: 0; border: 1px solid var(--d-border); background: var(--d-surface); }
.dl-list li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.55rem 0.9rem; border-bottom: 1px solid var(--rule); flex-wrap: wrap; }
.dl-list li:last-child { border-bottom: 0; }
.dl-list li[hidden] { display: none; }
.dl-list .st { font-family: "Courier Prime", monospace; font-size: 0.875rem; color: var(--d-dim); }
.status-line { font-family: "Courier Prime", monospace; font-size: 0.9375rem; color: var(--d-dim); margin: 0.75rem 0 0; }

/* ---------- projects ---------- */
.jump { position: sticky; top: 4.5rem; z-index: 20; background: color-mix(in srgb, var(--paper) 94%, transparent); border-bottom: 1px solid var(--rule); backdrop-filter: blur(6px); }
.jump ul { list-style: none; display: flex; gap: 0.3rem 1.2rem; margin: 0; padding: 0.4rem 0; overflow-x: auto; }
.jump a { display: inline-flex; align-items: center; min-height: 44px; font-family: "Courier Prime", monospace; font-size: 0.9375rem; text-decoration: none; white-space: nowrap; color: var(--ink-soft); }
.jump a:hover { color: var(--ink); text-decoration: underline; }
.jump .n { color: var(--muted); margin-left: 0.3rem; }

.featured-plate { display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); gap: 2.5rem; align-items: center; }
@media (max-width: 860px) { .featured-plate { grid-template-columns: 1fr; } }
.featured-plate .mount { aspect-ratio: 16 / 10; }

.spec-row { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(1.5rem, 4vw, 3.5rem); align-items: center; padding-block: 2.2rem; border-bottom: 1px solid var(--rule); }
.spec-row:nth-child(even) .mount-wrap { order: 2; }
.spec-row .mount { aspect-ratio: 16 / 10; background: var(--leaf-soft); }
.spec-row .mount.drawn { display: grid; place-items: center; color: var(--leaf); }
.spec-row .mount.drawn svg { width: 55%; height: 85%; }
.spec-row h3 { font-size: 1.9rem; }
.spec-row .stat-line { font-family: "Courier Prime", monospace; font-size: 0.9375rem; color: var(--muted); }
@media (max-width: 760px) { .spec-row { grid-template-columns: 1fr; } .spec-row:nth-child(even) .mount-wrap { order: 0; } }

.label-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); gap: 1.25rem; }
.label-card { text-decoration: none; color: inherit; display: flex; flex-direction: column; }
.label-card:hover { background: var(--leaf-soft); color: inherit; }
.label-card .label-title { font-size: 1.35rem; }
.label-card p { font-family: "EB Garamond", serif; font-size: 1.05rem; margin: 0.25rem 0 0.75rem; color: var(--ink-soft); }
.label-card .meta { margin-top: auto; font-size: 0.875rem; color: var(--muted); display: flex; justify-content: space-between; gap: 0.5rem; }

.tray { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 1.25rem; }
.cell { background: var(--sheet); border: 1px solid var(--rule); padding: 0.9rem; display: flex; flex-direction: column; gap: 0.4rem; text-decoration: none; color: inherit; }
.cell:hover { border-color: var(--rule-strong); color: inherit; }
.cell .mount { aspect-ratio: 16 / 10; margin-bottom: 0.5rem; background: var(--leaf-soft); }
.cell .mount.drawn { display: grid; place-items: center; color: var(--leaf); }
.cell .mount.drawn svg { width: 40%; height: 80%; }
.cell h3 { font-size: 1.3rem; margin: 0; }
.cell p { margin: 0; font-size: 1.02rem; }
.cell .meta { font-size: 0.875rem; color: var(--muted); margin-top: auto; }

/* ---------- stories ---------- */
.fable { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); gap: 2rem; align-items: start; padding-block: 2rem; border-bottom: 1px solid var(--rule); text-decoration: none; color: inherit; }
.fable:hover { color: inherit; }
.fable:hover h3 { text-decoration: underline; text-decoration-thickness: 1px; }
.fable .mount { aspect-ratio: 4 / 3; }
.fable .part { font-family: "IM Fell English", serif; font-size: 3rem; line-height: 1; color: var(--madder); }
@media (max-width: 700px) { .fable { grid-template-columns: 1fr; } }
.dormant { opacity: 1; border: 1px dashed var(--rule-strong); padding: 1.25rem; background: transparent; }
.dormant .kind { color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
  .specimen:hover, .plate-card:hover { transform: none; }
}

.prose pre code { background: none; padding: 0; font-size: inherit; border-radius: 0; color: inherit; }

/* Optional generated assets (see meta.json). If missing, the SVG grain and hand-drawn fern already carry the look. */
:root:not([data-theme="dark"]) body { background-image: url("assets/herbarium-paper.jpg"); background-size: 900px auto; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) body { background-image: none; } }
.hero::after {
  content: ""; position: absolute; right: 0; bottom: 0; width: min(26rem, 40vw); height: 100%;
  background: url("assets/engraved-fern-plate.png") right bottom / contain no-repeat;
  opacity: 0.22; pointer-events: none; z-index: -1;
}
:root[data-theme="dark"] .hero::after { opacity: 0.12; filter: invert(1); }

/* gallery article */
.prose .prose-plate { margin: 1.6em 0; }
.prose .prose-plate .mount img { display: block; width: 100%; height: auto; aspect-ratio: auto; object-fit: contain; }
.prose blockquote p + p { margin-top: .75rem; }
.prose code { overflow-wrap: anywhere; }
