:root {
  --bg: #0e0e0f;
  --surface: #17171a;
  --text: #ecebe7;
  --muted: #9a9892;
  --line: #2a2a2e;
  --accent: #e2b04a;
  --row: clamp(160px, 18vw, 320px);
  --gap: 8px;
  --serif: "Instrument Serif", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
img { display: block; max-width: 100%; }
h1, h2 { font-family: var(--serif); font-weight: 400; letter-spacing: -0.01em; margin: 0; }
h2 { font-size: clamp(2rem, 4vw, 3rem); line-height: 1.1; }

/* Top bar */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px clamp(16px, 4vw, 48px);
  transition: background .3s, backdrop-filter .3s;
}
.topbar.scrolled { background: rgba(14,14,15,.82); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { font-family: var(--serif); font-size: 1.5rem; text-decoration: none; }
.topbar nav { display: flex; gap: clamp(14px, 3vw, 32px); }
.topbar nav a { text-decoration: none; font-size: .9rem; color: var(--muted); transition: color .2s; }
.topbar nav a:hover { color: var(--text); }

/* Hero */
.hero { position: relative; height: 100svh; min-height: 520px; overflow: hidden; }
.hero-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scale(1.04); animation: settle 2.4s ease-out forwards; }
@keyframes settle { to { transform: scale(1); } }
.hero-shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.45) 0%, rgba(0,0,0,0) 30%, rgba(0,0,0,.2) 55%, rgba(14,14,15,.95) 100%); }
.hero-text { position: absolute; left: 0; right: 0; bottom: 0; padding: 0 clamp(16px, 4vw, 48px) clamp(40px, 8vh, 88px); max-width: 900px; }
.eyebrow { text-transform: uppercase; letter-spacing: .2em; font-size: .75rem; color: var(--accent); margin: 0 0 12px; }
.hero h1 { font-size: clamp(3rem, 9vw, 7.5rem); line-height: .95; }
.tagline { font-size: clamp(1rem, 1.6vw, 1.2rem); color: #d6d4ce; margin: 18px 0 28px; max-width: 34em; }
.cta {
  display: inline-block; padding: 12px 22px; border: 1px solid rgba(255,255,255,.5); border-radius: 999px;
  text-decoration: none; font-size: .9rem; transition: background .2s, color .2s, border-color .2s;
}
.cta:hover { background: var(--text); color: var(--bg); border-color: var(--text); }

/* Work */
.work { padding: clamp(64px, 10vw, 120px) clamp(16px, 4vw, 48px) 40px; }
.work-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filters button {
  font: 500 .85rem var(--sans); color: var(--muted); background: transparent;
  border: 1px solid var(--line); border-radius: 999px; padding: 7px 15px; cursor: pointer;
  transition: color .2s, border-color .2s, background .2s;
}
.filters button:hover { color: var(--text); border-color: #55555b; }
.filters button[aria-selected="true"] { color: var(--bg); background: var(--text); border-color: var(--text); }

/* Justified gallery: each tile grows in proportion to its aspect ratio */
.gallery { display: flex; flex-wrap: wrap; gap: var(--gap); }
.gallery::after { content: ""; flex-grow: 999; }
.tile {
  position: relative; overflow: hidden; cursor: zoom-in; background: var(--surface);
  flex-grow: var(--r); flex-basis: calc(var(--r) * var(--row));
  aspect-ratio: var(--r); border: 0; padding: 0; color: inherit; font: inherit;
  opacity: 0; transform: translateY(12px); transition: opacity .6s ease, transform .6s ease;
}
.tile.in { opacity: 1; transform: none; }
.tile img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s ease, filter .4s; }
.tile:hover img, .tile:focus-visible img { transform: scale(1.03); }
.tile-cap {
  position: absolute; inset: auto 0 0 0; padding: 36px 14px 12px; text-align: left;
  background: linear-gradient(transparent, rgba(0,0,0,.72));
  opacity: 0; transition: opacity .3s;
}
.tile:hover .tile-cap, .tile:focus-visible .tile-cap { opacity: 1; }
.tile-cap strong { display: block; font-weight: 500; font-size: .95rem; }
.tile-cap span { font-size: .78rem; color: #cfcdc7; }
.tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* About / contact */
.about, .contact { padding: clamp(64px, 10vw, 120px) clamp(16px, 4vw, 48px); border-top: 1px solid var(--line); }
.about { display: grid; grid-template-columns: 1fr 2fr; gap: 32px; }
.about-body { max-width: 38em; color: #cfcdc7; font-size: 1.1rem; }
.about-body p:first-child { margin-top: 0; }
.contact { text-align: center; }
.contact p { color: var(--muted); margin: 12px 0 28px; }
.contact-links { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; }
.contact-links a { display: inline-block; padding: 12px 22px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; transition: border-color .2s, background .2s; }
.contact-links a:hover { border-color: var(--text); }
.contact-links .placeholder { color: var(--muted); font-size: .9rem; }
.footer { padding: 28px clamp(16px, 4vw, 48px); border-top: 1px solid var(--line); color: var(--muted); font-size: .82rem; }

/* Lightbox */
.lightbox {
  width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0;
  border: 0; background: rgba(8,8,9,.97); color: var(--text);
  display: grid; grid-template-columns: 64px 1fr 64px; align-items: center;
}
.lightbox:not([open]) { display: none; }
.lightbox::backdrop { background: transparent; }
.lb-figure { margin: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 56px 0 20px; min-width: 0; }
.lb-figure img { max-height: calc(100vh - 150px); max-height: calc(100dvh - 150px); max-width: 100%; object-fit: contain; transition: opacity .25s; }
.lb-figure img.loading { opacity: .25; }
.lb-figure figcaption { width: 100%; display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 8px 24px; padding-top: 16px; }
.lb-title { font-family: var(--serif); font-size: 1.6rem; margin-right: 12px; }
.lb-cat { color: var(--accent); font-size: .8rem; text-transform: uppercase; letter-spacing: .14em; }
.lb-exif { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--muted); font-size: .82rem; font-variant-numeric: tabular-nums; }
.lb-nav, .lb-close {
  background: none; border: 0; color: var(--text); cursor: pointer; opacity: .6; transition: opacity .2s;
  font: 300 3rem/1 var(--sans); height: 100%; width: 100%;
}
.lb-nav:hover, .lb-close:hover { opacity: 1; }
.lb-close { position: absolute; top: 12px; right: 16px; width: 44px; height: 44px; font-size: 2.2rem; z-index: 2; }

@media (max-width: 760px) {
  :root { --row: 150px; --gap: 6px; }
  .about { grid-template-columns: 1fr; gap: 16px; }
  /* Nav buttons are absolutely positioned here, so the figure is the only grid item */
  .lightbox { grid-template-columns: 1fr; }
  .lb-nav {
    position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; font-size: 2rem;
    display: grid; place-items: center; padding: 0 0 4px; border-radius: 50%;
    background: rgba(14,14,15,.55); backdrop-filter: blur(4px); opacity: .9;
  }
  .lb-prev { left: 6px; } .lb-next { right: 6px; }
  .lb-figure { padding: 56px 12px 16px; }
  .tile-cap { opacity: 1; padding: 24px 10px 8px; }
  .tile-cap span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .tile { opacity: 1; transform: none; }
}
