/* =========================================================
   06 — TORCH
   A dark room. The cursor is the light.
   ========================================================= */

@font-face {
  font-family: 'Space Grotesk';
  src: url('/vendor/fonts/SpaceGrotesk-Variable.woff2') format('woff2');
  font-weight: 300 700;
  font-display: swap;
}
@font-face {
  font-family: 'Newsreader';
  src: url('/vendor/fonts/Newsreader-Italic-Variable.woff2') format('woff2');
  font-weight: 200 800;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Fraunces';
  src: url('/vendor/fonts/Fraunces-Variable.woff2') format('woff2');
  font-weight: 300 900;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('/vendor/fonts/Inter-Variable.woff2') format('woff2');
  font-weight: 300 700;
  font-display: swap;
}

:root {
  --bg: #050403;
  --paper: #f2e8d8;
  --paper-dim: rgba(242, 232, 216, 0.5);
  --warm-core: 255, 178, 102;
  --warm-edge: 255, 120, 48;
  --beam-r: 150px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--paper);
  height: 100%;
}

body.torch {
  font-family: 'Inter', system-ui, sans-serif;
  overflow-x: hidden;
  overflow-y: auto;
  scroll-snap-type: y proximity;
  -webkit-font-smoothing: antialiased;
  cursor: none;
}

@media (hover: none), (pointer: coarse) {
  body.torch { cursor: auto; }
}

::selection { background: rgba(255, 160, 90, 0.35); color: var(--paper); }

/* ---------- chrome ---------- */

.chrome {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: max(1.1rem, env(safe-area-inset-top)) 1.3rem 0.6rem;
  z-index: 60;
  pointer-events: none;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.chrome__index,
.chrome__title {
  pointer-events: auto;
  color: var(--paper-dim);
  text-decoration: none;
  opacity: 0.6;
  transition: opacity 0.3s ease;
}

.chrome__index:hover { opacity: 1; }
.chrome__title { opacity: 0.4; }

/* ---------- hint ---------- */

.hint {
  position: fixed;
  left: 50%;
  bottom: 3.4rem;
  transform: translateX(-50%);
  z-index: 55;
  margin: 0;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: lowercase;
  color: var(--paper-dim);
  opacity: 0.55;
  pointer-events: none;
  transition: opacity 1.1s ease;
  text-align: center;
  padding: 0 1.5rem;
}

.hint.is-hidden { opacity: 0; }

/* ---------- fx canvas ---------- */

#fx {
  position: fixed;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  mix-blend-mode: screen;
}

/* ---------- chambers ---------- */

main { position: relative; z-index: 1; }

