/* ============================================
   GALACTIC UNIVERSE — Cosmic Theme
   ============================================ */

/* --- CSS Variables --- */
:root {
  --void: #080422;
  --deep-space: #0f0830;
  --nebula-dark: #1a0e40;
  --nebula-purple: #8B2FC9;
  --nebula-blue: #1B8ECF;
  --cosmic-cyan: #00D4FF;
  --stardust: #C850F0;
  --gold-ancient: #E0B84E;
  --gold-light: #F0D68A;
  --text-primary: #F0ECF8;
  --text-secondary: #C4B8DC;
  --text-muted: #8A7EA8;
  --glass-bg: rgba(18, 10, 48, 0.65);
  --glass-border: rgba(0, 212, 255, 0.12);
  --glass-border-hover: rgba(0, 212, 255, 0.3);

  --font-display: 'Cinzel', Georgia, serif;
  --font-body: 'Raleway', 'Segoe UI', sans-serif;
  --font-accent: 'Cinzel Decorative', 'Cinzel', serif;

  --max-width: 1200px;
  --section-padding: 100px 0;
}

/* --- Reset & Base --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  font-family: var(--font-body);
  background-color: var(--void);
  color: var(--text-primary);
  line-height: 1.8;
  font-size: 17.5px;
  overflow-x: hidden;
}

/* --- Starfield Background --- */
body::before,
body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

body::before {
  background:
    radial-gradient(1px 1px at 10% 20%, rgba(255,255,255,0.8) 0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 40% 15%, rgba(255,255,255,0.9) 0%, transparent 100%),
    radial-gradient(1px 1px at 55% 75%, rgba(255,255,255,0.5) 0%, transparent 100%),
    radial-gradient(1px 1px at 70% 35%, rgba(255,255,255,0.7) 0%, transparent 100%),
    radial-gradient(1px 1px at 30% 40%, rgba(0,212,255,0.5) 0%, transparent 100%),
    radial-gradient(1px 1px at 75% 60%, rgba(200,80,240,0.4) 0%, transparent 100%);
  animation: starDrift 120s linear infinite;
  will-change: transform;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

@keyframes starDrift {
  0% { transform: translateY(0); }
  100% { transform: translateY(-30px); }
}

/* --- Nebula Ambient Blobs --- */
.nebula-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.nebula-bg .blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.08;
  will-change: transform, opacity;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  animation: nebulaPulse 20s ease-in-out infinite alternate;
}

.nebula-bg .blob:nth-child(1) {
  width: 600px; height: 600px;
  background: var(--nebula-purple);
  top: -10%; left: -5%;
  animation-delay: 0s;
}
.nebula-bg .blob:nth-child(2) {
  width: 500px; height: 500px;
  background: var(--nebula-blue);
  top: 30%; right: -10%;
  animation-delay: -7s;
}
.nebula-bg .blob:nth-child(3) {
  width: 700px; height: 700px;
  background: var(--stardust);
  bottom: -15%; left: 20%;
  animation-delay: -14s;
}
.nebula-bg .blob:nth-child(4) {
  width: 400px; height: 400px;
  background: var(--cosmic-cyan);
  top: 60%; left: -15%;
  animation-delay: -5s;
}

@keyframes nebulaPulse {
  0% { transform: scale(1) translate(0, 0); opacity: 0.08; }
  100% { transform: scale(1.2) translate(30px, -20px); opacity: 0.16; }
}

/* --- Content Wrapper --- */
.content-wrapper {
  position: relative;
  z-index: 1;
}

/* --- Navigation --- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 100;
  padding: 20px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.4s ease;
  background: transparent;
}

.nav.scrolled {
  background: rgba(3, 0, 20, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 14px 40px;
  border-bottom: 1px solid var(--glass-border);
}

.nav-logo {
  font-family: var(--font-accent);
  font-size: 1.3rem;
  color: var(--cosmic-cyan);
  text-decoration: none;
  letter-spacing: 3px;
  text-transform: uppercase;
}

.nav-logo span {
  color: var(--gold-ancient);
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 40px;
}

.nav-links a {
  font-family: var(--font-display);
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-decoration: none;
  letter-spacing: 2px;
  text-transform: uppercase;
  transition: color 0.3s ease;
  position: relative;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--cosmic-cyan), var(--stardust));
  transition: width 0.3s ease;
}

.nav-links a:hover {
  color: var(--cosmic-cyan);
}

.nav-links a:hover::after {
  width: 100%;
}

.nav-links a.active {
  color: var(--cosmic-cyan);
}

/* Mobile menu toggle */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}

