/* ==========================================================================
   Photo Library
   Editorial dark gallery: serif display type, warm blacks, amber accent.
   ========================================================================== */

:root {
  color-scheme: dark;

  --bg: #0b0a09;
  --bg-2: #14120f;
  --bg-3: #1d1a16;
  --ink: #f3ede4;
  --ink-2: rgb(243 237 228 / 0.66);
  --ink-3: rgb(243 237 228 / 0.4);
  --line: rgb(243 237 228 / 0.12);
  --glass: rgb(20 18 15 / 0.55);
  --accent: #e2b06b;
  --accent-2: #c9714b;
  --danger: #f08a75;

  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --gutter: clamp(16px, 4vw, 56px);
  --radius: 18px;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --spring: linear(0, 0.009, 0.035 2.1%, 0.141 4.4%, 0.723 12.9%, 0.938 16.7%, 1.017 19.4%, 1.067, 1.099 24.3%, 1.104 25.8%, 1.099 27.4%, 1.068 30.7%, 1.016 36.4%, 0.996 39.4%, 0.987 42.4%, 0.993 52.5%, 1.001 63.6%, 1);
}

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

html {
  background: var(--bg);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  scrollbar-color: var(--bg-3) var(--bg);
}

body {
  margin: 0;
  min-height: 100svh;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

html.lb-open, html.lb-open body { overflow: hidden; }

img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
code { font: 0.9em var(--mono); color: var(--accent); }
svg { width: 1.25em; height: 1.25em; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
::selection { background: var(--accent); color: var(--bg); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.eyebrow {
  margin: 0;
  font: 500 11.5px/1.2 var(--mono);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-2);
  display: flex;
  flex-wrap: wrap;
  gap: 0.4em 1.4em;
}

/* Film grain over everything ------------------------------------------- */
.grain {
  position: fixed;
  inset: -50%;
  z-index: 100;
  pointer-events: none;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 0.9s steps(5) infinite;
  view-transition-name: grain;
}
@keyframes grain {
  0% { transform: translate(0, 0); }
  20% { transform: translate(-3%, 2%); }
  40% { transform: translate(2%, -4%); }
  60% { transform: translate(-4%, -1%); }
  80% { transform: translate(3%, 3%); }
  100% { transform: translate(0, 0); }
}

/* Slowly drifting colour blobs ----------------------------------------- */
.aurora {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  filter: blur(70px) saturate(1.2);
  opacity: 0.55;
}
.aurora i {
  position: absolute;
  width: 55vmax;
  aspect-ratio: 1;
  border-radius: 50%;
  mix-blend-mode: screen;
}
.aurora i:nth-child(1) { background: radial-gradient(closest-side, #8a4b2a, transparent); top: -20%; left: -10%; animation: drift-a 26s var(--ease-in-out) infinite alternate; }
.aurora i:nth-child(2) { background: radial-gradient(closest-side, #6b5530, transparent); top: 10%; right: -25%; animation: drift-b 32s var(--ease-in-out) infinite alternate; }
.aurora i:nth-child(3) { background: radial-gradient(closest-side, #2d3b3a, transparent); bottom: -35%; left: 20%; animation: drift-c 22s var(--ease-in-out) infinite alternate; }
@keyframes drift-a { to { transform: translate(25vw, 18vh) scale(1.15); } }
@keyframes drift-b { to { transform: translate(-30vw, 10vh) scale(0.85); } }
@keyframes drift-c { to { transform: translate(-10vw, -25vh) scale(1.2); } }

/* Images fade from their average colour to sharp ----------------------- */
img[data-fade] {
  opacity: 0;
  filter: blur(14px);
  transform: scale(1.06);
  transition: opacity 0.7s var(--ease-out), filter 0.9s var(--ease-out), transform 1.4s var(--ease-out);
}
img[data-fade].ok { opacity: 1; filter: none; transform: none; }
html:not(.js) img[data-fade] { opacity: 1; filter: none; transform: none; }

/* Buttons -------------------------------------------------------------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
  height: 40px;
  padding: 0 16px 0 12px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--line);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  font: 500 13px var(--sans);
  transition: background 0.3s, border-color 0.3s, transform 0.4s var(--spring);
}
.pill:hover { background: rgb(243 237 228 / 0.1); border-color: rgb(243 237 228 / 0.25); }
.pill:active { transform: scale(0.95); }
.pill svg { width: 17px; height: 17px; transition: transform 0.4s var(--ease-out); }
.pill-back:hover svg { transform: translateX(-3px); }

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  height: 52px;
  padding: 0 26px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font: 500 15px var(--sans);
  overflow: hidden;
  isolation: isolate;
  transition: transform 0.5s var(--spring), box-shadow 0.4s;
}
.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--accent);
  transform: translateY(101%);
  border-radius: 50% 50% 0 0 / 30% 30% 0 0;
  transition: transform 0.55s var(--ease-out), border-radius 0.55s var(--ease-out);
}
.btn:hover::before { transform: none; border-radius: 0; }
.btn:hover { box-shadow: 0 10px 40px -10px rgb(226 176 107 / 0.6); }
.btn:active { transform: scale(0.96); }
.btn svg { transition: transform 0.45s var(--ease-out); }
.btn:hover svg { transform: translateX(4px); }
.btn:disabled { opacity: 0.7; cursor: progress; }

/* ==========================================================================
   Home
   ========================================================================== */

.hero {
  position: relative;
  min-height: 100svh;
  display: grid;
  align-items: end;
  padding: 0 var(--gutter) clamp(72px, 12vh, 140px);
  overflow: hidden;
  isolation: isolate;
}
.hero-bg {
  position: absolute;
  inset: 0;
  z-index: -1;
}
.hero-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  animation: kenburns 40s ease-in-out infinite alternate;
}
.hero-bg img:not(.ok) { animation-play-state: paused; }
.hero-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 80% at 20% 100%, rgb(11 10 9 / 0.85), transparent 60%),
    linear-gradient(to bottom, rgb(11 10 9 / 0.35), rgb(11 10 9 / 0.1) 35%, var(--bg));
}
.hero .aurora { z-index: -2; }
@keyframes kenburns {
  from { transform: scale(1.08) translate(0, 0); }
  to { transform: scale(1.18) translate(-2%, -3%); }
}

.hero-inner { max-width: 1400px; }
.hero-eyebrow { opacity: 0; animation: fade-up 1s var(--ease-out) 0.1s forwards; }
.hero-title {
  margin: 0.15em 0 0.2em;
  font: 400 clamp(4.2rem, 15vw, 13.5rem) / 0.86 var(--serif);
  letter-spacing: -0.035em;
  text-wrap: balance;
}
.hero-title .word {
  display: inline-block;
  overflow: clip;
  overflow-clip-margin: 0.12em;
  padding-bottom: 0.06em;
  white-space: nowrap;
}
.hero-title .word:nth-child(even) { font-style: italic; color: var(--accent); }
.hero-title .char {
  display: inline-block;
  transform: translateY(105%) rotate(10deg);
  transform-origin: left bottom;
  animation: char-in 1.25s var(--ease-out) forwards;
  animation-delay: calc(var(--i) * 42ms + 150ms);
}
@keyframes char-in { to { transform: none; } }

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em 2em;
  margin: 0;
  font: 500 12px var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-2);
  opacity: 0;
  animation: fade-up 1s var(--ease-out) 0.9s forwards;
}
.hero-meta span::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 0.8em;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: 0.1em;
}
@keyframes fade-up {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}

.scroll-cue {
  position: absolute;
  right: var(--gutter);
  bottom: clamp(72px, 12vh, 140px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  font: 500 11px var(--mono);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-2);
  writing-mode: vertical-rl;
  opacity: 0;
  animation: fade-up 1s var(--ease-out) 1.2s forwards;
}
.scroll-cue i {
  position: relative;
  width: 1px;
  height: 72px;
  background: var(--line);
  overflow: hidden;
}
.scroll-cue i::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--ink);
  animation: cue 2.2s var(--ease-in-out) infinite;
}
@keyframes cue {
  0% { transform: translateY(-100%); }
  60%, 100% { transform: translateY(100%); }
}

