/* ── ASCII Solar System ── */

:root {
  --bg: #1c1c1f;
  --bg-light: #242428;
  --dim: #444;
  --mid: #777;
  --text: #bbb;
  --bright: #ddd;
  --accent: #6b7394;
  --mono: 'IBM Plex Mono', 'Courier New', monospace;
  --display: 'Bebas Neue', Impact, sans-serif;
  --body: 'Space Mono', 'Courier New', monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

/* ── Full-page ASCII star field ── */
#star-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 0;
  pointer-events: none;
  font-family: var(--mono);
  font-size: clamp(7px, 0.9vw, 12px);
  line-height: 1.18;
  color: var(--text);
  white-space: pre;
  margin: 0;
  background: transparent;
  overflow: hidden;
}

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


/* ── Header ── */
header {
  position: relative;
  z-index: 2;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 60px 20px;
  text-align: center;
  overflow: hidden;
}

#header-sun {
  position: absolute;
  top: -42vw;
  left: -38vw;
  font-family: var(--mono);
  font-size: clamp(5px, 0.7vw, 9px);
  line-height: 1.18;
  color: var(--text);
  white-space: pre;
  margin: 0;
  pointer-events: none;
  z-index: 1;
}

.header-rule {
  width: 1px;
  height: 60px;
  background: var(--dim);
  margin-bottom: 28px;
  position: relative;
  z-index: 2;
}

.header-tag, header h1, .subtitle, .scroll-cue {
  position: relative;
  z-index: 2;
}

.header-tag {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 300;
  letter-spacing: 0.4em;
  color: var(--dim);
  margin: 0 0 20px 0;
}

