/* ============================================================
   Legion Comps — Fallout skin, pixel variant ("Fallout Takeover")
   Loaded by home.html instead of fallout.css while the pixel theme is
   active (Skin.pixel_variant). Every rule is also scoped under
   :root[data-theme="pixel"], so the file is inert anywhere else.

   Scenery only. The hero's copy, buttons, spotlight card, meters and the
   rest of the page keep the pixel theme's own look; the skin draws the
   backdrop behind them and its "Fallout Takeover" tag, nothing else.

   Same scene as the classic skin: a trooper in power armour and his dog
   trek across the dusk wasteland to a cog-shaped vault door that flares
   rad-green as they reach it, under a passing tiltrotor, with fallout
   motes, a low dust haze and terminal scanlines. The sprites are SpriteCook
   8-frame strips pre-scaled to their drawn size (px-*.webp), so they are
   drawn at 1x; the 512x288 backdrop is scaled to cover the hero, like the
   other pixel skins' skies.

   Decor is aria-hidden, absolutely positioned and click-through, sits
   behind the hero content, and all motion stops under
   prefers-reduced-motion (the pair stay, as a still scene).
   ============================================================ */

:root[data-theme="pixel"] .lc-skin-fallout {
  /* Skin palette (the decor's own colours) */
  --fo-void:  #11130e;
  --fo-term:  #0d160c;
  --fo-amber: #f2b632;
  --fo-rad:   #7dff6a;   /* 15:1 on --fo-term */
}

/* ---- Hero: the scene replaces the theme's backdrop ---------------- */
:root[data-theme="pixel"] .lc-skin-fallout .lc-hero {
  background: #6d7a5c;
  /* A strip of wasteland below the content for the trek */
  padding-bottom: clamp(160px, 14vw, 210px);
}
:root[data-theme="pixel"] .lc-skin-fallout :is(.lc-hero-ring, .lc-hero-glow) { display: none; }
/* The copy and cards sit above the decor */
:root[data-theme="pixel"] .lc-skin-fallout .lc-hero-inner { z-index: 1; }

/* Seasonal tag above the eyebrow: a pixel badge in terminal green,
   label-size caps in a 2px frame of its own colour, never bolded. */
.lc-fo-tag { display: none; }
:root[data-theme="pixel"] .lc-skin-fallout .lc-fo-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 2px 0 18px 2px;
  padding: 4px 10px;
  background: var(--fo-term);
  color: var(--fo-rad);
  font-family: var(--font-label);
  font-size: var(--label-size);
  font-weight: 400;
  letter-spacing: var(--label-tracking);
  line-height: 1;
  text-transform: uppercase;
  box-shadow: 0 -2px 0 0 currentColor, 0 2px 0 0 currentColor, -2px 0 0 0 currentColor, 2px 0 0 0 currentColor;
}
:root[data-theme="pixel"] .lc-skin-fallout .lc-fo-tag i { animation: lc-fo-px-geiger 2.4s steps(1, end) infinite; }

/* ---- Hero decor --------------------------------------------------
   The decor carries image-rendering once, inherited by every piece of art
   inside it (never on the hero itself, or the prize photos would pixelate). */
.lc-fo-decor { display: none; }
:root[data-theme="pixel"] .lc-skin-fallout .lc-fo-decor {
  --fo-pos: 0.5;  /* backdrop's horizontal anchor; slides right on phones to keep the vault in view */
  /* One backdrop pixel in CSS px: the 512x288 scene is drawn at "cover", so
     whichever axis binds sets the scale. The door and the ground line are
     placed in backdrop pixels from this, so they stay on the art at any size. */
  --fo-u: max(100cqw / 512, 100cqh / 288);
  --fo-left: calc((100cqw - 512 * var(--fo-u)) * var(--fo-pos));
  --fo-floor: calc(24 * var(--fo-u));   /* the dust the pair walk on: backdrop row ~264 */
  --fo-door-x: calc(var(--fo-left) + 412 * var(--fo-u));
  --fo-door-y: calc(100cqh - 96 * var(--fo-u));
  display: block;
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  container-type: size;
  image-rendering: pixelated;
}
:root[data-theme="pixel"] .lc-skin-fallout .lc-fo-decor i { display: block; position: absolute; }