.chamber {
  position: relative;
  min-height: 100svh;
  width: 100%;
  overflow: hidden;
  scroll-snap-align: start;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

.frame {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.ph {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 10%;
  will-change: filter;
}

.frame--case .ph { object-position: 50% 45%; }

.ph--dim {
  filter: brightness(0.14) contrast(1.08) saturate(0.35) sepia(0.12);
}

.ph--lit {
  filter: brightness(1.1) contrast(1.12) saturate(1.08) sepia(0.03);
  -webkit-mask-image: radial-gradient(circle var(--beam-r) at var(--mx, 50%) var(--my, 50%), #000 0%, #000 52%, transparent 100%);
          mask-image: radial-gradient(circle var(--beam-r) at var(--mx, 50%) var(--my, 50%), #000 0%, #000 52%, transparent 100%);
}

.chamber--vitrine .ph--lit {
  filter: brightness(1.12) contrast(1.2) saturate(1.2) sepia(0.14);
}

/* soft interior vignette, museum-case intimacy */
.frame::after {
  content: '';
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 min(22vw, 22vh) min(5vw, 5vh) rgba(0, 0, 0, 0.6);
  pointer-events: none;
}

.chamber__cap {
  position: absolute;
  left: 1.3rem;
  bottom: 1.4rem;
  z-index: 5;
  margin: 0;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  color: var(--paper-dim);
  opacity: 0.55;
  max-width: 70vw;
}

.chamber__cap span {
  display: inline-block;
  margin-right: 0.6em;
  opacity: 0.7;
  font-variation-settings: 'wght' 500;
}

.chamber__cap--text { color: var(--paper-dim); }

/* the felt moment: a caption near the face, lit by proximity */
.find-text {
  position: absolute;
  top: 17%;
  left: 6%;
  width: min(38ch, 60vw);
  margin: 0;
  font-family: 'Newsreader', serif;
  font-style: italic;
  font-size: clamp(1rem, 2.2vw, 1.4rem);
  color: rgb(var(--warm-core));
  opacity: 0;
  text-shadow: 0 0 18px rgba(var(--warm-core), 0.35);
  transition: opacity 0.25s ease;
  z-index: 4;
}

/* ---------- text chamber ---------- */

.chamber--text {
  background: var(--bg);
}

.frag-mask {
  position: absolute;
  inset: 0;
  -webkit-mask-image: radial-gradient(circle var(--beam-r) at var(--mx, 50%) var(--my, 50%), #000 0%, #000 60%, transparent 100%);
          mask-image: radial-gradient(circle var(--beam-r) at var(--mx, 50%) var(--my, 50%), #000 0%, #000 60%, transparent 100%);
  pointer-events: none;
}

.frag {
  position: absolute;
  margin: 0;
  max-width: 22ch;
  font-family: 'Newsreader', serif;
  font-style: italic;
  font-weight: 380;
  font-size: clamp(1.3rem, 3.4vw, 2.1rem);
  line-height: 1.32;
  color: var(--paper);
}

.frag-mask--a .frag { top: 16%; left: 8%; text-align: left; }
.frag-mask--b .frag { top: 44%; right: 8%; left: auto; text-align: right; max-width: 24ch; }
.frag-mask--c .frag { bottom: 16%; left: 10%; text-align: left; max-width: 26ch; }

/* ---------- notes ---------- */

.notes {
  position: relative;
  z-index: 2;
  background: var(--bg);
  padding: 5rem 1.5rem 7rem;
  scroll-snap-align: start;
  border-top: 1px solid rgba(242, 232, 216, 0.08);
}

.notes__inner {
  max-width: 640px;
  margin: 0 auto;
}

.notes__heading {
  font-family: 'Fraunces', serif;
  font-optical-sizing: auto;
  font-variation-settings: 'WONK' 1;
  font-weight: 420;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  margin: 0 0 2.4rem;
  color: var(--paper);
}

.notes__row { margin-bottom: 2.1rem; }

.notes__row h3 {
  font-family: 'Space Grotesk', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  color: rgb(var(--warm-core));
  margin: 0 0 0.6rem;
  opacity: 0.85;
}

.notes__row p {
  font-family: 'Inter', sans-serif;
  font-size: 0.98rem;
  line-height: 1.65;
  color: var(--paper-dim);
  margin: 0;
}

.notes__row code {
  font-family: ui-monospace, monospace;
  background: rgba(242, 232, 216, 0.08);
  padding: 0.1em 0.4em;
  border-radius: 3px;
  font-size: 0.85em;
  color: var(--paper);
}

/* ---------- ambient toggle ---------- */

.ambient-toggle {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 2.6rem auto 0;
  padding: 0.55rem 1rem;
  background: transparent;
  border: 1px solid rgba(242, 232, 216, 0.18);
  border-radius: 999px;
  color: var(--paper-dim);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.3s ease, color 0.3s ease;
  max-width: 640px;
}

.ambient-toggle:hover { border-color: rgba(242, 232, 216, 0.4); color: var(--paper); }

.ambient-toggle__dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: rgba(242, 232, 216, 0.35);
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

.ambient-toggle[aria-pressed="true"] .ambient-toggle__dot {
  background: rgb(var(--warm-core));
  box-shadow: 0 0 8px rgba(var(--warm-core), 0.8);
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .hint, .ambient-toggle, .chrome__index, .chrome__title, .find-text { transition: none; }
}

/* ---------- small screens ---------- */

@media (max-width: 600px) {
  :root { --beam-r: 110px; }
  .chamber__cap { font-size: 0.62rem; max-width: 82vw; }
  .frag { max-width: 18ch; }
  .frag-mask--a .frag,
  .frag-mask--c .frag { max-width: 20ch; }
  .find-text { top: 19%; width: min(30ch, 78vw); }
  .notes { padding: 4rem 1.2rem 5rem; }
}
