/*
  Gallery site. Dark only (by brief).
  Shape rule: media 4px, panels 20px, every interactive control is a full pill or circle.
  Layers: stage 0, scrim 10, preview 15, hero/dock 20, follower 25, bar 30, grain 60 (dialogs sit in the top layer).
*/
:root {
  --bg: #0b0b0c;
  --bg-2: #141416;
  --bg-3: #1c1c1f;
  --fg: #ecebe7;
  --fg-2: rgb(236 235 231 / .66);
  --fg-3: rgb(236 235 231 / .42);
  --line: rgb(236 235 231 / .11);
  --glass: rgb(22 22 24 / .62);
  --accent: #cfe86f;
  --on-accent: #0b0b0c;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --sans: 'Mona Sans', 'Readex Pro', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --bar-h: 68px;
  --gutter: clamp(16px, 2.2vw, 32px);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
body.view-canvas { overflow: hidden; height: 100dvh; overscroll-behavior: none; }
img, video { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 999px; }
.i { width: 1.15em; height: 1.15em; flex: none; }
[dir="rtl"] .i-arrow { transform: scaleX(-1); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* film grain, fixed and inert */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  opacity: .07;
  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='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.skip {
  position: fixed; top: 8px; inset-inline-start: 8px; z-index: 70;
  padding: 10px 16px; border-radius: 999px; background: var(--fg); color: var(--bg);
  transform: translateY(-160%); transition: transform .3s var(--ease);
}
.skip:focus { transform: none; }

/* ---------- top bar ---------- */
.bar {
  position: fixed; inset: 0 0 auto 0; z-index: 30;
  height: var(--bar-h);
  padding: 0 var(--gutter);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
  transition: background-color .5s var(--ease), border-color .5s var(--ease), transform .7s var(--ease), opacity .7s var(--ease);
  border-bottom: 1px solid transparent;
}
body.view-index .bar { background: rgb(11 11 12 / .78); backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%); border-color: var(--line); }
.mark {
  justify-self: start;
  font-weight: 800; font-stretch: 125%; font-size: 17px; letter-spacing: .01em; text-transform: uppercase;
  line-height: 1; padding: 8px 0;
}
.text-btn {
  justify-self: end; font-size: 14px; font-weight: 500; color: var(--fg-2);
  padding: 10px 4px; transition: color .3s;
  background: linear-gradient(currentColor, currentColor) no-repeat 0 100% / 0 1px;
  transition: color .3s, background-size .5s var(--ease);
}
[dir="rtl"] .text-btn { background-position: 100% 100%; }
.text-btn:hover { color: var(--fg); background-size: 100% 1px; }

.switch {
  position: relative; display: inline-flex; padding: 4px; gap: 2px;
  border-radius: 999px; background: var(--glass); border: 1px solid var(--line);
  backdrop-filter: blur(16px) saturate(140%); -webkit-backdrop-filter: blur(16px) saturate(140%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .05);
}
.switch button {
  position: relative; z-index: 1;
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 16px; border-radius: 999px;
  font-size: 13px; font-weight: 550; color: var(--fg-2);
  transition: color .45s var(--ease);
}
.switch button[aria-pressed="true"] { color: var(--bg); }
.switch button:not([aria-pressed="true"]):hover { color: var(--fg); }
.switch .count { font-family: var(--mono); font-size: 10px; font-weight: 500; opacity: .7; align-self: flex-start; margin-top: 7px; margin-inline-start: -4px; }
.switch-thumb {
  position: absolute; top: 4px; left: 0; height: 36px; width: var(--w, 0);
  border-radius: 999px; background: var(--fg);
  transform: translateX(var(--x, 0));
}
.switch.ready .switch-thumb { transition: transform .55s var(--ease), width .55s var(--ease); }

