/* =========================================
   THE EARTH IS FLAT — Manifesto Styles
   ========================================= */

:root {
  --bg: rgb(12, 13, 17);
  --chalk: rgba(235, 230, 220, 0.85);
  --chalk-strong: rgba(235, 230, 220, 0.95);
  --chalk-dim: rgba(235, 230, 220, 0.45);
  --chalk-faint: rgba(235, 230, 220, 0.15);
  --warm: rgba(218, 175, 72, 0.85);
  --warm-dim: rgba(218, 175, 72, 0.4);
  --cool: rgba(140, 170, 210, 0.7);
  --cool-dim: rgba(140, 170, 210, 0.3);
  --nav-h: 60px;
  --content-width: 800px;
}

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

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
  overflow-y: scroll;
  scrollbar-gutter: stable;
}

body {
  overflow: hidden;
  background: var(--bg);
  color: var(--chalk);
  font-family: 'Spectral', Georgia, serif;
  font-size: 18px;
  line-height: 1.8;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--warm-dim);
  color: var(--chalk-strong);
}

/* ---- Navigation ---- */
.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  z-index: 1000;
  background: linear-gradient(to bottom, var(--bg), transparent);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.nav-home {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 300;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--chalk-dim);
  text-decoration: none;
  transition: color 0.3s;
}

.nav-home:hover { color: var(--chalk); }

.nav-links {
  display: flex;
  gap: 32px;
}

.nav-links a {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 300;
  letter-spacing: 0.12em;
  text-transform: lowercase;
  color: var(--chalk-dim);
  text-decoration: none;
  transition: color 0.3s;
}

.nav-links a:hover,
.nav-links a.active { color: var(--chalk); }

.nav-hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  width: 28px;
  height: 20px;
  position: relative;
  z-index: 1001;
}

.nav-hamburger span {
  display: block;
  width: 100%;
  height: 1px;
  background: var(--chalk-dim);
  position: absolute;
  left: 0;
  transition: all 0.3s;
}

.nav-hamburger span:nth-child(1) { top: 0; }
.nav-hamburger span:nth-child(2) { top: 50%; }
.nav-hamburger span:nth-child(3) { top: 100%; }

.nav-hamburger.open span:nth-child(1) { top: 50%; transform: rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { top: 50%; transform: rotate(-45deg); }

.nav-dropdown {
  display: none;
  position: fixed;
  top: var(--nav-h);
  left: 0;
  right: 0;
  background: var(--bg);
  padding: 20px 40px;
  flex-direction: column;
  gap: 16px;
  z-index: 999;
}

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

.nav-dropdown a {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  font-weight: 300;
  letter-spacing: 0.1em;
  color: var(--chalk-dim);
  text-decoration: none;
  transition: color 0.3s;
}

.nav-dropdown a:hover { color: var(--chalk); }

/* ---- Progress Bar ---- */
.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0%;
  z-index: 1001;
  transition: background-color 1.5s ease;
}

.progress-bar.warm {
  background: linear-gradient(90deg, var(--warm), rgba(218, 175, 72, 0.6));
}

.progress-bar.cool {
  background: linear-gradient(90deg, var(--cool), rgba(140, 170, 210, 0.5));
}

/* ---- Canvas & SVG ---- */
#particleCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

#mainSvg {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 70vw;
  max-width: 1000px;
  height: auto;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 2s ease;
}

#mainSvg.visible {
  opacity: 0.12;
}

.chalk-stroke {
  fill: none;
  stroke: var(--chalk);
  stroke-width: 1.5;
  opacity: 0.6;
}

.chalk-fill {
  fill: var(--chalk);
  opacity: 0.5;
}

.earth-disc { stroke-width: 2; }
.earth-disc-inner { opacity: 0.3; }
.ice-wall { stroke-width: 1.8; opacity: 0.5; }
.firmament { stroke-width: 1; opacity: 0.4; }
.orbit-path { stroke-width: 0.8; }
.sun { fill: var(--warm); opacity: 0.7; }
.sun-glow { stroke: var(--warm); stroke-width: 1; }
.moon { fill: var(--cool); }
.star { opacity: 0.4; }
.polaris { fill: var(--warm); opacity: 0.8; }
.polaris-ray { stroke: var(--warm); stroke-width: 1; opacity: 0.5; }

