/* Bob's Butterflies */

@font-face {
  font-family: 'Fraunces';
  src: url('/fonts/fraunces.woff2') format('woff2');
  font-weight: 100 900; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Fraunces';
  src: url('/fonts/fraunces-italic.woff2') format('woff2');
  font-weight: 100 900; font-style: italic; font-display: swap;
}

/* Colours from Bob's favourite butterfly, the Sword-tailed Flash: near-black
   wings, an electric-blue hindwing patch, and orange sword-like tails. */
:root {
  color-scheme: light;
  --paper: #f5f3ee;
  --surface: #fffefb;
  --surface-2: #ebe8e0;
  --ink: #1b1f2e;
  --ink-2: #4a4f60;
  --ink-3: #6b7080;
  --line: #dcd8cd;
  --primary: #2f4fd1;
  --primary-hover: #243eaa;
  --primary-ink: #ffffff;
  --primary-soft: #e4e9fb;
  --accent: #e2832a;          /* decorative: borders, arrows, the tails */
  --accent-text: #a8550f;     /* orange that is readable as small text */
  --wing: #1b1f2e;
  --wing-stroke: none;
  --flash: #3557e0;
  --mark-body: #1b1f2e;
  --shadow: 0 1px 2px rgb(27 31 46 / 6%), 0 6px 20px rgb(27 31 46 / 7%);
  --radius: 12px;
  --radius-sm: 6px;
  --wrap: 1180px;
  --gutter: clamp(16px, 4vw, 32px);
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --paper: #111319;
    --surface: #181b24;
    --surface-2: #212532;
    --ink: #e8eaf1;
    --ink-2: #b4b9c8;
    --ink-3: #8d93a4;
    --line: #2c3140;
    --primary: #93a7ff;
    --primary-hover: #b0bfff;
    --primary-ink: #0f1220;
    --primary-soft: #222a48;
    --accent: #f09a46;
    --accent-text: #f2a65c;
    --wing: #2a3045;
    --wing-stroke: #8a93ad;
    --flash: #6f8cff;
    --mark-body: #d5dae6;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%);
  }
}

/* ---------------------------------------------------------------- base */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 16px; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.6 var(--font-body);
  overflow-x: hidden;
}
main { flex: 1; }
img { max-width: 100%; height: auto; }
a { color: var(--primary); text-underline-offset: .15em; text-decoration-thickness: 1px; }
a:hover { color: var(--primary-hover); text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

h1, h2, h3 {
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -.01em;
  margin: 0 0 .5em;
  text-wrap: balance;
}
h1 { font-size: clamp(2rem, 1.4rem + 2.6vw, 3rem); }
h2 { font-size: clamp(1.4rem, 1.15rem + 1vw, 1.8rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
.sci { font-style: italic; }
h1 .sci, h2 .sci, .species-sci .sci { font-family: var(--font-display); font-weight: 500; }
.muted { color: var(--ink-3); font-size: .92em; }
.note { color: var(--ink-3); font-size: .9rem; margin-top: 1.5rem; }
.lede { font-size: 1.12rem; color: var(--ink-2); max-width: 68ch; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .78rem; font-weight: 600; color: var(--accent-text); margin-bottom: .4rem; }
.visually-hidden, .toggle-input {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }
main { min-height: 60vh; padding-bottom: 4rem; }

.skip-link { position: absolute; left: 8px; top: -60px; z-index: 10; background: var(--primary); color: var(--primary-ink); padding: 8px 14px; border-radius: var(--radius-sm); }
.skip-link:focus { top: 8px; }

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em; font: inherit; cursor: pointer;
  padding: .65em 1.2em; border-radius: 999px;
  background: var(--primary); color: var(--primary-ink);
  font-weight: 600; text-decoration: none; line-height: 1.2;
  border: 1px solid var(--primary);
}
.button:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--primary-ink); }
.button-quiet { background: transparent; color: var(--primary); }
.button-quiet:hover { background: var(--primary-soft); color: var(--primary); }
.actions { display: flex; flex-wrap: wrap; gap: .6rem; }

/* ---------------------------------------------------------------- mark */

