/*
  Last Firewall — temporary launch takeover.
  Loaded after styles.css. Scoped entirely to .lf-legacy-portal / .lf-stage
  so it never touches the original four-card portal system.
  To roll back: remove the <link> to this file and the .lf-legacy-portal
  hidden attribute/class in index.html + portal.html.
*/

.lf-legacy-portal {
  display: none !important;
}

body.lf-mode.launch-page {
  overflow: hidden;
}

body.lf-mode .launch-shell {
  display: flex;
  padding: 0;
  gap: 0;
  min-height: 100vh;
  min-height: 100dvh;
}

.lf-stage {
  position: relative;
  flex: 1;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  isolation: isolate;
  background: #030509;
  padding: calc(clamp(16px, 4vw, 40px) + var(--safe-top))
    calc(clamp(16px, 4vw, 40px) + var(--safe-right))
    calc(clamp(16px, 4vw, 40px) + var(--safe-bottom))
    calc(clamp(16px, 4vw, 40px) + var(--safe-left));
}

/* Ambient color field */
.lf-stage-field {
  position: absolute;
  inset: -10%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(60% 46% at 50% 38%, rgba(72, 248, 218, 0.22), rgba(72, 248, 218, 0) 72%),
    radial-gradient(46% 38% at 12% 88%, rgba(82, 164, 255, 0.18), rgba(82, 164, 255, 0) 74%),
    radial-gradient(46% 38% at 88% 12%, rgba(255, 90, 90, 0.12), rgba(255, 90, 90, 0) 74%);
  filter: blur(18px);
  animation: lfFieldDrift 20s ease-in-out infinite;
}

/* Soft core glow — brightens the focal area behind the title and countdown */
.lf-core-glow {
  position: absolute;
  top: 46%;
  left: 50%;
  z-index: 1;
  width: clamp(320px, 48vw, 720px);
  height: clamp(320px, 48vw, 720px);
  pointer-events: none;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(72, 248, 218, 0.2) 0%, rgba(72, 248, 218, 0) 70%);
  filter: blur(4px);
}