.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  margin: 5px 0;
  transition: all 0.3s ease;
}

/* --- Hero Section --- */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 120px 40px 80px;
  position: relative;
}

.hero-tagline {
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--gold-ancient);
  letter-spacing: 6px;
  text-transform: uppercase;
  margin-bottom: 24px;
  opacity: 0;
  animation: fadeInUp 1s ease 0.3s forwards;
}

.hero h1 {
  font-family: var(--font-accent);
  font-size: clamp(2.5rem, 6vw, 5rem);
  letter-spacing: 8px;
  text-transform: uppercase;
  line-height: 1.2;
  margin-bottom: 8px;
  opacity: 0;
  animation: fadeInUp 1s ease 0.6s forwards;
  background: linear-gradient(135deg, var(--cosmic-cyan) 0%, var(--text-primary) 40%, var(--stardust) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-family: var(--font-display);
  font-size: clamp(1rem, 2vw, 1.3rem);
  color: var(--text-secondary);
  letter-spacing: 4px;
  margin-bottom: 40px;
  opacity: 0;
  animation: fadeInUp 1s ease 0.9s forwards;
}

.hero-description {
  max-width: 600px;
  font-size: 1.15rem;
  color: var(--text-secondary);
  line-height: 1.9;
  margin-bottom: 48px;
  opacity: 0;
  animation: fadeInUp 1s ease 1.2s forwards;
}

.hero-cta {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
  opacity: 0;
  animation: fadeInUp 1s ease 1.5s forwards;
}

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

/* --- Buttons --- */
.btn {
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  padding: 16px 36px;
  text-decoration: none;
  border-radius: 2px;
  transition: all 0.3s ease;
  cursor: pointer;
  border: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--cosmic-cyan), var(--nebula-blue));
  color: var(--void);
  font-weight: 700;
}

.btn-primary:hover {
  box-shadow: 0 0 30px rgba(0, 212, 255, 0.3);
  transform: translateY(-2px);
}

.btn-outline {
  background: transparent;
  color: var(--gold-ancient);
  border: 1px solid var(--gold-ancient);
}

.btn-outline:hover {
  background: rgba(212, 168, 67, 0.1);
  box-shadow: 0 0 20px rgba(212, 168, 67, 0.15);
  transform: translateY(-2px);
}

/* --- Sections --- */
section {
  padding: var(--section-padding);
  position: relative;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 40px;
}

/* --- Section Headers --- */
.section-header {
  text-align: center;
  margin-bottom: 70px;
}

.section-label {
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--gold-ancient);
  letter-spacing: 5px;
  text-transform: uppercase;
  margin-bottom: 16px;
  display: block;
}

.section-header h2 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3.5vw, 2.8rem);
  letter-spacing: 4px;
  text-transform: uppercase;
  margin-bottom: 20px;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--cosmic-cyan) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.section-header p {
  max-width: 650px;
  margin: 0 auto;
  color: var(--text-secondary);
  font-size: 1.15rem;
  line-height: 1.85;
}

/* --- Divider --- */
.divider {
  width: 60px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--cosmic-cyan), transparent);
  margin: 0 auto 20px;
}

/* --- Series Cards --- */
.series-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 30px;
}

.series-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 4px;
  padding: 40px 35px;
  transition: all 0.4s ease;
  position: relative;
  overflow: hidden;
}

.series-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--cosmic-cyan), var(--stardust), transparent);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.series-card:hover {
  border-color: var(--glass-border-hover);
  transform: translateY(-4px);
  box-shadow: 0 20px 60px rgba(0, 212, 255, 0.06);
}

.series-card:hover::before {
  opacity: 1;
}

.series-icon {
  font-size: 2rem;
  margin-bottom: 20px;
  display: block;
}

.series-card h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--cosmic-cyan);
  margin-bottom: 14px;
}

.series-card p {
  color: var(--text-secondary);
  font-size: 1.02rem;
  line-height: 1.85;
}

.series-tag {
  display: inline-block;
  margin-top: 16px;
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gold-ancient);
  border: 1px solid rgba(212, 168, 67, 0.3);
  padding: 4px 12px;
  border-radius: 2px;
}

/* --- About Section --- */
.about-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  align-items: center;
}

.about-text h3 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  letter-spacing: 2px;
  margin-bottom: 24px;
  color: var(--text-primary);
}

.about-text p {
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.9;
}

.about-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 30px;
}

.stat-item {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  padding: 30px;
  border-radius: 4px;
  text-align: center;
  transition: all 0.3s ease;
}