.mark { width: 38px; height: 38px; flex: none; }
.mark .wing, .mark .spot { fill: var(--wing); }
.mark .wing { stroke: var(--wing-stroke); stroke-width: 1; }
.mark .flash { fill: var(--flash); }
.mark .tail { fill: var(--accent); }
.mark .body { fill: var(--mark-body); }
.mark .antenna { fill: none; stroke: var(--mark-body); stroke-width: 1.3; stroke-linecap: round; }
/* Placeholder for species without photos: an outline of the mark. */
.mark-ghost .wing, .mark-ghost .flash, .mark-ghost .tail { fill: none; stroke: var(--line); stroke-width: 1.4; }
.mark-ghost .spot, .mark-ghost .body { fill: var(--line); }
.mark-ghost .antenna { stroke: var(--line); }
.mark.big { width: 120px; height: 120px; }

/* ---------------------------------------------------------------- header */

.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.header-bar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas: "brand nav search";
  align-items: center;
  gap: 12px 24px;
  min-height: 68px;
  padding-block: 10px;
}
.brand { grid-area: brand; display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand:hover { color: var(--ink); }
.brand-name { font-family: var(--font-display); font-weight: 650; font-size: 1.3rem; letter-spacing: -.01em; white-space: nowrap; }
.site-nav { grid-area: nav; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 2px; }
.site-nav a {
  display: block; padding: 6px 8px; border-radius: var(--radius-sm);
  color: var(--ink-2); text-decoration: none; font-size: .95rem; font-weight: 500;
}
.site-nav a:hover { background: var(--surface-2); color: var(--ink); }
.site-nav a[aria-current="page"] { color: var(--primary); background: var(--primary-soft); }
.header-bar > .search { grid-area: search; width: 170px; }
.menu-button { display: none; }

@media (max-width: 1140px) {
  .header-bar { grid-template-columns: 1fr auto; grid-template-areas: "brand menu" "search search" "nav nav"; }
  .header-bar > .search { width: 100%; }
  .menu-button {
    grid-area: menu; display: inline-flex; align-items: center; gap: 8px;
    font: inherit; font-size: .95rem; font-weight: 600; color: var(--ink);
    background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; cursor: pointer;
  }
  .menu-icon, .menu-icon::before, .menu-icon::after { display: block; width: 16px; height: 2px; background: currentColor; border-radius: 1px; position: relative; }
  .menu-icon::before, .menu-icon::after { content: ""; position: absolute; left: 0; }
  .menu-icon::before { top: -5px; } .menu-icon::after { top: 5px; }
  .site-nav:not(.open) { display: none; }   /* without JS, the footer links still work */
  .site-nav ul { flex-direction: column; padding-bottom: 6px; }
  .site-nav a { padding: 10px 8px; font-size: 1rem; }
}

/* ---------------------------------------------------------------- search */

.search { position: relative; display: flex; }
.search-input {
  width: 100%; min-width: 0;
  font: inherit; font-size: .95rem; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 40px 8px 16px;
}
.search-input::placeholder { color: var(--ink-3); }
.search-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 25%, transparent); }
.search-button {
  position: absolute; right: 4px; top: 50%; translate: 0 -50%;
  width: 32px; height: 32px; display: grid; place-items: center;
  background: none; border: 0; color: var(--ink-2); cursor: pointer; border-radius: 50%;
}
.search-button svg { width: 18px; height: 18px; }
.search-large .search-input { font-size: 1.1rem; padding: 14px 54px 14px 22px; background: var(--surface); box-shadow: var(--shadow); }
.search-large .search-button { right: 8px; width: 42px; height: 42px; }
.search-large .search-button svg { width: 22px; height: 22px; }
.search-results {
  position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; right: 0;
  margin: 0; padding: 6px; list-style: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  max-height: min(70vh, 460px); overflow: auto; min-width: 280px; text-align: left;
}
.search-results li a { display: block; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--ink); text-decoration: none; line-height: 1.3; }
.search-results li a .sci, .search-results li a small { display: block; font-size: .85rem; color: var(--ink-3); }
.search-results li[aria-selected="true"] a, .search-results li a:hover { background: var(--primary-soft); }
.search-results .result-kind { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); padding: 8px 10px 2px; }
.search-results .result-all a { color: var(--primary); font-weight: 600; }