/* Album grid ----------------------------------------------------------- */
.albums {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr));
  gap: clamp(36px, 5vw, 64px) clamp(18px, 2.4vw, 32px);
  max-width: 1600px;
  margin: 0 auto;
  padding: clamp(24px, 6vh, 72px) var(--gutter) clamp(80px, 14vh, 160px);
}

.album {
  --rx: 0deg;
  --ry: 0deg;
  --mx: 50%;
  --my: 50%;
  display: flex;
  flex-direction: column;
  gap: 18px;
  perspective: 900px;
}
.album-cover {
  position: relative;
  margin: 0;
  aspect-ratio: 4 / 5;
  border-radius: var(--radius);
  overflow: hidden;
  background: linear-gradient(150deg, var(--bg-3), var(--bg-2));
  transform: rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform 0.6s var(--ease-out), box-shadow 0.6s var(--ease-out);
  box-shadow: 0 1px 0 rgb(255 255 255 / 0.04) inset, 0 20px 50px -30px rgb(0 0 0 / 0.8);
}
.album.is-tilting .album-cover { transition: transform 0.12s linear, box-shadow 0.6s var(--ease-out); }
.album-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  scale: 1.12;
  transition: scale 1.4s var(--ease-out), opacity 0.7s var(--ease-out), filter 0.9s var(--ease-out), transform 1.4s var(--ease-out);
}
.album:hover .album-cover { box-shadow: 0 1px 0 rgb(255 255 255 / 0.06) inset, 0 40px 80px -30px rgb(0 0 0 / 0.9); }
.album:hover .album-cover img { scale: 1.03; }
.album-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgb(11 10 9 / 0.55), transparent 45%);
  opacity: 0.7;
  transition: opacity 0.6s;
}
.album:hover .album-cover::after { opacity: 0.3; }
.album-sheen {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: radial-gradient(circle at var(--mx) var(--my), rgb(255 240 220 / 0.22), transparent 45%);
  opacity: 0;
  transition: opacity 0.5s;
  mix-blend-mode: soft-light;
}
.album:hover .album-sheen { opacity: 1; }
.album-initial {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font: italic 400 clamp(6rem, 18vw, 11rem) / 1 var(--serif);
  color: rgb(243 237 228 / 0.14);
}

