/* ============================================================
   styles.css — ATLAS Global Intelligence Globe
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;700&family=Instrument+Serif:ital@0;1&display=swap');

/* ── Reset & tokens ──────────────────────────────────────── */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg:     #000005;
  --g100:   #fafafa;
  --g200:   #e0e0e2;
  --g300:   #a0a0a8;
  --g400:   #6a6a74;
  --g500:   #2a2a32;
  --red:    #c8364e;
  --font-b: 'DM Sans', sans-serif;
  --font-d: 'Instrument Serif', serif;
}

/* ── Base ────────────────────────────────────────────────── */
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--g200);
  font-family: var(--font-b);
  overflow-x: hidden;
  cursor: grab;
  -webkit-font-smoothing: antialiased;
}
body.grabbing { cursor: grabbing; }

#cc {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
}
canvas { display: block; }

/* ── Loading screen ──────────────────────────────────────── */
#load-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 0.8s ease;
}
#load-screen.done {
  opacity: 0;
  pointer-events: none;
}
.load-logo {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 6px;
  color: var(--g100);
  text-transform: uppercase;
  margin-bottom: 24px;
}
.load-logo span { color: var(--red); }
.load-bar {
  width: 200px;
  height: 2px;
  background: var(--g500);
  border-radius: 1px;
  overflow: hidden;
}
.load-fill {
  height: 100%;
  width: 0%;
  background: var(--red);
  transition: width 0.3s ease;
}
#load-text {
  font-size: 11px;
  color: var(--g400);
  margin-top: 12px;
  letter-spacing: 0.5px;
}

/* ── Stats (reused in hero section) ─────────────────────── */
.stats {
  display: flex;
  gap: 32px;
  align-items: flex-start;
}
.stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--g100);
}
.stat-value span { color: var(--red); }
.stat-label {
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--g400);
  margin-top: 2px;
}

/* ── Hint ────────────────────────────────────────────────── */
#hint {
  position: fixed;
  bottom: 84px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  font-size: 11px;
  color: var(--g400);
  letter-spacing: 1px;
  opacity: 0.5;
  transition: opacity 1s ease;
  pointer-events: none;
  white-space: nowrap;
}
#hint.hidden { opacity: 0; }

/* ── Tooltip ─────────────────────────────────────────────── */
#tt {
  position: fixed;
  z-index: 20;
  background: rgba(10, 10, 15, 0.95);
  border: 1px solid rgba(200, 54, 78, 0.2);
  border-radius: 8px;
  padding: 12px 16px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  max-width: 280px;
}
#tt.visible { opacity: 1; }
#tt-category {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 4px;
}
#tt-name {
  font-family: var(--font-d);
  font-size: 17px;
  color: var(--g100);
  margin-bottom: 4px;
  line-height: 1.2;
}
#tt-desc {
  font-size: 12px;
  font-weight: 300;
  color: var(--g400);
  line-height: 1.5;
}

/* ── Info panel ──────────────────────────────────────────── */
#ip {
  position: fixed;
  top: 72px;
  right: -460px;
  width: 420px;
  max-height: calc(100vh - 140px);
  z-index: 15;
  background: rgba(8, 8, 14, 0.97);
  border: 1px solid rgba(200, 54, 78, 0.15);
  border-radius: 12px;
  overflow-y: auto;
  transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
  scrollbar-width: thin;
  scrollbar-color: var(--g500) transparent;
}
#ip.open { right: 24px; }

#ip::-webkit-scrollbar { width: 4px; }
#ip::-webkit-scrollbar-track { background: transparent; }
#ip::-webkit-scrollbar-thumb { background: var(--g500); border-radius: 2px; }

/* Photo area */
.panel-photo-wrap {
  position: relative;
  width: 100%;
  height: 190px;
  background: linear-gradient(135deg, #0a0a16, #12121e);
  overflow: hidden;
  border-radius: 12px 12px 0 0;
  flex-shrink: 0;
}
#panel-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
#panel-photo-fallback {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  font-family: var(--font-d);
  font-size: 18px;
  color: var(--g400);
  text-align: center;
  padding: 16px;
}