header h1 {
  font-family: var(--display);
  font-size: clamp(48px, 9vw, 180px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.04em;
  color: #fff;
  margin: 0;
  text-transform: uppercase;
  white-space: nowrap;
}

.subtitle {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 300;
  letter-spacing: 0.5em;
  color: var(--dim);
  margin: 36px 0 0 0;
  text-transform: uppercase;
}

.scroll-cue {
  margin-top: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.scroll-cue span {
  display: block;
  width: 1px;
  height: 8px;
  background: var(--dim);
}

/* ── Planet Sections ── */
.planet-section {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 90vh;
  padding: 60px 2%;
  gap: 20px;
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.planet-section.visible {
  opacity: 1;
  transform: translateY(0);
}

.planet-section.left  { flex-direction: row; }
.planet-section.right { flex-direction: row; }

/* ── Planet Canvas ── */
.planet-canvas-wrap {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
}

/* Push canvas to the edge of its side */
.planet-section.left .planet-canvas-wrap {
  justify-content: flex-start;
  padding-left: 1%;
}

.planet-section.right .planet-canvas-wrap {
  justify-content: flex-end;
  padding-right: 1%;
}

.planet-canvas {
  font-family: var(--mono);
  font-size: clamp(4px, 0.5vw, 8px);
  line-height: 1.18;
  color: var(--text);
  white-space: pre;
  margin: 0;
  background: transparent;
}

/* ── Planet Info ── */
.planet-info {
  flex: 1 1 0;
  padding: 20px 4%;
}

.planet-number {
  font-family: var(--display);
  font-size: clamp(52px, 6vw, 84px);
  color: var(--bg-light);
  line-height: 1;
  display: block;
  margin-bottom: 4px;
  letter-spacing: 0.05em;
}

.planet-info h2 {
  font-family: var(--display);
  font-size: clamp(60px, 8vw, 120px);
  line-height: 0.92;
  letter-spacing: 0.08em;
  color: var(--bright);
  margin: 0;
  text-transform: uppercase;
}

.planet-divider {
  width: 36px;
  height: 1px;
  background: var(--dim);
  margin: 18px 0;
}

.planet-info p {
  font-family: var(--body);
  font-size: clamp(14px, 1.2vw, 17px);
  line-height: 1.8;
  color: var(--mid);
  margin: 0 0 24px 0;
  max-width: 440px;
}

/* Stats */
.planet-stats {
  display: flex;
  gap: 24px;
  margin: 0;
  padding: 0;
}

.planet-stats > div {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.planet-stats dt {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 300;
  letter-spacing: 0.2em;
  color: var(--dim);
  text-transform: uppercase;
}

.planet-stats dd {
  font-family: var(--display);
  font-size: clamp(18px, 1.8vw, 24px);
  letter-spacing: 0.04em;
  color: var(--accent);
  margin: 0;
}

/* Left sections: planet on left, text on right — text-align left points text toward planet */
.planet-section.left .planet-info { text-align: left; }

/* Right sections: planet on right, text on left — text-align right points text toward planet */
.planet-section.right .planet-info { text-align: right; }
.planet-section.right .planet-divider { margin-left: auto; }
.planet-section.right .planet-stats { justify-content: flex-end; }
.planet-section.right .planet-info p { margin-left: auto; }

/* Compact: smaller heading for small planets so the wider text column doesn't look top-heavy */
.planet-section.compact .planet-info h2 { font-size: clamp(48px, 5.5vw, 80px); }
.planet-section.compact .planet-info .planet-number { font-size: clamp(36px, 4.2vw, 56px); }
.planet-section.compact .planet-info p { max-width: none; }

/* ── Footer ── */
footer {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 60px 20px 40px;
}

.footer-rule {
  width: 1px;
  height: 40px;
  background: var(--dim);
  margin: 0 auto 24px;
}

footer p {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 300;
  letter-spacing: 0.3em;
  color: var(--dim);
  text-transform: uppercase;
  margin: 0;
}

/* ── Responsive ── */
@media (max-width: 960px) {
  .planet-section {
    flex-direction: column !important;
    padding: 40px 16px;
    min-height: auto;
    gap: 20px;
  }
  /* Right sections have text before canvas in DOM — flip with order so planet always leads */
  .planet-section.right .planet-canvas-wrap { order: 0; }
  .planet-section.right .planet-info { order: 1; }
  .planet-canvas-wrap { flex: none; width: 100%; justify-content: center !important; padding: 0 !important; }
  /* Scale canvas to fit viewport in column layout — Saturn (widest at 240 chars) sets the floor */
  .planet-canvas { font-size: calc((100vw - 32px) / 144); }
  .planet-info { flex: none; padding: 10px 16px; text-align: center !important; }
  .planet-section.right .planet-info p { margin-left: auto; margin-right: auto; }
  .planet-section.right .planet-divider { margin-left: auto; margin-right: auto; }
  .planet-section.right .planet-stats { justify-content: center; }
  .planet-divider { margin-left: auto; margin-right: auto; }
  .planet-stats { justify-content: center; }

  /* Header sun: font-size and position both scale with viewport so the visible arc is consistent across all phone/tablet widths */
  #header-sun { font-size: 1.3vw; top: -135vw; left: -140vw; }
}

@media (max-width: 600px) {
  header {
    min-height: 80vh;
    padding: 60px 16px;
  }
  header h1 {
    font-size: clamp(36px, 12vw, 72px);
    white-space: normal;
    line-height: 1;
  }
  .header-tag {
    font-size: 7px;
    letter-spacing: 0.1em;
    padding: 0 8px;
  }
  .subtitle {
    font-size: 9px;
    letter-spacing: 0.25em;
  }
  .planet-stats { flex-wrap: wrap; gap: 10px; }
  .planet-stats dt { font-size: 7px; letter-spacing: 0.15em; }
  .planet-stats dd { font-size: clamp(11px, 3vw, 14px); }
  .planet-info h2 { font-size: clamp(28px, 9vw, 44px); }
  .planet-section.compact .planet-info h2 { font-size: clamp(26px, 8vw, 40px); }
  .planet-number { font-size: clamp(20px, 6vw, 30px); }
  .planet-info p { font-size: 11px; line-height: 1.7; }

}