/* Defense field — concentric shield pulses radiating from the core */
.lf-shield-field {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.lf-shield-ring {
  position: absolute;
  width: clamp(220px, 34vw, 560px);
  height: clamp(220px, 34vw, 560px);
  border-radius: 50%;
  border: 1px solid rgba(120, 246, 214, 0.4);
  box-shadow: 0 0 34px rgba(72, 248, 218, 0.16);
  opacity: 0;
  animation: lfShieldPulse 4.8s ease-out infinite;
}

.lf-shield-ring-b {
  animation-delay: 1.6s;
}

.lf-shield-ring-c {
  animation-delay: 3.2s;
}

/* Attack field — incoming intrusion streaks that dissipate against the shield */
.lf-attack-field {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

.lf-attack-ping {
  position: absolute;
  top: var(--ping-top, 20%);
  left: var(--ping-left, 10%);
  width: 44px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(
    90deg,
    rgba(255, 92, 92, 0) 0%,
    rgba(255, 92, 92, 0.9) 70%,
    rgba(255, 224, 196, 0.95) 100%
  );
  filter: drop-shadow(0 0 6px rgba(255, 90, 90, 0.6));
  opacity: 0;
  transform: rotate(var(--ping-rot, 0deg));
  transform-origin: left center;
  animation: lfAttackPing var(--ping-duration, 3.6s) ease-in infinite;
  animation-delay: var(--ping-delay, 0s);
}

.lf-attack-ping-1 {
  --ping-top: 18%;
  --ping-left: 8%;
  --ping-rot: 26deg;
  --ping-duration: 3.4s;
  --ping-delay: 0.2s;
}

.lf-attack-ping-2 {
  --ping-top: 78%;
  --ping-left: 12%;
  --ping-rot: -24deg;
  --ping-duration: 4.1s;
  --ping-delay: 1.4s;
}

.lf-attack-ping-3 {
  --ping-top: 14%;
  --ping-left: 84%;
  --ping-rot: 158deg;
  --ping-duration: 3.8s;
  --ping-delay: 2.3s;
}

.lf-attack-ping-4 {
  --ping-top: 82%;
  --ping-left: 88%;
  --ping-rot: -158deg;
  --ping-duration: 4.4s;
  --ping-delay: 3.1s;
}

.lf-attack-ping-5 {
  --ping-top: 50%;
  --ping-left: 3%;
  --ping-rot: 2deg;
  --ping-duration: 3.9s;
  --ping-delay: 0.8s;
}

/* HUD corner brackets — security-console framing */
.lf-hud-corner {
  position: absolute;
  z-index: 2;
  width: clamp(18px, 2.4vw, 30px);
  height: clamp(18px, 2.4vw, 30px);
  border: 1px solid rgba(120, 246, 214, 0.42);
  opacity: 0.6;
  pointer-events: none;
}

.lf-hud-corner-tl {
  top: clamp(22px, 4.6vh, 46px);
  left: clamp(16px, 3vw, 36px);
  border-right: none;
  border-bottom: none;
}

.lf-hud-corner-tr {
  top: clamp(22px, 4.6vh, 46px);
  right: clamp(16px, 3vw, 36px);
  border-left: none;
  border-bottom: none;
}

.lf-hud-corner-bl {
  bottom: clamp(22px, 4.6vh, 46px);
  left: clamp(16px, 3vw, 36px);
  border-right: none;
  border-top: none;
}

.lf-hud-corner-br {
  bottom: clamp(22px, 4.6vh, 46px);
  right: clamp(16px, 3vw, 36px);
  border-left: none;
  border-top: none;
}

/* HUD status readout — defense/attack telemetry framing the stage */
.lf-hud-status {
  position: absolute;
  z-index: 2;
  top: clamp(34px, 6.6vh, 60px);
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
  font-size: clamp(9px, 1vw, 11px);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--studio-text-faint);
  opacity: 0.85;
  pointer-events: none;
}

.lf-hud-status-left {
  left: clamp(20px, 4vw, 46px);
}

.lf-hud-status-right {
  right: clamp(20px, 4vw, 46px);
  flex-direction: row-reverse;
}

.lf-hud-dot {
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: 50%;
  background: #48f8da;
  box-shadow: 0 0 8px rgba(72, 248, 218, 0.9);
  animation: lfHudPulse 2.2s ease-in-out infinite;
}

.lf-hud-counter {
  font-variant-numeric: tabular-nums;
  color: var(--studio-text-mid);
  min-width: 6ch;
  text-align: right;
}

/* Corner announcement — reveal-date notice, no countdown */
.lf-notice {
  position: absolute;
  z-index: 2;
  right: clamp(28px, 5.2vw, 60px);
  bottom: clamp(30px, 6vh, 58px);
  width: min(260px, 62vw);
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 12px clamp(14px, 2vw, 18px);
  border-radius: 14px;
  border: 1px solid var(--studio-line-soft);
  background: var(--studio-surface-2);
  backdrop-filter: blur(10px);
  text-align: left;
  opacity: 0;
  animation: lfReveal 900ms var(--motion-ease-emerge, ease-out) forwards;
  animation-delay: var(--enter-delay, 1000ms);
}

.lf-notice-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
  font-size: var(--type-label-sm);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #48f8da;
}

.lf-notice-badge::before {
  content: '';
  width: 5px;
  height: 5px;
  flex: none;
  border-radius: 50%;
  background: #48f8da;
  box-shadow: 0 0 8px rgba(72, 248, 218, 0.9);
  animation: lfHudPulse 2.2s ease-in-out infinite;
}

.lf-notice-text {
  margin: 0;
  font-size: clamp(12px, 1.2vw, 14px);
  line-height: 1.45;
  color: var(--studio-text-mid);
}

.lf-notice-text strong {
  color: var(--studio-text-high);
  font-weight: 600;
}

@media (max-width: 560px) {
  .lf-notice {
    right: clamp(16px, 5vw, 28px);
    bottom: clamp(18px, 3.6vh, 30px);
    width: min(220px, 58vw);
  }
}

.lf-stage-grid {
  position: absolute;
  inset: -20%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.2;
  mix-blend-mode: screen;
  background-image:
    repeating-linear-gradient(
      90deg,
      rgba(120, 246, 214, 0) 0 46px,
      rgba(120, 246, 214, 0.5) 46px 47px,
      rgba(120, 246, 214, 0) 47px 92px
    ),
    repeating-linear-gradient(
      180deg,
      rgba(120, 246, 214, 0) 0 46px,
      rgba(120, 246, 214, 0.3) 46px 47px,
      rgba(120, 246, 214, 0) 47px 92px
    );
  animation: lfGridPan 34s linear infinite;
}