/* Panel body */
.panel-body {
  padding: 22px 24px 28px;
}
#panel-category {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 6px;
}
#panel-name {
  font-family: var(--font-d);
  font-size: 26px;
  color: var(--g100);
  line-height: 1.15;
  margin-bottom: 4px;
}
#panel-coords {
  font-size: 12px;
  color: var(--g400);
  margin-bottom: 14px;
}
#panel-desc {
  font-size: 14px;
  font-weight: 300;
  color: var(--g300);
  line-height: 1.7;
  margin-bottom: 20px;
}
.panel-conn-title {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--g400);
  margin-bottom: 10px;
}

/* Connection list items */
.conn-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.conn-item:last-child { border-bottom: none; }
.conn-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 5px;
}
.conn-text {
  font-size: 13px;
  color: var(--g200);
  line-height: 1.45;
}

/* Close button */
#panel-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: transparent;
  border: 1px solid var(--g500);
  border-radius: 6px;
  color: var(--g300);
  width: 28px;
  height: 28px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  z-index: 2;
  transition: border-color 0.2s, color 0.2s;
}
#panel-close:hover {
  border-color: var(--red);
  color: var(--red);
}

/* ── Satellite orbital data table ───────────────────────── */
.sat-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.sat-stat:last-child { border-bottom: none; }
.sat-stat-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--g400);
}
.sat-stat-value {
  font-size: 13px;
  font-weight: 500;
  color: var(--g200);
  text-align: right;
}

/* ── Mobile (globe UI) ───────────────────────────────────── */
@media (max-width: 768px) {
  .bottom-left h1 { font-size: 26px; }
  .stats { gap: 16px; }
  .stat-value { font-size: 16px; }
  #ip {
    width: calc(100vw - 32px);
    right: -110vw;
  }
  #ip.open { right: 16px; }
  .top-bar { padding: 16px 20px; }
  .bottom-bar { padding: 16px 20px; }
}

/* ============================================================
   SCROLLABLE CONTENT — Screens 2–5
   ============================================================ */

/* ── Globe layer & scroll container ─────────────────────── */
#globe-layer {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 1;
}

#scroll-content {
  position: relative;
  z-index: 2;
  pointer-events: none;  /* pass events to globe in Screen 1 */
}

.globe-spacer {
  height: 100vh;
  pointer-events: none;
}

/* ── Fade-in-up animation ────────────────────────────────── */
.fade-up {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.fade-up.in-view {
  opacity: 1;
  transform: translateY(0);
}

/* ── Content sections base ───────────────────────────────── */
.content-section {
  background: rgba(0, 0, 5, 0.88);  /* semi-transparent so globe bleeds through */
  pointer-events: auto;
}

.section-inner {
  max-width: 900px;
  margin: 0 auto;
}

/* ─────────────────────────────────────────────────────────────
   HERO TRANSITION — "Everything is connected"
   ───────────────────────────────────────────────────────────── */
#hero-transition {
  background: linear-gradient(to bottom, transparent 0%, #000005 200px);
  padding: 60px 32px 100px;
  text-align: center;
}

.hero-inner { max-width: 680px; margin: 0 auto; }

.hero-headline {
  font-family: var(--font-d);
  font-size: 38px;
  font-weight: 400;
  color: var(--g100);
  line-height: 1.15;
  margin-bottom: 14px;
}
.hero-headline em { font-style: italic; color: var(--red); }

.hero-sub {
  font-size: 14px;
  font-weight: 300;
  color: var(--g400);
  line-height: 1.65;
  margin-bottom: 36px;
}

.hero-stats {
  justify-content: center;
  gap: 40px;
}

/* ─────────────────────────────────────────────────────────────
   SCREEN 2 — THE PROBLEM
   ───────────────────────────────────────────────────────────── */
#screen-2 {
  padding: 100px 32px 120px;
}