/* ---------------------------------------------------------------- home */

.hero { text-align: center; padding-top: clamp(32px, 6vw, 72px); overflow: hidden; }
.hero-body { position: relative; }
.hero-title {
  display: inline-flex; align-items: center; gap: .3em; justify-content: center;
  font-size: clamp(2.4rem, 1.4rem + 4.5vw, 4.4rem); font-weight: 650; margin-bottom: .25em;
}
.hero-mark { width: 1.15em; height: 1.15em; }
.hero-lede { font-size: clamp(1.1rem, 1rem + .5vw, 1.35rem); color: var(--ink-2); max-width: 36ch; margin: 0 auto 1.6em; text-wrap: balance; }
.hero .search { max-width: 560px; margin: 0 auto; }
.hero-stats { list-style: none; padding: 0; margin: 1.4rem 0 0; display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 26px; color: var(--ink-3); font-size: .95rem; }
.hero-stats strong { color: var(--ink); font-family: var(--font-display); font-size: 1.15rem; font-weight: 600; }
.hero-mosaic {
  order: 2; margin-top: clamp(32px, 5vw, 56px);
  display: grid; gap: 4px;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}
.hero { display: flex; flex-direction: column; }
.mosaic-row { display: flex; gap: 4px; justify-content: center; }
.mosaic-row:nth-child(even) { translate: 72px 0; }
.mosaic-row img { width: 216px; height: 72px; object-fit: cover; border-radius: 4px; flex: none; }
@media (max-width: 600px) {
  .hero-title { flex-direction: column; gap: .05em; }
  .mosaic-row img { width: 150px; height: 50px; }
  .mosaic-row:nth-child(even) { translate: 50px 0; }
}

.memorial {
  display: grid; grid-template-columns: minmax(180px, 300px) 1fr; gap: clamp(24px, 5vw, 64px); align-items: center;
  margin-top: clamp(48px, 8vw, 96px);
}
.memorial-photo { width: 100%; max-width: 300px; height: auto; display: block; margin-inline: auto; }
.memorial h2 { font-size: clamp(1.8rem, 1.3rem + 2vw, 2.6rem); }
.dates { font-family: var(--font-display); font-weight: 400; color: var(--ink-3); white-space: nowrap; }
.memorial h2 .dates { font-size: .6em; margin-left: .3em; }
blockquote { margin: 1.4em 0; padding: .2em 0 .2em 1.2em; border-left: 3px solid var(--accent); }
blockquote p { font-family: var(--font-display); font-style: italic; font-size: 1.18rem; line-height: 1.55; color: var(--ink); }
blockquote footer { color: var(--ink-3); font-size: .9rem; }
@media (max-width: 680px) {
  .memorial { grid-template-columns: 1fr; text-align: center; }
  .memorial-photo { max-width: 220px; }
  .memorial blockquote { text-align: left; }
  .memorial .actions { justify-content: center; }
}

.explore { margin-top: clamp(48px, 7vw, 88px); }
.explore-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.explore-grid a {
  display: flex; flex-direction: column; gap: 6px; height: 100%;
  padding: 20px 20px 22px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
  color: var(--ink-2); text-decoration: none; transition: border-color .15s, transform .15s;
}
.explore-grid a:hover { border-color: var(--primary); transform: translateY(-2px); color: var(--ink-2); }
.explore-grid strong { font-family: var(--font-display); font-size: 1.25rem; font-weight: 600; color: var(--ink); }
.explore-grid strong::after { content: "\00a0→"; color: var(--accent); }

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

.page-head { padding-top: clamp(28px, 5vw, 56px); margin-bottom: 1.6rem; }
.breadcrumb { padding-top: clamp(20px, 3vw, 32px); font-size: .9rem; }
.breadcrumb ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.breadcrumb li:not(:last-child)::after { content: "›"; margin-left: 6px; color: var(--ink-3); }
.breadcrumb a { color: var(--ink-2); }
.breadcrumb + .page-head, .breadcrumb + .species-head { padding-top: 12px; }