.lock-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--glass);
  border: 1px solid var(--line);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.lock-badge svg { width: 17px; height: 17px; }
.lock-badge.is-open { color: var(--accent); }
.lock-svg .shackle { transition: transform 0.6s var(--spring); transform-origin: 16.5px 11px; }
.is-open .lock-svg .shackle { transform: translateY(-2px) rotate(28deg); }
.album:hover .lock-badge:not(.is-open) .shackle { transform: translateY(-1.5px); }

.album-body {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: baseline;
  column-gap: 14px;
  padding: 0 4px;
}
.album-index {
  font: 500 12px var(--mono);
  color: var(--accent);
  letter-spacing: 0.06em;
}
.album-title {
  margin: 0;
  font: 400 clamp(1.7rem, 2.4vw, 2.2rem) / 1.05 var(--serif);
  letter-spacing: -0.01em;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  transition: background-size 0.7s var(--ease-out);
  justify-self: start;
}
.album:hover .album-title { background-size: 100% 1px; }
.album-meta {
  grid-column: 2;
  display: flex;
  gap: 1.2em;
  margin: 8px 0 0;
  font: 500 11px var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.album-go {
  grid-column: 3;
  grid-row: 1;
  align-self: center;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line);
  transition: background 0.4s, color 0.4s, border-color 0.4s, transform 0.5s var(--spring);
}
.album-go svg { width: 17px; height: 17px; transition: transform 0.5s var(--ease-out); }
.album:hover .album-go { background: var(--ink); color: var(--bg); border-color: var(--ink); transform: rotate(-45deg); }

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 1em;
  padding: 28px var(--gutter) calc(28px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  font: 500 11px var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.empty {
  grid-column: 1 / -1;
  padding: 12vh var(--gutter);
  text-align: center;
  color: var(--ink-2);
}
.empty-title { margin: 0 0 0.3em; font: italic 400 2.4rem/1.1 var(--serif); color: var(--ink); }

/* Scroll reveal (JS adds .in, with a stagger in --delay) */
.js .reveal {
  opacity: 0;
  translate: 0 48px;
  transition: opacity 1s var(--ease-out) var(--delay, 0ms), translate 1.2s var(--ease-out) var(--delay, 0ms);
}
.js .reveal.in { opacity: 1; translate: 0 0; }

/* ==========================================================================
   Category
   ========================================================================== */

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(14px + env(safe-area-inset-top)) var(--gutter) 14px;
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.topbar form { margin-left: auto; }
.topbar-title {
  margin: 0;
  padding: 0 18px;
  height: 40px;
  display: flex;
  align-items: center;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--line);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  font: italic 400 19px var(--serif);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 50vw;
  opacity: 0;
  translate: 0 -12px;
  transition: opacity 0.5s var(--ease-out), translate 0.5s var(--ease-out);
}
.topbar.is-scrolled .topbar-title { opacity: 1; translate: 0 0; }