.hook-block {
  margin-bottom: 80px;
}

.hook-text {
  font-family: var(--font-d);
  font-size: 28px;
  color: var(--g200);
  line-height: 1.5;
  margin-bottom: 22px;
}

.how-btn {
  background: transparent;
  border: 1px solid rgba(200, 54, 78, 0.35);
  color: var(--red);
  font-family: var(--font-b);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.5px;
  padding: 8px 18px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.how-btn:hover {
  background: rgba(200, 54, 78, 0.1);
  border-color: var(--red);
}

/* Explainer slide panel */
.explainer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.65s cubic-bezier(0.16, 1, 0.3, 1);
}
.explainer.open {
  max-height: 1400px;
  margin-top: 24px;
}

/* Cause-and-effect chain */
.chain {
  padding: 28px;
  background: rgba(200, 54, 78, 0.04);
  border: 1px solid rgba(200, 54, 78, 0.12);
  border-radius: 8px;
}

.chain-step {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.explainer.open .chain-step { opacity: 1; transform: none; }

/* Stagger: chain-steps are odd-numbered children (1,3,5,7,9) */
.explainer.open .chain-step:nth-child(1) { transition-delay: 0.05s; }
.explainer.open .chain-step:nth-child(3) { transition-delay: 0.15s; }
.explainer.open .chain-step:nth-child(5) { transition-delay: 0.25s; }
.explainer.open .chain-step:nth-child(7) { transition-delay: 0.35s; }
.explainer.open .chain-step:nth-child(9) { transition-delay: 0.45s; }

.chain-line {
  width: 1px;
  height: 28px;
  background: rgba(200, 54, 78, 0.3);
  margin-left: 5px;
  flex-shrink: 0;
}

.chain-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(200, 54, 78, 0.15);
  border: 1.5px solid var(--red);
  flex-shrink: 0;
  margin-top: 3px;
}
.chain-dot.active {
  background: var(--red);
  box-shadow: 0 0 8px rgba(200, 54, 78, 0.5);
}

.chain-content { flex: 1; }

.chain-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--g100);
  margin-bottom: 4px;
  line-height: 1.4;
}
.chain-detail {
  font-size: 13px;
  font-weight: 300;
  color: var(--g400);
  line-height: 1.6;
}

.explainer-close {
  display: block;
  margin: 18px auto 0;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--g400);
  font-family: var(--font-b);
  font-size: 11px;
  letter-spacing: 0.5px;
  padding: 7px 16px;
  border-radius: 4px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.explainer-close:hover {
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--g200);
}

/* Dramatic text */
.dramatic-text {
  font-size: 20px;
  font-weight: 300;
  color: var(--g300);
  line-height: 1.8;
  margin-bottom: 28px;
}
.dramatic-text.large { font-size: 28px; }

.red-divider {
  width: 80px;
  height: 1px;
  background: var(--red);
  margin: 64px auto;
  opacity: 0;
  transition: opacity 0.7s ease;
}
.red-divider.in-view { opacity: 1; }

.killshot {
  font-family: var(--font-d);
  font-size: 48px;
  color: var(--g100);
  line-height: 1.25;
  text-align: center;
  text-shadow: 0 0 40px rgba(200, 54, 78, 0.3);
  margin: 80px 0 60px;
}

/* ─────────────────────────────────────────────────────────────
   SCREEN 3 — ATLAS ENTERS
   ───────────────────────────────────────────────────────────── */
#screen-3 {
  padding: 200px 32px 120px;
}

.atlas-reveal {
  font-family: var(--font-d);
  font-size: 42px;
  color: var(--g100);
  text-align: center;
  line-height: 1.3;
  margin-bottom: 120px;
}

.atlas-logo-block {
  text-align: center;
  margin-bottom: 80px;
}
.atlas-logo-large {
  font-family: var(--font-d);
  font-size: 56px;
  font-weight: 400;
  letter-spacing: 10px;
  color: #fafafa;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.atlas-subtitle {
  font-family: var(--font-b);
  font-size: 15px;
  color: #6a6a74;
  letter-spacing: 2px;
}

