:root {
  --bg: #FAFAF7;
  --ink: #1A1A1A;
  --muted: #6B6B66;
  --line: #E5E3DE;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans: 'Inter', -apple-system, system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }

/* ---------- Header ---------- */
.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  padding: 1.5rem 3rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  mix-blend-mode: difference;
  color: #fff;
  transition: background 0.3s ease, color 0.3s ease;
}
.header.scrolled {
  mix-blend-mode: normal;
  background: rgba(250, 250, 247, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--ink);
  border-bottom: 1px solid var(--line);
}
.wordmark {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-decoration: none;
}
.nav {
  display: flex;
  gap: 2.5rem;
  font-size: 0.8125rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.nav a { text-decoration: none; font-weight: 400; }

/* ---------- Hero ---------- */
.hero {
  height: 100vh;
  min-height: 600px;
  position: relative;
  overflow: hidden;
}
/* Hero — crossfading slideshow */
.hero-image {
  position: absolute;
  inset: 0;
  background: #14180f;
}
/* 5 slides, 40s total cycle, 8s between starts.
   Each slide: 1.5s fade-in, 6s hold, 1.5s fade-out, then hidden.
   The 1.5s fade-out overlaps the next slide's 1.5s fade-in for a smooth crossfade. */
.hero-image .slide {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  animation: heroFade 48s infinite;
}
.hero-image .slide:nth-child(1) { animation-delay:  0s; background-image: url('/mammals/007.jpg'); }
.hero-image .slide:nth-child(2) { animation-delay:  8s; background-image: url('/landscapes/003.jpg'); }
.hero-image .slide:nth-child(3) { animation-delay: 16s; background-image: url('/landscapes/007.jpg'); }
.hero-image .slide:nth-child(4) { animation-delay: 24s; background-image: url('/landscapes/011.jpg'); }
.hero-image .slide:nth-child(5) { animation-delay: 32s; background-image: url('/landscapes/014.jpg'); }
.hero-image .slide:nth-child(6) { animation-delay: 40s; background-image: url('/landscapes/008.jpg'); }
@keyframes heroFade {
  0%       { opacity: 0; }   /*  0.0s — start hidden            */
  3.125%   { opacity: 1; }   /*  1.5s — fully faded in          */
  15.625%  { opacity: 1; }   /*  7.5s — start fading out        */
  18.75%   { opacity: 0; }   /*  9.0s — fully hidden            */
  100%     { opacity: 0; }   /* 48.0s — stays hidden until loop */
}
.hero-image::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(0,0,0,0.25) 0%, transparent 35%, rgba(0,0,0,0.6) 100%);
}
@media (prefers-reduced-motion: reduce) {
  .hero-image .slide { animation: none; opacity: 0; }
  .hero-image .slide:nth-child(1) { opacity: 1; }
}
.hero-content {
  position: relative;
  z-index: 2;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 0 3rem 4rem;
  color: #fff;
}
.hero h1 {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(2.75rem, 8vw, 6.5rem);
  line-height: 0.95;
  letter-spacing: -0.02em;
  max-width: 16ch;
}
.hero h1 em {
  font-style: italic;
  font-weight: 300;
}
.hero .subtitle {
  margin-top: 1.25rem;
  font-size: 0.8125rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  opacity: 0.85;
}
.scroll-hint {
  position: absolute;
  bottom: 2rem;
  right: 3rem;
  font-size: 0.6875rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #fff;
  opacity: 0.7;
  writing-mode: vertical-rl;
}

/* ---------- Section frame ---------- */
.section {
  padding: 8rem 3rem;
  max-width: 1600px;
  margin: 0 auto;
}
.section-header {
  margin-bottom: 4rem;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px solid var(--line);
  padding-bottom: 1.75rem;
}
.section-label {
  font-size: 0.6875rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--muted);
}
.section-title {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(2rem, 5vw, 3.5rem);
  letter-spacing: -0.01em;
}

/* ---------- Filters ---------- */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  margin-bottom: 3.5rem;
  font-size: 0.8125rem;
  letter-spacing: 0.08em;
}
.filters button {
  background: none;
  border: none;
  padding: 0 0 4px;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  color: var(--muted);
  letter-spacing: inherit;
  text-transform: uppercase;
  border-bottom: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}