.cat-hero {
  position: relative;
  height: min(78svh, 820px);
  min-height: 420px;
  display: grid;
  align-items: end;
  padding: 0 var(--gutter) clamp(28px, 6vh, 64px);
  isolation: isolate;
}
.cat-cover {
  position: absolute;
  inset: 0;
  z-index: -1;
  margin: 0;
  overflow: hidden;
  background: linear-gradient(150deg, var(--bg-3), var(--bg));
}
.cat-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cat-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgb(11 10 9 / 0.45), rgb(11 10 9 / 0.05) 30%, rgb(11 10 9 / 0.5) 70%, var(--bg));
}
.cat-heading > * { opacity: 0; animation: fade-up 1s var(--ease-out) forwards; }
.cat-heading > :nth-child(2) { animation-delay: 0.08s; }
.cat-heading > :nth-child(3) { animation-delay: 0.16s; }
.cat-title {
  margin: 0.2em 0 0;
  font: 400 clamp(3rem, 9vw, 8.5rem) / 0.92 var(--serif);
  letter-spacing: -0.03em;
  text-wrap: balance;
}
.cat-folder { margin: 0.6em 0 0; font: 500 12px var(--mono); color: var(--ink-3); letter-spacing: 0.08em; }

/* Justified gallery: every row is filled edge to edge, preserving ratios. */
.gallery {
  --row: clamp(120px, 17vw, 250px);
  --gap: clamp(4px, 0.6vw, 8px);
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap);
  padding: 0 var(--gutter);
}
.gallery::after { content: ""; flex-grow: 1000000; }
.tile {
  position: relative;
  flex-grow: calc(var(--ar) * 100);
  flex-basis: calc(var(--ar) * var(--row));
  aspect-ratio: var(--ar);
  border-radius: 6px;
  overflow: hidden;
  background: var(--c, var(--bg-2));
  cursor: zoom-in;
  -webkit-tap-highlight-color: transparent;
}
.tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.tile img.ok { transition: opacity 0.7s var(--ease-out), filter 0.9s var(--ease-out), transform 0.9s var(--ease-out); }
.tile::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.06);
  background: linear-gradient(to top, rgb(0 0 0 / 0.35), transparent 40%);
  opacity: 0;
  transition: opacity 0.4s;
  pointer-events: none;
}
@media (hover: hover) {
  .tile:hover img.ok { transform: scale(1.045); }
  .tile:hover::after { opacity: 1; }
}
.js .tile:not(.in) { opacity: 0; translate: 0 28px; scale: 0.97; }
.js .tile {
  transition: opacity 0.8s var(--ease-out) var(--delay, 0ms), translate 1s var(--ease-out) var(--delay, 0ms), scale 1s var(--ease-out) var(--delay, 0ms);
}
.tile-play {
  position: absolute;
  inset: 0;
  margin: auto;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgb(11 10 9 / 0.45);
  border: 1px solid rgb(255 255 255 / 0.3);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: transform 0.5s var(--spring);
}
.tile-play svg { width: 16px; height: 16px; margin-left: 2px; }
.tile:hover .tile-play { transform: scale(1.15); }

.more { min-height: 1px; display: grid; place-items: center; padding: 48px 0 96px; }
.loader { display: flex; gap: 6px; }
.loader i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink-2);
  animation: bounce 1s var(--ease-in-out) infinite;
}
.loader i:nth-child(2) { animation-delay: 0.12s; }
.loader i:nth-child(3) { animation-delay: 0.24s; }
@keyframes bounce { 0%, 100% { transform: translateY(0); opacity: 0.4; } 50% { transform: translateY(-8px); opacity: 1; } }

.scroll-nav {
  position: fixed;
  right: var(--gutter);
  bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: 15;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.scroll-nav button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--glass);
  border: 1px solid var(--line);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  opacity: 0;
  scale: 0.6;
  pointer-events: none;
  transition: opacity 0.4s var(--ease-out), scale 0.5s var(--spring), background 0.3s;
}
.scroll-nav button.visible { opacity: 1; scale: 1; pointer-events: auto; }
.scroll-nav button:hover { background: rgb(243 237 228 / 0.12); }

