:root {
  --paper: #fffdf8;
  --paper-warm: #f5ecdd;
  --ink: #281b12;
  --muted: #6f6252;
  --line: #d8c29e;
  --accent: #7a481d;
  --accent-dark: #4f2b10;
  --gold: #c89a4b;
  --focus: #1e6ea7;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper-warm);
  color: var(--ink);
  font-family: "Segoe UI", Arial, sans-serif;
  line-height: 1.5;
  letter-spacing: 0;
}
body.lightbox-open { overflow: hidden; }
a { color: inherit; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.skip-link {
  position: fixed;
  left: 16px;
  top: -100px;
  z-index: 1000;
  padding: 10px 14px;
  background: #fff;
  color: #111;
}
.skip-link:focus { top: 16px; }

.album-header {
  position: relative;
  min-height: 360px;
  display: grid;
  align-items: end;
  overflow: hidden;
  background-image: url("/media/photos/bob-rice-field-wide.png?v=20260713-texture-clean-1");
  background-size: cover;
  background-position: center 42%;
  color: #fff;
}
.album-header::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(30, 20, 12, .56);
}
.header-inner {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 42px 0 44px;
}
.back-link {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  margin-bottom: 40px;
  padding: 0 14px;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 5px;
  text-decoration: none;
  font-weight: 700;
  background: rgba(20, 13, 8, .44);
}
.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}
.album-header .eyebrow { color: #f7d996; }
h1, h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  letter-spacing: 0;
}
h1 { max-width: 820px; font-size: clamp(42px, 6vw, 72px); line-height: 1.03; }
.header-copy { max-width: 760px; margin: 18px 0 12px; font-size: 20px; }
.photographer-credit { margin: 0; font-weight: 700; }
.photographer-credit a { color: #fff2cf; }

main { width: min(1320px, calc(100% - 32px)); margin: 0 auto; }
.album-intro,
.album-credit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 28px;
  padding: 38px 0;
}
.album-intro h2, .album-credit h2 { font-size: 38px; }
.album-intro p, .album-credit p { max-width: 760px; margin: 10px 0 0; color: var(--muted); }
.archive-actions { text-align: right; }
.archive-actions .button { margin-left: 8px; }
.archive-actions p { margin: 8px 0 0 auto; font-size: 12px; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--accent);
  border-radius: 5px;
  text-decoration: none;
  font-weight: 750;
  cursor: pointer;
}
.button.primary { background: var(--accent); color: #fff; }
.button.secondary { background: var(--paper); color: var(--accent-dark); border-color: var(--line); }
.button:hover { border-color: var(--accent-dark); }
.button:focus-visible, button:focus-visible, input:focus-visible, a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.gallery-shell {
  margin-bottom: 40px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--paper);
}
.gallery-toolbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(220px, 360px) auto minmax(160px, 1fr);
  align-items: end;
  gap: 16px;
  margin: -18px -18px 18px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 248, .97);
}
.photo-search { display: grid; gap: 5px; color: var(--muted); font-size: 12px; font-weight: 700; }
.photo-search input {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
}
.view-control { display: inline-flex; min-height: 42px; }
.view-button {
  padding: 0 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}
