/* Colors are true neutral grays on purpose: tinted backgrounds shift how
   people perceive the colors in your photos. */
:root {
  --bg: #f4f4f4;
  --surface: #e6e6e6;
  --text: #1c1c1c;
  --muted: #666666;
  --rule: #d2d2d2;
  --error: #b3261e;
  --pad: clamp(1rem, 4vw, 3rem);
  --gutter: clamp(4px, 0.6vw, 8px);
  --row: 300px;
  color-scheme: light;
}

html[data-theme="dark"] {
  --bg: #262626;
  --surface: #313131;
  --text: #ededed;
  --muted: #9b9b9b;
  --rule: #3e3e3e;
  --error: #ff8a80;
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] {
    --bg: #262626;
    --surface: #313131;
    --text: #ededed;
    --muted: #9b9b9b;
    --rule: #3e3e3e;
    --error: #ff8a80;
    color-scheme: dark;
  }
}

/* Fonts: pick one with "font" in site.config.json. Each sets the headline face,
   the text face, and small spacing adjustments that suit it. */
:root {
  --sans-system: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font: "Archivo", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --head-font: var(--font);
  --head-weight: 500;
  --head-strong: 600;
  --wide: 125%;
  --semi: 112%;
  --track: 1;
}

html[data-font="bodoni"] {
  --font: var(--sans-system);
  --head-font: "Bodoni Moda", "Bodoni 72", Didot, Georgia, serif;
  --wide: 100%; --semi: 100%; --track: 0.4;
}

html[data-font="cormorant"] {
  --font: var(--sans-system);
  --head-font: "Cormorant Garamond", Garamond, Georgia, serif;
  --wide: 100%; --semi: 100%; --track: 0.2;
}

html[data-font="jost"] {
  --font: "Jost", Futura, var(--sans-system);
  --head-font: var(--font);
  --wide: 100%; --semi: 100%; --track: 0.6;
}

html[data-font="manrope"] {
  --font: "Manrope", var(--sans-system);
  --head-font: var(--font);
  --wide: 100%; --semi: 100%; --track: 0.8;
}

html[data-font="nunito"] {
  --font: "Nunito Sans", var(--sans-system);
  --head-font: var(--font);
  --wide: 100%; --semi: 100%; --track: 0.5;
}

html[data-font="system"] {
  --font: var(--sans-system);
  --head-font: var(--font);
  --head-weight: 600; --head-strong: 700;
  --wide: 100%; --semi: 100%; --track: 0.8;
}

@media (max-width: 900px) { :root { --row: 220px; } }
@media (max-width: 560px) { :root { --row: 150px; } }

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

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; }

img { display: block; max-width: 100%; }

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }

code { font-size: 0.92em; background: var(--surface); padding: 0.1em 0.35em; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: var(--pad); top: 0.5rem; z-index: 10; background: var(--text); color: var(--bg); padding: 0.5rem 0.75rem; }

/* ---------- header and footer ---------- */

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.75rem 2rem;
  padding: 1.25rem var(--pad);
}

.brand {
  font-size: 1rem;
  font-family: var(--head-font);
  font-weight: var(--head-strong);
  font-stretch: var(--wide);
  letter-spacing: calc(-0.005em * var(--track));
  text-decoration: none;
}

.site-header nav { display: flex; gap: clamp(1.25rem, 3vw, 2rem); }

.site-header nav a {
  color: var(--muted);
  font-size: 0.9375rem;
  text-decoration: none;
}

.site-header nav a:hover { color: var(--text); }
.site-header nav a[aria-current="page"] { color: var(--text); text-decoration: underline; }

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  padding: clamp(3rem, 8vw, 6rem) var(--pad) 2rem;
  color: var(--muted);
  font-size: 0.875rem;
}

.site-footer p { margin: 0; }
.footer-links { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; }
.footer-links a { text-decoration: none; }
.footer-links a:hover { color: var(--text); }

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

.intro { padding: clamp(1.5rem, 7vw, 6rem) var(--pad) clamp(2.5rem, 6vw, 5rem); }

.wordmark {
  margin: 0;
  max-width: 13ch;
  font-size: clamp(2.25rem, 0.25rem + 9vw, 9rem);
  font-family: var(--head-font);
  font-weight: var(--head-weight);
  font-stretch: var(--wide);
  line-height: 0.92;
  letter-spacing: calc(-0.035em * var(--track));
  overflow-wrap: break-word;
  text-wrap: balance;
}

.tagline {
  margin: 1.5rem 0 0;
  max-width: 40ch;
  color: var(--muted);
  font-size: clamp(1.0625rem, 1rem + 0.4vw, 1.3rem);
  line-height: 1.45;
}

/* Optional banner: add content/banner.jpg (and content/banner-mobile.jpg for phones). */
.banner { padding: 0 var(--pad); }

