:root {
  --bg: #fafaf8;
  --text: #1b1b1b;
  --muted: #6f6f6a;
  --line: #e4e3df;
  --accent: #1b1b1b;
  --lb-bg: rgba(10, 10, 10, 0.96);
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, sans-serif;
  --gutter: clamp(16px, 4vw, 48px);
  --max: 1440px;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-weight: 300;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body.lb-open { overflow: hidden; }

a { color: inherit; }

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px var(--gutter);
  background: rgba(250, 250, 248, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid transparent;
}

.brand {
  font-family: var(--serif);
  font-size: 1.6rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-decoration: none;
  white-space: nowrap;
}

.brand span {
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  margin-left: 8px;
}

.site-nav { display: flex; gap: clamp(16px, 3vw, 36px); }

.site-nav a {
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--muted);
  transition: color 0.2s;
}

.site-nav a:hover { color: var(--text); }

/* ---------- Intro ---------- */

.intro {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(48px, 9vw, 120px) var(--gutter) clamp(32px, 5vw, 64px);
}

.intro h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.4rem, 6vw, 4.6rem);
  line-height: 1.05;
  letter-spacing: -0.01em;
}

.intro p {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
}

/* ---------- Filters ---------- */

.work {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 28px;
  padding-bottom: 20px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--line);
}

.filter {
  padding: 4px 0;
  background: none;
  border: 0;
  border-bottom: 1px solid transparent;
  font: inherit;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.filter:hover { color: var(--text); }

.filter[aria-pressed="true"] {
  color: var(--text);
  border-bottom-color: var(--text);
}

/* ---------- Gallery ---------- */

.gallery {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
  /* --row is set by gallery.js to two-thirds of a column's width, so a
     landscape cell is 3:2 and a portrait cell (two rows) is roughly 3:4. */
  grid-auto-rows: var(--row, 230px);
  gap: clamp(10px, 1.4vw, 18px);
}

.gallery > li { min-width: 0; }
.gallery > li.portrait { grid-row: span 2; }

.thumb {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  overflow: hidden;
  background: #ecebe7;
  cursor: zoom-in;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transform: scale(1.01);
  transition: opacity 0.6s ease, transform 0.8s cubic-bezier(.2, .7, .2, 1);
}

.thumb.loaded img { opacity: 1; }

.thumb:hover img,
.thumb:focus-visible img { transform: scale(1.045); }

.thumb-caption {
  position: absolute;
  inset: auto 0 0 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  padding: 40px 16px 14px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.55), transparent);
  color: #fff;
  text-align: left;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.3s, transform 0.3s;
}

.thumb:hover .thumb-caption,
.thumb:focus-visible .thumb-caption { opacity: 1; transform: none; }

.thumb-title {
  font-family: var(--serif);
  font-size: 1.2rem;
  line-height: 1.2;
}

.thumb-cat {
  font-size: 0.66rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.85;
  white-space: nowrap;
}

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

/* ---------- About / Contact ---------- */

.about, .contact {
  max-width: 720px;
  margin: 0 auto;
  padding: clamp(72px, 10vw, 140px) var(--gutter) 0;
  text-align: center;
}

.about h2, .contact h2 {
  margin: 0 0 18px;
  font-size: 0.78rem;
  font-weight: 400;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}

.about p {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.35rem, 2.4vw, 1.75rem);
  line-height: 1.45;
}

.contact p { margin: 0 0 10px; color: var(--muted); }

.contact-link {
  font-family: var(--serif);
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  transition: border-color 0.2s;
}

.contact-link:hover { border-color: var(--text); }

.site-footer {
  margin-top: clamp(72px, 10vw, 140px);
  padding: 28px var(--gutter);
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: var(--muted);
}

/* ---------- Lightbox ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: 80px 1fr 80px;
  align-items: center;
  background: var(--lb-bg);
  color: #f2f2f0;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.lightbox[hidden] { display: none; }
.lightbox.open { opacity: 1; }

.lb-figure {
  grid-column: 2;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}

.lb-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
}

.lb-img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 140px);
  max-height: calc(100dvh - 140px);
  object-fit: contain;
  user-select: none;
  transition: opacity 0.3s ease;
}

.lightbox.loading .lb-img { opacity: 0; }

.lb-spinner {
  position: absolute;
  width: 32px;
  height: 32px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  opacity: 0;
  animation: spin 0.8s linear infinite;
  transition: opacity 0.2s;
}

.lightbox.loading .lb-spinner { opacity: 1; }

@keyframes spin { to { transform: rotate(360deg); } }

.lb-caption {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  width: 100%;
  max-width: 900px;
  padding-top: 18px;
}

.lb-title { font-family: var(--serif); font-size: 1.25rem; }

.lb-count {
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  color: rgba(255, 255, 255, 0.55);
  white-space: nowrap;
  padding-top: 4px;
}

.lb-btn {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}

.lb-btn:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.lb-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.lb-btn svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lb-prev { grid-column: 1; justify-self: center; }
.lb-next { grid-column: 3; justify-self: center; }
.lb-close { position: absolute; top: 16px; right: 16px; z-index: 1; }

/* ---------- Small screens ---------- */

@media (max-width: 640px) {
  .site-header { flex-direction: column; align-items: flex-start; gap: 10px; padding-block: 16px; }
  .brand span { display: block; margin: 2px 0 0; }

  .thumb-caption { opacity: 1; transform: none; padding: 28px 12px 10px; }

  .lightbox { grid-template-columns: 1fr; }
  .lb-figure { grid-column: 1; padding: 0 0 72px; }
  .lb-img { max-height: calc(100dvh - 180px); }
  .lb-caption { padding: 14px 16px 0; }
  .lb-prev, .lb-next { position: absolute; bottom: 16px; }
  .lb-prev { left: 16px; }
  .lb-next { right: 16px; }
  .lb-close { top: 8px; right: 8px; }
}

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