*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  color-scheme: dark;
  --bg-color: #0b0f1a;
  --surface: rgba(255, 255, 255, 0.03);
  --surface-hover: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.08);
  --border-highlight: rgba(124, 92, 255, 0.4);
  --muted: #8b9bb4;
  --text: #f0f4f8;
  --heading: #ffffff;
  
  --accent-purple: #7c5cff;
  --accent-purple-rgb: 124, 92, 255;
  --accent-cyan: #00e0ff;
  --accent-cyan-rgb: 0, 224, 255;
  
  --shadow-base: 0 4px 24px -8px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 10px 40px rgba(124, 92, 255, 0.15);
  --shadow-glow-hover: 0 15px 50px rgba(124, 92, 255, 0.3), 0 0 20px rgba(0, 224, 255, 0.2);
  
  --radius: 20px;
  --radius-sm: 12px;
  --container: 1200px;
  --space-1: 8px;
  --space-2: 12px;
  --space-3: 16px;
  --space-4: 24px;
  --space-5: 32px;
  --space-6: 48px;
  --space-7: 64px;
  --ease-apple: cubic-bezier(0.25, 1, 0.5, 1);
  --dur-fast: 300ms;
  --dur-medium: 400ms;
  --dur-slow: 500ms;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-color);
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(124, 92, 255, 0.12) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(0, 224, 255, 0.08) 0%, transparent 40%);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.2' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  opacity: 0.015;
  z-index: 9999;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

h1, h2, h3, h4 {
  margin: 0 0 var(--space-3);
  font-weight: 600;
  color: var(--heading);
  line-height: 1.15;
  letter-spacing: -0.01em;
}

p {
  margin: 0 0 var(--space-3);
  color: var(--muted);
  line-height: 1.6;
  font-size: 1rem;
}

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--space-5);
}

/* Button Upgrade */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 12px 24px;
  border-radius: 999px;
  font-weight: 500;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.15), rgba(0, 224, 255, 0.15));
  border: 1px solid rgba(124, 92, 255, 0.3);
  color: #ffffff;
  margin: 16px 0 0;
  min-height: 44px;
  min-width: 44px;
  transition: all var(--dur-fast) var(--ease-apple);
  box-shadow: 0 4px 15px rgba(124, 92, 255, 0.15);
  position: relative;
  z-index: 1;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.btn:hover {
  transform: translateY(-2px) scale(1.04);
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.3), rgba(0, 224, 255, 0.3));
  border-color: rgba(0, 224, 255, 0.6);
  box-shadow: 0 8px 25px rgba(124, 92, 255, 0.4), 0 0 15px rgba(0, 224, 255, 0.3);
}

.btn:active {
  transform: translateY(0) scale(0.98);
  opacity: 0.9;
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 224, 255, 0.4);
}

.btn:disabled, .btn.is-disabled {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
  box-shadow: none;
  pointer-events: none;
}

.btn-secondary, .btn-outline {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
}

.btn-secondary:hover, .btn-outline:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  box-shadow: 0 4px 15px rgba(255, 255, 255, 0.05);
}

.btn-secondary:active, .btn-outline:active {
  background: rgba(255, 255, 255, 0.05);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text);
  box-shadow: none;
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
  text-shadow: 0 0 8px rgba(124, 92, 255, 0.4);
}

.btn-ghost:active {
  background: rgba(255, 255, 255, 0.03);
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  background: rgba(124, 92, 255, 0.08);
  border: 1px solid rgba(124, 92, 255, 0.2);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--accent-cyan);
  letter-spacing: 0.02em;
}

/* Navbar Premium Look */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(11, 15, 26, 0.65);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(124, 92, 255, 0.15);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5), 0 1px 0 rgba(0, 224, 255, 0.05);
}

.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) 0;
  gap: var(--space-4);
}

.nav-bar .btn,
.nav-bar .menu-toggle {
  margin: 0;
}

.brand {
  font-weight: 600;
  letter-spacing: 0.02em;
  font-size: 1.05rem;
  color: #ffffff;
  text-shadow: 0 0 12px rgba(124, 92, 255, 0.5);
}

.nav-links {
  display: flex;
  gap: var(--space-4);
  align-items: center;
}

.nav-links a {
  color: var(--muted);
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  min-height: 44px;
  border-radius: 8px;
  transition: all var(--dur-fast) var(--ease-apple);
  position: relative;
}

.nav-links a:hover {
  color: #ffffff;
  background: rgba(124, 92, 255, 0.08);
  text-shadow: 0 0 12px rgba(0, 224, 255, 0.4);
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 60%;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-purple), var(--accent-cyan));
  border-radius: 2px;
  transition: transform var(--dur-fast) var(--ease-apple);
  box-shadow: 0 0 8px rgba(0, 224, 255, 0.6);
}

.nav-links a:hover::after {
  transform: translateX(-50%) scaleX(1);
}