/* Sky: a 512x288 wasteland scaled up with hard pixel edges */
:root[data-theme="pixel"] .lc-skin-fallout .lc-fo-sky {
  position: absolute;
  inset: 0;
  background: url("../../images/skins/fallout/sky.webp") calc(var(--fo-pos) * 100%) 100% / cover no-repeat;
}

/* The vault door's rim: a steady glow that flickers like a failing tube,
   then flares as the trekkers reach it (the trek's own 32s clock) */
:root[data-theme="pixel"] .lc-skin-fallout .lc-fo-door {
  position: absolute;
  left: var(--fo-door-x);
  top: var(--fo-door-y);
  width: calc(96 * var(--fo-u));
  height: calc(108 * var(--fo-u));
  transform: translate(-50%, -50%);
}
:root[data-theme="pixel"] .lc-skin-fallout .lc-fo-door::before,
:root[data-theme="pixel"] .lc-skin-fallout .lc-fo-door::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  mix-blend-mode: screen;
}
:root[data-theme="pixel"] .lc-skin-fallout .lc-fo-door::before {
  background: radial-gradient(closest-side, transparent 70%, rgba(125, 255, 106, 0.42) 84%, transparent 100%);
  animation: lc-fo-px-flicker 5s steps(1, end) infinite;
}
:root[data-theme="pixel"] .lc-skin-fallout .lc-fo-door::after {
  inset: -30%;
  background: radial-gradient(closest-side, rgba(125, 255, 106, 0.55), rgba(125, 255, 106, 0.18) 55%, transparent 100%);
  opacity: 0;
  animation: lc-fo-px-flare 32s linear infinite;
  animation-delay: -6s;   /* the trek's delay, so the flare lands as they arrive */
}

/* An olive-iron wash behind the copy column, so light text holds on the dusk */
:root[data-theme="pixel"] .lc-skin-fallout .lc-fo-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(17, 19, 14, 0.4) 0%, transparent 18%),
    linear-gradient(90deg, rgba(17, 19, 14, 0.9) 0%, rgba(17, 19, 14, 0.78) 32%, rgba(17, 19, 14, 0.3) 52%, transparent 66%);
}

/* Sprite strips: eight frames side by side. Each sprite clips a ::before
   eight frames wide and slides it one frame at a time with transform, which
   the compositor runs off the main thread. */
:root[data-theme="pixel"] .lc-skin-fallout :is(.lc-fo-flyer, .lc-fo-trek) i { overflow: hidden; }
:root[data-theme="pixel"] .lc-skin-fallout :is(.lc-fo-flyer, .lc-fo-trek) i::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 800%;
  height: 100%;
  background: 0 0 / 100% 100% no-repeat;
  animation: lc-fo-px-frames 1s steps(8, jump-none) infinite;
}

/* Overhead: a tiltrotor crosses left-to-right in the first half of a 30s
   cycle, rotors spinning */
:root[data-theme="pixel"] .lc-skin-fallout .lc-fo-flyer {
  position: absolute;
  left: 0;
  bottom: calc(var(--fo-floor) + 140px);
  width: 125px;
  height: 75px;
  transform: translateX(-260px);
  animation: lc-fo-px-flyer 30s linear infinite;
  animation-delay: -4s;
}
:root[data-theme="pixel"] .lc-skin-fallout .lc-fo-flyer i {
  inset: 0;
  filter: brightness(0.8) saturate(0.85);
}
:root[data-theme="pixel"] .lc-skin-fallout .lc-fo-flyer i::before {
  background-image: url("../../images/skins/fallout/px-flyer.webp");
  animation-duration: 0.4s;
}

/* Dust haze rolling low over the ground: one 600px tile, slid one tile per loop */
:root[data-theme="pixel"] .lc-skin-fallout .lc-fo-haze {
  position: absolute;
  left: 0;
  bottom: 0;
  width: calc(100% + 600px);
  height: calc(var(--fo-floor) + 70px);
  background:
    radial-gradient(ellipse 160px 34px at 120px 70%, rgba(214, 172, 104, 0.22), transparent 70%),
    radial-gradient(ellipse 220px 40px at 420px 80%, rgba(190, 150, 90, 0.18), transparent 70%);
  background-repeat: repeat-x;
  background-size: 600px 100%;
  animation: lc-fo-px-haze 40s linear infinite;
}

