/* ============ JACO — base chrome ============ */

@font-face {
  font-family: 'Inter';
  src: url('../assets/fonts/inter-400.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('../assets/fonts/inter-500.woff2') format('woff2');
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('../assets/fonts/inter-600.woff2') format('woff2');
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Instrument Serif';
  src: url('../assets/fonts/instrument-serif-400.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Instrument Serif';
  src: url('../assets/fonts/instrument-serif-400-italic.woff2') format('woff2');
  font-weight: 400; font-style: italic; font-display: swap;
}

:root {
  --paper: #f2f2f2;
  --ink: #111;
  --muted: #8b8b8b;
  --line: #ddd;
  --pill: #fff;
  --wipe: #0a0a0a;
  --font-sans: 'Inter', Arial, sans-serif;
  --font-serif: 'Instrument Serif', Georgia, serif;
  --fs-micro: 11px;
  --fs-body: clamp(14px, .55vw + 10px, 17px);
  --fs-h2: clamp(28px, 4vw, 56px);
  --fs-name: clamp(96px, min(30vw, 42vh), 460px);
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-wipe: cubic-bezier(.77, 0, .18, 1);
  --grain-url: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='280' height='280'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='280' height='280' filter='url(%23n)'/%3E%3C/svg%3E");
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { background: var(--paper); }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

.micro {
  font-family: var(--font-sans);
  font-size: var(--fs-micro);
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  line-height: 1.5;
}

/* ---- view wipe ---- */
#wipe {
  position: fixed; inset: 0;
  z-index: 100;
  background: var(--wipe);
  opacity: 0;
  pointer-events: none;
  transition: opacity .55s var(--ease-wipe);
}
#wipe.is-in { opacity: 1; pointer-events: auto; transition-duration: .4s; }

/* ---- film grain overlay (clean screenshots: add ?clean=1) ---- */
#grain {
  position: fixed; inset: -60%;
  z-index: 60;
  pointer-events: none;
  background-image: var(--grain-url);
  background-size: 280px 280px;
  opacity: .05;
  will-change: transform;
  animation: grain-shift 1.2s steps(1) infinite;
}
@keyframes grain-shift {
  0%, 100% { transform: translate(0, 0); }
  10% { transform: translate(-3%, -2%); }
  20% { transform: translate(2%, 4%); }
  30% { transform: translate(-4%, 1%); }
  40% { transform: translate(3%, -3%); }
  50% { transform: translate(-2%, 3%); }
  60% { transform: translate(4%, 2%); }
  70% { transform: translate(-3%, -4%); }
  80% { transform: translate(1%, 3%); }
  90% { transform: translate(-1%, -3%); }
}
html.clean #grain { display: none; }

/* ---- bottom nav pill ---- */
.pill {
  position: fixed; left: 50%; bottom: 20px; translate: -50% 0;
  z-index: 50;
  display: flex; align-items: center; gap: 26px;
  background: var(--pill);
  border-radius: 999px;
  padding: 12px 26px;
  box-shadow: 0 6px 24px rgb(0 0 0 / .08);
}
.pill-logo {
  font-family: var(--font-serif);
  font-size: 18px; letter-spacing: .02em; line-height: 1;
  padding: 2px 0;
}
.pill-link { position: relative; padding: 4px 0; color: var(--ink); }
.pill-link.is-active::after {
  content: ''; position: absolute; left: 50%; bottom: -4px; translate: -50% 0;
  width: 3px; height: 3px; border-radius: 50%; background: var(--ink);
}

/* ---- mini player ---- */
.player {
  position: fixed; right: 20px; bottom: 20px; z-index: 50;
  display: flex; align-items: center; gap: 12px;
  background: rgb(255 255 255 / .92);
  backdrop-filter: blur(6px);
  border-radius: 999px;
  padding: 10px 18px;
  box-shadow: 0 6px 24px rgb(0 0 0 / .1);
  max-width: min(480px, calc(100vw - 40px));
}
.view--show ~ .player, body[data-view="show"] .player {
  background: rgb(17 17 17 / .72); color: #f2f2f2;
}
.player-btn { font-size: 10px; letter-spacing: .1em; width: 18px; text-align: center; }
/* speaker + hover volume popup */
.vol { position: relative; display: flex; align-items: center; }
.player-speaker {
  display: flex; align-items: center; padding: 2px;
  color: inherit; opacity: .75;
  transition: opacity .25s var(--ease-out);
}
.player-speaker:hover { opacity: 1; }
.player-speaker .sp-off { display: none; }
.player-speaker.is-muted .sp-on { display: none; }
.player-speaker.is-muted .sp-off { display: block; }
.vol-pop {
  position: absolute; bottom: calc(100% + 12px); left: 50%;
  translate: -50% 4px;
  padding: 12px 16px;
  background: rgb(255 255 255 / .95);
  backdrop-filter: blur(6px);
  border-radius: 999px;
  box-shadow: 0 6px 24px rgb(0 0 0 / .12);
  opacity: 0; visibility: hidden; translate: -50% 4px;
  transition: opacity .25s var(--ease-out), translate .25s var(--ease-out), visibility 0s .3s;
}
.vol:hover .vol-pop, .vol:has(:focus-visible) .vol-pop {
  opacity: 1; visibility: visible; translate: -50% 0;
  transition: opacity .25s var(--ease-out), translate .25s var(--ease-out);
}
#vol-range {
  -webkit-appearance: none; appearance: none;
  display: block; width: 110px; height: 3px; border-radius: 999px;
  background: linear-gradient(to right, var(--ink) var(--fill, 100%), #ddd var(--fill, 100%));
  cursor: pointer; outline-offset: 5px;
}
#vol-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 12px; height: 12px; border-radius: 50%; background: var(--ink); border: none;
}
#vol-range::-moz-range-thumb {
  width: 12px; height: 12px; border-radius: 50%; background: var(--ink); border: none;
}
.player-label {
  opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 220px;
}
.player-time { opacity: .55; font-variant-numeric: tabular-nums; white-space: nowrap; }
.demo-tag {
  border: 1px solid currentColor; border-radius: 4px;
  padding: 1px 5px; font-size: 9px; opacity: .6;
}

