/* Beaudoin Photography
   Palette taken from the archive itself: the library measures ~48% neutral —
   snow, bark, stone, sky — so the chrome is built from those greys and the
   accent is lichen green, the colour of the fence posts and trunks that recur
   through the work. Dark is the primary ground; photographs sit better on it.
   Type: Newsreader for voice (field journal), IBM Plex Sans for interface,
   IBM Plex Mono for catalogue data — species counts, dates, hex values. */

:root {
  --ground: #14171a;
  --ground-deep: #0f1113;
  --surface: #1c2024;
  --surface-hi: #23282d;
  --ink: #e7eae4;
  --ink-2: #969d95;
  --ink-3: #6b7270;
  --line: #2a2f34;
  --accent: #9bb077;
  --accent-ink: #14171a;
  --shadow: rgba(0, 0, 0, 0.5);

  --step--1: 0.8125rem;
  --step-0: 1rem;
  --step-1: 1.2rem;
  --step-2: 1.55rem;
  --step-3: 2.1rem;
  --step-4: clamp(2.4rem, 5.5vw, 4.1rem);

  --measure: 63ch;
  --gap: 1.15rem;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --ground: #eef0ea;
    --ground-deep: #e4e7df;
    --surface: #ffffff;
    --surface-hi: #f6f7f2;
    --ink: #191c19;
    --ink-2: #5c635b;
    --ink-3: #858b83;
    --line: #d9ddd2;
    --accent: #55693f;
    --accent-ink: #ffffff;
    --shadow: rgba(30, 35, 28, 0.16);
    color-scheme: light;
  }
}

:root[data-theme="light"] {
  --ground: #eef0ea;
  --ground-deep: #e4e7df;
  --surface: #ffffff;
  --surface-hi: #f6f7f2;
  --ink: #191c19;
  --ink-2: #5c635b;
  --ink-3: #858b83;
  --line: #d9ddd2;
  --accent: #55693f;
  --accent-ink: #ffffff;
  --shadow: rgba(30, 35, 28, 0.16);
  color-scheme: light;
}

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

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
  font-size: var(--step-0);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

