/* ---------- Tokens (light is the default, dark via data-theme) ---------- */
:root {
  --paper: #ffffff;
  --ink: #1c1c1a;
  --muted: #7a7970;
  --line: #ebeae6;
  --wash: #f6f5f2;
  --header-bg: rgba(255, 255, 255, 0.86);
  --serif: "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --pad: 16px;
  color-scheme: light;
}

@media (min-width: 720px) {
  :root { --pad: 40px; }
}

:root[data-theme="dark"] {
  --paper: #121211;
  --ink: #ecebe6;
  --muted: #8f8e86;
  --line: #2b2b28;
  --wash: #1d1d1b;
  --header-bg: rgba(18, 18, 17, 0.86);
  color-scheme: dark;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color 0.6s var(--ease), color 0.6s var(--ease);
}

body.is-locked { overflow: hidden; }

img { display: block; max-width: 100%; }
h1, h2, p, figure { margin: 0; }
h1, h2 { font-weight: 400; }
a { color: inherit; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

:focus-visible { outline: 1px solid currentColor; outline-offset: 4px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--header-bg);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  transition: background-color 0.6s var(--ease), border-color 0.6s var(--ease);
}

.bar {
  max-width: 1280px;
  margin: 0 auto;
  padding: 14px var(--pad);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px 24px;
  flex-wrap: wrap;
}

.bar-right {
  display: flex;
  align-items: center;
  gap: 26px;
  flex-wrap: wrap;
}

.brand {
  font-family: var(--serif);
  font-size: 22px;
  letter-spacing: 0.01em;
  text-decoration: none;
}

nav { display: flex; gap: 22px; }

nav a {
  position: relative;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--muted);
  transition: color 0.4s var(--ease);
}

nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -4px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.5s var(--ease);
}

nav a:hover { color: var(--ink); }
nav a:hover::after { transform: scaleX(1); }

/* ---------- Theme switch ---------- */
.theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 0.4s var(--ease);
}

.theme-switch:hover { color: var(--ink); }

.switch-track {
  position: relative;
  width: 44px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--wash);
  transition: background-color 0.5s var(--ease), border-color 0.5s var(--ease);
}

.switch-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--ink);
  transition: transform 0.5s var(--ease), background-color 0.5s var(--ease);
}

.theme-switch[aria-checked="true"] .switch-knob { transform: translateX(20px); }

/* ---------- Hero ---------- */
.hero {
  max-width: 1280px;
  margin: 0 auto;
  padding: clamp(56px, 12vh, 120px) var(--pad) clamp(32px, 6vh, 64px);
}

.hero h1 {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(46px, 9vw, 116px);
  line-height: 0.95;
  letter-spacing: -0.01em;
}

#tagline {
  margin-top: 20px;
  max-width: 46ch;
  color: var(--muted);
  font-size: 16px;
}

/* ---------- Sections ---------- */
.section {
  max-width: 1280px;
  margin: 0 auto;
  padding: clamp(48px, 8vh, 88px) var(--pad);
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 32px;
}

.section-title {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(34px, 4.5vw, 48px);
  line-height: 1.05;
}

/* ---------- View switch ---------- */
.views {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
}

.views button {
  border: 0;
  background: transparent;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  transition: background-color 0.5s var(--ease), color 0.5s var(--ease);
}

.views button:hover { color: var(--ink); }

.views button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
}

/* ---------- Works (shared) ---------- */
.works {
  list-style: none;
  margin: 0;
  padding: 0;
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
}

.works.is-swapping {
  opacity: 0;
  transform: translateY(8px);
}

.work {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
}

.work-media {
  position: relative;
  overflow: hidden;
  background: var(--wash);
}

.work-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 1.6s var(--ease), opacity 0.9s var(--ease);
}

.js .work-media img { opacity: 0; }
.js .work-media img.loaded { opacity: 1; }

.work:hover .work-media img { transform: scale(1.03); }

.work-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-top: 12px;
}

.work-title {
  font-family: var(--serif);
  font-size: 21px;
  line-height: 1.2;
}

