/* === ANIMATIONS ===
 * Pass 1-10: Comprehensive animation system for immersive landing page
 */

/* ── Base Keyframes ─────────────────────────────────────────── */

@keyframes resolve {
  from { opacity: 0; filter: blur(8px); transform: translateY(12px); }
  to   { opacity: 1; filter: blur(0); transform: translateY(0); }
}

@keyframes scan-line {
  from { transform: translateY(-100%); }
  to   { transform: translateY(100vh); }
}

@keyframes flicker {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.85; }
  52% { opacity: 0.3; }
  54% { opacity: 1; }
  90% { opacity: 0.9; }
}

@keyframes pulse-ring {
  0%   { transform: scale(0.95); opacity: 0.6; }
  50%  { transform: scale(1.05); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.6; }
}

@keyframes drift-up {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-80px); }
}

@keyframes boot-fade {
  from { opacity: 1; }
  to   { opacity: 0; visibility: hidden; }
}

@keyframes constellation-pulse {
  0%, 100% { opacity: 0.3; }
  50%      { opacity: 0.6; }
}

/* Pass 1: Enhanced particle glow pulse */
@keyframes particle-pulse {
  0%, 100% { opacity: 0.3; }
  50%      { opacity: 0.9; }
}

/* Pass 3: Section wipe reveal */
@keyframes wipe-reveal {
  from { clip-path: inset(0 100% 0 0); }
  to   { clip-path: inset(0 0 0 0); }
}

/* Pass 4: CRT flicker for warning section */
@keyframes crt-flicker {
  0%  { opacity: 0.97; }
  5%  { opacity: 0.95; }
  10% { opacity: 0.88; }
  15% { opacity: 0.95; }
  20% { opacity: 0.99; }
  50% { opacity: 0.95; }
  55% { opacity: 0.88; }
  60% { opacity: 0.99; }
  100%{ opacity: 0.97; }
}

/* Pass 4: Glitch horizontal shift */
@keyframes glitch-1 {
  0%, 100% { transform: translate(0); }
  20% { transform: translate(-2px, 1px); }
  40% { transform: translate(-2px, -1px); }
  60% { transform: translate(2px, 1px); }
  80% { transform: translate(2px, -1px); }
}

/* Pass 5: Ambient glow drift */
@keyframes ambient-drift {
  0%   { transform: translate(0, 0) scale(1); }
  33%  { transform: translate(18px, -12px) scale(1.04); }
  66%  { transform: translate(-12px, 8px) scale(0.98); }
  100% { transform: translate(0, 0) scale(1); }
}

/* Pass 6: Orbital ring rotations */
@keyframes ring-rotate-cw {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes ring-rotate-ccw {
  from { transform: rotate(360deg); }
  to   { transform: rotate(0deg); }
}

/* Pass 9: Vignette breathing */
@keyframes vignette-breathe {
  0%, 100% { opacity: 0.45; }
  50%      { opacity: 0.65; }
}

/* Pass 10: Subtle header shadow on scroll */
@keyframes header-glow {
  0%, 100% { box-shadow: 0 1px 0 rgba(200,190,160,0.05); }
  50%      { box-shadow: 0 1px 0 rgba(200,190,160,0.1), 0 4px 20px rgba(0,0,0,0.3); }
}

/* ── Reveal System ──────────────────────────────────────────── */

.reveal {
  opacity: 0; transform: translateY(40px); filter: blur(4px);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.8s cubic-bezier(0.16, 1, 0.3, 1),
              filter 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal.revealed { opacity: 1; transform: translateY(0); filter: blur(0); }
.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }

.resolve-text { animation: resolve 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.flicker-text { animation: flicker 0.15s infinite; }

/* ── Utility Effects ────────────────────────────────────────── */

.scan-line {
  position: absolute; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--beam-blue), transparent);
  animation: scan-line 2s linear infinite;
}

.seam-glow { position: relative; }
.seam-glow::after {
  content: ''; position: absolute; inset: -1px; border-radius: 9px;
  border: 1px solid transparent; transition: border-color 0.3s, box-shadow 0.3s; pointer-events: none;
}
.seam-glow:hover::after {
  border-color: var(--accent-primary, var(--vey-gold));
  box-shadow: 0 0 20px var(--accent-glow, rgba(200,190,160,0.15));
}