.nav-links a:active {
  transform: scale(0.96);
}

.nav-links a:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.3);
}

.menu-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 12px;
  margin: 16px 0 0;
  min-height: 44px;
  min-width: 44px;
  transition: all var(--dur-medium) var(--ease-apple);
}

.menu-toggle:hover {
  background: rgba(124, 92, 255, 0.1);
  border-color: rgba(124, 92, 255, 0.4);
  transform: scale(1.02);
  color: #ffffff;
}

.menu-toggle:active {
  transform: scale(0.96);
}

.hero {
  padding: var(--space-7) 0 var(--space-6);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: var(--space-6);
  align-items: center;
}

.hero-card {
  background: var(--surface);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(124, 92, 255, 0.15);
  border-radius: var(--radius);
  padding: var(--space-5);
  box-shadow: var(--shadow-base), var(--shadow-glow);
}

.hero h1 {
  font-size: clamp(2.2rem, 5vw, 4rem);
  letter-spacing: -0.02em;
  background: linear-gradient(180deg, #ffffff 0%, #b3c2ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.1;
  margin-bottom: var(--space-4);
  text-shadow: 0 0 40px rgba(124, 92, 255, 0.2);
}

.hero p {
  font-size: 1.15rem;
  max-width: 90%;
}

.hero-actions {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
}

.metric-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.metric-card strong {
  font-size: 1.6rem;
  letter-spacing: -0.02em;
  display: block;
  color: #ffffff;
  margin-bottom: 4px;
  background: linear-gradient(90deg, #fff, var(--accent-cyan));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.section {
  padding: var(--space-7) 0;
  position: relative;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.section-header h2 {
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  letter-spacing: -0.02em;
}

.section-header p {
  max-width: 640px;
  font-size: 1.1rem;
}

.grid {
  display: grid;
  gap: var(--space-4);
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* CARDS (Apple + Cyberpunk SaaS minimalist element) */
.card {
  background: var(--surface);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all var(--dur-medium) var(--ease-apple);
  position: relative;
  box-shadow: var(--shadow-base), var(--shadow-glow);
  display: flex;
  flex-direction: column;
}

.card:hover {
  transform: translateY(-5px);
  border-color: rgba(124, 92, 255, 0.3);
  box-shadow: var(--shadow-base), var(--shadow-glow-hover);
  background: var(--surface-hover);
}

.card-title {
  font-size: 1.2rem;
  margin-bottom: var(--space-1);
  color: #ffffff;
}

.card-meta {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-top: 4px;
}

.card-image {
  aspect-ratio: 16 / 9;
  background: rgba(0, 0, 0, 0.3);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  overflow: hidden;
  position: relative;
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s var(--ease-apple);
}

.card:hover .card-image img {
  transform: scale(1.03);
}

.footer {
  padding: var(--space-7) 0;
  border-top: 1px solid rgba(124, 92, 255, 0.15);
  background: rgba(11, 15, 26, 0.8);
  position: relative;
  box-shadow: 0 -10px 40px rgba(124, 92, 255, 0.05);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  gap: var(--space-5);
}

.footer a {
  color: var(--muted);
  transition: color var(--dur-fast) var(--ease-apple);
}

.footer a:hover {
  color: var(--text);
  text-shadow: 0 0 8px rgba(0, 224, 255, 0.4);
}

.page-hero {
  padding: var(--space-6) 0 var(--space-4);
}

.page-hero .pill {
  margin-bottom: var(--space-3);
}

.page-hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.5rem);
  letter-spacing: -0.02em;
}

.page-hero p {
  font-size: 1.2rem;
}

.resource-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: var(--space-5);
  align-items: start;
}

.resource-preview {
  border-radius: var(--radius);
  border: 1px solid rgba(124, 92, 255, 0.2);
  overflow: hidden;
  margin-bottom: var(--space-4);
  background: rgba(0,0,0,0.4);
  box-shadow: var(--shadow-base), var(--shadow-glow);
}

.resource-section {
  background: var(--surface);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
  box-shadow: var(--shadow-base), 0 10px 40px rgba(124, 92, 255, 0.08);
  transition: all var(--dur-medium) var(--ease-apple);
}

.resource-section:hover {
  border-color: rgba(124, 92, 255, 0.2);
  background: var(--surface-hover);
}

.sidebar {
  position: sticky;
  top: 100px;
}

.file-info {
  display: grid;
  gap: var(--space-3);
}

.file-info div {
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  border: 1px solid var(--border);
}

.list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: var(--space-2);
}

.breadcrumb {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: var(--space-4);
}

.breadcrumb a {
  color: var(--muted);
  transition: color var(--dur-fast) var(--ease-apple);
}

.breadcrumb a:hover {
  color: var(--text);
  text-shadow: 0 0 8px rgba(124, 92, 255, 0.4);
}