/* ---------- masthead ---------- */
.masthead {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1.5rem; padding: 1rem clamp(1rem, 4vw, 3rem);
  background: color-mix(in srgb, var(--ground) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.wordmark { text-decoration: none; display: flex; align-items: baseline; gap: 0.5rem; }
.wordmark-name {
  font-family: Newsreader, Georgia, serif;
  font-size: var(--step-1); font-weight: 500; letter-spacing: 0.01em;
}
.wordmark-sub {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.22em;
  color: var(--ink-2);
}
.nav { display: flex; gap: clamp(0.9rem, 2.5vw, 1.9rem); }
.nav a {
  font-size: var(--step--1); text-decoration: none; color: var(--ink-2);
  padding-bottom: 2px; border-bottom: 1px solid transparent;
}
.nav a:hover { color: var(--ink); border-bottom-color: var(--accent); }

/* ---------- opening ---------- */
.opening {
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 3.5rem); align-items: center;
  padding: clamp(2rem, 6vw, 4.5rem) clamp(1rem, 4vw, 3rem) clamp(1.5rem, 4vw, 3rem);
  max-width: 1500px; margin: 0 auto;
}
@media (max-width: 860px) { .opening { grid-template-columns: 1fr; } }

.opening-plate {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
  aspect-ratio: 3 / 2; border-radius: 3px; overflow: hidden;
}
.opening-plate img { width: 100%; height: 100%; object-fit: cover; display: block; }
.opening-plate .plate-tall { grid-row: span 2; }

h1 {
  font-family: Newsreader, Georgia, serif;
  font-size: var(--step-4); font-weight: 400; line-height: 1.06;
  letter-spacing: -0.015em; margin: 0 0 1rem; text-wrap: balance;
}
h1 em { font-style: italic; color: var(--accent); }
.standfirst { color: var(--ink-2); max-width: 46ch; margin: 0 0 1.8rem; }

.figures { display: flex; flex-wrap: wrap; gap: 2rem; margin: 0; }
.figures dt {
  font-family: "IBM Plex Mono", monospace; font-size: 0.62rem;
  text-transform: uppercase; letter-spacing: 0.18em; color: var(--ink-3);
}
.figures dd {
  margin: 0.2rem 0 0; font-family: Newsreader, Georgia, serif;
  font-size: var(--step-2); font-variant-numeric: tabular-nums;
}

/* ---------- filters ---------- */
.gallery-section { padding: 0 clamp(1rem, 4vw, 3rem) 4rem; max-width: 1500px; margin: 0 auto; }
.filters {
  position: sticky; top: 60px; z-index: 30;
  display: flex; flex-direction: column; gap: 0.85rem;
  padding: 1rem 0 0.9rem;
  background: var(--ground);
  border-bottom: 1px solid var(--line);
}
.filter-row { display: flex; flex-wrap: wrap; gap: 0.9rem; align-items: flex-end; }
.filter-row-color { align-items: center; gap: 0.7rem; }
.field { display: flex; flex-direction: column; gap: 0.3rem; }
.field-label {
  font-family: "IBM Plex Mono", monospace; font-size: 0.62rem;
  text-transform: uppercase; letter-spacing: 0.18em; color: var(--ink-3);
}
input[type="search"], select {
  font: inherit; font-size: var(--step--1);
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 2px;
  padding: 0.45rem 0.6rem; min-width: 12rem;
}
input[type="search"]::placeholder { color: var(--ink-3); }

.swatches { display: flex; flex-wrap: wrap; gap: 5px; }
.swatch {
  width: 30px; height: 22px; border-radius: 2px; cursor: pointer;
  border: 1px solid var(--line); padding: 0; position: relative;
}
.swatch[aria-pressed="true"] { outline: 2px solid var(--accent); outline-offset: 2px; }
.swatch span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

.reset {
  font: inherit; font-size: var(--step--1); cursor: pointer;
  background: none; color: var(--accent); border: none;
  border-bottom: 1px solid currentColor; padding: 0 0 1px; margin-left: auto;
}
.result-count {
  font-family: "IBM Plex Mono", monospace; font-size: 0.68rem;
  letter-spacing: 0.1em; color: var(--ink-3); margin: 0;
  font-variant-numeric: tabular-nums;
}

/* ---------- grid ---------- */
.grid { columns: 4 260px; column-gap: var(--gap); margin-top: 1.4rem; }
@media (max-width: 700px) { .grid { column-gap: 0.7rem; } }

.card {
  break-inside: avoid; margin-bottom: var(--gap);
  display: block; width: 100%; padding: 0; border: none; cursor: zoom-in;
  background: var(--surface); border-radius: 2px; overflow: hidden;
  position: relative; line-height: 0;
}
.card img {
  width: 100%; height: auto; display: block;
  background: var(--surface-hi);
  transition: opacity 0.5s ease, transform 0.5s ease;
  opacity: 0;
}
.card img.loaded { opacity: 1; }
.card:hover img { transform: scale(1.02); }
.card-strip { display: flex; height: 3px; }
.card-strip i { flex: 1 1 0; }
.card-caption {
  position: absolute; inset: auto 0 0 0;
  padding: 1.6rem 0.7rem 0.5rem;
  background: linear-gradient(to top, rgba(8,10,12,0.82), transparent);
  color: #eef0ea; line-height: 1.35;
  font-family: "IBM Plex Mono", monospace; font-size: 0.62rem;
  letter-spacing: 0.08em; text-transform: uppercase;
  opacity: 0; transition: opacity 0.25s ease;
}
.card:hover .card-caption, .card:focus-visible .card-caption { opacity: 1; }

.grid-empty { color: var(--ink-2); text-align: center; padding: 3rem 0; }
.more {
  display: block; margin: 2rem auto 0; padding: 0.6rem 1.5rem;
  font: inherit; font-size: var(--step--1); cursor: pointer;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 2px;
}
.more:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- prose ---------- */
.prose {
  max-width: var(--measure); margin: 0 auto;
  padding: clamp(2.5rem, 6vw, 4.5rem) clamp(1rem, 4vw, 3rem);
  border-top: 1px solid var(--line);
}
.prose h2 {
  font-family: Newsreader, Georgia, serif; font-weight: 400;
  font-size: var(--step-3); margin: 0 0 1rem; text-wrap: balance;
}
.prose p { margin: 0 0 1rem; color: var(--ink-2); }
.contact-line { margin-top: 1.5rem; }
.contact {
  font-family: "IBM Plex Mono", monospace; font-size: var(--step--1);
  color: var(--accent); text-decoration: none;
  border-bottom: 1px solid currentColor; padding-bottom: 2px;
}

.footer {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem;
  padding: 1.5rem clamp(1rem, 4vw, 3rem) 3rem;
  border-top: 1px solid var(--line);
  font-family: "IBM Plex Mono", monospace; font-size: 0.66rem;
  letter-spacing: 0.08em; color: var(--ink-3);
}

/* ---------- lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--ground-deep) 96%, transparent);
  padding: clamp(0.5rem, 3vw, 2.5rem);
}
.lightbox[hidden] { display: none; }
.lb-figure {
  margin: 0; display: flex; flex-direction: column; gap: 0.75rem;
  max-width: min(1100px, 100%); max-height: 100%;
}
.lb-figure img {
  max-width: 100%; max-height: 74vh; object-fit: contain;
  border-radius: 2px; box-shadow: 0 24px 60px var(--shadow);
}
.lb-meta { display: flex; flex-direction: column; gap: 0.4rem; }
.lb-collections {
  font-family: Newsreader, Georgia, serif; font-size: var(--step-1);
}
.lb-labels { color: var(--ink-2); font-size: var(--step--1); }
.lb-foot {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  font-family: "IBM Plex Mono", monospace; font-size: 0.66rem;
  letter-spacing: 0.1em; color: var(--ink-3);
}
.lb-palette { display: inline-flex; gap: 3px; }
.lb-palette i { width: 20px; height: 10px; border-radius: 1px; }
.lb-close, .lb-nav {
  position: absolute; background: none; border: none; cursor: pointer;
  color: var(--ink-2); font-size: 2rem; line-height: 1; padding: 0.5rem 0.75rem;
}
.lb-close { top: 0.5rem; right: 0.75rem; font-size: 2.2rem; }
.lb-nav { top: 50%; transform: translateY(-50%); font-size: 3rem; }
.lb-prev { left: 0.25rem; }
.lb-next { right: 0.25rem; }
.lb-close:hover, .lb-nav:hover { color: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  .card:hover img { transform: none; }
}

/* ---- category drill-down ---------------------------------------------- */
.browse { max-width: 1500px; margin: 0 auto; padding: 0 clamp(1rem, 4vw, 3rem) 1.1rem; }

.crumbs {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.15rem 0.4rem;
  list-style: none; margin: 0 0 0.7rem; padding: 0; font-size: 0.82rem;
}
.crumbs li { display: flex; align-items: baseline; gap: 0.4rem; }
.crumbs li + li::before { content: "\203A"; color: var(--line); }
.crumbs button {
  background: none; border: 0; padding: 0; cursor: pointer;
  font: inherit; color: var(--ink-2); border-bottom: 1px solid transparent;
}
.crumbs button:hover { color: var(--ink); border-bottom-color: var(--line); }
.crumbs .here { color: var(--ink); font-weight: 500; }

.cats { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.cat {
  display: inline-flex; align-items: baseline; gap: 0.4rem;
  padding: 0.34rem 0.7rem; cursor: pointer;
  background: none; border: 1px solid var(--line); border-radius: 2px;
  font: inherit; font-size: 0.82rem; color: var(--ink-2);
  transition: border-color 0.15s ease, color 0.15s ease;
}
.cat:hover { color: var(--ink); border-color: var(--ink-2); }
.cat .n { font-size: 0.72rem; opacity: 0.65; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) { .cat { font-size: 0.78rem; padding: 0.3rem 0.6rem; } }
