/* =========================================================
   Solar System — cinematic, durable motion layer
   Tokens align with site design system (navy · gold · teal)
   ========================================================= */

:root {
  --ss-size: min(720px, 62vw);
  --ss-tilt-x: 62deg;
  --ss-tilt-z: -12deg;
  --ss-sun: 78px;
  --ss-track: rgba(232, 240, 255, 0.16);
  --ss-track-glow: rgba(212, 175, 55, 0.14);
  --ss-ease-spin: linear;
}

.solar-system {
  --ss-px: 0deg;
  --ss-py: 0deg;
  position: absolute;
  right: clamp(-4%, 1vw, 6%);
  top: 46%;
  width: var(--ss-size);
  aspect-ratio: 1;
  transform:
    translateY(-50%)
    rotateX(var(--ss-tilt-x))
    rotateZ(var(--ss-tilt-z))
    rotateY(var(--ss-py))
    rotateX(var(--ss-px));
  transform-style: preserve-3d;
  z-index: 0;
  pointer-events: none;
  opacity: 1;
  will-change: transform;
  transition: transform 0.45s var(--ease, cubic-bezier(0.22, 1, 0.36, 1));
}

.hero:not(.page-hero) .solar-system {
  --ss-size: min(780px, 68vw);
  right: clamp(-6%, -1vw, 4%);
  top: 44%;
}

.page-hero .solar-system {
  --ss-size: min(520px, 55vw);
  opacity: 0.88;
}

/* Ambient glow floor */
.solar-system::before {
  content: "";
  position: absolute;
  inset: 12%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 48%, rgba(240, 193, 90, 0.22), transparent 42%),
    radial-gradient(circle at 50% 55%, rgba(30, 77, 92, 0.28), transparent 62%);
  filter: blur(18px);
  transform: translateZ(-40px);
  z-index: 0;
}

.solar-system::after {
  content: "";
  position: absolute;
  left: 16%;
  right: 16%;
  bottom: 2%;
  height: 22%;
  background: radial-gradient(ellipse at center, rgba(91, 141, 239, 0.22), transparent 70%);
  filter: blur(12px);
  transform: rotateX(90deg) translateZ(-8px);
  z-index: 0;
}

/* ---------- Sun ---------- */
.ss-sun {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--ss-sun);
  height: var(--ss-sun);
  margin: calc(var(--ss-sun) / -2) 0 0 calc(var(--ss-sun) / -2);
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, #fff8d6 0%, #f6d06a 28%, #e8952a 62%, #9a3a0c 100%);
  box-shadow:
    0 0 24px rgba(255, 220, 120, 0.95),
    0 0 60px rgba(240, 160, 50, 0.55),
    0 0 120px rgba(212, 175, 55, 0.28),
    0 0 180px rgba(30, 77, 92, 0.2);
  animation: sun-pulse 4.5s ease-in-out infinite;
  z-index: 20;
  transform: translateZ(12px);
}

.ss-sun::before {
  content: "";
  position: absolute;
  inset: 18%;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, rgba(255, 255, 255, 0.55), transparent 60%);
}

.ss-sun::after {
  content: "";
  position: absolute;
  inset: -28px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 200, 80, 0.4), transparent 68%);
  animation: sun-corona 7s ease-in-out infinite alternate;
  z-index: -1;
}

@keyframes sun-pulse {
  0%, 100% { transform: translateZ(12px) scale(1); filter: brightness(1); }
  50% { transform: translateZ(12px) scale(1.07); filter: brightness(1.12); }
}

@keyframes sun-corona {
  from { transform: scale(0.92); opacity: 0.5; }
  to { transform: scale(1.2); opacity: 0.95; }
}

/* ---------- Static orbital tracks (paths) ---------- */
.ss-track {
  position: absolute;
  left: 50%;
  top: 50%;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  border: 1px solid var(--ss-track);
  box-shadow:
    inset 0 0 24px rgba(91, 141, 239, 0.04),
    0 0 0 1px rgba(212, 175, 55, 0.04);
  z-index: 1;
}