/* Fallout motes: rad-green and ember specks drifting up out of the dust */
:root[data-theme="pixel"] .lc-skin-fallout .lc-fo-motes i {
  bottom: var(--fo-floor);
  width: 3px;
  height: 3px;
  background: var(--fo-rad);
  box-shadow: 0 0 6px rgba(125, 255, 106, 0.8);
  opacity: 0;
  animation: lc-fo-px-mote 9s linear infinite;
}
:root[data-theme="pixel"] .lc-skin-fallout .lc-fo-motes i:nth-child(even) {
  width: 4px;
  height: 4px;
  background: #ffd36b;
  box-shadow: 0 0 6px rgba(255, 196, 80, 0.7);
}
:root[data-theme="pixel"] .lc-skin-fallout .lc-fo-motes i:nth-child(1) { left: 58%; }
:root[data-theme="pixel"] .lc-skin-fallout .lc-fo-motes i:nth-child(2) { left: 64%; animation-delay: -1.4s; animation-duration: 11s; }
:root[data-theme="pixel"] .lc-skin-fallout .lc-fo-motes i:nth-child(3) { left: 71%; animation-delay: -3.1s; }
:root[data-theme="pixel"] .lc-skin-fallout .lc-fo-motes i:nth-child(4) { left: 77%; animation-delay: -5.2s; animation-duration: 10s; }
:root[data-theme="pixel"] .lc-skin-fallout .lc-fo-motes i:nth-child(5) { left: 83%; animation-delay: -2.2s; animation-duration: 12s; }
:root[data-theme="pixel"] .lc-skin-fallout .lc-fo-motes i:nth-child(6) { left: 89%; animation-delay: -6.6s; }
:root[data-theme="pixel"] .lc-skin-fallout .lc-fo-motes i:nth-child(7) { left: 94%; animation-delay: -4.4s; animation-duration: 10s; }
:root[data-theme="pixel"] .lc-skin-fallout .lc-fo-motes i:nth-child(8) { left: 52%; animation-delay: -7.8s; animation-duration: 13s; }

/* The trek: trooper and dog cross the dust over a 32s cycle, reach the vault
   door as it flares, and step inside. Each walks on its own frame strip. */
:root[data-theme="pixel"] .lc-skin-fallout .lc-fo-trek {
  --fo-trek-w: 180px;   /* trooper 83 + 18 gap + dog 79 */
  /* Where the pair stop: at the door's left edge, or the screen's if the door is off it */
  --fo-trek-end: min(calc(var(--fo-door-x) - 30 * var(--fo-u) - var(--fo-trek-w)), calc(100cqw - var(--fo-trek-w) * 0.6));
  position: absolute;
  left: 0;
  bottom: var(--fo-floor);
  width: var(--fo-trek-w);
  height: 108px;
  transform: translateX(calc(var(--fo-trek-w) * -1 - 20px));
  animation: lc-fo-px-trek 32s linear infinite;
  animation-delay: -6s;
}
:root[data-theme="pixel"] .lc-skin-fallout .lc-fo-trek i {
  bottom: 0;
  filter: drop-shadow(3px 0 0 rgba(23, 15, 5, 0.35));
}
:root[data-theme="pixel"] .lc-skin-fallout .lc-fo-trooper {
  left: 0;
  width: 83px;
  height: 108px;
}
:root[data-theme="pixel"] .lc-skin-fallout .lc-fo-trek .lc-fo-trooper::before {
  background-image: url("../../images/skins/fallout/px-trooper-walk.webp");
  animation-duration: 1.2s;
}
:root[data-theme="pixel"] .lc-skin-fallout .lc-fo-dog {
  right: 0;
  width: 79px;
  height: 49px;
}
:root[data-theme="pixel"] .lc-skin-fallout .lc-fo-trek .lc-fo-dog::before {
  background-image: url("../../images/skins/fallout/px-dog-trot.webp");
  animation-duration: 0.8s;
}

/* Scanlines over the whole scene, like the glass of a wrist terminal */
:root[data-theme="pixel"] .lc-skin-fallout .lc-fo-scan {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(180deg, rgba(0, 0, 0, 0.12) 0 1px, transparent 1px 3px);
}