/* ---- Floating Characters ---- */
.floater {
  position: fixed;
  z-index: 1;
  pointer-events: none;
  filter: drop-shadow(0 0 8px rgba(235, 230, 220, 0.15));
  opacity: 0.4;
  transition: opacity 0.5s ease;
}

.floaters-active .floater {
  opacity: 1;
}

.floater-ufo {
  animation:
    floatDriftUfo 26s ease-in-out infinite,
    floatRotateUfo 18s ease-in-out infinite;
}

.floater-cow {
  animation:
    floatDriftCow 32s ease-in-out infinite,
    floatRotateCow 22s ease-in-out infinite;
}

@keyframes floatDriftUfo {
  0%   { transform: translate(0, 0); }
  15%  { transform: translate(-80px, 20px); }
  30%  { transform: translate(40px, -30px); }
  50%  { transform: translate(-60px, -50px); }
  70%  { transform: translate(70px, 10px); }
  85%  { transform: translate(-20px, 40px); }
  100% { transform: translate(0, 0); }
}

@keyframes floatRotateUfo {
  0%   { rotate: 0deg; }
  25%  { rotate: 8deg; }
  50%  { rotate: -6deg; }
  75%  { rotate: 5deg; }
  100% { rotate: 0deg; }
}

@keyframes floatDriftCow {
  0%   { transform: translate(0, 0); }
  20%  { transform: translate(50px, -40px); }
  40%  { transform: translate(-30px, -20px); }
  60%  { transform: translate(20px, 30px); }
  80%  { transform: translate(-40px, 10px); }
  100% { transform: translate(0, 0); }
}

@keyframes floatRotateCow {
  0%   { rotate: 0deg; }
  20%  { rotate: -10deg; }
  40%  { rotate: 15deg; }
  60%  { rotate: -5deg; }
  80%  { rotate: 12deg; }
  100% { rotate: 0deg; }
}

.floater-astronaut {
  top: 0;
  left: 0;
  will-change: transform;
  transition: none;
}

/* ---- Controls Panel ---- */
.controls-wrapper {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.controls-btn {
  background: none;
  border: 1px solid var(--chalk-faint);
  color: var(--chalk-dim);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  padding: 6px 14px;
  cursor: pointer;
  border-radius: 3px;
  transition: all 0.3s;
}

.mute-btn {
  margin-top: 6px;
}

.controls-btn:hover {
  border-color: var(--chalk-dim);
  color: var(--chalk);
}

.controls-panel {
  background: rgba(12, 13, 17, 0.92);
  border: 1px solid var(--chalk-faint);
  border-radius: 6px;
  padding: 16px 20px;
  margin-bottom: 8px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.controls-wrapper:hover .controls-panel {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.controls-section {
  margin-bottom: 10px;
}

.controls-section:last-child {
  margin-bottom: 0;
}

.controls-character {
  font-family: 'Cormorant Garamond', serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--chalk-strong);
  margin-bottom: 2px;
}

.controls-row {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.05em;
  color: var(--chalk-dim);
  line-height: 1.7;
}

.controls-keys {
  color: var(--warm);
  margin-right: 6px;
}

/* ---- Space Torpedo ---- */
.space-torpedo {
  position: fixed;
  width: 12px;
  height: 6px;
  z-index: 50;
  pointer-events: none;
  background: radial-gradient(ellipse at 30% 50%,
    rgba(140, 255, 140, 1) 0%,
    rgba(80, 255, 80, 0.9) 40%,
    rgba(40, 200, 40, 0.6) 100%);
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  box-shadow:
    0 0 6px rgba(80, 255, 80, 0.9),
    0 0 14px rgba(80, 255, 80, 0.5),
    0 0 28px rgba(80, 255, 80, 0.2);
  transform-origin: 50% 50%;
}

/* ---- Explosion ---- */
.explosion-particle {
  position: fixed;
  z-index: 60;
  pointer-events: none;
  border-radius: 50%;
  animation: explodeParticle 0.6s ease-out forwards;
}

@keyframes explodeParticle {
  0%   { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(var(--ex), var(--ey)) scale(0); opacity: 0; }
}

.explosion-flash {
  position: fixed;
  z-index: 55;
  pointer-events: none;
  width: 80px;
  height: 80px;
  margin-left: -40px;
  margin-top: -40px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,220,100,0.9) 0%, rgba(255,140,40,0.5) 40%, transparent 70%);
  animation: explodeFlash 0.35s ease-out forwards;
}

