/* ================================================================
   DRAGON BALL · NIGHTSIDE ARCHIVE · v5
   Superman/Ironman-style scroll-driven frame-scrubbing
   Sticky sections with will-change + translateZ, Frame-img wechselt
   basierend auf Scroll-Position. Bento-Cards mit Hover-Play.
   ================================================================ */

:root {
  --night-950: #0a0608;
  --night-900: #110a0e;
  --night-800: #1a1015;
  --night-700: #221419;

  --ember: #f97316;
  --ember-2: #fb923c;
  --ember-3: #fdba74;
  --ember-glow: rgba(249, 115, 22, 0.55);

  --blood: #dc2626;
  --gold: #fbbf24;
  --gold-soft: #fde68a;

  --ink: #f5e7d4;
  --ink-dim: rgba(245, 231, 212, 0.65);
  --ink-faint: rgba(245, 231, 212, 0.35);
  --ink-mute: rgba(245, 231, 212, 0.18);

  --line: rgba(249, 115, 22, 0.20);
  --line-strong: rgba(249, 115, 22, 0.45);

  --serif: "Noto Serif JP", "Times New Roman", serif;
  --display: "Bebas Neue", "Impact", sans-serif;
  --mono: "JetBrains Mono", "SF Mono", monospace;
  --body: "Space Grotesk", "Inter", system-ui, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  background: var(--night-950);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ================================================================
   FIXED ATMOSPHERIC LAYERS
   ================================================================ */

.night-base {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 60% 40% at 50% 20%, rgba(249, 115, 22, 0.08) 0%, transparent 70%),
    radial-gradient(ellipse 80% 60% at 50% 100%, rgba(220, 38, 38, 0.05) 0%, transparent 70%),
    var(--night-950);
}

.comic-dust {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background-image:
    radial-gradient(circle 1px at 5% 12%, rgba(255, 255, 255, 0.18) 0%, transparent 100%),
    radial-gradient(circle 1px at 25% 8%, rgba(255, 255, 255, 0.20) 0%, transparent 100%),
    radial-gradient(circle 1px at 50% 4%, rgba(255, 255, 255, 0.15) 0%, transparent 100%),
    radial-gradient(circle 1px at 75% 14%, rgba(255, 255, 255, 0.18) 0%, transparent 100%),
    radial-gradient(circle 1px at 95% 18%, rgba(255, 255, 255, 0.15) 0%, transparent 100%);
  mix-blend-mode: screen;
  animation: dustShift 30s linear infinite;
}
@keyframes dustShift {
  0% { transform: translateY(0); }
  100% { transform: translateY(-50vh); }
}

/* ================================================================
   FIXED TOP BAR
   ================================================================ */

.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  padding: 14px 28px;
  background: rgba(10, 6, 8, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.topbar__left, .topbar__right { display: flex; align-items: center; gap: 10px; }
.topbar__right { justify-content: flex-end; color: var(--ink-dim); }
.topbar__center { display: inline-flex; align-items: center; gap: 10px; font-size: 10px; color: var(--ink-dim); }
.topbar__kanji {
  font-family: var(--serif);
  font-weight: 900;
  font-size: 16px;
  color: var(--ember);
  letter-spacing: 0.05em;
  text-transform: none;
}
.topbar__sep { color: var(--ink-mute); }
.topbar__title { color: var(--ink); }
.topbar__dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--ember);
  box-shadow: 0 0 12px var(--ember-glow);
  animation: pulse 2s ease-in-out infinite;
}
.topbar__label { color: var(--ember); }
.topbar__date { color: var(--ember); letter-spacing: 0.16em; font-variant-numeric: tabular-nums; }
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.4; transform: scale(0.85); }
}

@media (max-width: 880px) {
  .topbar__center { display: none; }
}
@media (max-width: 520px) {
  .topbar { padding: 12px 16px; }
  .topbar__title { display: none; }
}

/* ================================================================
   FIXED TICKER
   ================================================================ */