.lf-stage-scan {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

.lf-stage-scan::before {
  content: '';
  position: absolute;
  left: -10%;
  right: -10%;
  height: 34%;
  top: -40%;
  background: linear-gradient(
    180deg,
    rgba(120, 246, 214, 0) 0%,
    rgba(120, 246, 214, 0.09) 46%,
    rgba(120, 246, 214, 0) 100%
  );
  animation: lfScanSweep 7s ease-in-out infinite;
}

/* Stage spotlight — draws the eye to center, deepens the black at the frame edges */
.lf-stage-spotlight {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(56% 50% at 50% 46%, rgba(10, 16, 26, 0) 0%, rgba(3, 5, 9, 0.58) 100%);
}

/* Fine film grain — static, cheap (single tiled SVG noise layer, no per-frame cost) */
.lf-stage-grain {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 160px 160px;
}

/* Letterbox bars — subtle widescreen framing */
.lf-stage-letterbox {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 3;
  pointer-events: none;
  height: clamp(10px, 3.4vh, 34px);
  background: linear-gradient(var(--lf-letterbox-dir, 180deg), #000 0%, rgba(0, 0, 0, 0) 100%);
}

.lf-stage-letterbox-top {
  top: 0;
  --lf-letterbox-dir: 180deg;
}

.lf-stage-letterbox-bottom {
  bottom: 0;
  --lf-letterbox-dir: 0deg;
}

.lf-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: clamp(14px, 2.4vw, 26px);
  max-width: 960px;
}

.lf-content > * {
  opacity: 0;
  animation: lfReveal 900ms var(--motion-ease-emerge, ease-out) forwards;
  animation-delay: var(--enter-delay, 0ms);
}

.lf-kicker {
  font-family: var(--font-ui);
  font-size: var(--type-label-md);
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--studio-text-faint);
}

.lf-title {
  margin: 0;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: clamp(38px, 8vw, 96px);
  line-height: 1.02;
  letter-spacing: 0.07em;
  color: var(--studio-text-high);
  text-shadow:
    0 0 18px rgba(72, 248, 218, 0.55),
    0 0 46px rgba(72, 248, 218, 0.26),
    0 0 110px rgba(82, 164, 255, 0.16);
  animation-name: lfRevealTitle;
  animation-duration: 1400ms;
}

.lf-tagline {
  margin: 0;
  max-width: 56ch;
  font-size: var(--type-body-lg);
  line-height: 1.5;
  letter-spacing: 0.02em;
  color: var(--studio-text-mid);
}

.lf-release {
  display: flex;
  align-items: center;
  gap: clamp(8px, 1.4vw, 14px);
  padding: 10px clamp(16px, 2.4vw, 26px);
  border-radius: var(--radius-chip);
  border: 1px solid var(--studio-line-strong);
  background: var(--studio-surface-1);
  backdrop-filter: blur(10px);
}

.lf-release-label {
  font-size: var(--type-label-sm);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--studio-text-faint);
}

.lf-release-date {
  font-size: var(--type-title-lg);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--studio-text-high);
}

.lf-foot {
  margin-top: clamp(4px, 1vw, 10px);
  font-size: var(--type-label-sm);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--studio-text-faint);
  opacity: 0.7;
}

/* ---------- Split-flap countdown board ---------- */

.lf-countdown {
  display: grid;
  grid-template-columns: repeat(4, minmax(72px, 1fr));
  gap: clamp(10px, 1.8vw, 22px);
  margin-top: clamp(6px, 1.2vw, 12px);
}

.lf-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(8px, 1.2vw, 12px);
}

.lf-flap-group {
  display: flex;
  gap: clamp(3px, 0.6vw, 6px);
  perspective: 300px;
}

.lf-unit-label {
  font-size: var(--type-label-sm);
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--studio-text-faint);
}

.lf-flap {
  position: relative;
  width: clamp(28px, 6.2vw, 54px);
  height: clamp(44px, 9.6vw, 82px);
  border-radius: 6px;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.45));
}