.work-year {
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.work:focus-visible { outline: 1px solid currentColor; outline-offset: 6px; }

/* ---------- Overview: columns (natural proportions, default) ---------- */
.works--columns {
  column-count: 2;
  column-gap: 16px;
}

@media (min-width: 720px) {
  .works--columns { column-count: 3; column-gap: 28px; }
}

.works--columns > li {
  break-inside: avoid;
  margin: 0 0 48px;
}

.works--columns .work-media { height: auto; }
.works--columns .work-media img { height: auto; }

/* ---------- Overview: grid ---------- */
.works--grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 36px 16px;
}

@media (min-width: 720px) {
  .works--grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 56px 28px; }
}

.works--grid .work-media { aspect-ratio: 4 / 5; }

/* ---------- Overview: list ---------- */
.works--list > li { border-top: 1px solid var(--line); }
.works--list > li:last-child { border-bottom: 1px solid var(--line); }

.works--list .work {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 14px 0;
}

@media (min-width: 720px) {
  .works--list .work { grid-template-columns: 112px minmax(0, 1fr) auto; gap: 28px; padding: 18px 0; }
}

.works--list .work-media { aspect-ratio: 1 / 1; }

.works--list .work-meta {
  margin: 0;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.works--list .work-year { text-align: right; }
.works--list .work-title { font-size: 20px; }
.works--list .work:hover .work-title { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }

/* ---------- Statement ---------- */
.statement {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 28px 64px;
}

@media (max-width: 800px) {
  .statement { grid-template-columns: 1fr; }
}

.statement-text { max-width: 62ch; }

.statement-text p {
  font-size: 17px;
  line-height: 1.8;
  margin-bottom: 1.2em;
}

/* ---------- Contact ---------- */
.contact { border-top: 1px solid var(--line); }

#contact-links {
  margin-top: 28px;
  display: flex;
  gap: 24px 56px;
  flex-wrap: wrap;
}

.contact-link {
  display: inline-flex;
  align-items: center;
  gap: 18px;
  text-decoration: none;
}

.contact-icon {
  width: 60px;
  height: 60px;
  flex: none;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink);
  transition: transform 0.6s var(--ease), background-color 0.6s var(--ease),
              border-color 0.6s var(--ease), color 0.6s var(--ease);
}

.contact-icon svg {
  width: 28px;
  height: 28px;
}