/* ---- Motion ------------------------------------------------------ */
@keyframes lc-fo-px-frames {
  from { transform: translateX(0); }
  to   { transform: translateX(-87.5%); }
}
@keyframes lc-fo-px-trek {
  0%           { transform: translateX(calc(var(--fo-trek-w) * -1 - 20px)); opacity: 1; }
  84%          { transform: translateX(var(--fo-trek-end)); opacity: 1; }
  89%          { transform: translateX(calc(var(--fo-trek-end) + 24px)); opacity: 0; }
  89.01%, 100% { transform: translateX(calc(var(--fo-trek-w) * -1 - 20px)); opacity: 0; }
}
/* Lines up with the trek: they reach the door at 84%, are inside by 89%
   (the flare's delay matches the trek's, so the two share one clock) */
@keyframes lc-fo-px-flare {
  0%, 80%  { opacity: 0; }
  86%      { opacity: 1; }
  92%      { opacity: 0.6; }
  98%, 100% { opacity: 0; }
}
@keyframes lc-fo-px-flicker {
  0%   { opacity: 1; }
  41%  { opacity: 0.35; }
  43%  { opacity: 1; }
  44%  { opacity: 0.5; }
  46%  { opacity: 1; }
  88%  { opacity: 0.7; }
  90%  { opacity: 1; }
}
@keyframes lc-fo-px-geiger {
  0%   { opacity: 1; }
  12%  { opacity: 0.45; }
  14%  { opacity: 1; }
  52%  { opacity: 0.45; }
  54%  { opacity: 1; }
  58%  { opacity: 0.45; }
  60%  { opacity: 1; }
}
@keyframes lc-fo-px-flyer {
  0%           { transform: translateX(-260px) translateY(0); }
  25%          { transform: translateX(50cqw) translateY(-8px); }
  50%          { transform: translateX(calc(100cqw + 40px)) translateY(0); }
  50.01%, 100% { transform: translateX(-260px); }
}
@keyframes lc-fo-px-haze {
  from { transform: translateX(0); }
  to   { transform: translateX(-600px); }
}
@keyframes lc-fo-px-mote {
  0%   { transform: translate(0, 0); opacity: 0; }
  10%  { opacity: 0.9; }
  70%  { opacity: 0.6; }
  100% { transform: translate(40px, -180px); opacity: 0; }
}

/* ---- Smaller screens --------------------------------------------- */
@media (max-width: 1024px) {
  :root[data-theme="pixel"] .lc-skin-fallout .lc-fo-decor { --fo-pos: 0.7; }
  :root[data-theme="pixel"] .lc-skin-fallout .lc-fo-shade {
    background:
      linear-gradient(180deg, rgba(17, 19, 14, 0.86) 0%, rgba(17, 19, 14, 0.66) 60%, rgba(17, 19, 14, 0.25) 85%, transparent 100%);
  }
}
@media (max-width: 640px) {
  :root[data-theme="pixel"] .lc-skin-fallout .lc-hero { padding-bottom: 150px; }
  :root[data-theme="pixel"] .lc-skin-fallout .lc-fo-decor { --fo-pos: 0.85; }
  :root[data-theme="pixel"] .lc-skin-fallout .lc-fo-motes i:nth-child(n+5) { display: none; }
}

/* ---- Reduced motion: a still scene -------------------------------- */
@media (prefers-reduced-motion: reduce) {
  :root[data-theme="pixel"] .lc-skin-fallout :is(.lc-fo-flyer, .lc-fo-motes) { display: none; }
  :root[data-theme="pixel"] .lc-skin-fallout :is(.lc-fo-haze, .lc-fo-trek, .lc-fo-tag i),
  :root[data-theme="pixel"] .lc-skin-fallout .lc-fo-trek i::before,
  :root[data-theme="pixel"] .lc-skin-fallout .lc-fo-door::before,
  :root[data-theme="pixel"] .lc-skin-fallout .lc-fo-door::after { animation: none; }
  :root[data-theme="pixel"] .lc-skin-fallout .lc-fo-trek { transform: translateX(min(42cqw, calc(100cqw - var(--fo-trek-w) - 12px))); }
}
