@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@500&display=swap');

:root {
  --bg: #0a0e1a;
  --bg-panel: #101624;
  --bg-card: #161d30;
  --primary: #5c7cff;
  --accent: #4de3ff;
  --secondary: #8a9fd4;
  --heading: #ffffff;
  --body-text: #b8c2d9;
  --font-heading: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --header-height: 84px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html.hide #preloader { display: none; }

body {
  background: var(--bg);
  color: var(--body-text);
  font-family: var(--font-body);
  position: relative;
  overflow-x: hidden;
}

body.fixed { overflow: hidden; }

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: radial-gradient(circle, rgba(92, 124, 255, 0.06) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
  z-index: 0;
}

img { max-width: 100%; display: block; }
a { text-decoration: none; }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 1;
}

.container.narrow { max-width: 800px; }

/* Preloader */
#preloader {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

/* Header */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: rgba(10, 14, 26, 0.4);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

.site-header.scrolled {
  background: rgba(10, 14, 26, 0.92);
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.header-inner {
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo img { height: 36px; }

.main-nav { display: flex; align-items: center; gap: 36px; }

.nav-link {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  color: var(--body-text);
  position: relative;
  transition: color 0.2s ease;
  cursor: pointer;
}

.nav-link::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -6px;
  width: 0;
  height: 1px;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  transition: width 0.3s ease;
}

.nav-link:hover { color: var(--heading); }
.nav-link:hover::after { width: 100%; }

.burger-btn {
  display: none;
  background: transparent;
  border: 0;
  width: 28px;
  height: 20px;
  position: relative;
  padding: 0;
  cursor: pointer;
  z-index: 60;
}

.burger-btn span {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--heading);
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease, top 0.3s ease;
}

.burger-btn span:nth-child(1) { top: 0; }
.burger-btn span:nth-child(2) { top: 9px; }
.burger-btn span:nth-child(3) { top: 18px; }

.burger-btn.act span:nth-child(1) { top: 9px; transform: rotate(45deg); }
.burger-btn.act span:nth-child(2) { opacity: 0; }
.burger-btn.act span:nth-child(3) { top: 9px; transform: rotate(-45deg); }

#mobile-menu {
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  height: calc(100vh - var(--header-height));
  background: var(--bg-panel);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 30px;
  padding: 28px 32px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 45;
  overflow-y: auto;
}

#mobile-menu.opened { opacity: 1; pointer-events: auto; }

#mobile-menu .nav-link {
  font-size: 24px;
  font-family: var(--font-heading);
  font-weight: 500;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 15px 34px;
  border-radius: 8px;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.02em;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #04101f;
  box-shadow: 0 0 28px rgba(77, 227, 255, 0.35);
}

.hero-cta {
  animation: levitate 3s ease-in-out infinite;
}

.hero-cta:hover { animation-play-state: paused; }

@keyframes levitate {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* Eyebrow labels */
.eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 18px;
}

/* Hero */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding-top: var(--header-height);
  background: linear-gradient(180deg, var(--bg), var(--bg-panel));
}

.hero-inner {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 56px;
  align-items: center;
  padding: 60px 24px;
}

.hero-content h1 {
  font-family: var(--font-heading);
  font-size: clamp(2.1rem, 3.6vw, 3.2rem);
  color: var(--heading);
  line-height: 1.18;
  margin: 0 0 18px;
}

.hero-subtitle {
  color: var(--secondary);
  font-size: 1.1rem;
  margin: 0 0 22px;
}

.hero-sequence {
  font-family: var(--font-mono);
  font-size: 0.92rem;
  line-height: 1.9;
  color: var(--accent);
  opacity: 0.85;
  margin: 0 0 26px;
}

.hero-body {
  color: var(--body-text);
  line-height: 1.75;
  max-width: 540px;
  margin: 0 0 16px;
}

.hero-cta {
  margin-top: 12px;
  padding: 22px 84px;
  font-size: 18px;
}

.hero-visual {
  max-width: 420px;
  margin-left: auto;
}

.hero-visual img {
  filter: drop-shadow(0 0 44px rgba(77, 227, 255, 0.25));
}

/* Content sections */
.content-section {
  position: relative;
  padding: 110px 0;
}

.content-section:nth-of-type(even) { background: var(--bg-panel); }

.content-section h2 {
  font-family: var(--font-heading);
  color: var(--heading);
  font-size: clamp(1.6rem, 2.8vw, 2.3rem);
  line-height: 1.25;
  max-width: 720px;
  margin: 0 0 26px;
}

.content-section p {
  line-height: 1.75;
  max-width: 640px;
  margin: 0 0 16px;
}

.content-section ul {
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
}

.content-section li {
  position: relative;
  padding-left: 26px;
  margin-bottom: 10px;
  line-height: 1.65;
}

.content-section li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 9px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 64px;
  align-items: center;
}

.split.reverse { direction: rtl; }
.split.reverse > * { direction: ltr; }

.split-visual img {
  border-radius: 16px;
  box-shadow: 0 0 60px rgba(92, 124, 255, 0.15);
}

/* Echo System: image echoes itself, mirroring the game's core mechanic */
.echo-visual {
  position: relative;
  aspect-ratio: 6 / 5;
}

.echo-visual img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.echo-visual-main { z-index: 2; }

.echo-visual-ghost {
  z-index: 1;
  opacity: 0.3;
  box-shadow: none;
  transform: translate(22px, 22px);
}

