/* ── Priyanka's Photos ── elegant, self-contained slideshow ─────────────── */

:root {
  --ink:        #f5f0e8;
  --ink-dim:    #9b948a;
  --accent:     #c9a86a;
  --bg:         #09090a;
  --dur-fade:   1.15s;
  --dur-kb:     11s;
  --chrome-fade:.55s;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg); color: var(--ink);
  font-family: var(--sans);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

body.idle { cursor: none; }

/* ── ambient backdrop: the current photo, heavily blurred ─────────────── */
.backdrop {
  position: fixed; inset: -8%;
  background-size: cover; background-position: center;
  filter: blur(52px) saturate(115%) brightness(.42);
  transform: scale(1.12);
  transition: background-image .8s ease;
  z-index: 0;
}
.vignette {
  position: fixed; inset: 0; z-index: 2; pointer-events: none;
  background:
    radial-gradient(ellipse at center, rgba(0,0,0,0) 32%, rgba(0,0,0,.66) 100%),
    linear-gradient(180deg, rgba(0,0,0,.58) 0%, rgba(0,0,0,0) 24%, rgba(0,0,0,0) 66%, rgba(0,0,0,.62) 100%);
}
.grain {
  position: fixed; inset: 0; z-index: 3; pointer-events: none; opacity: .05;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/></filter><rect width='140' height='140' filter='url(%23n)'/></svg>");
}

/* ── stage ─────────────────────────────────────────────────────────────── */
.stage { position: fixed; inset: 0; z-index: 1; display: grid; place-items: center; outline: none; }

.frame {
  position: absolute; inset: 0; margin: 0;
  display: grid;
  grid-template-columns: 100%;   /* definite tracks so % max-* resolves */
  grid-template-rows: 100%;
  place-items: center;
  /* reserved gutters keep the photo clear of the chrome */
  padding: 82px 4vw 132px;
  opacity: 0; transition: opacity var(--dur-fade) ease;
  will-change: opacity;
}
.frame.visible { opacity: 1; }

.frame img {
  /* the /1.04 exactly cancels the Ken Burns end-scale, so the zoomed photo
     can never grow beyond the padded stage box */
  max-width: calc(100% / 1.04);
  max-height: calc(100% / 1.04);
  width: auto; height: auto;
  object-fit: contain;
  border-radius: 3px;
  box-shadow: 0 40px 90px -30px rgba(0,0,0,.92), 0 4px 22px rgba(0,0,0,.5);
  transform-origin: center;
  background: #101011;
}
.frame.visible img.kb-a { animation: kbA var(--dur-kb) ease-out forwards; }
.frame.visible img.kb-b { animation: kbB var(--dur-kb) ease-out forwards; }
@keyframes kbA { from { transform: scale(1.005); } to { transform: scale(1.04); } }
@keyframes kbB { from { transform: scale(1.04); } to { transform: scale(1.005); } }

@media (max-width: 760px), (max-height: 560px) {
  .frame { padding: 64px 3vw 112px; }
}

/* placeholder while the full-res photo loads */
.frame img.loading {
  background-image: var(--lqip);
  background-size: contain; background-repeat: no-repeat; background-position: center;
}