/* ==========================================================================
   Lightbox
   ========================================================================== */

.lb {
  --bar: 64px;
  --strip: 76px;
  position: fixed;
  inset: 0;
  z-index: 50;
  background: #080706;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  animation: lb-in 0.35s var(--ease-out);
}
@keyframes lb-in { from { opacity: 0; } }

.lb-ambient {
  position: absolute;
  inset: -10%;
  opacity: 0.4;
  filter: blur(80px) saturate(1.6);
  transition: opacity 0.6s;
}
.lb-ambient img { width: 100%; height: 100%; object-fit: cover; transition: opacity 0.8s var(--ease-out); }

.lb-bar {
  position: absolute;
  inset: 0 0 auto;
  z-index: 3;
  height: calc(var(--bar) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) var(--gutter) 0;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  background: linear-gradient(to bottom, rgb(8 7 6 / 0.7), transparent);
  transition: opacity 0.4s, translate 0.5s var(--ease-out);
}
.lb-count {
  margin: 0;
  display: flex;
  gap: 0.35em;
  font: 500 13px var(--mono);
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.lb-count b { color: var(--ink); font-weight: 500; }
.lb-count i { font-style: normal; }
.lb-name {
  margin: 0;
  font: italic 400 18px var(--serif);
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lb-actions { display: flex; gap: 4px; }
.lb-actions > * {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  transition: background 0.3s, transform 0.4s var(--spring);
}
.lb-actions > *:hover { background: rgb(243 237 228 / 0.1); }
.lb-actions > *:active { transform: scale(0.88); }
.lb-actions svg { width: 19px; height: 19px; }
.lb .when-playing, .lb.is-playing .when-paused { display: none; }
.lb.is-playing .when-playing { display: contents; }

.lb-progress {
  position: absolute;
  inset: 0 0 auto;
  z-index: 4;
  height: 2px;
  opacity: 0;
  transition: opacity 0.3s;
}
.lb.is-playing .lb-progress { opacity: 1; }
.lb-progress span {
  display: block;
  height: 100%;
  background: var(--accent);
  transform-origin: left;
  transform: scaleX(0);
}
.lb.is-playing .lb-progress span { animation: progress var(--slide, 5s) linear forwards; }
@keyframes progress { to { transform: scaleX(1); } }

.lb-stage {
  position: absolute;
  inset: calc(var(--bar) + env(safe-area-inset-top)) var(--gutter) calc(var(--strip) + 12px + env(safe-area-inset-bottom));
  z-index: 1;
  touch-action: none;
}
.lb-media {
  position: absolute;
  inset: 0;
  margin: auto;
  border-radius: 4px;
  background: var(--c, transparent);
  box-shadow: 0 30px 90px -20px rgb(0 0 0 / 0.8);
  will-change: transform, opacity;
}
img.lb-media { object-fit: contain; }
img.lb-media.is-low { filter: blur(6px); }
img.lb-media.is-sharp { filter: none; transition: filter 0.5s var(--ease-out); }
video.lb-media { background: #000; }

.lb-nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin-top: -27px;
  border-radius: 50%;
  background: var(--glass);
  border: 1px solid var(--line);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  opacity: 0.6;
  transition: opacity 0.3s, transform 0.5s var(--spring), background 0.3s;
}
.lb-nav:hover { opacity: 1; background: rgb(243 237 228 / 0.12); }
.lb-nav.prev { left: calc(var(--gutter) / 2); }
.lb-nav.next { right: calc(var(--gutter) / 2); }
.lb-nav.prev:hover { transform: translateX(-3px); }
.lb-nav.next:hover { transform: translateX(3px); }
.lb-nav:active { transform: scale(0.9); }

.lb-strip {
  position: absolute;
  inset: auto 0 0;
  z-index: 3;
  height: calc(var(--strip) + env(safe-area-inset-bottom));
  padding: 10px 50vw calc(14px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  mask-image: linear-gradient(to right, transparent, #000 15%, #000 85%, transparent);
  transition: opacity 0.4s, translate 0.5s var(--ease-out);
}
.lb-strip::-webkit-scrollbar { display: none; }
.lb-strip button {
  flex: none;
  height: 100%;
  aspect-ratio: var(--ar);
  max-width: 120px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--c, var(--bg-3));
  opacity: 0.4;
  scale: 0.86;
  transition: opacity 0.35s, scale 0.5s var(--spring);
}
.lb-strip button:hover { opacity: 0.8; }
.lb-strip button.active { opacity: 1; scale: 1; box-shadow: 0 0 0 2px var(--accent); }
.lb-strip img { width: 100%; height: 100%; object-fit: cover; }

/* Hide the chrome while idle, like a cinema */
.lb.is-idle .lb-bar { opacity: 0; translate: 0 -10px; }
.lb.is-idle .lb-strip { opacity: 0; translate: 0 10px; }
.lb.is-idle .lb-nav { opacity: 0; }
.lb.is-idle { cursor: none; }

/* ==========================================================================
   Login
   ========================================================================== */

.login {
  position: relative;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 96px var(--gutter);
  overflow: hidden;
  isolation: isolate;
}
.login .aurora { z-index: -2; }
.login-bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  margin: 0;
  overflow: hidden;
}
.login-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.5;
}
.login-bg img.ok { opacity: 0.5; filter: blur(28px) saturate(1.2); transform: scale(1.15); animation: kenburns 30s ease-in-out infinite alternate; }
.login-bg::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 50% 45%, rgb(11 10 9 / 0.2), rgb(11 10 9 / 0.85)); }
.login-back { position: absolute; top: calc(14px + env(safe-area-inset-top)); left: var(--gutter); }