/* ---------- canvas ---------- */
.stage {
  position: fixed; inset: 0; z-index: 0;
  overflow: hidden; cursor: grab;
  touch-action: none; user-select: none; -webkit-user-select: none;
  transition: opacity .7s var(--ease), transform .9s var(--ease), visibility 0s linear 0s;
}
.stage.is-dragging { cursor: grabbing; }
.stage-inner { position: absolute; inset: 0; }
.tile {
  position: absolute; top: 0; left: 0;
  border-radius: 4px; overflow: hidden;
  background: var(--bg-2);
  will-change: transform;
  transform-origin: 50% 50%;
  opacity: 0;
  transition: opacity .9s var(--ease) var(--d, 0ms), filter .5s var(--ease);
}
.tile.is-in { opacity: 1; }
.tile .media {
  width: 100%; height: 100%; object-fit: cover;
  pointer-events: none; -webkit-user-drag: none;
  transform: scale(1.18);
  transition: transform 1.4s var(--ease) var(--d, 0ms);
}
.tile.is-in .media { transform: scale(1); }
.tile.is-in.is-hover .media { transform: scale(1.045); transition-delay: 0ms; transition-duration: .9s; }
.stage.has-hover .tile.is-in:not(.is-hover) { opacity: .32; transition-delay: 0ms; transition-duration: .5s; }
.stage-empty { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; color: var(--fg-3); }

.scrim {
  position: fixed; inset: auto 0 0 0; height: 52vh; z-index: 10; pointer-events: none;
  background: linear-gradient(to top, rgb(11 11 12 / .94) 6%, rgb(11 11 12 / .6) 42%, rgb(11 11 12 / 0));
  transition: opacity .7s var(--ease);
}
.scrim::before {
  content: ""; position: fixed; inset: 0 0 auto 0; height: 150px;
  background: linear-gradient(to bottom, rgb(11 11 12 / .8), rgb(11 11 12 / 0));
}

/* ---------- hero ---------- */
.hero {
  position: fixed; z-index: 20;
  inset-inline-start: var(--gutter);
  bottom: calc(var(--gutter) + env(safe-area-inset-bottom));
  width: min(620px, 50vw);
  pointer-events: none;
  transition: opacity .7s var(--ease), transform .8s var(--ease);
}
.hero > * { pointer-events: auto; }
.hero h1 {
  margin: 0 0 16px;
  font-size: clamp(2.3rem, 4.4vw, 4.4rem);
  font-weight: 640; font-stretch: 112%;
  line-height: .98; letter-spacing: -.035em;
  text-wrap: balance;
}
.hero p { margin: 0 0 26px; max-width: 42ch; font-size: clamp(15px, 1.1vw, 17px); color: var(--fg-2); text-wrap: pretty; }
body.is-exploring .hero { opacity: 0; transform: translateY(14px); }
body.is-exploring .hero > * { pointer-events: none; }
body.is-exploring .scrim { opacity: .55; }

.pill {
  display: inline-flex; align-items: center; gap: 10px;
  height: 48px; padding: 0 22px; border-radius: 999px;
  font-size: 15px; font-weight: 600; white-space: nowrap;
  transition: transform .4s var(--ease), background-color .3s, box-shadow .4s var(--ease);
}
.pill .i { transition: transform .45s var(--ease); }
.pill:hover .i { transform: translate(2px, -2px); }
[dir="rtl"] .pill:hover .i { transform: scaleX(-1) translate(2px, -2px); }
.pill:active { transform: scale(.97); }
.pill-accent { background: var(--accent); color: var(--on-accent); box-shadow: 0 10px 30px -12px color-mix(in srgb, var(--accent) 55%, transparent); }

/* ---------- dock ---------- */
.dock {
  position: fixed; z-index: 20;
  inset-inline-end: var(--gutter);
  bottom: calc(var(--gutter) + env(safe-area-inset-bottom));
  display: flex; align-items: flex-end; gap: 2px; padding: 6px;
  border-radius: 999px; background: var(--glass); border: 1px solid var(--line);
  backdrop-filter: blur(18px) saturate(150%); -webkit-backdrop-filter: blur(18px) saturate(150%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .06), 0 20px 50px -20px rgb(0 0 0 / .6);
}
.dock-link {
  width: 40px; height: 40px; border-radius: 999px;
  display: grid; place-items: center; color: var(--fg-2);
  transform-origin: 50% 100%;
  transition: transform .45s var(--ease), color .3s, background-color .3s;
}
.dock-link .i { width: 20px; height: 20px; }
.dock-link:hover { color: var(--fg); background: rgb(236 235 231 / .08); transform: translateY(-4px) scale(1.2); }
.dock-link:has(+ .dock-link:hover), .dock-link:hover + .dock-link { transform: translateY(-2px) scale(1.08); }
.dock-link:active { transform: scale(.94); }