.echo-pair {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin: 4px 0 24px;
}

.echo-pair-item {
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  white-space: nowrap;
}

.echo-pair-now {
  color: var(--heading);
  background: rgba(92, 124, 255, 0.1);
  border-color: rgba(92, 124, 255, 0.4);
}

.echo-pair-later {
  color: var(--accent);
  background: rgba(77, 227, 255, 0.06);
  border-color: rgba(77, 227, 255, 0.35);
}

.echo-pair-connector {
  width: 28px;
  height: 1px;
  flex-shrink: 0;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  box-shadow: 0 0 8px var(--accent);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 4px 0 24px;
}

.chip {
  font-size: 14px;
  padding: 10px 18px;
  border-radius: 10px;
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--body-text);
}

/* Mechanics: minimal grid of tiles, echoing the game's own dot/square nodes */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 4px 0 24px;
}

.tile {
  position: relative;
  padding: 14px 16px 14px 26px;
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  font-size: 14px;
  color: var(--body-text);
}

.tile::before {
  content: '';
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  border-radius: 1px;
  background: var(--secondary);
}

.tile-grid-accent .tile::before {
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
}

/* Puzzles: skills laid out as a connected node chain */
.skill-chain {
  display: grid;
  grid-template-columns: 1fr;
  gap: 26px 32px;
  margin: 28px 0 32px;
}

.skill-node {
  position: relative;
  padding-left: 34px;
  padding-top: 1px;
}

.skill-node::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 24px;
  bottom: -30px;
  width: 1px;
  background: linear-gradient(180deg, var(--accent), transparent);
  opacity: 0.35;
}

.skill-node-wide::before {
  display: none;
}

@media (min-width: 641px) {
  .skill-chain { grid-template-columns: repeat(2, 1fr); }

  .skill-node:nth-child(3)::before,
  .skill-node:nth-child(4)::before {
    display: none;
  }
}

.skill-index {
  position: absolute;
  left: 0;
  top: 0;
  width: 17px;
  height: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  background: rgba(77, 227, 255, 0.08);
  border: 1px solid rgba(77, 227, 255, 0.4);
  box-shadow: 0 0 8px rgba(77, 227, 255, 0.3);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 10px;
}

.skill-node p {
  margin: 0;
  color: var(--body-text);
  line-height: 1.55;
}

.skill-node-wide {
  grid-column: 1 / -1;
}

@media (min-width: 641px) {
  .skill-node-wide { max-width: 360px; }
}

.pull-quote {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  color: var(--heading);
  border-left: 2px solid var(--accent);
  padding-left: 22px;
  margin-top: 34px;
  max-width: 620px;
}

.text-only .container { text-align: left; }

/* FAQ */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 36px;
}

.faq-item {
  display: flex;
  gap: 22px;
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 30px;
}

.faq-number {
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 14px;
  flex-shrink: 0;
}

.faq-item h3 {
  font-family: var(--font-heading);
  color: var(--heading);
  font-size: 1.05rem;
  margin: 0 0 8px;
}

.faq-item p { margin: 0; max-width: none; }

/* Footer */
.site-footer {
  background: linear-gradient(180deg, rgba(10, 14, 26, 0.85), rgba(10, 14, 26, 0.98)), var(--bg-panel) url(../img/footer-bg.webp) center/cover no-repeat;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding: 60px 0 34px;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  text-align: center;
}

.footer-links { display: flex; gap: 28px; }

.footer-links a {
  color: var(--secondary);
  font-size: 14px;
  transition: color 0.2s ease;
}

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

.footer-copy {
  color: var(--secondary);
  font-size: 13px;
  opacity: 0.7;
  margin: 0;
}

/* Legal pages */
.legal-page { padding: 170px 0 110px; }

.legal-content { max-width: 760px; margin: 0 auto; }

.legal-content h1 {
  font-family: var(--font-heading);
  color: var(--heading);
  font-size: 2rem;
  margin: 0 0 36px;
}

.legal-content h2 {
  font-family: var(--font-heading);
  color: var(--heading);
  font-size: 1.25rem;
  margin: 36px 0 12px;
}

.legal-content p,
.legal-content li {
  line-height: 1.75;
  margin-bottom: 12px;
}

.legal-content a { color: var(--accent); }
.legal-content ul,
.legal-content ol { padding-left: 24px; margin-bottom: 16px; }
.legal-content section:first-of-type h2 { margin-top: 0; }

/* Responsive */
@media (max-width: 1024px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-visual { max-width: 420px; margin: 0 auto; }
  .split { grid-template-columns: 1fr; gap: 40px; }
  .split.reverse { direction: ltr; }
  .split-text { order: 1; }
  .split-visual { order: 2; max-width: 480px; margin: 0 auto; }
}

@media (max-width: 768px) {
  .main-nav { display: none; }
  .burger-btn { display: block; }
  .content-section { padding: 80px 0; }
  .hero { padding-top: calc(var(--header-height) + 20px); }
}

@media (max-width: 640px) {
  .faq-item { flex-direction: column; gap: 10px; padding: 24px; }
  .footer-links { flex-direction: column; gap: 12px; }
  .hero-inner { padding: 40px 20px; }
  .hero-cta {
    display: block;
    width: 100%;
    text-align: center;
    padding: 18px 24px;
  }
}
