:root,
:root[data-theme="dark"] {
  --bg: #101210;
  --overlay-bg: #0a0b0a;
  --nav-bg: rgba(16, 18, 16, 0.92);
  --overlay-header-bg: rgba(10, 11, 10, 0.92);
  --lightbox-bg: rgba(6, 7, 6, 0.96);
  --row-hover: #181b17;
  --portrait-fade: rgba(16, 18, 16, 0.7);
  --vignette: rgba(0, 0, 0, 0.42);
  --text: #ece9e2;
  --accent: #fc0;
  --on-accent: #101210;
  --border: rgba(236, 233, 226, 0.12);
  --border-mid: rgba(236, 233, 226, 0.3);
  --dim-72: rgba(236, 233, 226, 0.72);
  --dim-60: rgba(236, 233, 226, 0.6);
  --dim-50: rgba(236, 233, 226, 0.5);
  --dim-40: rgba(236, 233, 226, 0.4);
  --dim-35: rgba(236, 233, 226, 0.35);

  --font-display: 'Archivo Black', sans-serif;
  --font-body: 'Space Grotesk', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
}

:root[data-theme="light"] {
  --bg: #f4f2ec;
  --overlay-bg: #faf9f5;
  --nav-bg: rgba(244, 242, 236, 0.92);
  --overlay-header-bg: rgba(250, 249, 245, 0.92);
  --lightbox-bg: rgba(244, 242, 236, 0.97);
  --row-hover: #eae7dc;
  --portrait-fade: rgba(244, 242, 236, 0.7);
  --vignette: rgba(0, 0, 0, 0.08);
  --text: #1a1c19;
  --accent: #b57400;
  --on-accent: #f4f2ec;
  --border: rgba(26, 28, 25, 0.14);
  --border-mid: rgba(26, 28, 25, 0.32);
  --dim-72: rgba(26, 28, 25, 0.72);
  --dim-60: rgba(26, 28, 25, 0.62);
  --dim-50: rgba(26, 28, 25, 0.52);
  --dim-40: rgba(26, 28, 25, 0.45);
  --dim-35: rgba(26, 28, 25, 0.4);
}

html { color-scheme: dark; }
html[data-theme="light"] { color-scheme: light; }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
}

body {
  font-family: var(--font-body);
  color: var(--text);
}

a {
  color: var(--text);
  text-decoration: none;
}
a:hover { color: var(--accent); }

::selection {
  background: var(--accent);
  color: var(--on-accent);
}

@keyframes ns-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes ns-rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============ NAV ============ */

.nav {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 40px;
  background: var(--nav-bg);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.nav-logo {
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: 0.14em;
  cursor: pointer;
}

.nav-links {
  display: flex;
  gap: 28px;
  font-size: 12px;
  letter-spacing: 0.18em;
  align-items: center;
}

.nav-link {
  cursor: pointer;
  color: var(--dim-60);
  border-bottom: 2px solid transparent;
  padding-bottom: 3px;
}

.nav-link.is-active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.nav-ig {
  color: var(--dim-60);
}

/* ---- Theme toggle ---- */

.theme-toggle {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border-mid);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: transparent;
  color: var(--dim-72);
  font-size: 15px;
  line-height: 1;
  padding: 0;
}
.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ============ PAGES ============ */

.page { animation: ns-rise 0.6s ease both; }

.page[hidden] { display: none; }

/* ---- Home ---- */

.page-home {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: calc(100vh - 71px);
}

.home-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 26px;
  padding: 60px 56px;
  animation: ns-rise 0.7s ease both;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.24em;
  color: var(--accent);
}

.home-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(52px, 6.5vw, 92px);
  line-height: 0.95;
  letter-spacing: -0.01em;
}

.home-tagline {
  margin: 0;
  font-size: 17px;
  line-height: 1.6;
  color: var(--dim-72);
  max-width: 440px;
}

.home-cta-row {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 6px;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.14em;
  padding: 16px 28px;
  cursor: pointer;
}
.btn-primary:hover { background: var(--text); color: var(--bg); }