.ticker {
  position: fixed;
  top: 49px; left: 0; right: 0;
  z-index: 99;
  width: 100%;
  overflow: hidden;
  background: linear-gradient(90deg, var(--ember) 0%, var(--blood) 100%);
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.ticker__track {
  display: inline-flex;
  white-space: nowrap;
  animation: tickerSlide 40s linear infinite;
}
.ticker__group {
  display: inline-flex;
  align-items: center;
  gap: 24px;
  padding-right: 24px;
}
.ticker__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--night-950);
  text-transform: uppercase;
}
.ticker__bullet {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--night-950);
}
.ticker__sep { color: var(--night-950); opacity: 0.6; font-size: 10px; }
@keyframes tickerSlide {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* ================================================================
   STICKY SCROLL SECTION (Superman-pattern)
   height: 300vh = 3x viewport, with sticky 100vh inner content.
   When user scrolls through, the inner stays pinned while the
   outer section scrolls past, giving 200vh of "scrub" time.
   ================================================================ */

.scroll-sec {
  position: relative;
  z-index: 5;
  height: 300vh; /* 3 viewports of scroll per section */
  width: 100%;
}

.sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  width: 100%;
  overflow: hidden;
  background: var(--night-950);
  will-change: transform;
  transform: translateZ(0); /* own compositor layer */
}

.bg-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 1;
  will-change: contents;
  transform: translateZ(0);
}

/* The actual frame image — full 16:9 widescreen, no letterbox */
.frame-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  z-index: 2;
  background: var(--night-900); /* placeholder color until loaded */
}

.vignette {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background:
    radial-gradient(ellipse 110% 70% at 50% 50%, transparent 40%, rgba(10, 6, 8, 0.45) 80%, rgba(10, 6, 8, 0.75) 100%),
    linear-gradient(180deg, transparent 0%, rgba(10, 6, 8, 0.3) 70%, rgba(10, 6, 8, 0.6) 100%);
}

/* HUD corner markers */
.corner {
  position: absolute;
  z-index: 14;
  color: var(--ember);
  pointer-events: none;
}
.corner--tl { top: 88px; left: 24px; }
.corner--tr { top: 88px; right: 24px; color: var(--ember-2); }
.corner--bl { bottom: 56px; left: 24px; color: var(--ember-2); }
.corner--br { bottom: 56px; right: 24px; color: var(--blood); }

/* HUD Telemetry (left/right bottom) */
.hud-telemetry {
  position: absolute;
  z-index: 14;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.32em;
  color: var(--ink-dim);
  text-transform: uppercase;
  pointer-events: none;
}
.hud-telemetry--left { bottom: 90px; left: 60px; }
.hud-telemetry--right { bottom: 90px; right: 60px; }
.hud-line { background: var(--ember); opacity: 0.5; height: 1px; }
.hud-value { color: var(--ember); font-weight: 500; }
.hud-pulse {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--ember);
  box-shadow: 0 0 8px var(--ember-glow);
  animation: pulse 2s ease-in-out infinite;
}
.hud-pulse--alt {
  background: var(--blood);
  box-shadow: 0 0 8px rgba(220, 38, 38, 0.7);
}

/* HUD Top (left/right) */
.hud-top {
  position: absolute;
  z-index: 14;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.32em;
  color: var(--ink-dim);
  text-transform: uppercase;
  pointer-events: none;
}
.hud-top--left { top: 100px; left: 60px; }
.hud-top--right { top: 100px; right: 60px; }
.hud-label { color: var(--ink-faint); }
.hud-counter { color: var(--ember); font-weight: 500; font-variant-numeric: tabular-nums; }

/* Title block (bottom-left, large) */
.title-block {
  position: absolute;
  z-index: 14;
  bottom: 90px;
  left: 60px;
  max-width: 60%;
  display: flex;
  flex-direction: column;
  gap: 4px;
  pointer-events: none;
  transform: translateY(20px);
  opacity: 0;
  transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}
.title-block.is-visible { transform: translateY(0); opacity: 1; }

.title-block__kanji {
  font-family: var(--serif);
  font-weight: 900;
  font-size: clamp(64px, 8vw, 128px);
  line-height: 0.9;
  color: var(--ember-2);
  text-shadow: 0 0 32px var(--ember-glow);
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.8));
  letter-spacing: 0.04em;
  opacity: 0.92;
}
.title-block__name {
  font-family: var(--display);
  font-size: clamp(32px, 4.5vw, 56px);
  line-height: 1;
  letter-spacing: 0.06em;
  color: var(--ink);
  text-transform: uppercase;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.8);
}
.title-block__role {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.24em;
  color: var(--ember);
  text-transform: uppercase;
  margin-top: 4px;
}