@keyframes explodeFlash {
  0%   { transform: scale(0.3); opacity: 1; }
  50%  { transform: scale(1.2); opacity: 0.8; }
  100% { transform: scale(1.8); opacity: 0; }
}

/* ---- Mobile Controls ---- */
.mobile-controls {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  pointer-events: none;
  padding: 20px;
}

.mobile-controls.active {
  display: block;
}

.joystick-area {
  position: absolute;
  bottom: 30px;
  left: 30px;
  pointer-events: auto;
  touch-action: none;
}

.joystick-base {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: rgba(235, 230, 220, 0.08);
  border: 2px solid rgba(235, 230, 220, 0.2);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.joystick-nub {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(235, 230, 220, 0.25);
  border: 2px solid rgba(235, 230, 220, 0.4);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  transition: background 0.15s;
}

.joystick-nub.active {
  background: rgba(218, 175, 72, 0.4);
  border-color: rgba(218, 175, 72, 0.6);
}

.mobile-fire-btn {
  position: absolute;
  bottom: 45px;
  right: 30px;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(80, 255, 80, 0.1);
  border: 2px solid rgba(80, 255, 80, 0.3);
  color: rgba(80, 255, 80, 0.7);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.1em;
  cursor: pointer;
  pointer-events: auto;
  touch-action: none;
  transition: all 0.15s;
}

.mobile-fire-btn:active {
  background: rgba(80, 255, 80, 0.3);
  border-color: rgba(80, 255, 80, 0.6);
  transform: scale(0.93);
}

/* Hide desktop controls panel on mobile when mobile controls are active */
@media (pointer: coarse) {
  .controls-panel {
    display: none !important;
  }
}

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

.hero-content {
  max-width: 900px;
}

.hero-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  font-weight: 300;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--warm);
  margin-bottom: 20px;
  opacity: 0;
  animation: fadeUp 1.5s ease 0.3s forwards;
}

.hero-title {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  color: var(--chalk-strong);
  line-height: 1;
  margin-bottom: 30px;
  opacity: 0;
  animation: fadeUp 1.5s ease 0.6s forwards;
}

.hero-title-prefix {
  display: block;
  font-size: clamp(24px, 4vw, 48px);
  font-weight: 400;
  letter-spacing: 0.2em;
  color: var(--chalk-dim);
  margin-bottom: 8px;
}

.hero-title-main {
  display: block;
  font-size: clamp(60px, 10vw, 140px);
  letter-spacing: -0.02em;
}

.hero-tagline {
  font-family: 'Spectral', serif;
  font-size: clamp(18px, 2.5vw, 26px);
  font-style: italic;
  font-weight: 300;
  color: var(--chalk-dim);
  opacity: 0;
  animation: fadeUp 1.5s ease 1s forwards;
}

.scroll-hint {
  position: absolute;
  bottom: 40px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--chalk-dim);
  opacity: 0;
  animation: fadeUp 1.5s ease 1.5s forwards, pulse 3s ease 2.5s infinite;
  transition: opacity 0.5s;
}

.scroll-hint.hidden { opacity: 0 !important; }

/* ---- Preamble Sections ---- */
.preamble {
  position: relative;
  z-index: 1;
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 40px;
  max-width: 900px;
  margin: 0 auto;
}

.preamble-text {
  font-size: clamp(18px, 2.2vw, 24px);
  line-height: 1.9;
  color: var(--chalk);
  margin-bottom: 24px;
  text-align: center;
}