.banner img {
  width: 100%;
  height: auto;
  max-height: 80vh;
  aspect-ratio: 21 / 9;
  object-fit: cover;
  object-position: var(--pos, center);
  background: var(--surface);
}

@media (max-width: 640px) {
  .banner img { aspect-ratio: 3 / 2; }
  .banner.has-mobile img { aspect-ratio: 4 / 5; max-height: 75vh; }
}

.intro.has-banner { padding-top: clamp(2rem, 6vw, 5rem); }

.statement {
  margin: 0;
  max-width: 22ch;
  font-size: clamp(1.75rem, 1rem + 3.6vw, 4.75rem);
  font-family: var(--head-font);
  font-weight: var(--head-weight);
  font-stretch: var(--wide);
  line-height: 1.02;
  letter-spacing: calc(-0.025em * var(--track));
  text-wrap: balance;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.index { list-style: none; margin: 0; padding: 0 var(--pad); }
.index li + li { margin-top: clamp(2.5rem, 6vw, 4.5rem); }

.index-row { display: block; text-decoration: none; }

.index-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding-bottom: 0.75rem;
  margin-bottom: var(--gutter);
  border-bottom: 1px solid var(--rule);
}

.index-title {
  font-size: clamp(1.625rem, 1rem + 2.6vw, 3.25rem);
  font-family: var(--head-font);
  font-weight: var(--head-weight);
  font-stretch: var(--wide);
  line-height: 1.05;
  letter-spacing: calc(-0.02em * var(--track));
}

.index-count {
  color: var(--muted);
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.index-row:hover .index-title {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.12em;
}

/* A contact-sheet strip: as many frames as fit across the screen. */
.strip {
  display: flex;
  gap: var(--gutter);
  height: clamp(120px, 18vw, 240px);
  overflow: hidden;
}

.strip img { flex: none; width: auto; height: 100%; background: var(--surface); }

.empty { padding: 0 var(--pad); max-width: 40rem; }
.empty h2 { margin: 0 0 0.5rem; font-family: var(--head-font); font-size: 1.375rem; font-stretch: var(--semi); font-weight: var(--head-strong); }

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

.page-head { max-width: 62rem; padding: clamp(1.5rem, 5vw, 4rem) var(--pad) clamp(1.5rem, 3vw, 2.5rem); }

.page-title {
  margin: 0;
  font-size: clamp(2.25rem, 1rem + 5vw, 5.5rem);
  font-family: var(--head-font);
  font-weight: var(--head-weight);
  font-stretch: var(--wide);
  line-height: 0.95;
  letter-spacing: calc(-0.03em * var(--track));
  overflow-wrap: break-word;
  text-wrap: balance;
}

.meta { margin: 0.85rem 0 0; color: var(--muted); font-size: 0.9375rem; }
.lede { margin: 1rem 0 0; max-width: 52ch; font-size: 1.125rem; line-height: 1.5; }
.text-link { color: var(--text); }

.page-body { padding: 0 var(--pad); }

/* ---------- gallery grid: rows of equal height, like a contact sheet ---------- */

.grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gutter);
  padding: 0 var(--pad);
}

/* Keeps the last row at normal height instead of stretching it. */
.grid::after { content: ""; flex-grow: 1000000; }

.tile {
  margin: 0;
  min-width: 0;
  flex-grow: calc(var(--w) / var(--h) * 100);
  flex-basis: calc(var(--w) / var(--h) * var(--row));
}

.tile a { display: block; }
.tile img { width: 100%; height: auto; background: var(--surface); cursor: zoom-in; }

.pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: clamp(2rem, 5vw, 4rem) var(--pad) 0;
}

/* ---------- about and terms ---------- */

.about {
  display: grid;
  grid-template-columns: minmax(0, 22rem) minmax(0, 38rem);
  gap: clamp(1.5rem, 4vw, 4rem);
  align-items: start;
  padding: 0 var(--pad);
}

.about.no-portrait { grid-template-columns: minmax(0, 38rem); }
.portrait { width: 100%; height: auto; background: var(--surface); }

@media (max-width: 760px) {
  .about { grid-template-columns: minmax(0, 1fr); }
  .portrait { max-width: 22rem; }
}

.prose { max-width: 38rem; }
.prose > :first-child { margin-top: 0; }
.prose p, .prose ul, .prose ol { margin: 0 0 1rem; }
.prose ul, .prose ol { padding-left: 1.25rem; }
.prose li + li { margin-top: 0.35rem; }

.prose h2 {
  margin: 2.25rem 0 0.5rem;
  font-size: 1.375rem;
  font-family: var(--head-font);
  font-weight: var(--head-strong);
  font-stretch: var(--semi);
  line-height: 1.25;
  letter-spacing: calc(-0.01em * var(--track));
}