/* Quote card (bottom-right) */
.quote-card {
  position: absolute;
  z-index: 14;
  bottom: 90px;
  right: 60px;
  max-width: 380px;
  pointer-events: none;
  display: none;
}
@media (min-width: 1100px) { .quote-card { display: block; } }
.quote-card figure {
  padding: 18px 20px;
  background: rgba(10, 6, 8, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
  transform: translateY(20px);
  opacity: 0;
  transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}
.quote-card.is-visible figure { transform: translateY(0); opacity: 1; }
.quote-card blockquote {
  font-family: var(--display);
  font-size: 15px;
  line-height: 1.3;
  color: var(--ink);
  font-weight: 500;
}
.quote-card figcaption {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--ink-dim);
}
.quote-source {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ember);
}

/* Editorial stamp (right middle) */
.editorial-stamp {
  position: absolute;
  z-index: 14;
  right: 60px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  text-align: right;
  pointer-events: none;
  display: none;
}
@media (min-width: 1280px) { .editorial-stamp { display: flex; } }
.editorial-stamp__label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.3em;
  color: var(--ember);
  text-transform: uppercase;
}
.editorial-stamp__pulse {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--ember);
  box-shadow: 0 0 10px var(--ember-glow);
  animation: pulse 2s ease-in-out infinite;
}
.editorial-stamp__title {
  font-family: var(--display);
  font-size: clamp(40px, 6vw, 80px);
  line-height: 0.9;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.editorial-stamp__title span { color: var(--ember); }
.editorial-stamp__sub {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.22em;
  color: var(--ink-dim);
  text-transform: uppercase;
  max-width: 28ch;
}

/* Progress bar bottom */
.progress {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  z-index: 14;
  pointer-events: none;
}
.progress__track {
  margin: 0 28px 12px;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
}
.progress__bar {
  height: 100%;
  background: var(--ember);
  transform-origin: left;
  transform: scaleX(0);
  transition: transform 80ms linear;
  box-shadow: 0 0 6px var(--ember-glow);
}
#frieza-sec .progress__bar {
  background: var(--blood);
  box-shadow: 0 0 6px rgba(220, 38, 38, 0.7);
}
#vegeta-sec .progress__bar {
  background: linear-gradient(90deg, var(--ember) 0%, var(--gold) 100%);
  box-shadow: 0 0 6px rgba(251, 191, 36, 0.5);
}
.progress__meta {
  display: flex;
  justify-content: space-between;
  padding: 0 28px 16px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.28em;
  color: var(--ink-dim);
  text-transform: uppercase;
}

/* ================================================================
   BENTO ARCHIVE (final content)
   ================================================================ */

.bento {
  position: relative;
  z-index: 10;
  max-width: 1400px;
  margin: 0 auto;
  padding: 80px 28px 40px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 24px;
  background: linear-gradient(180deg, var(--night-950) 0%, var(--night-900) 100%);
}
.bento__corner {
  position: absolute;
  width: 28px; height: 28px;
  border: 2px solid var(--ember);
  pointer-events: none;
}
.bento__corner--tl { top: 0; left: 0; border-right: none; border-bottom: none; }
.bento__corner--br { bottom: 0; right: 0; border-left: none; border-top: none; }

.bento__head {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 40px;
  align-items: end;
  padding-bottom: 32px;
  margin-bottom: 32px;
  border-bottom: 1px solid var(--line);
}
.bento__num {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--ember);
  text-transform: uppercase;
  margin-bottom: 8px;
}
.bento__title {
  font-family: var(--display);
  font-size: clamp(40px, 6vw, 72px);
  line-height: 0.9;
  letter-spacing: 0.04em;
  color: var(--ink);
  text-transform: uppercase;
}
.bento__sub {
  font-family: var(--body);
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-dim);
  max-width: 540px;
  align-self: end;
}

@media (max-width: 1100px) {
  .bento { grid-template-columns: 1fr 1fr; }
  .card:nth-child(3) { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
  .bento { grid-template-columns: 1fr; }
  .bento__head { grid-template-columns: 1fr; gap: 16px; }
}

/* ================================================================
   CARD (16:9 horizontal, hover-play)
   ================================================================ */

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--night-900);
  border: 1px solid var(--line);
  overflow: hidden;
}
.card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--ember);
  z-index: 5;
  box-shadow: 0 0 12px var(--ember-glow);
}
.card--alt::before { background: linear-gradient(90deg, var(--ember), var(--gold)); }

