/* Custom CSS for The Coding Skool - Dark Neon Minimalism */

/* ==================================================
   SMOOTHNESS FOUNDATIONS
   ================================================== */

html {
  /* scroll-behavior: smooth; Removed - conflicts with GSAP ScrollTrigger pinning */
}

body {
  margin: 0;
  background-color: #000000;
  background: radial-gradient(
    circle at 50% 30%,
    #0a0a0a 0%,
    #050505 40%,
    #000 100%
  );
  overflow-x: hidden;
  color: #ffffff;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-family: 'Inter', sans-serif;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: 'Chakra Petch', sans-serif;
  text-transform: uppercase;
  letter-spacing: -0.02em;
  text-shadow: 0 0 15px var(--brand-red-glow-subtle);
}

code,
pre,
.mono {
  font-family: 'JetBrains Mono', monospace;
}

/* Brutalist resets */
* {
  box-shadow: none !important;
  border-radius: 0 !important;
  cursor: none !important;
}

.glass-neutral {
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 2px solid #e7232a;
}

/* Global Animated Background System */
#bg-root {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: #000;
  pointer-events: none;
}

#terrain {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#fx-overlay {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(231, 35, 42, 0.02),
    rgba(231, 35, 42, 0.02) 1px,
    transparent 2px
  );
  mix-blend-mode: overlay;
  opacity: 0.15;
  z-index: -5;
}

/* Base UI Layout Adjustment */
#app {
  position: relative;
  z-index: 1;
}

/* Master Brand Colors */
:root {
  --brand-red: #e7232a;
  --brand-red-glow: rgba(231, 35, 42, 0.4);
  --brand-red-glow-subtle: rgba(231, 35, 42, 0.1);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 14px;
}

::-webkit-scrollbar-track {
  background: #000000 !important;
  border-left: 1px solid rgba(231, 35, 42, 0.4) !important;
  box-shadow: inset 0 0 10px var(--brand-red-glow-subtle);
}

::-webkit-scrollbar-thumb {
  background: var(--brand-red) !important;
  border: 2px solid #000000 !important;
}

::-webkit-scrollbar-thumb:hover {
  background: #ffffff !important;
  box-shadow: 0 0 10px var(--brand-red);
}

@media (pointer: coarse) {
  .cursor, .cursor-follower {
    display: none !important;
  }
  * {
    cursor: auto !important;
  }
}

/* ==================================================
   CUSTOM CURSOR — ULTRA SMOOTH
   ================================================== */

.cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 12px;
  height: 12px;
  background-color: var(--brand-red);
  border: 1px solid #ffffff;
  border-radius: 0;
  pointer-events: none;
  z-index: 10000;
  display: block !important;
  will-change: transform;
  transition: width 0.3s cubic-bezier(0.23, 1, 0.32, 1),
              height 0.3s cubic-bezier(0.23, 1, 0.32, 1),
              background-color 0.3s cubic-bezier(0.23, 1, 0.32, 1);
}

.cursor-follower {
  position: fixed;
  top: 0;
  left: 0;
  width: 44px;
  height: 44px;
  border: 1px solid var(--brand-red);
  background: rgba(231, 35, 42, 0.05);
  border-radius: 0;
  pointer-events: none;
  z-index: 9999;
  will-change: transform;
  transition: width 0.5s cubic-bezier(0.23, 1, 0.32, 1), 
              height 0.5s cubic-bezier(0.23, 1, 0.32, 1),
              border-color 0.4s cubic-bezier(0.23, 1, 0.32, 1),
              background 0.4s cubic-bezier(0.23, 1, 0.32, 1);
  display: block !important;
}

/* Data Readout Style */
.cursor-follower::after {
  content: attr(data-readout);
  position: absolute;
  top: 120%;
  left: 120%;
  font-family: 'JetBrains Mono', monospace;
  font-size: 8px;
  color: var(--brand-red);
  background: rgba(0,0,0,0.85);
  border: 1px solid var(--brand-red);
  padding: 3px 8px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), 
              transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.cursor-follower.active::after {
  opacity: 1;
  transform: translateY(0);
}

.cursor-follower.active {
  width: 64px;
  height: 64px;
  background: rgba(231, 35, 42, 0.2);
  border-color: #ffffff;
}

.cursor-follower.no-jitter {
  animation: none !important;
  opacity: 1 !important;
  scale: 1 !important;
  border-color: var(--brand-red) !important;
}

.cursor.mode-input {
  width: 1px;
  height: 20px;
  background: white;
  border: none;
}