/* ---------- hover label ---------- */
.follower {
  position: fixed; top: 0; left: 0; z-index: 25; pointer-events: none;
  display: inline-flex; align-items: baseline; gap: 10px;
  padding: 8px 14px; border-radius: 999px;
  background: rgb(11 11 12 / .72); border: 1px solid var(--line);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  white-space: nowrap;
  opacity: 0; scale: .9;
  transition: opacity .3s var(--ease), scale .4s var(--ease);
}
.follower.on { opacity: 1; scale: 1; }
.f-title { font-size: 13px; font-weight: 600; }
.f-meta { font-family: var(--mono); font-size: 11px; color: var(--fg-3); }

/* ---------- index ---------- */
.index {
  position: relative; z-index: 1;
  min-height: 100dvh;
  padding: calc(var(--bar-h) + clamp(24px, 6vh, 72px)) var(--gutter) clamp(120px, 20vh, 220px);
  display: none;
}
body.view-index .index { display: block; }
body.view-index .stage { opacity: 0; visibility: hidden; transform: scale(1.06); transition: opacity .5s var(--ease), transform .7s var(--ease), visibility 0s linear .5s; }
body.view-index .hero, body.view-index .scrim { opacity: 0; visibility: hidden; transform: translateY(14px); }
.rows { list-style: none; margin: 0; padding: 0; }
.row { animation: row-in 1s var(--ease) both; animation-delay: calc(var(--i) * 45ms); }
@keyframes row-in { from { opacity: 0; transform: translateY(28px); } }
.row-btn {
  width: 100%;
  display: grid; grid-template-columns: minmax(0, 1fr) 180px 72px 28px; align-items: center; gap: 24px;
  padding: clamp(14px, 2.2vh, 26px) 0;
  border-bottom: 1px solid var(--line);
  text-align: start;
  transition: opacity .45s var(--ease);
}
.row-thumb { display: none; }
.row-title {
  font-size: clamp(2rem, 5.6vw, 5.6rem);
  font-weight: 560; font-stretch: 100%;
  line-height: 1.02; letter-spacing: -.04em;
  overflow-wrap: anywhere;
  transition: font-stretch .7s var(--ease), color .4s var(--ease), letter-spacing .7s var(--ease);
}
.row-cat, .row-year { font-family: var(--mono); font-size: 12px; color: var(--fg-3); letter-spacing: .02em; }
.row-year { text-align: end; }
.row-arrow { width: 24px; height: 24px; color: var(--fg-3); transition: transform .5s var(--ease), color .3s; }
.rows:hover .row-btn:not(:hover) { opacity: .34; }
.row-btn:hover .row-title, .row-btn:focus-visible .row-title { font-stretch: 125%; letter-spacing: -.03em; color: var(--accent); }
.row-btn:hover .row-arrow { color: var(--fg); transform: translate(3px, -3px); }
[dir="rtl"] .row-btn:hover .row-arrow { transform: scaleX(-1) translate(3px, -3px); }
.row-btn:focus-visible { outline-offset: -2px; border-radius: 4px; }
.empty { color: var(--fg-3); }

.preview {
  position: fixed; top: 0; left: 0; z-index: 15; pointer-events: none;
  width: 300px; border-radius: 4px; overflow: hidden; background: var(--bg-2);
  opacity: 0; scale: .85;
  transition: opacity .35s var(--ease), scale .5s var(--ease);
  box-shadow: 0 30px 80px -30px rgb(0 0 0 / .8);
}
.preview.on { opacity: 1; scale: 1; }
.preview img, .preview video { width: 100%; height: 100%; object-fit: cover; }