.filters button:hover { color: var(--ink); }
.filters button.active {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

/* ---------- Gallery rows (justified layout) ---------- */
.grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.row {
  display: flex;
  gap: 14px;
  width: 100%;
}
.photo {
  position: relative;
  overflow: hidden;
  background: #1f221b;
  cursor: pointer;
  min-width: 0;
}
.photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.photo:hover img { transform: scale(1.03); }
.photo::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, transparent 55%, rgba(0,0,0,0.15) 100%);
  opacity: 0;
  transition: opacity 0.4s;
}
.photo:hover::after { opacity: 1; }

/* ---------- About ---------- */
.about-inner {
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
}
.about-inner p {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(1.25rem, 2.2vw, 1.75rem);
  line-height: 1.55;
  color: var(--ink);
  letter-spacing: -0.005em;
}
.about-inner p + p {
  margin-top: 1.5rem;
  color: var(--muted);
  font-size: clamp(1.0625rem, 1.7vw, 1.25rem);
}

/* ---------- Thicket (the birdsong app) ---------- */
.thicket-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 3rem 5rem;
  align-items: center;
  max-width: 1080px;
  margin: 0 auto;
}
.thicket-copy { display: flex; flex-direction: column; align-items: flex-start; }
.thicket-icon { width: 64px; height: 64px; border-radius: 14px; margin-bottom: 1.75rem; }
.thicket-copy p { color: var(--muted); max-width: 52ch; }
.thicket-copy p + p { margin-top: 1rem; }
.thicket-lede {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(1.5rem, 2.6vw, 2.1rem);
  line-height: 1.3;
  letter-spacing: -0.005em;
  color: var(--ink) !important;
}
.thicket-status {
  font-size: 0.6875rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 1.5rem;
}
.thicket-copy p.thicket-status { margin-top: 1.75rem; max-width: none; }
.thicket-phone {
  justify-self: center;
  width: min(280px, 100%);
  background: #16211B;
  padding: 9px;
  border-radius: 34px;
  box-shadow: 0 24px 48px -20px rgba(22, 33, 27, 0.45);
}
.thicket-phone img { display: block; width: 100%; height: auto; border-radius: 26px; }
@media (max-width: 900px) {
  .thicket-inner { grid-template-columns: 1fr; }
  .thicket-phone { width: min(240px, 72%); }
}

/* ---------- Exhibitions ---------- */
.exhibitions-intro {
  max-width: 720px;
  margin: -2rem 0 3.5rem;
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(1.25rem, 2.2vw, 1.6rem);
  line-height: 1.5;
  color: var(--muted);
}
.exhibitions-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}
.exhibition-card {
  border: 1px solid var(--line);
  padding: 2.25rem 2rem 2rem;
  display: flex;
  flex-direction: column;
  background: #fff;
  transition: border-color 0.3s ease, transform 0.3s ease;
}
.exhibition-card:hover { border-color: var(--ink); transform: translateY(-3px); }
.exhibition-status {
  font-size: 0.6875rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1.25rem;
}
.exhibition-card h3 {
  font-family: var(--serif);
  font-weight: 300;
  font-size: 1.85rem;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin-bottom: 0.35rem;
}
.exhibition-org {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 1.5rem;
}
.exhibition-meta {
  list-style: none;
  margin: 0 0 1.75rem;
  padding: 1.25rem 0 0;
  border-top: 1px solid var(--line);
}
.exhibition-meta div {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
  font-size: 0.875rem;
  line-height: 1.45;
}
.exhibition-meta div:last-child { margin-bottom: 0; }
.exhibition-meta .k {
  flex: 0 0 3.75rem;
  font-size: 0.625rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  padding-top: 0.2rem;
}
.exhibition-meta .v { color: var(--ink); }
.exhibition-link {
  margin-top: auto;
  align-self: flex-start;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 3px;
  transition: opacity 0.2s;
}
.exhibition-link:hover { opacity: 0.55; }
@media (max-width: 900px) {
  .exhibitions-grid { grid-template-columns: 1fr; }
  .exhibitions-intro { margin-top: 0; }
}