.preamble-text.large {
  font-size: clamp(24px, 3vw, 36px);
  font-weight: 300;
  line-height: 1.6;
}

.preamble-text.accent {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(32px, 4.5vw, 56px);
  font-weight: 600;
  font-style: italic;
  color: var(--chalk-strong);
  line-height: 1.3;
}

.preamble-text em {
  color: var(--chalk-strong);
  font-style: italic;
}

/* ---- Declarations ---- */
.declarations {
  gap: 12px;
}

.declaration {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(22px, 3vw, 38px);
  font-weight: 600;
  text-align: center;
  line-height: 1.4;
  padding: 8px 0;
}

.decl-emphasis {
  color: var(--chalk-strong);
  font-style: italic;
}

.decl-not {
  color: var(--chalk-dim);
  font-weight: 400;
  font-size: 0.75em;
  margin: 0 4px;
}

/* ---- Part Headers ---- */
.part-header {
  position: relative;
  z-index: 1;
  min-height: 50vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 80px 40px;
  margin-top: 80px;
}

.part-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 300;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--warm);
  margin-bottom: 16px;
}

.part-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(48px, 8vw, 100px);
  font-weight: 700;
  color: var(--chalk-strong);
  line-height: 1;
  margin-bottom: 20px;
}

.part-subtitle {
  font-family: 'Spectral', serif;
  font-size: clamp(16px, 2vw, 22px);
  font-style: italic;
  font-weight: 300;
  color: var(--chalk-dim);
}

/* ---- Principle Cards ---- */
.principle {
  position: relative;
  z-index: 1;
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 80px 60px;
  border-top: 1px solid var(--chalk-faint);
}

.principle-number {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 300;
  letter-spacing: 0.2em;
  color: var(--warm-dim);
  margin-bottom: 12px;
}

.principle-subtitle {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 300;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--chalk-dim);
  margin-bottom: 12px;
}

.principle-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 700;
  color: var(--chalk-strong);
  line-height: 1.15;
  margin-bottom: 24px;
}

.principle-text {
  font-size: 17px;
  line-height: 1.85;
  color: var(--chalk);
}

.principle-text em {
  color: var(--chalk-strong);
}

/* ---- Closing Section ---- */
.closing {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 120px auto 0;
  padding: 120px 40px 80px;
  text-align: center;
}

.closing-tagline {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(36px, 5vw, 64px);
  font-weight: 700;
  color: var(--chalk-strong);
  line-height: 1.2;
  margin-bottom: 24px;
}

.closing-welcome {
  font-size: clamp(18px, 2.2vw, 24px);
  font-weight: 300;
  color: var(--chalk);
  margin-bottom: 60px;
}

.closing-welcome em {
  color: var(--warm);
  font-style: italic;
}

.closing-attribution {
  border-top: 1px solid var(--chalk-faint);
  padding-top: 40px;
  margin-bottom: 40px;
}

.closing-attribution p {
  font-size: 15px;
  line-height: 1.7;
  color: var(--chalk-dim);
}

.closing-meta {
  margin-bottom: 40px;
}

.closing-disclaimer {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--chalk-dim);
  opacity: 0.5;
  margin-bottom: 16px;
  padding: 16px 24px;
  border: 1px solid var(--chalk-faint);
  border-radius: 4px;
  display: inline-block;
}

.closing-updated {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--chalk-dim);
  opacity: 0.4;
}

.site-footer {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--chalk-dim);
  opacity: 0.3;
  padding: 40px 0;
}

/* ---- Reveal Animations ---- */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---- Keyframes ---- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 0.2; }
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-hamburger { display: block; }

  .site-nav { padding: 0 20px; }

  .hero { padding: 0 20px; }

  .preamble { padding: 60px 20px; }

  .principle { padding: 60px 24px; }

  .part-header { padding: 60px 20px; }

  .closing { padding: 80px 20px 60px; }

  #mainSvg { width: 95vw; }
}

@media (max-width: 480px) {
  body { font-size: 16px; }

  .principle-text { font-size: 15px; line-height: 1.75; }

  .principle { padding: 48px 20px; }
}
