/* design-lab only — shared device frame + reset. Not part of the app build. */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  height: 100%;
}

body {
  position: relative;
  isolation: isolate;
  min-height: 100dvh;
  background: #050609;
  color: #f5f2e9;
  font-family: Inter, ui-sans-serif, system-ui, "Segoe UI", sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: -8px;
  z-index: 0;
  background: url("../assets/bg/page-background.png") center / cover no-repeat;
  filter: saturate(0.78) brightness(0.68) blur(2px);
  opacity: 0.9;
  pointer-events: none;
}

/* ---- device frame (desktop preview) ---- */
.device {
  position: relative;
  z-index: 1;
  width: 402px;
  height: min(874px, 100dvh);
  overflow: hidden;
  isolation: isolate;
  border-radius: 46px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06),
    0 0 0 11px #0b0d12,
    0 0 0 12px rgba(255, 255, 255, 0.08),
    0 42px 90px -20px rgba(0, 0, 0, 0.9);
  touch-action: pan-y;
}

@media (max-width: 640px) {
  body {
    display: block;
  }
  .device {
    width: 100%;
    height: 100dvh;
    border-radius: 0;
    box-shadow: none;
  }
}

/* ---- parallax stage ---- */
.stage {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.stage-layer {
  position: absolute;
  inset: 0;
  will-change: transform;
}

/* The plate is authored at the app's exact width and runs taller than the
   frame — that surplus height IS the parallax travel. Width is pinned to 100%
   so the art is never cropped or scaled horizontally, and the layer is as tall
   as the image so scrolling it up reveals the lower band. */
.stage-bg {
  bottom: auto;
  height: auto;
  aspect-ratio: 402 / 1120;
  background: url("../assets/bg/night.jpg") top center / 100% auto no-repeat;
}

/* Motes travel further than the plate, so the two read as depth. */
.stage-motes {
  bottom: -340px;
}

.stage-veil {
  background:
    radial-gradient(90% 55% at 50% 6%, rgba(155, 195, 255, 0.2), transparent 70%),
    linear-gradient(180deg, rgba(4, 7, 14, 0.18) 0%, rgba(4, 7, 14, 0.42) 52%, rgba(3, 5, 10, 0.74) 100%);
}

/* Two washes every direction shares. Written as literal white overlays these
   were invisible on a daylight plate, which is most of what broke when the
   night-only screens were themed. */
:root {
  --film: rgba(255, 255, 255, 0.07);
  --film-2: rgba(255, 255, 255, 0.04);
  --line: rgba(255, 255, 255, 0.12);
  /* the frosted sheet every panel sits on, and the shadow it casts */
  --sheet: rgba(8, 12, 19, 0.55);
  --sheet-2: rgba(7, 10, 17, 0.76);
  --drop: rgba(0, 0, 0, 0.9);
  /* A scrim is not a sheet: it lies over photographic art to carry a label,
     so it stays nearly clear at the top and only goes dense at the baseline. */
  --scrim: rgba(6, 9, 15, 0.06);
  --scrim-2: rgba(6, 9, 15, 0.84);
}

[data-theme="light"] {
  /* The day plate is bright (mean 176 against night's 36), so a light sheet
     has to be near-opaque to separate from it at all — 0.58 disappeared. */
  --film: rgba(18, 32, 50, 0.08);
  --film-2: rgba(18, 32, 50, 0.05);
  --line: rgba(18, 32, 50, 0.18);
  --sheet: rgba(255, 255, 255, 0.8);
  --sheet-2: rgba(255, 255, 255, 0.92);
  --drop: rgba(45, 56, 70, 0.4);
  --scrim: rgba(255, 255, 255, 0.06);
  --scrim-2: rgba(255, 255, 255, 0.88);
}

/* ---- light mode: same layout, daylight plate ---- */
[data-theme="light"] body {
  color: #171b21;
}

[data-theme="light"] .device {
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.08),
    0 0 0 11px #f7f6f1,
    0 0 0 12px rgba(0, 0, 0, 0.1),
    0 42px 90px -24px rgba(60, 66, 58, 0.45);
}

[data-theme="light"] .stage-bg {
  background-image: url("../assets/bg/day.jpg");
}

[data-theme="light"] .stage-veil {
  background:
    radial-gradient(90% 55% at 50% 4%, rgba(255, 248, 225, 0.5), transparent 68%),
    linear-gradient(180deg, rgba(255, 253, 246, 0.42) 0%, rgba(252, 251, 244, 0.3) 46%, rgba(238, 240, 231, 0.5) 100%);
}

[data-theme="light"] .stage-motes {
  opacity: 0.4;
  mix-blend-mode: soft-light;
}

/* ---- theme toggle (prototype affordance, sits outside the device) ---- */
.theme-toggle {
  position: fixed;
  z-index: 200;
  top: 18px;
  right: 18px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 13px 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(14, 18, 26, 0.72);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: #e9edf5;
  font: 500 10.5px/1 Inter, system-ui, sans-serif;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
}

.theme-toggle svg {
  width: 15px;
  height: 15px;
}

[data-theme="light"] .theme-toggle {
  border-color: rgba(0, 0, 0, 0.12);
  background: rgba(255, 255, 255, 0.78);
  color: #232830;
}

@media (max-width: 640px) {
  .theme-toggle {
    top: 8px;
    right: 8px;
    height: 28px;
    padding: 0 10px 0 8px;
    font-size: 9px;
    opacity: 0.85;
  }
}

.stage-motes {
  background-image:
    radial-gradient(1.4px 1.4px at 18% 22%, rgba(255, 240, 190, 0.9), transparent 60%),
    radial-gradient(1.2px 1.2px at 74% 15%, rgba(200, 225, 255, 0.75), transparent 60%),
    radial-gradient(1.6px 1.6px at 44% 62%, rgba(255, 235, 175, 0.8), transparent 60%),
    radial-gradient(1.1px 1.1px at 86% 48%, rgba(255, 245, 205, 0.65), transparent 60%),
    radial-gradient(1.3px 1.3px at 12% 74%, rgba(190, 220, 255, 0.6), transparent 60%),
    radial-gradient(1.5px 1.5px at 62% 88%, rgba(255, 238, 190, 0.7), transparent 60%);
  animation: mote-drift 14s ease-in-out infinite alternate;
}

/* Uses `translate`, not `transform` — an animated transform would beat the
   inline transform the parallax writes, and the motes would never drift. */
@keyframes mote-drift {
  from {
    opacity: 0.55;
    translate: 0 0;
  }
  to {
    opacity: 1;
    translate: -8px -14px;
  }
}

/* ---- scrollable screen ---- */
.screen {
  position: relative;
  z-index: 1;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}

.screen::-webkit-scrollbar {
  display: none;
}

/* ---- deck primitives ---- */
.deck {
  position: relative;
  z-index: 1; /* contain card z-indexes so following sections can sit above */
  touch-action: pan-y;
  cursor: grab;
  user-select: none;
}

.deck.dragging {
  cursor: grabbing;
}

.deck-card {
  position: absolute;
  top: 0;
  left: 50%;
  will-change: transform, opacity;
  transform-origin: center bottom;
}

.deck-card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  -webkit-user-drag: none;
}

/* capture control is an <a> when rendered by nav.js */
.capture {
  text-decoration: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  .stage-layer,
  .stage-motes {
    animation: none;
    transform: none;
  }
}