/* ---------- lightbox ---------- */
dialog { color: var(--fg); }
.lightbox {
  width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  background: rgb(9 9 10 / .94);
  backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px);
  overflow: hidden;
}
.lightbox::backdrop { background: transparent; }
.lightbox[open] { animation: fade-in .4s var(--ease); }
@keyframes fade-in { from { opacity: 0; } }
.lb-stage {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  padding: calc(var(--bar-h) + 8px) clamp(16px, 7vw, 120px) 150px;
}
.lb-media { position: relative; border-radius: 4px; overflow: hidden; background: var(--bg-2); touch-action: pan-y; }
.lb-media img, .lb-media video { position: relative; width: 100%; height: 100%; object-fit: contain; }
.lb-media.loading::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgb(236 235 231 / .06) 50%, transparent 70%) var(--bg-2);
  background-size: 220% 100%;
  animation: shimmer 1.3s linear infinite;
}
@keyframes shimmer { from { background-position: 120% 0; } to { background-position: -120% 0; } }
.lb-info {
  position: absolute; inset-inline-start: var(--gutter); bottom: calc(var(--gutter) + env(safe-area-inset-bottom));
  max-width: min(640px, 70vw);
}
.lb-title { margin: 0 0 6px; font-size: clamp(1.4rem, 2.4vw, 2.2rem); font-weight: 620; font-stretch: 112%; letter-spacing: -.03em; line-height: 1.05; }
.lb-caption { margin: 0 0 8px; color: var(--fg-2); max-width: 60ch; }
.lb-caption:empty { display: none; }
.lb-meta { margin: 0; font-family: var(--mono); font-size: 12px; color: var(--fg-3); }
.icon-btn {
  width: 48px; height: 48px; border-radius: 999px;
  display: grid; place-items: center;
  background: rgb(236 235 231 / .06); border: 1px solid var(--line);
  transition: background-color .3s, transform .4s var(--ease);
}
.icon-btn .i { width: 20px; height: 20px; }
.icon-btn:hover { background: rgb(236 235 231 / .13); }
.icon-btn:active { transform: scale(.94); }
.lb-close { position: absolute; top: 12px; inset-inline-end: var(--gutter); }
.lb-prev, .lb-next { position: absolute; top: 50%; translate: 0 -50%; }
.lb-prev { inset-inline-start: var(--gutter); }
.lb-next { inset-inline-end: var(--gutter); }
.lightbox.single .lb-prev, .lightbox.single .lb-next { display: none; }