/* ── spinner ───────────────────────────────────────────────────────────── */
.spinner {
  position: absolute; bottom: 56px; left: 50%; transform: translateX(-50%);
  opacity: 0; transition: opacity .3s ease; z-index: 6;
}
.spinner.on { opacity: 1; }
.spinner span {
  display: block; width: 22px; height: 22px; border-radius: 50%;
  border: 1.5px solid rgba(245,240,232,.22); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── opening card ──────────────────────────────────────────────────────
   Full-bleed artwork generated from the same code as the video's title
   card (tools/make_card_asset.py). The card is cream, so `contain`
   letterboxes invisibly against the matching page colour on any aspect
   ratio — no cropping of the portrait. */
.card {
  position: fixed; inset: 0; z-index: 9;
  background: #f5f0ea;
  display: grid; place-items: center;
  opacity: 1;
  transition: opacity 1.15s ease;
  pointer-events: none;
}
.card img {
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
}
.card.hide { opacity: 0; }
.card.gone { display: none; }
/* page 1 is the dark dusk card, page 2 the cream one — the background behind
   `object-fit: contain` must match, or a non-16:9 screen shows the wrong bars */
.card.on-dark { background: #0d1118; }

/* ── kiosk mode (?kiosk=1) — only the photographs, nothing else ───────── */
body.kiosk { cursor: none; }
body.kiosk .chrome,
body.kiosk .edge,
body.kiosk .spinner { display: none !important; }

/* ── chrome ────────────────────────────────────────────────────────────── */
.chrome {
  position: absolute; left: 0; right: 0; z-index: 8;
  display: flex; align-items: center; justify-content: space-between;
  padding: 26px 34px;
  transition: opacity var(--chrome-fade) ease, transform var(--chrome-fade) ease;
}
body.idle .chrome { opacity: 0; transform: translateY(-6px); }
body.idle .chrome-bottom { transform: translateY(6px); }
body.grid-open .chrome { opacity: 0; pointer-events: none; }

.chrome-top { top: 0; }
.chrome-bottom { bottom: 0; flex-direction: column; gap: 16px; padding-bottom: 22px; }

.mark {
  font-family: var(--serif); font-size: 17px; letter-spacing: .06em;
  color: rgba(245,240,232,.94);
  text-shadow: 0 1px 12px rgba(0,0,0,.7);
}
.count {
  font-size: 13px; letter-spacing: .22em; color: rgba(245,240,232,.68);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 12px rgba(0,0,0,.7);
}
.count .slash { margin: 0 7px; color: rgba(245,240,232,.28); }

/* progress */
.progress {
  width: min(560px, 62vw); height: 1.5px;
  background: rgba(245,240,232,.14); border-radius: 2px; overflow: hidden;
}
.progress-fill {
  width: 0%; height: 100%;
  background: linear-gradient(90deg, var(--accent), #e8d6ae);
  transition: none;
}
body.paused .progress-fill { opacity: .35; }

/* controls */
.controls {
  display: flex; align-items: center; gap: 6px;
  background: rgba(14,14,15,.52);
  border: 1px solid rgba(245,240,232,.09);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  padding: 7px 10px; border-radius: 999px;
}
.ctl {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; color: var(--ink-dim);
  transition: color .2s ease, background .2s ease, transform .2s ease;
}
.ctl:hover { color: var(--ink); background: rgba(245,240,232,.08); }
.ctl:active { transform: scale(.93); }
.ctl:focus-visible { outline: 1.5px solid var(--accent); outline-offset: 2px; }
.ctl svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ctl-main { color: var(--ink); width: 40px; height: 40px; }
.ctl-main svg { width: 21px; height: 21px; }
#btnPlay .ico-play { display: none; }
body.paused #btnPlay .ico-play { display: block; fill: currentColor; stroke: none; }
body.paused #btnPlay .ico-pause { display: none; }
.sep { width: 1px; height: 18px; background: rgba(245,240,232,.13); margin: 0 5px; }

/* click edges */
.edge { position: absolute; top: 0; bottom: 0; width: 16%; border: 0; background: transparent; cursor: pointer; z-index: 5; }
.edge-prev { left: 0; }
.edge-next { right: 0; }
@media (max-width: 700px) { .edge { display: none; } }

/* ── grid overlay ─────────────────────────────────────────────────────── */
.grid-overlay {
  position: fixed; inset: 0; z-index: 20;
  background: rgba(8,8,9,.96);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  opacity: 0; pointer-events: none;
  transition: opacity .4s ease;
  display: flex; flex-direction: column;
  padding: 26px 30px 34px;
}
.grid-overlay.open { opacity: 1; pointer-events: auto; }
.grid-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex: 0 0 auto; }
.grid-head h2 {
  font-family: var(--serif); font-weight: 400; font-size: 19px;
  letter-spacing: .1em; color: rgba(245,240,232,.95); margin: 0;
}
.grid {
  flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain;
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  padding-right: 6px;
}
.grid::-webkit-scrollbar { width: 8px; }
.grid::-webkit-scrollbar-thumb { background: rgba(245,240,232,.14); border-radius: 8px; }
.cell {
  position: relative; aspect-ratio: 1; overflow: hidden; cursor: pointer;
  border-radius: 4px; background: #131314;
  border: 1px solid rgba(245,240,232,.06);
  transition: transform .25s ease, border-color .25s ease;
}
.cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cell:hover { transform: translateY(-2px); border-color: rgba(201,168,106,.55); }
.cell.current { border-color: var(--accent); }
.cell.current::after {
  content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 0 2px var(--accent); border-radius: 4px;
}
.cell .no {
  position: absolute; right: 7px; bottom: 6px;
  font-size: 10px; letter-spacing: .1em; color: rgba(245,240,232,.72);
  background: rgba(0,0,0,.5); padding: 1px 5px; border-radius: 3px;
  font-variant-numeric: tabular-nums;
}

@media (prefers-reduced-motion: reduce) {
  .frame.visible img { animation: none !important; }
  .frame { transition-duration: .3s; }
}