.login-card {
  width: min(420px, 100%);
  padding: clamp(28px, 5vw, 44px);
  border-radius: 28px;
  background: rgb(20 18 15 / 0.5);
  border: 1px solid var(--line);
  backdrop-filter: blur(30px) saturate(1.4);
  -webkit-backdrop-filter: blur(30px) saturate(1.4);
  box-shadow: 0 50px 120px -40px rgb(0 0 0 / 0.9), 0 1px 0 rgb(255 255 255 / 0.06) inset;
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: card-in 0.9s var(--spring) both;
}
@keyframes card-in { from { opacity: 0; transform: translateY(40px) scale(0.94); } }
.login-card.is-error { animation: shake 0.55s var(--ease-out); }
@keyframes shake {
  0%, 100% { transform: none; }
  15% { transform: translateX(-12px) rotate(-1deg); }
  30% { transform: translateX(10px) rotate(0.8deg); }
  45% { transform: translateX(-7px); }
  60% { transform: translateX(5px); }
  75% { transform: translateX(-2px); }
}
.login-lock {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin-bottom: 10px;
  border-radius: 20px;
  background: linear-gradient(150deg, rgb(226 176 107 / 0.25), rgb(201 113 75 / 0.12));
  border: 1px solid rgb(226 176 107 / 0.3);
  color: var(--accent);
}
.login-lock svg { width: 28px; height: 28px; }
.login-title { margin: 0 0 14px; font: 400 clamp(2.2rem, 6vw, 2.9rem) / 1 var(--serif); letter-spacing: -0.02em; }

.field {
  position: relative;
  display: block;
}
.field input {
  width: 100%;
  height: 58px;
  padding: 20px 52px 6px 18px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgb(11 10 9 / 0.45);
  color: var(--ink);
  font: 400 16px var(--sans);
  outline: none;
  transition: border-color 0.3s, background 0.3s, box-shadow 0.3s;
}
.field input:focus { border-color: rgb(226 176 107 / 0.7); box-shadow: 0 0 0 4px rgb(226 176 107 / 0.14); background: rgb(11 10 9 / 0.65); }
.field-label {
  position: absolute;
  left: 18px;
  top: 19px;
  font-size: 15px;
  color: var(--ink-3);
  pointer-events: none;
  transform-origin: left top;
  transition: transform 0.35s var(--ease-out), color 0.35s;
}
.field input:focus + .field-label,
.field input:not(:placeholder-shown) + .field-label { transform: translateY(-11px) scale(0.75); color: var(--accent); }
.field-eye {
  position: absolute;
  right: 8px;
  top: 8px;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  color: var(--ink-3);
  transition: color 0.3s, background 0.3s;
}
.field-eye:hover, .field-eye.on { color: var(--ink); background: rgb(243 237 228 / 0.06); }
.is-error .field input { border-color: rgb(240 138 117 / 0.7); }
.login-error {
  min-height: 1.2em;
  margin: -4px 2px 4px;
  font-size: 13.5px;
  color: var(--danger);
}
.login-error:empty { min-height: 0; margin: 0; }
.is-error .login-error { animation: fade-up 0.5s var(--ease-out); }
.login-card .btn { width: 100%; }