.stat-item:hover {
  border-color: var(--glass-border-hover);
}

.stat-icon {
  font-size: 1.8rem;
  margin-bottom: 12px;
  display: block;
}

.stat-label {
  font-family: var(--font-display);
  font-size: 0.75rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--cosmic-cyan);
  display: block;
  margin-bottom: 6px;
}

.stat-value {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* --- Resources Section --- */
.resources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 30px;
}

.resource-category h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gold-ancient);
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(212, 168, 67, 0.2);
}

.resource-item {
  display: block;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 4px;
  padding: 20px 24px;
  margin-bottom: 14px;
  text-decoration: none;
  transition: all 0.3s ease;
}

.resource-item:hover {
  border-color: var(--glass-border-hover);
  transform: translateX(4px);
}

.resource-item .resource-title {
  font-family: var(--font-display);
  font-size: 0.9rem;
  color: var(--text-primary);
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.resource-item .resource-author {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.resource-item .resource-type {
  font-size: 0.7rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--cosmic-cyan);
  opacity: 0.7;
}

/* --- Quotes / Featured --- */
.featured-quote {
  max-width: 700px;
  margin: 0 auto;
  text-align: center;
  padding: 60px 40px;
  position: relative;
}

.featured-quote blockquote {
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 2.5vw, 1.6rem);
  color: var(--text-primary);
  line-height: 1.8;
  font-style: italic;
}

.featured-quote cite {
  display: block;
  margin-top: 20px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--gold-ancient);
  font-style: normal;
  letter-spacing: 2px;
}

/* --- Footer --- */
.footer {
  padding: 60px 40px 40px;
  border-top: 1px solid var(--glass-border);
  text-align: center;
}

.footer-brand {
  font-family: var(--font-accent);
  font-size: 1.1rem;
  color: var(--cosmic-cyan);
  letter-spacing: 4px;
  text-transform: uppercase;
  margin-bottom: 20px;
}

.footer-tagline {
  font-family: var(--font-display);
  font-size: 0.85rem;
  color: var(--gold-ancient);
  letter-spacing: 3px;
  margin-bottom: 30px;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin-bottom: 30px;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  transition: color 0.3s ease;
}

.footer-links a:hover {
  color: var(--cosmic-cyan);
}

.footer-social {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 30px;
}

.footer-social a {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--glass-border);
  border-radius: 50%;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 1.1rem;
  transition: all 0.3s ease;
}

.footer-social a:hover {
  border-color: var(--cosmic-cyan);
  color: var(--cosmic-cyan);
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.15);
}

.footer-copy {
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 1px;
}

/* --- Scroll Animations --- */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(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; }

/* --- Page-specific headers --- */
.page-hero {
  padding: 160px 40px 80px;
  text-align: center;
}

.page-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3rem);
  letter-spacing: 6px;
  text-transform: uppercase;
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--cosmic-cyan), var(--text-primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-hero p {
  color: var(--text-secondary);
  max-width: 550px;
  margin: 0 auto;
  line-height: 1.8;
}

/* --- About page specifics --- */
.about-story {
  max-width: 750px;
  margin: 0 auto;
}

.about-story h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--cosmic-cyan);
  margin: 50px 0 16px;
}

.about-story p {
  color: var(--text-secondary);
  line-height: 1.9;
  margin-bottom: 18px;
}

/* --- Responsive --- */
@media (max-width: 900px) {
  .about-content {
    grid-template-columns: 1fr;
    gap: 50px;
  }

  .series-grid {
    grid-template-columns: 1fr;
  }

  .resources-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .nav {
    padding: 16px 24px;
  }

  .nav-links {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(3, 0, 20, 0.97);
    backdrop-filter: blur(20px);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 30px;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-toggle {
    display: block;
    z-index: 101;
  }

  .nav-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
  }
  .nav-toggle.active span:nth-child(2) {
    opacity: 0;
  }
  .nav-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
  }

  .hero {
    padding: 120px 24px 60px;
  }

  .container {
    padding: 0 24px;
  }

  :root {
    --section-padding: 70px 0;
  }
}

/* --- Mobile Performance: disable heavy GPU effects --- */
@media (max-width: 768px) {
  body::before {
    animation: none;
  }

  .nebula-bg .blob {
    filter: blur(60px);
    animation: none;
    opacity: 0.1;
  }

  .nav.scrolled {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: rgba(8, 4, 34, 0.95);
  }
}

/* --- Reduce motion for users who prefer it --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