/* ── Landing Sections ───────────────────────────────────────── */

.landing-section {
  min-height: 100vh; display: flex; flex-direction: column;
  justify-content: center; align-items: center; position: relative; overflow: hidden;
}

/* Background artwork layers */
.section-bg {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  opacity: 0.10; z-index: 0; pointer-events: none;
}
.faction-panel .section-bg {
  opacity: 0.055;
}
.section-bg::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(
    180deg,
    var(--void) 0%,
    transparent 25%,
    transparent 75%,
    var(--void) 100%
  );
}
.section-bg::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, transparent 30%, var(--void) 85%);
}
.landing-hero-text { text-align: center; z-index: 2; padding: 24px; }
.landing-hero-text h1 {
  font-size: clamp(36px, 8vw, 96px); letter-spacing: 0.12em; margin-bottom: 16px;
  text-shadow: 0 0 60px rgba(200,190,160,0.15);
}
.landing-hero-text .subtitle { font-size: clamp(14px, 2vw, 18px); color: var(--text-secondary); letter-spacing: 0.2em; text-transform: uppercase; }

/* ── Faction Panels ─────────────────────────────────────────── */

.faction-panel {
  min-height: 100vh; display: flex; flex-direction: column;
  justify-content: center; padding: 48px; position: relative;
  overflow: hidden;
}
.faction-panel h2 { font-size: clamp(32px, 6vw, 72px); margin-bottom: 16px; position: relative; z-index: 1; }
.faction-panel .philosophy {
  font-size: 18px; color: var(--text-secondary); max-width: 560px;
  margin-bottom: 32px; line-height: 1.6; position: relative; z-index: 1;
}
.faction-panel .dossier-link {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--accent-primary);
  border: 1px solid var(--accent-primary); padding: 10px 20px; border-radius: 4px;
  transition: all 0.2s; position: relative; z-index: 1;
}
.faction-panel .dossier-link:hover { background: var(--accent-primary); color: var(--void); }

/* Faction ambient glow layers */
.faction-ambient-glow {
  animation: ambient-drift 20s ease-in-out infinite;
}

/* ── Empty Ninth Ring System ────────────────────────────────── */

.empty-ninth-ring {
  width: 120px; height: 120px; border: 2px solid var(--vey-gold); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  position: relative;
  animation: pulse-ring 4s ease-in-out infinite;
  box-shadow: 0 0 40px rgba(200,190,160,0.1);
}
.empty-ninth-ring::before { content: ''; width: 60px; height: 60px; border: 1px solid rgba(200,190,160,0.3); border-radius: 50%; }
.empty-ninth-ring::after {
  content: '';
  position: absolute;
  inset: -20px;
  border: 1px solid rgba(200,190,160,0.08);
  border-radius: 50%;
  animation: ring-expand 6s ease-in-out infinite;
}

@keyframes ring-expand {
  0%   { transform: scale(0.85); opacity: 0.6; }
  50%  { transform: scale(1.15); opacity: 0.15; }
  100% { transform: scale(0.85); opacity: 0.6; }
}

/* Pass 6: Dramatic Empty Ninth with orbital rings */
.empty-ninth-dramatic {
  position: relative;
  width: 200px;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.empty-ninth-dramatic .ring-core {
  width: 100px; height: 100px;
  border: 2px solid var(--vey-gold);
  border-radius: 50%;
  position: relative;
  z-index: 2;
  animation: dramatic-pulse 5s ease-in-out infinite;
  box-shadow: 0 0 40px rgba(200,190,160,0.15), inset 0 0 30px rgba(200,190,160,0.05);
}
.empty-ninth-dramatic .ring-core::before {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 40px; height: 40px;
  border: 1px solid rgba(200,190,160,0.25);
  border-radius: 50%;
}
.empty-ninth-dramatic .ring-ripple {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(200,190,160,0.12);
  border-radius: 50%;
  animation: ripple-out 4s ease-out infinite;
}
.empty-ninth-dramatic .ring-ripple:nth-child(2) { animation-delay: 1.3s; }
.empty-ninth-dramatic .ring-ripple:nth-child(3) { animation-delay: 2.6s; }

/* Orbital rings that rotate */
.empty-ninth-dramatic .orbit-ring {
  position: absolute;
  border-radius: 50%;
}
.empty-ninth-dramatic .orbit-ring:nth-of-type(4) {
  width: 160px; height: 160px;
  border: 1px solid rgba(200,190,160,0.07);
  border-top-color: rgba(200,190,160,0.18);
  border-right-color: transparent;
  animation: ring-rotate-cw 24s linear infinite;
}
.empty-ninth-dramatic .orbit-ring:nth-of-type(5) {
  width: 140px; height: 140px;
  border: 1px solid rgba(200,190,160,0.05);
  border-bottom-color: rgba(200,190,160,0.14);
  border-left-color: transparent;
  animation: ring-rotate-ccw 18s linear infinite;
}

@keyframes dramatic-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.08); opacity: 0.85; }
}
@keyframes ripple-out {
  0%   { transform: scale(0.6); opacity: 0.5; }
  100% { transform: scale(1.6); opacity: 0; }
}