.view-button:first-child { border-radius: 5px 0 0 5px; }
.view-button:last-child { border-left: 0; border-radius: 0 5px 5px 0; }
.view-button.is-active { background: var(--accent-dark); color: #fff; }
.gallery-status { margin: 0; text-align: right; color: var(--muted); font-size: 13px; }

.gallery {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.gallery.compact { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.photo-tile {
  position: relative;
  min-width: 0;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: #e9dfcf;
  cursor: zoom-in;
}
.photo-tile img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform .2s ease;
}
.photo-tile:hover img { transform: scale(1.025); }
.photo-number {
  position: absolute;
  left: 8px;
  bottom: 8px;
  min-width: 38px;
  padding: 4px 7px;
  border-radius: 4px;
  background: rgba(25, 16, 10, .82);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}
.gallery-sentinel { height: 1px; }
.load-more { display: flex; margin: 20px auto 4px; }

.album-credit {
  grid-template-columns: 1fr;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.album-credit .copyright { grid-column: 1 / -1; margin-top: -12px; font-size: 12px; }

footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  width: min(1320px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
  color: var(--muted);
  font-size: 13px;
}
footer p { margin: 0; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: #120e0b;
  color: #fff;
}
.lightbox[hidden] { display: none; }
.lightbox-bar,
.lightbox-actions {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 18px;
  background: #1d1713;
}
.lightbox-title { margin: 0; font-weight: 800; }
.lightbox-meta { margin: 2px 0 0; color: #d7c8b7; font-size: 12px; }
.lightbox-tools, .lightbox-actions > div { display: flex; gap: 8px; }
.lightbox-tools button {
  min-width: 42px;
  height: 42px;
  border: 1px solid #5e5045;
  border-radius: 5px;
  background: #2d251f;
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}
.lightbox-stage {
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: auto;
  padding: 18px 72px;
  touch-action: pan-y;
}
.lightbox-stage img {
  display: block;
  width: auto;
  height: auto;
  max-width: calc(100vw - 164px);
  max-height: calc(100vh - 190px);
  object-fit: contain;
  transform-origin: center center;
  transition: transform .12s ease;
}
.lightbox-stage.is-zoomed img { cursor: grab; }
.lightbox-arrow {
  position: absolute;
  z-index: 4;
  top: 50%;
  width: 52px;
  height: 72px;
  border: 1px solid rgba(255,255,255,.42);
  border-radius: 5px;
  background: rgba(20,15,12,.72);
  color: #fff;
  font-size: 48px;
  line-height: 1;
  cursor: pointer;
}
.lightbox-arrow.previous { left: 12px; }
.lightbox-arrow.next { right: 12px; }
.lightbox-actions p { margin: 0; color: #d7c8b7; font-size: 12px; }
.lightbox-actions .button { min-height: 40px; font-size: 13px; }

@media (max-width: 980px) {
  .gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .gallery.compact { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .gallery-toolbar { grid-template-columns: minmax(0, 1fr) auto; }
  .gallery-status { grid-column: 1 / -1; text-align: left; }
}

@media (max-width: 720px) {
  .album-header { min-height: 320px; }
  .header-inner { width: min(100% - 28px, 1180px); padding-bottom: 32px; }
  .back-link { margin-bottom: 28px; }
  h1 { font-size: 43px; }
  .header-copy { font-size: 17px; }
  main { width: min(100% - 20px, 1320px); }
  .album-intro, .album-credit { grid-template-columns: 1fr; gap: 16px; padding: 28px 4px; }
  .archive-actions { text-align: left; }
  .archive-actions .button { width: 100%; margin: 0 0 8px; }
  .archive-actions p { margin-left: 0; }
  .gallery-shell { padding: 10px; }
  .gallery-toolbar { position: static; grid-template-columns: 1fr; margin: -10px -10px 12px; padding: 12px 10px; }
  .view-control { width: 100%; }
  .view-button { flex: 1; }
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .gallery.compact { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  footer { flex-direction: column; width: min(100% - 24px, 1320px); }
  .lightbox-bar { align-items: flex-start; padding: 9px 10px; }
  .lightbox-title { font-size: 14px; }
  .lightbox-tools { gap: 5px; }
  .lightbox-tools button { min-width: 38px; height: 38px; }
  .lightbox-stage { padding: 8px 42px; }
  .lightbox-stage img {
    max-width: calc(100vw - 92px);
    max-height: calc(100vh - 210px);
  }
  .lightbox-arrow { width: 38px; height: 58px; font-size: 40px; }
  .lightbox-arrow.previous { left: 3px; }
  .lightbox-arrow.next { right: 3px; }
  .lightbox-actions { align-items: stretch; flex-direction: column; padding: 9px 10px; }
  .lightbox-actions > div { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lightbox-actions .button { min-width: 0; padding: 0 8px; text-align: center; }
}

@media (max-width: 420px) {
  h1 { font-size: 38px; }
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gallery.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lightbox-meta { display: none; }
  .lightbox-tools button:nth-child(-n+3) { display: none; }
  .lightbox-actions p { display: none; }
}

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