/* Context-Aware Tactical Cursor */
.cursor.mode-crosshair {
  width: 20px;
  height: 20px;
  background: transparent;
  border: 1px solid var(--brand-red);
  border-radius: 50%;
}
.cursor.mode-crosshair::before, .cursor.mode-crosshair::after {
  content: '';
  position: absolute;
  background: var(--brand-red);
}
.cursor.mode-crosshair::before { top: 50%; left: -4px; right: -4px; height: 1px; transform: translateY(-50%); }
.cursor.mode-crosshair::after { left: 50%; top: -4px; bottom: -4px; width: 1px; transform: translateX(-50%); }

.cursor.mode-text {
  width: 2px;
  height: 24px;
  background: var(--brand-red);
  border: none;
  animation: blink 1s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ==================================================
   MULTI-LAYERED BACKGROUND ENGINE
   ================================================== */

.bg-layer-grain {
  position: fixed;
  inset: -100%;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.98' numOctaves='5' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.25;
  pointer-events: none;
  z-index: -9;
  mix-blend-mode: overlay;
  animation: grain-shift 0.8s steps(2) infinite;
}

@keyframes grain-shift {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(-1%, -1%); }
  50% { transform: translate(1%, 1%); }
  75% { transform: translate(-0.5%, 0.5%); }
}

.bg-layer-grid {
  position: fixed;
  inset: 0;
  background-image: 
    linear-gradient(rgba(231, 35, 42, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(231, 35, 42, 0.12) 1px, transparent 1px);
  background-size: 50px 50px;
  z-index: -8;
  pointer-events: none;
}

.bg-flashlight {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle 400px at center, black 0%, transparent 100%);
  z-index: -7;
  pointer-events: none;
  mix-blend-mode: destination-in;
  will-change: transform;
}


.bg-layer-marks {
  position: fixed;
  inset: 0;
  background-image: radial-gradient(circle, rgba(231, 35, 42, 0.4) 1px, transparent 0);
  background-size: 150px 150px;
  opacity: 0.2;
  z-index: -7;
  pointer-events: none;
}

.bg-layer-crosses {
  position: fixed;
  inset: 0;
  background-image: 
    linear-gradient(rgba(231, 35, 42, 0.2) 2px, transparent 2px),
    linear-gradient(90deg, rgba(231, 35, 42, 0.2) 2px, transparent 2px);
  background-size: 300px 300px;
  background-position: center;
  mask-image: radial-gradient(circle, black 2px, transparent 2px);
  -webkit-mask-image: radial-gradient(circle, black 2px, transparent 2px);
  opacity: 0.1;
  z-index: -6;
}

/* Hero Perspective Grid */
.hero-perspective-grid {
  background-image: linear-gradient(rgba(231,35,42,0.3) 1px, transparent 1px), linear-gradient(90deg, rgba(231,35,42,0.3) 1px, transparent 1px);
  background-size: 40px 40px;
  transform: perspective(400px) rotateX(70deg);
  mask-image: linear-gradient(transparent 20%, black 100%);
  -webkit-mask-image: linear-gradient(transparent 20%, black 100%);
  animation: grid-drive 2s linear infinite;
}

@keyframes grid-drive {
  0% { background-position: 0 0; }
  100% { background-position: 0 40px; }
}

/* CRT Scanlines Overlay */
.scanlines {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    rgba(18, 16, 16, 0) 50%,
    rgba(0, 0, 0, 0.15) 50%
  ),
  linear-gradient(
    90deg,
    rgba(255, 0, 0, 0.02),
    rgba(0, 255, 0, 0.01),
    rgba(0, 0, 255, 0.02)
  );
  background-size: 100% 3px, 3px 100%;
  pointer-events: none;
  z-index: 100;
  opacity: 0.4;
}

/* Screen Flicker Animation */
@keyframes flicker {
  0% { opacity: 0.99; }
  5% { opacity: 0.95; }
  10% { opacity: 0.9; }
  15% { opacity: 0.97; }
  20% { opacity: 0.99; }
  100% { opacity: 1; }
}

.text-flicker {
  animation: flicker 0.1s infinite alternate;
}

/* ==================================================
   GLASS CARDS — SILKY TRANSITIONS
   ================================================== */