.prose h3 { margin: 1.75rem 0 0.25rem; font-size: 1.0625rem; font-weight: 600; }

/* ---------- contact ---------- */

.contact {
  display: grid;
  grid-template-columns: minmax(0, 40rem) minmax(0, 18rem);
  gap: clamp(2.5rem, 6vw, 6rem);
  align-items: start;
  padding: 0 var(--pad);
}

@media (max-width: 860px) { .contact { grid-template-columns: minmax(0, 1fr); } }

.form { display: grid; gap: 1.1rem; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; }
@media (max-width: 560px) { .field-row { grid-template-columns: 1fr; } }

.field { display: grid; gap: 0.4rem; }
.field > span { color: var(--muted); font-size: 0.9375rem; }

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 2.9rem;
  padding: 0.7rem 0.8rem;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 2px;
}

.field textarea { min-height: 9rem; resize: vertical; }
.field ::placeholder { color: var(--muted); opacity: 1; }
.field .hint { margin-top: -0.2rem; color: var(--muted); font-size: 0.875rem; line-height: 1.4; }
.field-row.pair { grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible { outline-offset: 0; }

.check { display: flex; align-items: flex-start; gap: 0.65rem; font-size: 0.975rem; }
.check input { flex: none; width: 1.15rem; height: 1.15rem; margin: 0.22rem 0 0; accent-color: var(--text); }

.form button {
  justify-self: start;
  padding: 0.85rem 1.6rem;
  font: inherit;
  font-weight: 600;
  font-stretch: var(--semi);
  color: var(--bg);
  background: var(--text);
  border: 0;
  border-radius: 2px;
  cursor: pointer;
}

.form button:hover { opacity: 0.88; }
.form button:disabled { opacity: 0.6; cursor: progress; }

.form-status { margin: 0; }
.form-status:empty { display: none; }
.form-status.is-error { color: var(--error); }

.botcheck { display: none !important; }

.details { display: grid; gap: 1.5rem; margin: 0; }
.details dt { color: var(--muted); font-size: 0.875rem; }
.details dd { margin: 0.2rem 0 0; overflow-wrap: anywhere; }
.details .stack { display: grid; gap: 0.2rem; }

.embed { padding: clamp(3rem, 6vw, 5rem) var(--pad) 0; }

.embed h2 {
  margin: 0 0 1.25rem;
  font-size: clamp(1.5rem, 1rem + 2vw, 2.5rem);
  font-family: var(--head-font);
  font-weight: var(--head-weight);
  font-stretch: var(--wide);
  letter-spacing: calc(-0.02em * var(--track));
}

.embed-frame iframe { display: block; width: 100%; min-height: 720px; border: 0; }

/* ---------- photo viewer ---------- */

html.lb-open { overflow: hidden; }

.lb {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  color: #ededed;
  background: #1b1b1b;
  animation: lb-in 0.16s ease-out;
}

.lb[hidden] { display: none; }

.lb-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: clamp(0.5rem, 3vw, 2.5rem) clamp(0.5rem, 6vw, 5.5rem);
  touch-action: pinch-zoom;
}

.lb-img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  -webkit-user-select: none;
  user-select: none;
}

.lb-bar {
  display: flex;
  align-items: baseline;
  gap: 1.5rem;
  min-height: 3.5rem;
  padding: 0.75rem clamp(1rem, 3vw, 2rem) max(1.25rem, env(safe-area-inset-bottom));
  color: #b5b5b5;
  font-size: 0.875rem;
}

.lb-count { font-variant-numeric: tabular-nums; white-space: nowrap; }
.lb-caption { color: #ededed; }

.lb-btn {
  position: absolute;
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  padding: 0;
  color: #ededed;
  background: transparent;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}

.lb-btn:hover { background: rgba(255, 255, 255, 0.08); }
.lb-btn svg { width: 1.5rem; height: 1.5rem; }
.lb :focus-visible { outline-color: #ededed; }

.lb-close { top: 0.5rem; right: 0.5rem; }
.lb-prev { top: 50%; left: 0.5rem; transform: translateY(-50%); }
.lb-next { top: 50%; right: 0.5rem; transform: translateY(-50%); }

/* On phones, arrows move to the bottom bar so the photo can use the full width. */
@media (max-width: 640px) {
  .lb-stage { padding: 3.5rem 0.25rem 0.5rem; }
  .lb-bar { padding-right: 7.5rem; }
  .lb-prev, .lb-next { top: auto; bottom: max(0.5rem, env(safe-area-inset-bottom)); transform: none; }
  .lb-prev { left: auto; right: 3.75rem; }
  .lb-next { right: 0.5rem; }
}

@keyframes lb-in { from { opacity: 0; } }

@media (prefers-reduced-motion: reduce) { .lb { animation: none; } }

/* Optional: discourage saving images (set "protectImages" in site.config.json). */
.protect img { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