/* Unlock: shackle pops open, card glows and fades into the gallery */
.login-card.is-unlocking { animation: unlock 0.9s var(--ease-out) forwards; }
.login-card.is-unlocking .login-lock { animation: lock-glow 0.9s var(--ease-out) forwards; }
.login-card.is-unlocking .shackle { transform: translateY(-2.5px) rotate(32deg); }
@keyframes unlock {
  0%, 35% { transform: none; opacity: 1; }
  100% { transform: scale(1.04) translateY(-10px); opacity: 0; filter: blur(8px); }
}
@keyframes lock-glow {
  30% { box-shadow: 0 0 0 0 rgb(226 176 107 / 0.6); }
  100% { box-shadow: 0 0 0 26px rgb(226 176 107 / 0); background: var(--accent); color: var(--bg); }
}

/* ==========================================================================
   Admin
   ========================================================================== */

.admin {
  width: min(960px, 100%);
  margin: 0 auto;
  padding: calc(110px + env(safe-area-inset-top)) var(--gutter) 96px;
}
.admin-head { margin-bottom: 48px; }
.admin-title { margin: 14px 0 12px; font: 400 clamp(2.6rem, 7vw, 4.2rem) / 1 var(--serif); letter-spacing: -0.02em; }
.admin-title em { color: var(--accent); }
.admin-lead { margin: 0; max-width: 62ch; color: var(--ink-2); }
.admin-flash { display: inline-block; margin: 18px 0 0; padding: 6px 14px; border-radius: 999px; background: rgb(226 176 107 / 0.14); color: var(--accent); font-size: 13.5px; animation: fade-up 0.5s var(--ease-out); }

.admin-section + .admin-section { margin-top: 56px; }
.admin-h2-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.admin-h2 { margin: 0 0 18px; font: 400 1.9rem/1.1 var(--serif); }
.admin-h2 small { font: 500 12px var(--mono); color: var(--ink-3); vertical-align: middle; margin-left: 6px; }
.admin-h2-row .admin-h2 { margin: 0; }
.admin-h2-row { margin-bottom: 18px; }
.admin-list { display: grid; gap: 14px; }
.admin-empty { color: var(--ink-2); }

.admin-card {
  padding: clamp(18px, 3vw, 26px);
  border-radius: var(--radius);
  background: var(--bg-2);
  border: 1px solid var(--line);
  display: grid;
  gap: 18px;
  transition: border-color 0.4s;
}
.admin-card:focus-within { border-color: rgb(226 176 107 / 0.35); }
.admin-cat.is-error { border-color: rgb(240 138 117 / 0.6); animation: shake 0.55s var(--ease-out); }
.admin-site { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); align-items: end; }
.admin-site .admin-actions { display: flex; justify-content: flex-end; }

.admin-cat-head { display: flex; align-items: center; gap: 14px; min-width: 0; }
.admin-cat-head .lock-badge { position: static; flex: none; color: var(--accent); }
.admin-cat-head .lock-badge.is-open { color: var(--ink-3); }
.admin-cat-name { flex: 1; min-width: 0; }
.admin-cat-name h3 { margin: 0; font: 400 1.5rem/1.15 var(--serif); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-cat-name h3 a:hover { color: var(--accent); }
.admin-cat-name p { margin: 4px 0 0; display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12.5px; color: var(--ink-3); }
.admin-cat-name code { color: var(--ink-3); }

.tag { flex: none; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); font: 500 11px var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); }
.tag-on { color: var(--accent); border-color: rgb(226 176 107 / 0.35); }
.tag-warn { padding: 1px 8px; color: var(--danger); border-color: rgb(240 138 117 / 0.4); text-transform: none; letter-spacing: 0; }

.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.admin-field { display: grid; gap: 6px; font-size: 12.5px; color: var(--ink-2); }
.admin-field input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgb(11 10 9 / 0.5);
  color: var(--ink);
  font: 400 15px var(--sans);
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s;
}
.admin-field input::placeholder { color: var(--ink-3); }
.admin-field input:focus { border-color: rgb(226 176 107 / 0.7); box-shadow: 0 0 0 4px rgb(226 176 107 / 0.14); }