.glass-card {
  position: relative;
  overflow: hidden;
  background: rgba(20, 20, 30, 0.4);
  backdrop-filter: blur(10px) saturate(180%);
  -webkit-backdrop-filter: blur(10px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 10px var(--brand-red-glow-subtle);
  transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform, opacity;
}

.glass-card:hover {
  border-color: rgba(231, 35, 42, 0.6);
  background: rgba(20, 20, 28, 0.7);
  box-shadow: 
    2px 0 0 rgba(231, 35, 42, 0.4),
    -2px 0 0 rgba(255, 255, 255, 0.1),
    0 8px 32px rgba(231, 35, 42, 0.15);
  transform: translateY(-4px);
}

/* Industrial Card Markers */
.glass-card::before, .glass-card::after {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  border-color: var(--brand-red);
  border-style: solid;
  opacity: 0.4;
  pointer-events: none;
  transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 10;
}

.glass-card::before {
  top: -2px;
  left: -2px;
  border-width: 2px 0 0 2px;
}

.glass-card::after {
  bottom: -2px;
  right: -2px;
  border-width: 0 2px 2px 0;
}

.glass-card:hover::before {
  top: 8px;
  left: 8px;
  opacity: 1;
}

.glass-card:hover::after {
  bottom: 8px;
  right: 8px;
  opacity: 1;
}

/* Border Scan Effect */
.glass-card .scan-line {
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(231, 35, 42, 0.05),
    transparent
  );
  transform: skewX(-25deg);
  pointer-events: none;
}

.glass-card:hover .scan-line {
  animation: card-scan 1.5s infinite;
}

@keyframes card-scan {
  0% { left: -100%; }
  100% { left: 200%; }
}

/* Glitch Interference Layer */
.bg-glitch-lines {
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(231, 35, 42, 0.03) 2px,
    rgba(231, 35, 42, 0.03) 4px
  );
  background-size: 100% 4px;
  z-index: -6;
  pointer-events: none;
  animation: glitch-lines 10s infinite linear;
}

@keyframes glitch-lines {
  0% { transform: translateY(0); }
  100% { transform: translateY(100%); }
}

.vignette {
  display: none;
}

/* Headings Consistency */
h1, h2, h3 {
  text-shadow: 0 0 15px var(--brand-red-glow-subtle);
  letter-spacing: -0.03em;
}

/* ==================================================
   VERTICAL SYSTEM SIDEBAR
   ================================================== */

#sys-sidebar {
  position: fixed;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 20px;
  z-index: 40;
  pointer-events: none;
}

.sys-dot {
  width: 4px;
  height: 4px;
  background: var(--brand-red);
  opacity: 0.2;
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.sys-dot.active {
  opacity: 1;
  box-shadow: 0 0 8px var(--brand-red);
}

/* ==================================================
   GLASS PILLS & BUTTONS — SMOOTH INTERACTIONS
   ================================================== */

.glass-pill {
  background: rgba(231, 35, 42, 0.1);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(231, 35, 42, 0.2);
  color: var(--brand-red);
  padding: 2px 10px;
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
  text-transform: uppercase;
}

.btn-primary {
  background-color: var(--brand-red);
  color: #FFFFFF;
  border-radius: 0;
  padding: 14px 28px;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 15px;
  border: none;
  cursor: none;
  box-shadow: 0 0 10px var(--brand-red-glow-subtle);
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-primary:hover {
  background-color: #ff333a;
  box-shadow: 0 0 24px var(--brand-red-glow), 0 4px 16px rgba(231, 35, 42, 0.3);
  transform: scale(1.04) translateY(-1px);
}

.badge-pill {
  background: rgba(231, 35, 42, 0.15);
  border: 1px solid rgba(231, 35, 42, 0.3);
  color: var(--brand-red);
  border-radius: 0;
  padding: 4px 12px;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ==================================================
   IDE & LANGUAGE SHOWCASE
   ================================================== */
/* ==================================================
   ADVANCED IDE GLASS-MORPH & 3D
   ================================================== */

.floating-ide {
  background: rgba(0, 0, 0, 0.7) !important;
  backdrop-filter: blur(12px) saturate(180%);
  border: 1px solid rgba(231, 35, 42, 0.2);
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.8), 0 0 20px rgba(231, 35, 42, 0.1);
  transition: border-color 0.4s ease, box-shadow 0.4s ease;
  transform-style: preserve-3d;
  overflow: hidden;
}

.floating-ide:hover {
  border-color: rgba(231, 35, 42, 0.5);
  box-shadow: 0 0 60px rgba(231, 35, 42, 0.2), 0 0 100px rgba(0, 0, 0, 0.9);
}

.perspective-container {
  perspective: 2000px;
  width: 100%;
  max-width: 1600px; /* Increased to support 50% larger scale */
  margin: 0 auto;
  display: flex;
  justify-content: center;
  align-items: center;
}

.red-glow-aura {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 150%;
  height: 150%;
  background: radial-gradient(circle, rgba(231, 35, 42, 0.15) 0%, transparent 70%);
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: -1;
  filter: blur(50px);
}

/* Red Dot Terminal Header */
.ide-window::before {
  content: '';
  position: absolute;
  top: 12px;
  left: 12px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff5f56;
  box-shadow: 16px 0 0 #ffbd2e, 32px 0 0 #27c93f;
}

.lang-tab.active {
  border-left-color: var(--brand-red);
  background-color: rgba(231, 35, 42, 0.05);
  box-shadow: inset 5px 0 15px var(--brand-red-glow-subtle);
}

/* Track Cards */
.track-card {
  background-color: #0F0F1A;
  border: 1px solid rgba(231, 35, 42, 0.2);
  border-radius: 0;
  padding: 32px;
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  cursor: none;
}

.track-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 60px var(--brand-red-glow);
}

/* Notification Toasts */
#log-container {
  position: fixed;
  bottom: 40px;
  left: 40px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.log-entry {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: var(--brand-red);
  background: rgba(0, 0, 0, 0.8);
  border-left: 2px solid var(--brand-red);
  padding: 4px 12px;
  opacity: 0;
  transform: translateX(-20px);
}

/* Scattered Data Fragments */
.data-fragment {
  position: fixed;
  font-family: 'JetBrains Mono', monospace;
  font-size: 8px;
  color: var(--brand-red);
  background: rgba(0, 0, 0, 0.7);
  border-left: 2px solid var(--brand-red);
  padding: 4px 10px;
  pointer-events: none;
  z-index: 35;
  white-space: nowrap;
  opacity: 0;
  backdrop-filter: blur(2px);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  box-shadow: 0 0 10px rgba(231, 35, 42, 0.1);
}

/* Console System Check */
.terminal-output .text-primary {
  color: var(--brand-red) !important;
}

/* Ticker Animation */
.ticker-content {
  animation: ticker-scroll 30s linear infinite;
}

@keyframes ticker-scroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-100%); }
}