.btn-arrow { font-size: 16px; }

.social-row {
  display: flex;
  gap: 22px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--dim-50);
  margin-top: 18px;
}

.home-portrait {
  position: relative;
  min-height: 520px;
}

.home-portrait-fade {
  position: absolute;
  left: 0; bottom: 0; right: 0;
  height: 140px;
  background: linear-gradient(to top, var(--portrait-fade), transparent);
  pointer-events: none;
}

.home-portrait-caption {
  position: absolute;
  left: 24px;
  bottom: 20px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--dim-72);
  pointer-events: none;
}

/* ---- Work ---- */

.work-intro {
  padding: 64px 40px 28px;
}

.work-title {
  margin: 18px 0 0;
  font-family: var(--font-display);
  font-size: clamp(48px, 6vw, 80px);
  line-height: 0.98;
  letter-spacing: -0.01em;
}

.work-subtext {
  font-size: 15px;
  color: var(--dim-60);
  margin-top: 18px;
  max-width: 520px;
}

.album-list { margin-top: 20px; }

.album-row {
  display: flex;
  align-items: center;
  gap: 26px;
  padding: 20px 40px;
  border-top: 1px solid var(--border);
  cursor: pointer;
}
.album-row:hover { background: var(--row-hover); }

.album-num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--dim-40);
  width: 26px;
  flex: none;
}

.album-title {
  font-family: var(--font-display);
  font-size: clamp(24px, 3vw, 36px);
  flex: 1;
  min-width: 0;
}
.album-row:hover .album-title { color: var(--accent); }

.album-cat {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--accent);
  flex: none;
}

.album-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--dim-40);
  flex: none;
  width: 36px;
  text-align: right;
}

.album-cover {
  width: 150px;
  height: 64px;
  flex: none;
}

.album-arrow {
  font-size: 20px;
  color: var(--dim-50);
  flex: none;
}

.work-footer {
  border-top: 1px solid var(--border);
  padding: 28px 40px 48px;
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--dim-40);
}

.work-footer-links { display: flex; gap: 20px; }

/* ============ PLACEHOLDER TILES ============ */

.placeholder-tile {
  position: relative;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(45deg, var(--c1), var(--c1) 9px, var(--c2) 9px, var(--c2) 18px);
  display: flex;
  align-items: flex-end;
  padding: 14px;
}

.placeholder-caption {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--dim-60);
}

/* Real photo overlay — sits on top of the striped placeholder.
   Fades in once the file loads; removed by JS if the file is missing,
   revealing the placeholder underneath. */
.tile-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.5s ease;
}
.tile-img.is-loaded { opacity: 1; }

.placeholder-tile--cover {
  align-items: center;
  justify-content: center;
  padding: 8px;
  text-align: center;
}

.placeholder-tile--portrait {
  align-items: flex-end;
  justify-content: center;
  text-align: center;
  padding: 16px;
}

/* ============ ALBUM OVERLAY ============ */

.album-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: var(--overlay-bg);
  overflow-y: auto;
  animation: ns-fade 0.25s ease both;
}
.album-overlay[hidden] { display: none; }

/* Only one surface scrolls at a time. A fixed layer brings its own scrollbar,
   so the surface beneath it has to stop scrolling or both bars show at once. */
body.is-scroll-locked { overflow: hidden; }
.album-overlay.is-scroll-locked { overflow-y: hidden; }

.overlay-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 40px;
  background: var(--overlay-header-bg);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.overlay-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--accent);
}

.overlay-controls {
  display: flex;
  gap: 12px;
  align-items: center;
}

.circle-btn {
  width: 42px;
  height: 42px;
  border: 1px solid var(--border-mid);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  padding: 0;
}
.circle-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
#overlay-close { font-size: 15px; }

.overlay-title-block {
  padding: 44px 40px 16px;
  animation: ns-rise 0.4s ease both;
}

.overlay-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(40px, 5vw, 64px);
  line-height: 1;
}

.overlay-blurb {
  font-size: 15px;
  line-height: 1.6;
  color: var(--dim-60);
  max-width: 620px;
  margin-top: 16px;
}