/* ── Enter Archive Button ───────────────────────────────────── */

.enter-archive-btn {
  margin-top: 40px; font-family: var(--font-mono); font-size: 12px;
  letter-spacing: 0.15em; text-transform: uppercase; color: var(--vey-gold);
  background: transparent; border: 1px solid var(--vey-gold);
  padding: 14px 32px; border-radius: 4px; cursor: pointer; transition: all 0.3s;
  position: relative; z-index: 1;
}
.enter-archive-btn:hover {
  background: var(--vey-gold); color: var(--void);
  box-shadow: 0 0 30px rgba(200,190,160,0.2), 0 0 60px rgba(200,190,160,0.08);
  transform: translateY(-2px);
}

/* ── Warning Section Enhancements ───────────────────────────── */

#warning { position: relative; }
#warning::before {
  content: '';
  position: absolute; inset: 0;
  background: repeating-linear-gradient(
    0deg, transparent, transparent 2px, rgba(0,0,0,0.04) 2px, rgba(0,0,0,0.04) 4px
  );
  pointer-events: none; z-index: 1;
}
#warning h2 {
  position: relative;
  text-shadow:
    0 0 40px rgba(196,92,74,0.3),
    -1px 0 rgba(196,92,74,0.08),
    1px 0 rgba(142,197,232,0.08);
}

/* ── Constellation Footer ───────────────────────────────────── */

.constellation-line {
  stroke: rgba(200,190,160,0.08); stroke-width: 0.5; fill: none;
  animation: constellation-pulse 6s ease-in-out infinite;
}

/* ── Utility Classes ────────────────────────────────────────── */

.highlight { background: rgba(200,190,160,0.3); padding: 0 2px; border-radius: 2px; color: var(--text-primary); }
.hidden { display: none !important; }

/* ── Quick Nav Dots ─────────────────────────────────────────── */

#quick-nav a:hover {
  background: rgba(200,190,160,0.35) !important;
  border-color: rgba(200,190,160,0.5) !important;
  transform: scale(1.5) !important;
}

/* ── Ambient Overlay Animations ─────────────────────────────── */

#vignette-overlay { animation: vignette-breathe 10s ease-in-out infinite; }

/* ── Mobile Adjustments ─────────────────────────────────────── */

@media (max-width: 768px) {
  #quick-nav { display: none; }
  .empty-ninth-dramatic { width: 150px; height: 150px; }
  .empty-ninth-dramatic .ring-core { width: 75px; height: 75px; }
  .empty-ninth-dramatic .orbit-ring:nth-of-type(4) { width: 120px; height: 120px; }
  .empty-ninth-dramatic .orbit-ring:nth-of-type(5) { width: 105px; height: 105px; }
  .faction-panel { padding: 32px 24px; }
}

/* ── Reduced Motion ─────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; filter: none; transition: none; }
  .reveal.revealed { opacity: 1; transform: none; filter: none; }
  #vignette-overlay { animation: none; }
  .empty-ninth-dramatic .ring-core,
  .empty-ninth-dramatic .ring-ripple,
  .empty-ninth-dramatic .orbit-ring { animation: none; }
  .constellation-line { animation: none; }
  .faction-ambient-glow { animation: none; }
}