/* ==================================================
   SYSTEM CRASH VISUALS
   ================================================== */

.blink {
  animation: blink-red 0.5s step-end infinite;
}

@keyframes blink-red {
  50% { opacity: 0; }
}

.shatter-layer {
  transition: transform 1.5s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 1.5s ease;
}

#matrix-canvas {
  opacity: 0.6;
  filter: contrast(120%) brightness(120%);
}

#crash-overlay {
  background: rgba(0, 0, 0, 0.2) !important;
  backdrop-filter: blur(4px);
}

/* Chromatic Aberration Glitch */
.chromatic-glitch {
  animation: rgb-split 0.15s steps(2) forwards;
}

@keyframes rgb-split {
  0% { text-shadow: 4px 0 0 red, -4px 0 0 blue; filter: contrast(150%); }
  50% { text-shadow: -4px 0 0 red, 4px 0 0 blue; transform: translate(2px, -2px); filter: contrast(150%); }
  100% { text-shadow: none; transform: translate(0, 0); filter: none; }
}

/* Phase 1: Subtle Corruption */
.subtle-corrupt {
  animation: rgb-shift-subtle 0.15s infinite alternate;
}
@keyframes rgb-shift-subtle {
  0% { text-shadow: 1px 0 0 red, -1px 0 0 blue; filter: contrast(110%); }
  100% { text-shadow: -1px 0 0 red, 1px 0 0 blue; filter: contrast(115%); }
}

/* Phase 3: The Drop (Frame Tear) */
.frame-tear {
  animation: tear-effect 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}
@keyframes tear-effect {
  0% { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%); transform: translateX(0); }
  20% { clip-path: polygon(0 15%, 100% 15%, 100% 85%, 0 85%); transform: translateX(-10px); }
  40% { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%); transform: translateX(10px); }
  60% { clip-path: polygon(0 40%, 100% 40%, 100% 60%, 0 60%); transform: translateX(-5px); }
  80% { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%); transform: translateX(5px); }
  100% { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%); transform: translateX(0); }
}

/* ==================================================
   ANIME.JS LAYOUT ENGINE — SMOOTH TRANSITIONS
   ================================================== */

#tracks-layout .glass-card {
  transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.layout-card-focus {
  z-index: 30;
  border-color: var(--brand-red) !important;
  background: rgba(231, 35, 42, 0.1) !important;
  transform: scale(1.02) !important;
  box-shadow: 0 0 30px var(--brand-red-glow) !important;
}

.layout-card-dim {
  opacity: 0.4;
  filter: grayscale(100%) blur(1px);
  transform: scale(0.98) !important;
}

/* Matrix Mode Body State */
.bg-matrix-mode {
  background: #000000 !important;
}

.cursor-follower.mode-data::after {
  content: attr(data-readout);
  position: absolute;
  top: 120%;
  left: 120%;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: var(--brand-red);
  background: rgba(0,0,0,0.8);
  border: 1px solid var(--brand-red);
  padding: 2px 6px;
  white-space: nowrap;
  pointer-events: none;
}