.contact-link:hover .contact-icon {
  transform: translateY(-3px);
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.contact-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.contact-label {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.contact-value {
  font-family: var(--serif);
  font-size: 26px;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

/* ---------- Floating viewer (always dark, over a dimmed blurred page) ---------- */
.pop {
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  color: #fff;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-width: 100vw;
  max-height: 100dvh;
}

.pop::backdrop {
  background: rgba(14, 14, 13, 0.62);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.pop[open] { animation: pop-fade 0.5s ease both; }
.pop[open]::backdrop { animation: pop-fade 0.6s ease both; }

.pop-layout {
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(28px, 5vw, 84px);
  padding: 72px clamp(64px, 8vw, 120px);
}

.pop-figure {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 56vw;
  max-height: 80vh;
}

.pop-figure img {
  max-width: 100%;
  max-height: 80vh;
  width: auto;
  height: auto;
  object-fit: contain;
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, 0.6);
}

.pop-figure.play { animation: figure-in 0.9s var(--ease) both; }

.pop-text {
  width: min(340px, 30vw);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pop-text.play { animation: text-in 0.9s var(--ease) 0.15s both; }

.pop-counter {
  font-size: 11px;
  letter-spacing: 0.14em;
  color: rgba(255, 255, 255, 0.6);
  font-variant-numeric: tabular-nums;
}

#pop-title {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(34px, 3.6vw, 46px);
  line-height: 1.05;
}

.pop-meta { color: rgba(255, 255, 255, 0.7); font-size: 14px; }

.pop-desc {
  font-size: 15px;
  line-height: 1.75;
  color: rgba(255, 255, 255, 0.9);
  margin-top: 6px;
}

.pop-caption { font-size: 13px; color: rgba(255, 255, 255, 0.6); }

.pop-views {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pop-views button {
  width: 64px;
  height: 64px;
  padding: 0;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.1);
  cursor: pointer;
  overflow: hidden;
  opacity: 0.55;
  transition: opacity 0.4s var(--ease), border-color 0.4s var(--ease);
}

.pop-views button:hover { opacity: 1; }
.pop-views button[aria-current="true"] { opacity: 1; border-color: #fff; }
.pop-views img { width: 100%; height: 100%; object-fit: cover; }

.pop-close {
  position: fixed;
  top: 22px;
  right: 24px;
  z-index: 3;
  border: 0;
  background: none;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #fff;
  cursor: pointer;
  padding: 8px;
  opacity: 0.85;
  transition: opacity 0.3s var(--ease);
}

.pop-close:hover { opacity: 1; }

.pop-nav {
  position: fixed;
  top: 50%;
  z-index: 3;
  transform: translateY(-50%);
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  cursor: pointer;
  transition: background 0.4s var(--ease), border-color 0.4s var(--ease);
}

.pop-nav:hover { background: rgba(255, 255, 255, 0.16); border-color: #fff; }
.pop-nav.prev { left: 18px; }
.pop-nav.next { right: 18px; }

@media (max-width: 860px) {
  .pop-layout {
    flex-direction: column;
    justify-content: flex-start;
    height: 100%;
    overflow-y: auto;
    gap: 22px;
    padding: 64px 16px 96px;
  }

  .pop-figure { max-width: 100%; }
  .pop-figure img { max-height: 56dvh; }
  .pop-text { width: 100%; }
  #pop-title { font-size: 32px; }

  .pop-nav { top: auto; bottom: 22px; transform: none; }
  .pop-nav.prev { left: 16px; }
  .pop-nav.next { right: 16px; }
}

/* ---------- Scroll fade (animated page only) ---------- */
.fade-edge { display: none; }

body[data-fade="true"] .fade-edge {
  display: block;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 26vh;
  /* Many eased stops (smoothstep curve) plus a fine grain layer, so the
     gradient has no visible steps on dark backgrounds. */
  background: linear-gradient(to bottom,
      color-mix(in srgb, var(--paper) 0%, transparent) 0%,
      color-mix(in srgb, var(--paper) 2.8%, transparent) 10%,
      color-mix(in srgb, var(--paper) 10.4%, transparent) 20%,
      color-mix(in srgb, var(--paper) 21.6%, transparent) 30%,
      color-mix(in srgb, var(--paper) 35.2%, transparent) 40%,
      color-mix(in srgb, var(--paper) 50%, transparent) 50%,
      color-mix(in srgb, var(--paper) 64.8%, transparent) 60%,
      color-mix(in srgb, var(--paper) 78.4%, transparent) 70%,
      color-mix(in srgb, var(--paper) 89.6%, transparent) 80%,
      color-mix(in srgb, var(--paper) 97.2%, transparent) 90%,
      var(--paper) 100%);
  pointer-events: none;
  z-index: 5;
}

/* Fine grain, masked with the same curve as the gradient, so it fades in with it
   and does not form a hard-edged box. */
body[data-fade="true"] .fade-edge::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.7;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 0.11 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 100%);
  mask-image: linear-gradient(to bottom, transparent 0%, #000 100%);
}

/* ---------- Motion ---------- */
@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}

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

@keyframes figure-in {
  from { opacity: 0; transform: translate3d(42px, 0, 0) scale(0.96); }
  to { opacity: 1; transform: none; }
}

@keyframes text-in {
  from { opacity: 0; transform: translate3d(22px, 0, 0); }
  to { opacity: 1; transform: none; }
}

.js .rise {
  animation: rise 1.2s var(--ease) both;
  animation-delay: var(--d, 0ms);
}

.js .reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 1s var(--ease), transform 1s var(--ease);
  transition-delay: var(--d, 0ms);
}

.js .reveal.in {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }

  .js .reveal { opacity: 1 !important; transform: none !important; }
  .js .work-media img { opacity: 1 !important; }
  .work:hover .work-media img { transform: none; }
}