/* ---------- Contact ---------- */
.contact {
  background: #fff;
  border-top: 1px solid var(--line);
  padding: 8rem 3rem;
}
.contact-inner {
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
}
.contact h2 {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(2.5rem, 6vw, 4.75rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin-top: 1rem;
}
.contact h2 em { font-style: italic; }
.contact .lede {
  margin: 1.5rem auto 0;
  color: var(--muted);
  font-size: 1.0625rem;
  max-width: 36ch;
}

.contact-form {
  margin-top: 4rem;
  display: grid;
  gap: 1.5rem;
  text-align: left;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}
.field { display: flex; flex-direction: column; gap: 0.5rem; }
.field label {
  font-size: 0.6875rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}
.field input, .field textarea {
  font-family: inherit;
  font-size: 1rem;
  border: none;
  border-bottom: 1px solid var(--line);
  padding: 0.5rem 0;
  background: transparent;
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s;
}
.field input:focus, .field textarea:focus { border-bottom-color: var(--ink); }
.field textarea { resize: vertical; min-height: 110px; }

.submit {
  margin-top: 1rem;
  justify-self: start;
  font-family: inherit;
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  background: var(--ink);
  color: #fff;
  border: none;
  padding: 1.125rem 2.5rem;
  cursor: pointer;
  transition: background 0.2s;
}
.submit:hover { background: #000; }
.submit:disabled { opacity: 0.6; cursor: default; }
.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.form-status {
  min-height: 1.25em;
  margin-top: 0.5rem;
  font-size: 0.8125rem;
  color: var(--muted);
}
.form-status.error { color: #a02828; }
.form-status.ok { color: var(--ink); }

.contact-direct {
  margin-top: 5rem;
  padding-top: 3rem;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  text-align: left;
  font-size: 0.9375rem;
}
.contact-direct .col-label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.6875rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}
.contact-direct a {
  text-decoration: none;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 1px;
}
.contact-direct a + a { margin-left: 0.75rem; }

/* ---------- Footer ---------- */
footer {
  padding: 2rem 3rem;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.6875rem;
  letter-spacing: 0.15em;
  color: var(--muted);
  text-transform: uppercase;
}

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(10, 10, 8, 0.96);
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.lightbox.open {
  display: flex;
  opacity: 1;
}
body.lightbox-active {
  overflow: hidden;
}
.lightbox-stage {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4.5rem 5rem 8rem;
}
.lightbox-img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.lightbox-img.loaded {
  opacity: 1;
}
.lightbox-close,
.lightbox-nav {
  position: absolute;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.75);
  cursor: pointer;
  font-family: var(--sans);
  transition: color 0.2s ease, transform 0.2s ease;
  padding: 0.5rem;
  line-height: 1;
  user-select: none;
}
.lightbox-close:hover,
.lightbox-nav:hover {
  color: #fff;
}
.lightbox-close {
  top: 1.5rem;
  right: 1.75rem;
  font-size: 0.6875rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
}
.lightbox-nav {
  top: 50%;
  transform: translateY(-50%);
  font-size: 2rem;
  width: 3rem;
  height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox-nav:hover { transform: translateY(-50%) scale(1.1); }
.lightbox-prev { left: 1.5rem; }
.lightbox-next { right: 1.5rem; }
.lightbox-counter {
  position: absolute;
  bottom: 2rem;
  left: 1.75rem;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.6875rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  pointer-events: none;
}
.lightbox-textblock {
  position: absolute;
  bottom: 5rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  max-width: min(80%, 700px);
  text-align: center;
  pointer-events: none;
}
.lightbox-caption {
  color: rgba(255, 255, 255, 0.85);
  font-family: var(--serif);
  font-weight: 300;
  font-size: 1.0625rem;
  letter-spacing: 0.01em;
}
.lightbox-story {
  color: rgba(255, 255, 255, 0.6);
  font-family: var(--sans, sans-serif);
  font-weight: 300;
  font-size: 0.875rem;
  line-height: 1.5;
  letter-spacing: 0.01em;
  max-width: 60ch;
}
.lightbox-story:empty { display: none; }

/* ---------- Hue rail ---------- */
#hue-rail {
  position: fixed;
  right: 1.25rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 50;
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}
#hue-rail.visible {
  opacity: 1;
  pointer-events: auto;
}
#hue-track {
  width: 5px;
  height: 56vh;
  min-height: 280px;
  max-height: 580px;
  border-radius: 3px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.hue-seg {
  flex: 1;
  border: none;
  padding: 0;
  cursor: pointer;
  min-height: 1px;
  background: var(--line);
  transition: filter 0.15s ease, opacity 0.15s ease;
}
.hue-seg:hover {
  filter: brightness(1.55) saturate(1.2);
  opacity: 0.85;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  #hue-rail { display: none; }
  .header { padding: 1rem 1.5rem; }
  .nav { gap: 1.5rem; }
  .section { padding: 5rem 1.5rem; }
  .hero-content { padding: 0 1.5rem 3rem; }
  .scroll-hint { right: 1rem; bottom: 1.5rem; }
  .grid { gap: 10px; }
  .row { flex-wrap: wrap; height: auto !important; gap: 10px; }
  .row .photo { flex: 1 1 calc(50% - 5px) !important; aspect-ratio: 3/2; }
  .section-header { flex-direction: column; align-items: flex-start; gap: 1rem; }
  .contact { padding: 5rem 1.5rem; }
  .form-row { grid-template-columns: 1fr; }
  .contact-direct { flex-direction: column; gap: 1.5rem; }
  footer { padding: 1.5rem; flex-direction: column; gap: 0.5rem; text-align: center; }
  .lightbox-stage { padding: 4rem 1rem 7rem; }
  .lightbox-nav { width: 2.5rem; height: 2.5rem; font-size: 1.5rem; }
  .lightbox-prev { left: 0.25rem; }
  .lightbox-next { right: 0.25rem; }
  .lightbox-close { top: 1rem; right: 1rem; }
}