.ss-track::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  border: 1px dashed var(--ss-track-glow);
  opacity: 0.55;
  mask-image: conic-gradient(from 0deg, #000 0 18%, transparent 18% 100%);
  animation: track-sweep 10s linear infinite;
}

@keyframes track-sweep {
  to { transform: rotate(360deg); }
}

.ss-t1 { width: 22%; height: 22%; }
.ss-t2 { width: 34%; height: 34%; }
.ss-t3 { width: 46%; height: 46%; }
.ss-t4 { width: 58%; height: 58%; }
.ss-t5 { width: 72%; height: 72%; }
.ss-t6 { width: 86%; height: 86%; }
.ss-t7 { width: 98%; height: 98%; opacity: 0.75; }

.ss-t2::after { animation-duration: 14s; animation-direction: reverse; }
.ss-t4::after { animation-duration: 18s; }
.ss-t6::after { animation-duration: 24s; animation-direction: reverse; }

/* ---------- Orbiting carriers ---------- */
.ss-orbit {
  --dur: 20s;
  position: absolute;
  left: 50%;
  top: 50%;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transform-style: preserve-3d;
  animation: ss-orbit var(--dur) var(--ss-ease-spin) infinite;
  z-index: 5;
}

@keyframes ss-orbit {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

.ss-o1 { width: 22%; height: 22%; --dur: 7s; animation-delay: -1.2s; }
.ss-o2 { width: 34%; height: 34%; --dur: 11s; animation-delay: -4s; animation-direction: reverse; }
.ss-o3 { width: 46%; height: 46%; --dur: 16s; animation-delay: -7s; }
.ss-o4 { width: 58%; height: 58%; --dur: 22s; animation-delay: -3s; animation-direction: reverse; }
.ss-o5 { width: 72%; height: 72%; --dur: 30s; animation-delay: -11s; }
.ss-o6 { width: 86%; height: 86%; --dur: 40s; animation-delay: -18s; animation-direction: reverse; }
.ss-o7 { width: 98%; height: 98%; --dur: 52s; animation-delay: -9s; }

/* Planet sits on the rim */
.ss-planet-wrap {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translate(-50%, -50%);
  transform-style: preserve-3d;
}

.ss-planet {
  display: block;
  border-radius: 50%;
  position: relative;
  transform-style: preserve-3d;
  animation: ss-face-spin calc(var(--dur) * 0.55) linear infinite reverse;
  box-shadow:
    inset -3px -2px 6px rgba(0, 0, 0, 0.35),
    0 0 16px rgba(255, 255, 255, 0.22);
}

@keyframes ss-face-spin {
  to { transform: rotate(360deg); }
}

/* Motion wake — short trail behind planet */
.ss-planet::before {
  content: "";
  position: absolute;
  left: 55%;
  top: 50%;
  width: 220%;
  height: 55%;
  transform: translateY(-50%);
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.35), transparent 70%);
  opacity: 0.45;
  filter: blur(1.5px);
  z-index: -1;
  pointer-events: none;
}

.ss-o2 .ss-planet,
.ss-o4 .ss-planet,
.ss-o6 .ss-planet {
  animation-direction: normal;
}