/* Architecture diagram */
#architecture-diagram {
  position: relative;
  width: 100%;
  height: 900px;
  margin-bottom: 70px;
  cursor: default;
  overflow: visible;
}
@media (min-width: 1024px) {
  #architecture-diagram { height: 700px; }
}

#diag-tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(8, 8, 14, 0.97);
  border: 1px solid rgba(200, 54, 78, 0.18);
  border-radius: 8px;
  padding: 10px 14px;
  max-width: 220px;
  z-index: 5;
  opacity: 0;
  transition: opacity 0.15s ease;
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}
#diag-tooltip.visible { opacity: 1; }
#diag-tooltip .dt-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--g100);
  margin-bottom: 4px;
}
#diag-tooltip .dt-desc {
  font-size: 11px;
  font-weight: 300;
  color: var(--g400);
  line-height: 1.5;
}

/* Philosophy cards */
.philosophy-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.philosophy-card {
  background: #0d0d14;
  border: 1px solid #1a1a22;
  border-radius: 10px;
  padding: 24px;
  transition: border-color 0.2s;
}
.philosophy-card:hover { border-color: rgba(200, 54, 78, 0.2); }

.philosophy-card h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--g100);
  margin-bottom: 10px;
  line-height: 1.3;
}
.philosophy-card p {
  font-size: 14px;
  font-weight: 300;
  color: var(--g400);
  line-height: 1.7;
}

/* ─────────────────────────────────────────────────────────────
   SCREEN 5 — ABOUT
   ───────────────────────────────────────────────────────────── */
#screen-5 {
  padding: 120px 32px 80px;
}
#screen-5 .section-inner { max-width: 800px; }

.about-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 16px;
}

.about-heading {
  font-family: var(--font-d);
  font-size: 36px;
  color: var(--g100);
  margin-bottom: 48px;
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
}

.about-text p {
  font-size: 15px;
  font-weight: 300;
  color: var(--g300);
  line-height: 1.85;
  margin-bottom: 20px;
}

.about-emails {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 32px;
}

.email-link {
  color: var(--red);
  font-family: var(--font-b);
  font-size: 13px;
  font-weight: 400;
  text-decoration: none;
  letter-spacing: 0.2px;
  transition: text-decoration 0.15s;
}
.email-link:hover {
  text-decoration: underline;
}

.about-detail-item { margin-bottom: 24px; }

.about-detail-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--g400);
  margin-bottom: 6px;
}
.about-detail-value {
  font-size: 14px;
  color: var(--g200);
  line-height: 1.6;
}

/* ── Footer ──────────────────────────────────────────────── */
footer {
  border-top: 1px solid #1a1a22;
  padding: 24px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0, 0, 5, 0.88);
  pointer-events: auto;
}
footer span {
  font-size: 12px;
  color: var(--g400);
  letter-spacing: 0.3px;
}

/* ── Mobile (content) ────────────────────────────────────── */
@media (max-width: 768px) {
  #hero-transition { padding: 40px 20px 60px; }
  .hero-headline { font-size: 28px; }
  .hero-stats { gap: 20px; flex-wrap: wrap; justify-content: center; }
  #screen-2 { padding: 60px 20px 80px; }
  #screen-3 { padding: 80px 20px 80px; }
  #architecture-diagram { height: 900px; }
  #screen-5 { padding: 80px 20px 60px; }

  .hook-text { font-size: 22px; }
  .killshot { font-size: 32px; }
  .atlas-reveal { font-size: 28px; }
  .atlas-logo-large { font-size: 40px; letter-spacing: 8px; }
  .dramatic-text.large { font-size: 22px; }

  .layer-card { grid-template-columns: 1fr; gap: 8px; }
  .philosophy-grid { grid-template-columns: 1fr; gap: 12px; }
  .about-grid { grid-template-columns: 1fr; gap: 40px; }

  footer { flex-direction: column; gap: 8px; text-align: center; }
}