/* ---------- Category pages & homepage galleries index ---------- */
.section-lede {
  max-width: 46ch;
  margin: -2.25rem 0 3rem;
  color: var(--muted);
  font-size: 0.9375rem;
}
.gallery-page { padding-top: 9rem; }
.gallery-page .section-header { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
.gallery-page .section-label a { color: inherit; text-decoration: none; border-bottom: 1px solid var(--line); }
.gallery-page .section-label a:hover { color: var(--ink); }
.gallery-intro {
  max-width: 60ch;
  color: var(--muted);
  font-size: 0.9375rem;
  line-height: 1.75;
}
.gallery-foot {
  margin-top: 3rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.8125rem;
  letter-spacing: 0.04em;
}
.gallery-foot a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--ink); }

/* Sibling-gallery pills */
.cat-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 3.5rem;
}
.cat-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.cat-pill span { font-size: 0.6875rem; opacity: 0.6; }
.cat-pill:hover { color: var(--ink); border-color: var(--ink); }
.cat-pill.current { color: var(--bg); background: var(--ink); border-color: var(--ink); }

/* Homepage category cards — 4 columns; build-gallery.js widens the first card
   to two columns when the count would otherwise leave a hole (5, 7, 11…). */
.cat-header { margin-top: 6rem; }
.cat-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 230px;
  gap: 14px;
}
.cat-card--wide { grid-column: span 2; }
.cat-card {
  position: relative;
  display: block;
  overflow: hidden;
  text-decoration: none;
  color: #fff;
  background: var(--ink);
}
.cat-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.4s ease;
}
.cat-card:hover img { transform: scale(1.04); opacity: 0.85; }
.cat-card-body {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 1.25rem 1.25rem 1.1rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.72), rgba(0, 0, 0, 0.28) 55%, rgba(0, 0, 0, 0));
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}
.cat-card-title {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 300;
  letter-spacing: 0.01em;
}
.cat-card-meta {
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.8;
  white-space: nowrap;
}
@media (max-width: 1100px) {
  .cat-cards { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 200px; }
  }
@media (max-width: 900px) {
  .gallery-page { padding-top: 7rem; }
  .section-lede { margin-top: -1.5rem; }
  .cat-header { margin-top: 4rem; }
  .cat-cards { grid-template-columns: 1fr; grid-auto-rows: 180px; }
  .cat-card--wide { grid-column: span 1 !important; }
}