/* ---------- about sheet ---------- */
.sheet {
  position: fixed; inset: 0 0 0 auto;
  width: min(560px, 100vw); height: 100dvh; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0;
  border-inline-start: 1px solid var(--line);
  border-radius: 20px 0 0 20px;
  background: var(--bg-2);
  overflow-y: auto; overscroll-behavior: contain;
  transform: translateX(0);
  transition: transform .7s var(--ease), overlay .7s allow-discrete, display .7s allow-discrete;
}
[dir="rtl"] .sheet { inset: 0 auto 0 0; border-radius: 0 20px 20px 0; }
.sheet:not([open]) { transform: translateX(100%); }
[dir="rtl"] .sheet:not([open]) { transform: translateX(-100%); }
@starting-style { .sheet[open] { transform: translateX(100%); } [dir="rtl"] .sheet[open] { transform: translateX(-100%); } }
.sheet::backdrop { background: rgb(5 5 6 / .55); backdrop-filter: blur(6px); transition: opacity .6s var(--ease), overlay .6s allow-discrete, display .6s allow-discrete; }
.sheet:not([open])::backdrop { opacity: 0; }
@starting-style { .sheet[open]::backdrop { opacity: 0; } }
.sheet-inner { padding: 88px clamp(20px, 4vw, 40px) 48px; }
.sheet-close { position: absolute; top: 14px; inset-inline-end: 14px; }
.sheet-media { margin: 0 0 32px; width: 100%; aspect-ratio: 4 / 3; border-radius: 4px; overflow: hidden; background: var(--bg-3); }
.sheet-media img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; }
.sheet h2 { margin: 0 0 18px; font-size: clamp(1.9rem, 3vw, 2.6rem); font-weight: 640; font-stretch: 112%; letter-spacing: -.035em; line-height: 1.02; }
.sheet-text { color: var(--fg-2); font-size: 16px; line-height: 1.7; }
.sheet-text p { margin: 0 0 14px; max-width: 60ch; }
.contact { margin-top: 36px; }
.contact h3 { margin: 36px 0 10px; font-size: 13px; font-weight: 500; color: var(--fg-3); }
.contact-link {
  display: grid; grid-template-columns: 90px minmax(0, 1fr) 20px; align-items: center; gap: 12px;
  padding: 18px 0; border-bottom: 1px solid var(--line);
  transition: color .3s;
}
.cl-label { font-family: var(--mono); font-size: 12px; color: var(--fg-3); }
.cl-value { font-size: clamp(1.05rem, 1.6vw, 1.3rem); font-weight: 560; overflow-wrap: anywhere; }
[dir="rtl"] .cl-value { text-align: end; }
.contact-link:hover { color: var(--accent); }
.social-rows { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.social-row {
  display: flex; align-items: center; gap: 12px;
  height: 52px; padding: 0 18px; border-radius: 999px;
  background: rgb(236 235 231 / .04); border: 1px solid var(--line);
  font-size: 15px; font-weight: 520;
  transition: background-color .3s, border-color .3s, transform .4s var(--ease);
}
.social-row span { flex: 1; }
.social-row .i-arrow { color: var(--fg-3); transition: transform .45s var(--ease), color .3s; }
.social-row:hover { background: rgb(236 235 231 / .09); border-color: rgb(236 235 231 / .2); }
.social-row:hover .i-arrow { color: var(--accent); transform: translate(2px, -2px); }
[dir="rtl"] .social-row:hover .i-arrow { transform: scaleX(-1) translate(2px, -2px); }

/* ---------- load-in ---------- */
body.is-loading .bar { opacity: 0; transform: translateY(-10px); }
body.is-loading .hero, body.is-loading .dock { opacity: 0; transform: translateY(16px); }
.dock { transition: opacity .9s var(--ease) .25s, transform .9s var(--ease) .25s; }
.hero { transition-delay: 0s; }

/* ---------- small screens ---------- */
@media (max-width: 767px) {
  :root { --bar-h: 60px; }
  .bar { grid-template-columns: 1fr auto auto; gap: 10px; }
  .mark { font-size: 15px; }
  .switch button { padding: 0 12px; }
  .switch button span, .switch .count { display: none; }
  .hero { width: auto; inset-inline-end: var(--gutter); bottom: calc(var(--gutter) + 72px + env(safe-area-inset-bottom)); }
  .hero h1 { font-size: clamp(2rem, 10vw, 2.8rem); }
  .hero p { font-size: 15px; margin-bottom: 20px; }
  .pill { height: 46px; }
  .dock { inset-inline-end: 50%; translate: 50% 0; }
  [dir="rtl"] .dock { translate: -50% 0; }
  .dock-link { width: 44px; height: 44px; }
  .scrim { height: 70vh; }
  .row-btn { grid-template-columns: 64px minmax(0, 1fr) 20px; grid-template-areas: "thumb title arrow" "thumb meta arrow"; gap: 4px 14px; }
  .row-thumb { display: block; grid-area: thumb; width: 64px; height: 80px; border-radius: 4px; overflow: hidden; background: var(--bg-2); }
  .row-thumb img { width: 100%; height: 100%; object-fit: cover; }
  .row-title { grid-area: title; font-size: clamp(1.4rem, 7vw, 2rem); }
  .row-cat { grid-area: meta; }
  .row-year { display: none; }
  .row-arrow { grid-area: arrow; width: 20px; height: 20px; }
  .rows:hover .row-btn:not(:hover) { opacity: 1; }
  .lb-stage { padding: 72px 12px 170px; }
  .lb-prev, .lb-next { top: auto; bottom: calc(var(--gutter) + env(safe-area-inset-bottom)); translate: none; }
  .lb-prev { inset-inline-start: auto; inset-inline-end: calc(var(--gutter) + 56px); }
  .lb-info { max-width: calc(100vw - 2 * var(--gutter) - 120px); }
  .sheet { border-radius: 0; border: 0; }
  .social-rows { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; transition-delay: 0ms !important; }
  .tile .media { transform: none; }
}