.lf-flap-leaf {
  position: absolute;
  left: 0;
  right: 0;
  height: 50%;
  overflow: hidden;
  background: linear-gradient(180deg, #171f2c 0%, #0d1420 100%);
  backface-visibility: hidden;
}

.lf-flap-leaf-top,
.lf-flap-leaf-flip-top {
  top: 0;
  border-radius: 6px 6px 0 0;
}

.lf-flap-leaf-bottom,
.lf-flap-leaf-flip-bottom {
  bottom: 0;
  border-radius: 0 0 6px 6px;
  background: linear-gradient(180deg, #0c121c 0%, #070b12 100%);
}

.lf-flap-leaf-flip-top {
  z-index: 2;
  transform-origin: bottom center;
  transform: rotateX(0deg);
}

.lf-flap-leaf-flip-bottom {
  z-index: 2;
  transform-origin: top center;
  transform: rotateX(90deg);
}

.lf-flap-leaf.is-flipping {
  transition: transform 210ms cubic-bezier(0.5, 0, 0.85, 0.35);
}

.lf-flap-num {
  position: absolute;
  left: 0;
  right: 0;
  height: 200%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
  font-size: clamp(24px, 4.6vw, 48px);
  font-weight: 600;
  color: var(--studio-text-high);
}

.lf-flap-leaf-top .lf-flap-num,
.lf-flap-leaf-flip-top .lf-flap-num {
  top: 0;
}

.lf-flap-leaf-bottom .lf-flap-num,
.lf-flap-leaf-flip-bottom .lf-flap-num {
  bottom: 0;
}

.lf-flap-hinge {
  position: absolute;
  left: 6%;
  right: 6%;
  top: 50%;
  height: 1px;
  z-index: 3;
  background: rgba(0, 0, 0, 0.55);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05);
  pointer-events: none;
}

@keyframes lfFieldDrift {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(1.2%, -1.4%, 0) scale(1.04);
  }
}

@keyframes lfGridPan {
  from {
    background-position:
      0 0,
      0 0;
  }
  to {
    background-position:
      400px 0,
      0 400px;
  }
}

@keyframes lfScanSweep {
  0% {
    top: -40%;
  }
  100% {
    top: 106%;
  }
}

@keyframes lfShieldPulse {
  0% {
    transform: scale(0.55);
    opacity: 0;
  }
  14% {
    opacity: 0.5;
  }
  100% {
    transform: scale(1.18);
    opacity: 0;
  }
}

@keyframes lfAttackPing {
  0% {
    opacity: 0;
    transform: rotate(var(--ping-rot)) translateX(0);
  }
  10% {
    opacity: 0.9;
  }
  58% {
    opacity: 0.85;
    transform: rotate(var(--ping-rot)) translateX(34vh);
  }
  66% {
    opacity: 0;
    transform: rotate(var(--ping-rot)) translateX(36vh);
  }
  100% {
    opacity: 0;
    transform: rotate(var(--ping-rot)) translateX(36vh);
  }
}

@keyframes lfHudPulse {
  0%,
  100% {
    opacity: 0.5;
    transform: scale(0.85);
  }
  50% {
    opacity: 1;
    transform: scale(1.15);
  }
}

@keyframes lfReveal {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes lfRevealTitle {
  from {
    opacity: 0;
    letter-spacing: 0.34em;
    transform: translateY(6px) scale(0.98);
    filter: blur(6px);
  }
  60% {
    filter: blur(0);
  }
  to {
    opacity: 1;
    letter-spacing: 0.07em;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@media (max-width: 640px) {
  .lf-countdown {
    grid-template-columns: repeat(2, minmax(84px, 1fr));
  }
}

@media (max-width: 560px) {
  .lf-hud-status {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lf-stage-field,
  .lf-stage-grid,
  .lf-stage-scan::before,
  .lf-shield-ring,
  .lf-attack-ping,
  .lf-hud-dot,
  .lf-notice-badge::before {
    animation: none;
  }

  .lf-shield-ring,
  .lf-attack-ping {
    display: none;
  }

  .lf-content > *,
  .lf-notice {
    animation: none;
    opacity: 1;
  }

  .lf-flap-leaf.is-flipping {
    transition: none;
  }
}