/* cards */
.card-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 14px; }
.card a {
  display: flex; flex-direction: column; height: 100%;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; color: var(--ink); text-decoration: none; transition: border-color .15s, transform .15s;
}
.card a:hover { border-color: var(--primary); transform: translateY(-2px); color: var(--ink); }
.card-img { aspect-ratio: 4 / 3; display: grid; place-items: center; background: var(--surface-2); overflow: hidden; }
.card-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-img.shape-strip img { height: auto; aspect-ratio: 3 / 1; }
.card-img.shape-square img { width: 60%; height: auto; aspect-ratio: 1; border-radius: 4px; }
.card-empty .mark { width: 42%; height: auto; opacity: .9; }
.card-text { padding: 10px 14px 14px; display: flex; flex-direction: column; gap: 2px; line-height: 1.3; }
.card-text strong { font-weight: 600; }
.card-text .sci { color: var(--ink-2); font-size: .9rem; }
.card-sub { color: var(--ink-3); font-size: .82rem; margin-top: 4px; }

/* species index */
.browse-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-bottom: 1rem; }
.toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: .95rem; color: var(--ink-2); }
.toggle::before {
  content: ""; width: 38px; height: 22px; border-radius: 999px; flex: none;
  background: var(--surface-2); border: 1px solid var(--line);
  background-image: radial-gradient(circle at 11px 50%, var(--surface) 0 7px, transparent 7.5px);
  transition: background-color .15s, background-position .15s;
}
.toggle-input:checked + .toggle::before { background-color: var(--primary); background-position: 16px 0; border-color: var(--primary); }
.toggle-input:focus-visible + .toggle::before { outline: 3px solid var(--accent); outline-offset: 2px; }
.family-jump { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.family-jump a, .letters a {
  display: inline-block; padding: 3px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-2); font-size: .88rem; text-decoration: none;
}
.family-jump a:hover, .letters a:hover { border-color: var(--primary); color: var(--primary); }
.family { margin-top: 2.4rem; }
.family h2 { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2em .5em; }
.family-sci { font-family: var(--font-body); font-size: .9rem; font-weight: 400; color: var(--ink-3); letter-spacing: 0; }
.browse:not(:has(#show-all:checked)) .card[data-photos="0"],
.browse:not(:has(#show-all:checked)) .family[data-with-photos="0"] { display: none; }

/* species page */
.species-head { padding-top: clamp(24px, 4vw, 44px); margin-bottom: 2rem; }
.species-head h1 { margin-bottom: .1em; }
.species-sci { font-size: clamp(1.15rem, 1rem + .6vw, 1.45rem); color: var(--ink-2); margin-bottom: .5rem; }
.species-meta { color: var(--ink-3); margin-bottom: .4rem; }
.species-aka { color: var(--ink-2); }
.species-aka span { color: var(--ink-3); }
.species-summary { max-width: 72ch; font-size: 1.05rem; color: var(--ink-2); margin: -0.6rem 0 1.4rem; }
.species-page section { margin-top: 2.4rem; }
.subspecies-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.subspecies-list li { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.life-cycle h2 { border-bottom: 1px solid var(--line); padding-bottom: .35em; }
.stage { margin-top: 1.4rem; }
.stage h3 { font-family: var(--font-body); font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-3); margin-bottom: .7rem; }
/* Bob's photos come in sets: side/top pairs for caterpillars and pupae, and
   male upper/under + female upper/under for adults. One set per row. */
.photo-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; justify-content: start; }
.photo-grid.shape-strip { grid-template-columns: repeat(2, minmax(0, 330px)); }
.photo-grid.shape-wide { grid-template-columns: repeat(4, minmax(0, 260px)); }
.photo-grid.shape-square { grid-template-columns: repeat(auto-fill, 140px); }
@media (max-width: 760px) {
  .photo-grid.shape-strip { grid-template-columns: minmax(0, 330px); }
  .photo-grid.shape-wide { grid-template-columns: repeat(2, minmax(0, 260px)); }
}
.photo-grid figure { margin: 0; }
.photo-grid a { display: block; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); }
.photo-grid img { display: block; transition: transform .25s; }
.photo-grid a:hover img { transform: scale(1.03); }
.photo-grid.shape-strip img { width: 100%; aspect-ratio: 3 / 1; }
.photo-grid.shape-wide img { width: 100%; aspect-ratio: 4 / 3; }
.photo-grid.shape-square img { width: 140px; aspect-ratio: 1; }
.photo-grid figcaption { font-size: .85rem; color: var(--ink-3); margin-top: 5px; }
.photo-grid li:target a { outline: 3px solid var(--accent); outline-offset: 3px; }
.photo-credit { color: var(--ink-3); font-size: .92rem; margin-top: 1.6rem; }
.no-photos { padding: 28px; border: 1px dashed var(--line); border-radius: var(--radius); background: var(--surface); }
.book-refs ul, .references { padding-left: 1.2em; }
.book-refs li, .references li { margin-bottom: .4em; }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips a {
  display: inline-block; padding: 4px 12px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-size: .92rem;
}
.chips a:hover { border-color: var(--primary); color: var(--primary); }

/* colour search */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 1.2rem; overflow-x: auto; }
.tabs a {
  padding: 10px 16px; color: var(--ink-2); text-decoration: none; font-weight: 600;
  border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--primary); border-bottom-color: var(--primary); }
