/* Zion's Ecosystem — in motion. A cinema page: always dark, the film is the page. */

:root {
  color-scheme: dark;
  --bg: #04070d;
  --stage: #060a12;
  --ink: #e9eef5;
  --dim: #7a89a0;
  --line: rgba(233, 238, 245, 0.12);
  --accent: #f4c778;
}

* { box-sizing: border-box; }

html, body { margin: 0; background: var(--bg); color: var(--ink); }

body.film-page {
  min-height: 100vh;
  font-family: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.film {
  width: max(300px, min(1280px, calc(100% - 32px), calc((100svh - 230px) * 16 / 9)));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.film-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 18px;
  font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.film-back { color: var(--ink); text-decoration: none; opacity: 0.8; }
.film-back:hover, .film-back:focus-visible { opacity: 1; color: var(--accent); }
.film-meta { color: var(--dim); text-align: right; }

.film-stage {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--stage);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.05), 0 40px 120px -30px rgba(0, 0, 0, 0.9);
}

.film-stage canvas { display: block; width: 100%; height: 100%; cursor: pointer; }

.film-play {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 76px;
  height: 76px;
  margin: -38px 0 0 -38px;
  border: 1px solid rgba(233, 238, 245, 0.28);
  border-radius: 50%;
  background: rgba(6, 10, 18, 0.55);
  color: var(--ink);
  backdrop-filter: blur(6px);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease, transform 0.4s ease;
  transform: scale(0.92);
}
.film-play svg { width: 28px; height: 28px; margin-left: 4px; fill: currentColor; }
[data-film].is-ready:not(.is-playing):not(.is-ended) .film-play { opacity: 1; pointer-events: auto; transform: none; }
.film-play:hover, .film-play:focus-visible { border-color: var(--accent); color: var(--accent); }

.film-controls {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 18px;
}

.film-toggle {
  flex: none;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
.film-toggle svg { width: 16px; height: 16px; fill: currentColor; display: none; }
.film-toggle:hover, .film-toggle:focus-visible { border-color: var(--accent); color: var(--accent); }
.is-playing .film-toggle .i-pause { display: block; }
[data-film]:not(.is-playing):not(.is-ended) .film-toggle .i-play { display: block; }
.is-ended .film-toggle .i-replay { display: block; }

.film-scrub {
  position: relative;
  flex: 1;
  height: 40px;
  cursor: pointer;
  touch-action: none;
  outline: none;
}
.film-track {
  position: absolute;
  left: 0;
  right: 0;
  top: 12px;
  height: 2px;
  background: var(--line);
  border-radius: 2px;
  overflow: hidden;
}
.film-fill {
  height: 100%;
  background: linear-gradient(90deg, #f4c778, #f48aaa 40%, #a698ff 62%, #80e0a0 80%, #ffcc6e);
  clip-path: inset(0 100% 0 0);
}
.film-scrub:focus-visible .film-track { outline: 2px solid var(--accent); outline-offset: 6px; }

.film-marks { position: absolute; left: 0; right: 0; top: 22px; height: 14px; }
.film-mark {
  position: absolute;
  left: var(--at);
  font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
  white-space: nowrap;
}
.film-mark::before {
  content: "";
  position: absolute;
  left: 0;
  top: -10px;
  width: 1px;
  height: 6px;
  background: var(--line);
}

.film-time {
  flex: none;
  font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}

.film-caption {
  max-width: 64ch;
  margin: 28px 0 0;
  color: var(--dim);
  font-size: 15px;
  line-height: 1.65;
}

@media (max-width: 640px) {
  .film { padding-top: 18px; }
  .film-meta { display: none; }
  .film-controls { gap: 12px; }
  .film-mark { font-size: 9px; letter-spacing: 0.08em; }
  .film-time { display: none; }
  .film-play { width: 60px; height: 60px; margin: -30px 0 0 -30px; }
}

/* frame-exact capture for tools/render-motion.mjs */
body.render .film-head,
body.render .film-controls,
body.render .film-caption,
body.render .film-play { display: none; }
body.render .film { width: 1920px; padding: 0; margin: 0; }
body.render .film-stage { width: 1920px; height: 1080px; border-radius: 0; box-shadow: none; }