.card__media {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  overflow: hidden;
}
.card__video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.card__scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(10, 6, 8, 0.4) 0%, transparent 30%, transparent 70%, rgba(10, 6, 8, 0.7) 100%);
  pointer-events: none;
}
.card__id {
  position: absolute;
  top: 14px; left: 14px;
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.card__id-num {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--ember-2);
  background: rgba(0, 0, 0, 0.7);
  padding: 4px 8px;
  border: 1px solid var(--line);
  align-self: flex-start;
}
.card__id-kanji {
  font-family: var(--serif);
  font-weight: 900;
  font-size: 28px;
  line-height: 1;
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.8);
}
.card__play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(249, 115, 26, 0.95);
  border: 2px solid var(--ember);
  color: var(--night-950);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 6;
  transition: all 0.2s;
  box-shadow: 0 0 24px var(--ember-glow);
}
.card__play:hover {
  background: var(--ember-2);
  transform: translate(-50%, -50%) scale(1.1);
}
.card.is-playing .card__play { opacity: 0; pointer-events: none; }

.card__body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px 20px 18px;
  background: linear-gradient(180deg, var(--night-900) 0%, var(--night-800) 100%);
  flex: 1;
}
.card__header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.card__name {
  font-family: var(--display);
  font-size: 24px;
  letter-spacing: 0.05em;
  line-height: 1;
  color: var(--ink);
  text-transform: uppercase;
}
.card__role {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--ember);
  text-transform: uppercase;
  white-space: nowrap;
}
.card__counter {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-family: var(--mono);
}
.card__counter-label {
  font-size: 9px;
  letter-spacing: 0.18em;
  color: var(--ink-faint);
  text-transform: uppercase;
}
.card__counter-value {
  font-family: var(--display);
  font-size: 24px;
  letter-spacing: 0.02em;
  color: var(--ember-2);
  line-height: 1;
}
.card__bar {
  height: 4px;
  background: rgba(249, 115, 22, 0.08);
  position: relative;
  overflow: hidden;
}
.card__bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--ember) 0%, var(--ember-2) 100%);
  width: 0;
  transition: width 1.8s cubic-bezier(0.2, 0.8, 0.2, 1);
  box-shadow: 0 0 8px var(--ember-glow);
}

.pow {
  position: absolute;
  top: -8px; right: -8px;
  font-family: var(--display);
  font-size: 22px;
  color: var(--ember-2);
  text-shadow: 0 0 12px var(--ember-glow);
  opacity: 0;
  pointer-events: none;
  transform: rotate(-12deg) scale(0.5);
}
.pow--show { animation: powBurst 0.8s ease-out forwards; }
@keyframes powBurst {
  0%   { opacity: 0; transform: rotate(-12deg) scale(0.5); }
  20%  { opacity: 1; transform: rotate(-15deg) scale(1.3); }
  60%  { opacity: 1; transform: rotate(-12deg) scale(1.15); }
  100% { opacity: 0; transform: rotate(-12deg) scale(1.5); }
}

/* ================================================================
   FOOTER
   ================================================================ */

.footer {
  position: relative;
  z-index: 10;
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 28px 50px;
  border-top: 1px solid var(--line);
  background: var(--night-950);
}
.footer__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
}
.footer__brand {
  font-family: var(--display);
  font-size: 18px;
  letter-spacing: 0.08em;
  color: var(--ink);
  text-transform: uppercase;
}
.footer__meta {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--ink-faint);
  text-transform: uppercase;
}
.footer__legal {
  font-size: 12px;
  line-height: 1.6;
  color: var(--ink-faint);
  max-width: 800px;
}
.footer__legal code {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ember-2);
  background: rgba(249, 115, 22, 0.06);
  padding: 1px 5px;
}

/* ================================================================
   REDUCED MOTION
   ================================================================ */

@media (prefers-reduced-motion: reduce) {
  .topbar__dot, .ticker__track, .comic-dust, .hud-pulse,
  .pulse, .card__bar-fill, .progress__bar {
    animation: none;
    transition: none;
  }
  .title-block, .quote-card figure {
    transition: none;
    opacity: 1 !important;
    transform: none !important;
  }
}