/* Planet skins */
.ss-p1 {
  width: 12px;
  height: 12px;
  background: radial-gradient(circle at 30% 28%, #f8fafc, #94a3b8 55%, #475569);
}

.ss-p2 {
  width: 18px;
  height: 18px;
  background: radial-gradient(circle at 30% 28%, #fecdd3, #e11d48 55%, #9f1239);
  box-shadow:
    inset -3px -2px 6px rgba(0, 0, 0, 0.35),
    0 0 20px rgba(225, 29, 72, 0.5);
}

.ss-p3 {
  width: 22px;
  height: 22px;
  background:
    radial-gradient(circle at 28% 26%, #bae6fd, #0284c7 50%, #0c4a6e),
    repeating-linear-gradient(110deg, transparent, transparent 3px, rgba(255,255,255,0.08) 3px, rgba(255,255,255,0.08) 4px);
  box-shadow:
    inset -3px -2px 6px rgba(0, 0, 0, 0.35),
    0 0 22px rgba(14, 165, 233, 0.55);
}

.ss-p3::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 42px;
  height: 10px;
  margin: -5px 0 0 -21px;
  border: 1.5px solid rgba(125, 211, 252, 0.65);
  border-radius: 50%;
  transform: rotateX(68deg);
  box-shadow: 0 0 8px rgba(125, 211, 252, 0.35);
}

.ss-p4 {
  width: 28px;
  height: 28px;
  background:
    radial-gradient(circle at 30% 28%, #fde68a, #d97706 48%, #7c2d12),
    repeating-linear-gradient(95deg, transparent, transparent 4px, rgba(120, 53, 15, 0.25) 4px, rgba(120, 53, 15, 0.25) 6px);
  box-shadow:
    inset -4px -3px 8px rgba(0, 0, 0, 0.4),
    0 0 26px rgba(245, 158, 11, 0.5);
}

.ss-p5 {
  width: 20px;
  height: 20px;
  background: radial-gradient(circle at 30% 28%, #bbf7d0, #059669 55%, #064e3b);
  box-shadow:
    inset -3px -2px 6px rgba(0, 0, 0, 0.35),
    0 0 18px rgba(16, 185, 129, 0.45);
}

.ss-p6 {
  width: 34px;
  height: 34px;
  background:
    radial-gradient(circle at 32% 28%, #fef3c7, #f59e0b 40%, #b45309 70%, #78350f);
  box-shadow:
    inset -4px -3px 8px rgba(0, 0, 0, 0.4),
    0 0 28px rgba(245, 158, 11, 0.4);
}

.ss-p6::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 58px;
  height: 14px;
  margin: -7px 0 0 -29px;
  border: 2px solid rgba(253, 230, 138, 0.55);
  border-radius: 50%;
  transform: rotateX(70deg);
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.35);
}

.ss-p7 {
  width: 16px;
  height: 16px;
  background: radial-gradient(circle at 30% 28%, #e0e7ff, #6366f1 55%, #312e81);
  box-shadow:
    inset -3px -2px 6px rgba(0, 0, 0, 0.35),
    0 0 18px rgba(99, 102, 241, 0.45);
}

/* Moon around planet 2 */
.ss-moon-orbit {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  border-radius: 50%;
  animation: ss-spin-only 3.2s linear infinite;
  border: 1px solid rgba(226, 232, 255, 0.12);
}

@keyframes ss-spin-only {
  to { transform: rotate(360deg); }
}

.ss-moon {
  position: absolute;
  top: 0;
  left: 50%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #e2e8f0;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.75);
  transform: translate(-50%, -50%);
}

/* Asteroid belt */
.ss-belt {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 64%;
  height: 64%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 8px dotted rgba(212, 175, 55, 0.18);
  animation: ss-orbit 55s linear infinite;
  opacity: 0.85;
  z-index: 3;
  box-shadow: inset 0 0 20px rgba(212, 175, 55, 0.06);
}

.ss-belt::before {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  border: 4px dotted rgba(226, 232, 255, 0.1);
  animation: ss-spin-only 38s linear infinite reverse;
}

/* Comets */
.ss-comet {
  position: absolute;
  left: 4%;
  top: 14%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  box-shadow:
    0 0 12px #fff,
    -28px 6px 22px rgba(180, 210, 255, 0.6);
  animation: comet-fly 12s linear infinite;
  opacity: 0;
  z-index: 8;
}

.ss-comet::after {
  content: "";
  position: absolute;
  right: 5px;
  top: 2px;
  width: 64px;
  height: 2px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.85), transparent);
  border-radius: 2px;
  transform: rotate(-14deg);
}

.ss-comet.c2 {
  left: 18%;
  top: 8%;
  animation-delay: -6s;
  animation-duration: 15s;
  width: 5px;
  height: 5px;
}

@keyframes comet-fly {
  0% { transform: translate3d(0, 0, 40px) scale(0.5); opacity: 0; }
  8% { opacity: 1; }
  72% { opacity: 0.8; }
  100% { transform: translate3d(420px, 240px, -20px) scale(1.05); opacity: 0; }
}

/* Hide old emblem when solar system is active */
.hero.has-solar .emblem-3d,
.hero.has-solar .scene-books,
.hero.has-solar .scene-badge {
  opacity: 0;
  visibility: hidden;
}

.hero.has-solar .scene-village {
  opacity: 0.28;
}

.hero.has-solar .orb {
  opacity: 0.45;
}

/* Soften orbs so system reads as main visual */
.hero.has-solar .orb-1 {
  right: -4%;
  width: 380px;
  height: 380px;
}

/* Keep copy readable beside the larger system */
@media (min-width: 1100px) {
  .hero:not(.page-hero).has-solar .hero-content {
    max-width: min(720px, 46%);
  }
}

/* SVG icon helpers (shared) */
.icon-svg {
  width: 1.35em;
  height: 1.35em;
  display: inline-block;
  vertical-align: -0.2em;
  color: currentColor;
}

.pillar-icon .icon-svg,
.purpose-ico .icon-svg,
.social-ico .icon-svg {
  width: 28px;
  height: 28px;
}

.pillar-icon .icon-svg,
.social-ico .icon-svg {
  filter: brightness(0) invert(1);
}

.purpose-ico {
  width: 40px;
  height: 40px;
  margin: 0 auto 0.55rem;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #1e4d5c;
  background: linear-gradient(145deg, rgba(91, 141, 239, 0.12), rgba(212, 175, 55, 0.12));
  border: 1px solid rgba(15, 23, 42, 0.06);
}

.purpose-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.social-ico .icon-svg {
  width: 26px;
  height: 26px;
  color: #fff;
}

.ss-deco {
  position: absolute;
  width: 80px;
  height: 80px;
  opacity: 0.22;
  z-index: 0;
  animation: float-orb 12s ease-in-out infinite;
  pointer-events: none;
  filter: brightness(0) invert(1) sepia(0.35) saturate(1.6) hue-rotate(8deg);
}

.ss-deco.left {
  left: 5%;
  top: 20%;
}

.ss-deco.right {
  right: 6%;
  bottom: 14%;
  animation-delay: -3s;
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  :root {
    --ss-size: min(560px, 58vw);
    --ss-sun: 64px;
  }

  .hero:not(.page-hero) .solar-system {
    --ss-size: min(600px, 64vw);
  }
}

@media (max-width: 900px) {
  :root {
    --ss-size: min(420px, 78vw);
    --ss-sun: 52px;
    --ss-tilt-x: 68deg;
  }

  .solar-system {
    right: -12%;
    top: 38%;
    opacity: 0.72;
  }

  .hero:not(.page-hero) .solar-system {
    --ss-size: min(460px, 82vw);
  }

  .page-hero .solar-system {
    --ss-size: min(360px, 72vw);
    opacity: 0.55;
  }

  .ss-p4 { width: 22px; height: 22px; }
  .ss-p6 { width: 26px; height: 26px; }
  .ss-p6::after { width: 44px; margin-left: -22px; }
}

@media (max-width: 560px) {
  .solar-system {
    right: -18%;
    top: 30%;
    opacity: 0.5;
  }

  .ss-deco {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ss-orbit,
  .ss-planet,
  .ss-belt,
  .ss-belt::before,
  .ss-comet,
  .ss-moon-orbit,
  .ss-sun,
  .ss-sun::after,
  .ss-track::after,
  .ss-deco,
  .solar-system {
    animation: none !important;
    transition: none !important;
  }
}