/* Mobile Fixes & Clean Stacking */
@media (max-width: 768px) {
  .container {
    padding: 0 16px;
  }
  
  .site-header {
    padding: 0;
  }
  
  .nav-bar {
    padding: 16px 0;
  }

  .nav-links {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: rgba(11, 15, 26, 0.98);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    padding: 16px;
    border-radius: 0 0 20px 20px;
    border: 1px solid rgba(124, 92, 255, 0.15);
    border-top: none;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.8), 0 10px 20px rgba(124, 92, 255, 0.2);
    gap: 8px; /* Stack menu items vertically with proper spacing */
  }

  .nav-open .nav-links {
    display: flex;
  }

  .nav-links a {
    width: 100%;
    padding: 12px 16px;
    text-align: left;
    border-radius: 12px;
  }
  
  .nav-bar > .btn {
    display: none; /* Hide top-level nav buttons, only keep logo + menu button */
  }
  
  .menu-toggle {
    display: inline-flex;
    margin: 0;
    padding: 8px 12px;
    border-radius: 8px;
    min-height: unset;
    min-width: unset;
  }

  /* Typography Fix (Reduce heading sizes, standardize line height) */
  h1 { font-size: clamp(2rem, 8vw, 2.5rem); line-height: 1.25; margin-bottom: 16px; }
  h2 { font-size: 1.6rem; line-height: 1.3; margin-bottom: 16px; }
  h3 { font-size: 1.25rem; line-height: 1.35; margin-bottom: 12px; }
  p { font-size: 1rem; line-height: 1.5; margin-bottom: 16px; }

  /* Element Stacking & Grid Cleanup (Single column layout) */
  .grid-3, .grid-2, .hero-grid, .resource-layout, .metric-grid, .footer-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .sidebar {
    position: static;
  }

  /* Structural Spacing Reduction (Remove massive random gaps) */
  .hero, .page-hero, .section, .footer {
    padding: 40px 0;
  }
  
  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 24px;
  }
  
  .section-header .btn {
    align-self: flex-start;
    margin-top: 0;
    width: 100%;
  }

  /* Button alignment (Equal widths, center padding) */
  .btn {
    width: 100%;
    padding: 12px 16px;
    justify-content: center;
    border-radius: 12px; /* Not too oval */
    margin: 0;
  }
  
  .hero-actions {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: 16px;
  }

  /* Card internal spacing */
  .card-body, .resource-section {
    padding: 16px;
  }
  
  .metric-card {
    padding: 16px;
  }
}

/* Animations (Smooth fade-in on scroll) */
.stagger-item {
  opacity: 0;
  transform: translateY(24px);
  will-change: transform, opacity;
}

.stagger-item.is-visible {
  animation: fade-up 600ms var(--ease-apple) forwards;
  animation-delay: var(--stagger-delay, 0ms);
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .btn,
  .menu-toggle,
  .card,
  .card-image img,
  .resource-section,
  .stagger-item {
    transition: none !important;
    transform: none !important;
    box-shadow: none !important;
    animation: none !important;
    opacity: 1 !important;
  }
}

/* --- Single Clean Popup System --- */
body.popup-locked {
  overflow: hidden !important;
}

.popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(11, 15, 26, 0.8);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 999999;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.popup-overlay.active {
  opacity: 1;
  visibility: visible;
}

.popup-box {
  position: relative;
  width: 90%;
  max-width: 420px;
  transform: scale(0.88) translateY(24px);
  opacity: 0;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.5s ease;
}

.popup-overlay.active .popup-box {
  transform: scale(1) translateY(0);
  opacity: 1;
}

/* Gradient glow behind popup */
.popup-glow {
  position: absolute;
  top: -2px; left: -2px; right: -2px; bottom: -2px;
  background: linear-gradient(45deg, rgba(124, 92, 255, 0.5), rgba(0, 224, 255, 0.5));
  border-radius: 22px;
  z-index: -1;
  filter: blur(12px);
  opacity: 0.4;
  transition: opacity 0.4s ease;
}

.popup-box:hover .popup-glow {
  opacity: 0.8;
}

/* Main glassmorphism card */
.popup-card {
  background: rgba(15, 20, 35, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 36px 32px;
  border-radius: 20px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.popup-card h2 {
  color: #ffffff;
  font-size: 1.45rem;
  font-weight: 700;
  margin-bottom: 14px;
  letter-spacing: -0.02em;
}

.popup-card p {
  color: #a1a1aa;
  font-size: 0.95rem;
  line-height: 1.55;
  margin-bottom: 22px;
}

.popup-feature {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 28px;
  color: #e2e8f0;
  font-size: 0.95rem;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.03);
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.popup-continue-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #7c5cff, #00e0ff);
  color: #ffffff;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 4px 15px rgba(124, 92, 255, 0.3);
  font-family: inherit;
}

.popup-continue-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 224, 255, 0.4);
}

.popup-continue-btn:active {
  transform: translateY(0) scale(0.98);
}
