:root {
  --scene-dark: #101010;
  --scene-mid: #303030;
  --scene-light: #606060;
  --ink: #f2f2f2;
  --ink-dim: rgba(242, 242, 242, 0.62);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  font-family: "Inter Tight", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--scene-dark);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

/* ---- scene page ------------------------------------------------------ */

body.scene {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  overflow-x: hidden;
  position: relative;
  isolation: isolate;
}

/* The spill: the frame's picture, tiny, blurred, scaled up behind everything. */
.spill {
  position: fixed;
  inset: -20vmax;
  width: calc(100% + 40vmax);
  height: calc(100% + 40vmax);
  z-index: -1;
  filter: blur(48px) saturate(1.15) brightness(0.7);
  transform: scale(1.1);
  opacity: 0.9;
  pointer-events: none;
  image-rendering: auto;
}

body.surround-none .spill { display: none; }
body.surround-palette .spill { display: none; }
body.surround-palette {
  background: radial-gradient(120% 90% at 50% 40%, var(--scene-mid) 0%, var(--scene-dark) 70%);
}

/* Vignette so the page edges settle into darkness whatever the spill does. */
body.scene::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: radial-gradient(75% 65% at 50% 45%, transparent 40%, rgba(0, 0, 0, 0.55) 100%);
  pointer-events: none;
}

.stage {
  width: min(100vw - 2rem, 1400px);
  display: grid;
  grid-template-rows: auto auto auto;
  justify-items: center;
  gap: 1.1rem;
  padding: 2.5rem 0 2rem;
}

omnitwin-scene {
  width: min(100%, calc((100dvh - 12rem) * var(--frame-aspect, 1.5)));
  max-height: calc(100dvh - 12rem);
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.55),
    0 2px 6px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.06);
  --omnitwin-radius: 14px;
}

.caption {
  text-align: center;
  max-width: 60ch;
}
.caption h1 {
  font-size: clamp(1.25rem, 2.4vw, 1.75rem);
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 0 0 0.3rem;
}
.caption p {
  margin: 0;
  color: var(--ink-dim);
  font-size: 0.98rem;
  line-height: 1.5;
}

.gallery-nav {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  width: min(100%, 720px);
  font-size: 0.9rem;
  color: var(--ink-dim);
}
.gallery-nav a { text-decoration: none; padding: 0.5rem 0.75rem; border-radius: 999px; }
.gallery-nav a:hover { color: var(--ink); background: rgba(255, 255, 255, 0.07); }
.gallery-nav .prev { justify-self: start; }
.gallery-nav .next { justify-self: end; }
.gallery-nav .prev::before { content: "← "; }
.gallery-nav .next::after { content: " →"; }
.gallery-nav .home { justify-self: center; letter-spacing: 0.04em; text-transform: uppercase; font-size: 0.75rem; }

/* ---- index ------------------------------------------------------------ */

body.index { padding: 3rem 1.25rem; }
.gallery { max-width: 1200px; margin: 0 auto; }
.masthead h1 { font-weight: 500; font-size: clamp(1.6rem, 3vw, 2.4rem); letter-spacing: -0.02em; margin: 0 0 0.25rem; }
.masthead p { color: var(--ink-dim); margin: 0 0 2rem; }
.empty { color: var(--ink-dim); font-size: 1.05rem; }
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
}
.card {
  display: block;
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  text-decoration: none;
  background: var(--scene-dark);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.06);
  transition: transform 300ms ease, box-shadow 300ms ease;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.1); }
.card img { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; }
.card-title {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 2rem 1rem 0.9rem;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
  font-size: 1rem; font-weight: 500;
}

@media (prefers-reduced-motion: reduce) {
  .card, .card:hover { transition: none; transform: none; }
}