.admin-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink-2); cursor: pointer; }
.check input { width: 17px; height: 17px; margin: 0; accent-color: var(--accent); }
.admin-msg { flex: 1; margin: 0; text-align: right; font-size: 13px; color: var(--accent); }
.is-error .admin-msg { color: var(--danger); }
.admin-msg:empty { visibility: hidden; }
.is-saved .admin-msg { animation: fade-up 0.5s var(--ease-out); }
.btn-sm { height: 42px; padding: 0 20px; font-size: 14px; }

@media (max-width: 640px) {
  .admin-cat-head { flex-wrap: wrap; }
  .admin-msg { flex-basis: 100%; text-align: left; }
  .admin-row .btn { width: 100%; }
}

/* ==========================================================================
   404
   ========================================================================== */

.notfound {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: var(--gutter);
  text-align: center;
  overflow: hidden;
  isolation: isolate;
}
.notfound .aurora { z-index: -1; }
.notfound-title { margin: 0; font: 400 clamp(4rem, 16vw, 12rem) / 0.9 var(--serif); letter-spacing: -0.04em; animation: fade-up 1.2s var(--ease-out); }
.notfound-title em { color: var(--accent); }
.notfound p { margin: 0; color: var(--ink-2); }

/* ==========================================================================
   Page transitions (View Transitions API, driven by htmx boost)
   ========================================================================== */

@view-transition { navigation: auto; }

::view-transition-old(root) { animation: vt-out 0.45s var(--ease-out) both; }
::view-transition-new(root) { animation: vt-in 0.7s var(--ease-out) 0.08s both; }
@keyframes vt-out { to { opacity: 0; transform: scale(0.985); filter: blur(6px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(26px); } }

::view-transition-group(*) { animation-duration: 0.7s; animation-timing-function: var(--ease-out); }
/* Opening/closing the lightbox: plain cross-fade, the photo itself morphs. */
:root.vt-lightbox::view-transition-old(root) { animation: vt-fade 0.35s var(--ease-out) both reverse; }
:root.vt-lightbox::view-transition-new(root) { animation: vt-fade 0.35s var(--ease-out) both; }
@keyframes vt-fade { from { opacity: 0; } }
::view-transition-group(lb-media) { animation-duration: 0.5s; }
::view-transition-old(lb-media),
::view-transition-new(lb-media) { height: 100%; object-fit: cover; }
::view-transition-image-pair(grain) { display: none; }

/* ==========================================================================
   Scroll-driven motion (progressive enhancement)
   ========================================================================== */

@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    .hero-inner {
      animation: hero-away linear both;
      animation-timeline: view();
      animation-range: exit 0% exit 90%;
    }
    @keyframes hero-away { to { opacity: 0; transform: translateY(-14vh); filter: blur(6px); } }

    .album-cover img.ok {
      animation: parallax linear both;
      animation-timeline: view();
      animation-range: cover;
    }
    @keyframes parallax { from { translate: 0 -5%; } to { translate: 0 5%; } }

    .cat-cover img.ok {
      animation: hero-zoom linear both;
      animation-timeline: view();
      animation-range: exit 0% exit 100%;
    }
    @keyframes hero-zoom { to { transform: scale(1.18) translateY(8%); filter: blur(4px) brightness(0.6); } }
    .cat-heading {
      animation: hero-away linear both;
      animation-timeline: view();
      animation-range: exit -20% exit 70%;
    }
  }
}

/* ==========================================================================
   Small screens
   ========================================================================== */

@media (max-width: 640px) {
  .gallery { --row: 110px; --gap: 3px; padding: 0 3px; }
  .tile { border-radius: 2px; }
  .scroll-cue { display: none; }
  .topbar .pill span { display: none; }
  .topbar .pill { padding: 0 11px; }
  .topbar-title { max-width: calc(100vw - 150px); }
  .lb { --bar: 56px; --strip: 60px; }
  .lb-stage { inset-inline: 0; }
  .lb-nav { display: none; }
  .lb-name { display: none; }
  .lb-bar { grid-template-columns: auto 1fr; }
  .lb-actions { justify-self: end; }
  .lb-actions [data-lb="fullscreen"] { display: none; }
  .album-body { padding: 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
  }
  .grain { animation: none; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}