/* ---- lightbox (same layout as the show act: photo centered, info on the left) ---- */
.lightbox {
  border: none; background: transparent; color: var(--ink);
  max-width: 100vw; max-height: 100vh; width: 100%; height: 100%;
  padding: 0; margin: 0;
  display: none;
}
.lightbox[open] { display: block; }
.lightbox::backdrop { background: transparent; }
/* paper wash that fades the archive away behind the flying photo */
.lb-wash {
  position: absolute; inset: 0; margin: 0;
  background: var(--paper);
  opacity: 0; pointer-events: none;
  transition: opacity .55s var(--ease-out);
}
.lightbox.is-open .lb-wash { opacity: 1; }
.lightbox.is-closing .lb-wash { opacity: 0; }
.lb-figure {
  position: absolute; inset: 0; margin: 0;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.lb-figure img {
  width: auto; height: auto;
  max-width: min(56vw, 1040px);
  max-height: 72vh;
  object-fit: contain;
  box-shadow: 0 30px 90px rgb(0 0 0 / .18);
  will-change: transform;
}
.lb-fade { animation: lb-in .5s var(--ease-out); }
@keyframes lb-in { from { opacity: 0; } to { opacity: 1; } }
/* caption and controls drift in after the photo has taken flight */
@keyframes ui-in { from { opacity: 0; } }
.lightbox.ui-enter .lb-close, .lightbox.ui-enter .lb-nav {
  animation: ui-in .55s .3s var(--ease-out) backwards;
}
.lightbox .show-caption.swap { animation-fill-mode: backwards; }
.lightbox.is-closing .lb-close, .lightbox.is-closing .lb-nav {
  opacity: 0; transition: opacity .25s var(--ease-out);
}
.lightbox.is-closing .show-caption {
  animation: none; opacity: 0; transition: opacity .25s var(--ease-out);
}
/* the dialog renders in the top layer, above #grain — carry its own grain */
.lightbox::after {
  content: ''; position: absolute; inset: 0;
  background-image: var(--grain-url);
  background-size: 280px 280px;
  opacity: .05;
  pointer-events: none;
}
html.clean .lightbox::after { display: none; }
.lb-close { position: fixed; top: 22px; right: 26px; color: var(--ink); opacity: .75; }
.lb-close:hover { opacity: 1; }
.lb-nav {
  position: absolute; top: 50%; translate: 0 -50%;
  font-size: 22px; color: var(--ink); opacity: .55; padding: 16px 10px;
  font-family: var(--font-sans);
}
.lb-nav:hover { opacity: 1; }
.lb-prev { left: 10px; }
.lb-next { right: 10px; }

/* photo-to-photo crossfade rides the view-transition root snapshot */
::view-transition-old(root), ::view-transition-new(root) {
  animation-duration: .45s;
  animation-timing-function: var(--ease-out);
}

/* ---- boot error ---- */
.boot-error {
  position: fixed; inset: 0; z-index: 101;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; background: var(--paper); text-align: center; padding: 24px;
}
.boot-error__body { color: var(--muted); line-height: 2; }
.boot-error code { background: #e6e6e6; padding: 2px 8px; border-radius: 4px; }

/* ---- reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  #wipe { transition-duration: .15s; }
  #wipe.is-in { transition-duration: .15s; }
  #grain { animation: none; }
  * { scroll-behavior: auto; }
}

@media (max-width: 640px) {
  .player { right: 12px; bottom: auto; top: 12px; padding: 8px 14px; gap: 8px; }
  .player-label { max-width: 110px; }
  .pill { gap: 18px; padding: 10px 20px; }
  .vol-pop { bottom: auto; top: calc(100% + 12px); }
}

/* ---- fullscreen confirm (right-click) ---- */
.fs-confirm {
  border: none; padding: 0;
  background: transparent; color: var(--ink);
  max-width: 100vw; max-height: 100vh; width: 100%; height: 100%;
  display: none;
  align-items: center; justify-content: center;
}
.fs-confirm[open] { display: flex; }
.fs-confirm::backdrop {
  background: rgb(242 242 242 / .93);
  backdrop-filter: blur(6px);
  background-image: var(--grain-url);
  background-size: 280px 280px;
}
.fs-confirm-inner { display: flex; flex-direction: column; align-items: center; gap: 36px; }
.fs-confirm-q {
  font-family: var(--font-serif); font-style: italic;
  font-size: clamp(26px, 3.2vw, 44px); line-height: 1.15;
}
.fs-confirm-row { display: flex; gap: 48px; }
.fs-confirm-row .micro { position: relative; padding: 4px 0; opacity: .8; }
.fs-confirm-row .micro:hover { opacity: 1; }
.fs-confirm-row .micro::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -3px; height: 1px;
  background: var(--ink); transform: scaleX(0); transform-origin: left;
  transition: transform .25s var(--ease-out);
}
.fs-confirm-row .micro:hover::after { transform: scaleX(1); }