/* Masonry gallery — columns keep each photo at its native aspect ratio,
   so landscape and portrait images both show in full, no cropping. */
.photo-grid {
  column-count: 3;
  column-gap: 10px;
  padding: 28px 40px 56px;
}

.photo-tile {
  display: block;
  position: relative;
  break-inside: avoid;
  margin: 0 0 10px;
  padding: 0;
  height: auto;
  aspect-ratio: 3 / 2;   /* placeholder / loading size only */
  overflow: hidden;
  cursor: pointer;
}
.photo-tile:hover .tile-img { filter: brightness(1.08); }

/* Video tiles look like photo tiles, so they need a play mark to read as video. */
.photo-tile.is-video::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.85);
  background: rgba(0, 0, 0, 0.45) no-repeat center/14px 16px
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 14'%3E%3Cpath d='M0 0l12 7-12 7z' fill='white'/%3E%3C/svg%3E");
  backdrop-filter: blur(2px);
  transition: transform 0.2s ease, background-color 0.2s ease;
  pointer-events: none;
}
.photo-tile.is-video:hover::after { transform: translate(-50%, -50%) scale(1.08); }
/* once the real photo is in, let the image itself define the height */
.photo-tile:has(.tile-img.is-loaded) { aspect-ratio: auto; }

.photo-tile .placeholder-caption {
  position: absolute;
  left: 14px;
  bottom: 14px;
}

.photo-tile .tile-img {
  position: relative;
  inset: auto;
  display: block;
  width: 100%;
  height: auto;          /* natural aspect ratio — full frame, no crop */
}

.overlay-note {
  padding: 0 40px 60px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--dim-35);
  margin: 0;
}

/* ============ PHOTO LIGHTBOX ============ */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  flex-direction: column;
  background: var(--lightbox-bg);
  backdrop-filter: blur(6px);
  animation: ns-fade 0.2s ease both;
}
.lightbox[hidden] { display: none; }

.lightbox-bar {
  flex: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
}

.lightbox-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--dim-60);
}

.lightbox-figure {
  flex: 1;
  min-height: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 0 24px 32px;
}

.lightbox-img {
  display: block;
  max-width: min(1400px, 100%);
  max-height: 100%;
  object-fit: contain;
  animation: ns-fade 0.25s ease both;
}
.lightbox-img.is-missing { display: none; }
.lightbox-img[hidden] { display: none; }

/* YouTube decides the frame's aspect; we just give it a 16:9 box to fill. */
.lightbox-video {
  width: min(1400px, 100%);
  aspect-ratio: 16 / 9;
  max-height: 100%;
  animation: ns-fade 0.25s ease both;
}
.lightbox-video[hidden] { display: none; }
.lightbox-video iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.lightbox-caption {
  flex: none;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--dim-60);
  text-align: center;
}

/* ============ VIGNETTE ============ */

.vignette {
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, var(--vignette) 100%);
}

/* ============ RESPONSIVE ============ */

@media (max-width: 860px) {
  .nav { padding: 18px 20px; }
  .nav-links { gap: 16px; }
  .nav-ig { display: none; }

  .page-home {
    grid-template-columns: 1fr;
  }
  .home-copy { padding: 44px 24px; }
  .home-portrait { min-height: 320px; }

  .work-intro { padding: 44px 20px 24px; }

  .album-row {
    flex-wrap: wrap;
    padding: 18px 20px;
    gap: 12px;
  }
  .album-cover { order: 5; }
  .album-arrow { display: none; }

  .work-footer { padding: 24px 20px 36px; flex-direction: column; gap: 10px; }

  .overlay-header { padding: 16px 20px; }
  .overlay-title-block { padding: 32px 20px 16px; }
  .photo-grid {
    column-count: 2;
    padding: 20px 20px 40px;
  }
  .overlay-note { padding: 0 20px 40px; }

  .lightbox-bar { padding: 14px 16px; }
  .lightbox-figure { padding: 0 16px 24px; }
}

@media (max-width: 520px) {
  .photo-grid { column-count: 1; }
}