.colour-filter { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 1.4rem; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px 5px 10px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-size: .92rem;
}
.chip:hover { border-color: var(--primary); color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.chip-all { padding-left: 14px; }
.chip-count { color: var(--ink-3); font-size: .82rem; }
.chip[aria-pressed="true"] .chip-count { color: inherit; opacity: .7; }
.swatch { width: 14px; height: 14px; border-radius: 50%; flex: none; box-shadow: inset 0 0 0 1px rgb(0 0 0 / 15%); }
.swatch-green { background: #4f9a3c; } .swatch-yellow { background: #e6c933; } .swatch-orange { background: #e5832a; }
.swatch-red { background: #c73b2b; } .swatch-pink { background: #e58fb0; } .swatch-purple { background: #7b4fa0; }
.swatch-blue { background: #3c7fd0; } .swatch-brown { background: #80562f; } .swatch-black { background: #1d1d1b; }
.swatch-grey { background: #9a9a94; } .swatch-white { background: #f7f5ef; }
.colour-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.colour-grid.shape-strip { grid-template-columns: repeat(auto-fill, minmax(min(46vw, 200px), 1fr)); }
.colour-grid.shape-wide { grid-template-columns: repeat(auto-fill, minmax(min(30vw, 150px), 1fr)); }
.colour-grid a { position: relative; display: block; border-radius: 4px; overflow: hidden; background: var(--surface-2); }
.colour-grid img { display: block; width: 100%; height: auto; }
.colour-grid.shape-strip img { aspect-ratio: 3 / 1; }
.colour-grid.shape-wide img { aspect-ratio: 4 / 3; }
.tile-name {
  position: absolute; inset: auto 0 0 0; padding: 14px 8px 4px;
  font-size: .78rem; line-height: 1.2; color: #fff; text-shadow: 0 1px 2px rgb(0 0 0 / 60%);
  background: linear-gradient(transparent, rgb(0 0 0 / 65%));
  opacity: 0; transition: opacity .15s;
}
.colour-grid a:hover .tile-name, .colour-grid a:focus-visible .tile-name { opacity: 1; }
@media (hover: none) { .tile-name { opacity: 1; } }

/* plants */
.filter-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 1rem; max-width: 520px; }
.filter-bar label { font-weight: 600; }
.filter-bar input {
  flex: 1; font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 999px; padding: 8px 16px;
}
.letters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 1.4rem; }
.letters a { padding: 3px 10px; min-width: 34px; text-align: center; }
.letter-group { margin-top: 1.6rem; }
.letter-group h2 { font-size: 1.5rem; border-bottom: 1px solid var(--line); padding-bottom: .3em; }
.plant-list { list-style: none; margin: 0; padding: 0; columns: 16rem auto; column-gap: 2rem; }
.plant-list li { break-inside: avoid; display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; border-bottom: 1px dotted var(--line); }
.plant-list a, .result-list a { text-decoration: none; }
.plant-list a:hover, .result-list a:hover { text-decoration: underline; }
.badge { font-size: .78rem; color: var(--ink-3); background: var(--surface-2); border-radius: 999px; padding: 1px 8px; align-self: center; }
.more { margin-top: 2rem; }

/* activities */
.activity-groups { display: grid; gap: 22px; }
.activity-group {
  display: grid; grid-template-columns: 240px 1fr; gap: 24px; align-items: start;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px;
}
.activity-group img { width: 100%; border-radius: var(--radius-sm); }
.activity-list { margin: 0; padding-left: 1.1em; columns: 15rem auto; }
.activity-list li { margin-bottom: .35em; break-inside: avoid; }
.activity-list .quiet { color: var(--ink-3); font-size: .9rem; }
@media (max-width: 640px) { .activity-group { grid-template-columns: 1fr; } .activity-group img { max-width: 320px; } }

/* book */
.book-hero { display: grid; grid-template-columns: 220px 1fr; gap: clamp(24px, 5vw, 56px); align-items: center; padding-top: clamp(28px, 5vw, 56px); }
.book-cover {
  aspect-ratio: 210 / 297; border-radius: 4px 10px 10px 4px; padding: 22px 18px;
  display: flex; flex-direction: column; justify-content: flex-end; gap: 6px;
  background: linear-gradient(160deg, #2a3f9e, #121838); color: #fdf6e8;
  box-shadow: inset 6px 0 0 rgb(0 0 0 / 18%), 0 10px 30px rgb(20 30 20 / 25%);
}
.book-mark { width: 64px; height: 64px; margin-bottom: auto; }
.book-cover .mark { --wing: #0e1330; --wing-stroke: #7d8bc9; --flash: #6f8cff; --accent: #f09a46; --mark-body: #fdf6e8; }
.book-cover-title { font-family: var(--font-display); font-size: 1.6rem; font-weight: 650; line-height: 1.1; }
.book-cover-sub { font-size: .8rem; opacity: .8; }
.contents { margin-top: 3rem; max-width: 820px; }
.contents-section { margin-top: 1.6rem; }
.contents-section h3 { font-family: var(--font-body); font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-3); }
.contents-list { list-style: none; margin: 0; padding: 0; }
.contents-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; padding: 6px 0; border-bottom: 1px dotted var(--line); }
.contents-species { font-size: .88rem; display: inline-flex; flex-wrap: wrap; gap: 0 10px; }
.contents-species a { color: var(--ink-3); text-decoration: none; }
.contents-species a:hover { color: var(--primary); text-decoration: underline; }
.page-no { margin-left: auto; color: var(--ink-3); font-variant-numeric: tabular-nums; }
@media (max-width: 600px) { .book-hero { grid-template-columns: 1fr; } .book-cover { max-width: 200px; } }

/* about Bob */
.bob-head { display: grid; grid-template-columns: 220px 1fr; gap: clamp(20px, 4vw, 48px); align-items: center; padding-top: clamp(28px, 5vw, 56px); }
.bob-head .memorial-photo { max-width: 220px; }
.bob-head .dates { font-size: 1.3rem; }
.prose { max-width: 70ch; margin-top: 2rem; }
.prose h2 { margin-top: 2rem; }
.intro-quote p { font-size: 1.25rem; }
@media (max-width: 600px) { .bob-head { grid-template-columns: 1fr; text-align: center; } .bob-head .memorial-photo { max-width: 180px; } }

/* search page, 404 */
.search-page { padding-top: clamp(28px, 5vw, 56px); }
.search-page .search { max-width: 620px; margin-bottom: 2rem; }
.result-list { list-style: none; padding: 0; margin: 0 0 2rem; }
.result-list li { padding: 8px 0; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.result-list a { text-decoration: none; }
.result-list a strong { color: var(--ink); margin-right: 6px; }
.not-found { text-align: center; padding-top: clamp(40px, 8vw, 96px); }
.not-found .search { max-width: 520px; margin: 0 auto 1.5rem; }
.not-found .lede { margin-inline: auto; }

/* ---------------------------------------------------------------- lightbox */

.lightbox {
  border: 0; padding: 0; margin: auto; max-width: min(96vw, 1400px); max-height: 96vh;
  background: transparent; color: #f2f2ee; overflow: visible;
}
.lightbox::backdrop { background: rgb(10 12 10 / 88%); }
.lightbox-inner { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.lightbox img {
  max-width: min(96vw, 1400px); max-height: calc(96vh - 110px); width: auto; height: auto;
  min-width: min(92vw, 820px);           /* many of Bob's older photos are small: show them big */
  object-fit: contain; border-radius: 6px; display: block;
}
.lightbox-caption { text-align: center; font-size: .95rem; line-height: 1.45; }
.lightbox-caption strong { font-family: var(--font-display); font-size: 1.15rem; font-weight: 600; }
.lightbox-caption a { color: #f6bc7c; }
.lightbox-close, .lightbox-prev, .lightbox-next {
  position: fixed; background: rgb(255 255 255 / 12%); color: #fff; border: 0; cursor: pointer;
  width: 46px; height: 46px; border-radius: 50%; font-size: 1.5rem; line-height: 1; display: grid; place-items: center;
}
.lightbox-close:hover, .lightbox-prev:hover, .lightbox-next:hover { background: rgb(255 255 255 / 24%); }
.lightbox-close { top: 14px; right: 14px; }
.lightbox-prev { left: 14px; top: 50%; translate: 0 -50%; }
.lightbox-next { right: 14px; top: 50%; translate: 0 -50%; }
@media (max-width: 700px) { .lightbox-prev, .lightbox-next { top: auto; bottom: 14px; translate: none; } }

/* ---------------------------------------------------------------- footer */

.site-footer { background: var(--surface); border-top: 1px solid var(--line); padding: 32px 0 40px; color: var(--ink-2); font-size: .92rem; }
.footer-inner { display: grid; grid-template-columns: auto 1fr; gap: 18px 32px; align-items: center; }
.footer-memorial { display: flex; align-items: center; gap: 14px; }
.footer-memorial img { border-radius: 50%; }
.footer-memorial strong { font-family: var(--font-display); font-weight: 600; color: var(--ink); font-size: 1rem; }
.footer-licence { margin: 0; max-width: 60ch; }
.footer-nav { grid-column: 1 / -1; list-style: none; margin: 0; padding: 14px 0 0; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 4px 18px; }
.footer-nav a { color: var(--ink-2); }
@media (max-width: 700px) { .footer-inner { grid-template-columns: 1fr; } }

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

/* about Bob: favourite butterfly */
.favourite { margin: 0 0 1rem; max-width: 420px; }
.favourite img { display: block; width: 100%; height: auto; border-radius: var(--radius-sm); }
.favourite figcaption { font-size: .85rem; color: var(--ink-3); margin-top: 6px; }

/* ---------------------------------------------------------------- forms */

.narrow { max-width: 620px; }
.form { display: grid; gap: 10px; max-width: 760px; }
.form label, .form legend { font-weight: 600; font-size: .95rem; }
.form input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]), .form select, .form textarea, .reject-form input, .filter-bar input, .role-form select {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 9px 12px; width: 100%;
}
.form input:focus, .form select:focus, .form textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent); }
.form .button { justify-self: start; margin-top: 6px; }
.code-input { font-size: 1.6rem !important; letter-spacing: .3em; max-width: 240px; font-variant-numeric: tabular-nums; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400 !important; }
.check input { margin-top: .35em; }
.choices { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px 6px; margin: 6px 0; display: grid; gap: 10px; }
.choice { display: flex; gap: 10px; align-items: flex-start; font-weight: 400 !important; }
.choice input { margin-top: .35em; }
.tag { display: inline-block; font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--primary); background: var(--primary-soft); border-radius: 999px; padding: 1px 8px; vertical-align: middle; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.field-row > div { display: grid; gap: 6px; align-content: start; }
.notice { background: var(--primary-soft); border-radius: var(--radius-sm); padding: 10px 14px; max-width: 760px; }
.notice-error, .form-error { background: color-mix(in srgb, #c73b2b 14%, var(--surface)); color: var(--ink); border-radius: var(--radius-sm); padding: 10px 14px; }

/* upload */
.upload-step { border-top: 1px solid var(--line); padding-top: 18px; margin-top: 10px; display: grid; gap: 10px; }
.upload-step h2 { font-size: 1.3rem; display: flex; align-items: center; gap: 10px; }
.step { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--primary); color: var(--primary-ink); font-family: var(--font-body); font-size: .95rem; }
.file-drop { display: grid; place-items: center; min-height: 120px; border: 2px dashed var(--line); border-radius: var(--radius); background: var(--surface); cursor: pointer; text-align: center; padding: 16px; font-weight: 600 !important; color: var(--primary); }
.file-drop.dragging, .file-drop:hover { border-color: var(--primary); }
.file-drop input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.file-drop:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; }
.cropper { max-width: 760px; }
.cropper canvas { display: block; border-radius: var(--radius-sm); touch-action: none; cursor: move; max-width: 100%; }
.upload-status { color: var(--ink-3); }
.upload-done { max-width: 620px; padding: 24px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }

/* pickers */
.picker { position: relative; display: grid; gap: 6px; }
.picker-results {
  position: absolute; z-index: 20; top: 100%; left: 0; right: 0; margin: 4px 0 0; padding: 4px; list-style: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow); max-height: 300px; overflow: auto;
}
.picker-results li { padding: 7px 10px; border-radius: 4px; cursor: pointer; }
.picker-results li[aria-selected="true"], .picker-results li:hover { background: var(--primary-soft); }
.picker-results .picker-empty { color: var(--ink-3); cursor: default; }

/* account */
.account-section { margin-top: 2.4rem; }
.my-photos { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.my-photos li { display: grid; grid-template-columns: 200px 1fr; gap: 16px; align-items: start; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.my-photos img { width: 200px; height: auto; border-radius: 4px; display: block; }
.my-photos div { display: flex; flex-direction: column; gap: 2px; }
.status { font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; margin-top: 4px; }
.status-pending .status { color: var(--accent-text); }
.status-approved .status { color: var(--primary); }
.status-rejected .status { color: var(--ink-3); }
@media (max-width: 560px) { .my-photos li { grid-template-columns: 1fr; } }

/* moderation */
.mod-group { margin-top: 2rem; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.mod-group-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-bottom: 12px; }
.mod-group-head h2 { margin: 0; font-size: 1.3rem; flex: 1 1 auto; }
.mod-photos { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.mod-photos li { display: grid; grid-template-columns: 300px 1fr auto; gap: 16px; align-items: start; padding-top: 12px; border-top: 1px solid var(--line); }
.mod-photo img { width: 300px; height: auto; display: block; border-radius: 4px; }
.mod-info { display: flex; flex-direction: column; gap: 4px; font-size: .95rem; }
.mod-actions { display: flex; flex-direction: column; gap: 8px; align-items: stretch; min-width: 220px; }
.mod-actions .button { width: 100%; }
.reject-form { display: grid; gap: 6px; }
.reject-form input { font-size: .88rem; padding: 6px 10px; }
@media (max-width: 900px) { .mod-photos li { grid-template-columns: 1fr; } .mod-photo img { width: min(300px, 100%); } }
.pager { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2rem; }
.pager a { padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; }
.pager a[aria-current="page"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.mod-edit { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(300px, 1.2fr); gap: 28px; align-items: start; }
.mod-edit-photo { width: 100%; height: auto; border-radius: var(--radius-sm); display: block; }
.colour-bar { display: flex; gap: 4px; }
.history { list-style: none; padding: 0; font-size: .9rem; }
.history li { padding: 4px 0; border-bottom: 1px dotted var(--line); }
@media (max-width: 860px) { .mod-edit { grid-template-columns: 1fr; } }
.people { width: 100%; border-collapse: collapse; font-size: .92rem; }
.people th, .people td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.people tr.suspended td { opacity: .6; }
.role-form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.role-form select { width: auto; padding: 5px 8px; }
@media (max-width: 760px) { .people thead { display: none; } .people tr { display: grid; padding: 8px 0; border-bottom: 1px solid var(--line); } .people td { border: 0; padding: 2px 0; } }
