:root {
  color-scheme: dark;
  --bg: #050713;
  --bg-deep: #03040c;
  --surface: rgba(13, 20, 46, 0.62);
  --surface-solid: #0a1024;
  --text: #eef1ff;
  --muted: #a3accd;
  --faint: #747e9f;
  --line: rgba(158, 174, 235, 0.16);
  --line-strong: rgba(158, 174, 235, 0.28);
  --accent: #8b7cff;
  --accent-soft: #beb6ff;
  --teal: #58e0d0;
  --danger: #ff8a9a;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.45);
  --radius: 18px;
  --max-width: 1120px;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f2f3fa;
  --bg-deep: #e7e9f5;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-solid: #ffffff;
  --text: #171a2d;
  --muted: #565d78;
  --faint: #7b8199;
  --line: rgba(30, 40, 80, 0.13);
  --line-strong: rgba(30, 40, 80, 0.24);
  --accent: #5a49d6;
  --accent-soft: #4436b8;
  --teal: #0f8f83;
  --danger: #b4233a;
  --shadow: 0 28px 70px rgba(38, 45, 90, 0.16);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 75% 55% at 50% -12%, rgba(96, 79, 255, 0.22), transparent 65%),
    radial-gradient(ellipse 55% 42% at 88% 12%, rgba(46, 196, 182, 0.1), transparent 70%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
  background-attachment: fixed;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

html[data-theme="light"] body {
  background-image:
    radial-gradient(ellipse 75% 55% at 50% -12%, rgba(96, 79, 255, 0.12), transparent 65%),
    radial-gradient(ellipse 55% 42% at 88% 12%, rgba(15, 143, 131, 0.08), transparent 70%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
}

a {
  color: var(--accent-soft);
  text-decoration-color: rgba(139, 124, 255, 0.45);
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--text);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 0.65rem 1rem;
  color: #080d20;
  background: var(--teal);
  font-weight: 700;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

.container {
  width: min(100% - 2.5rem, var(--max-width));
  margin-inline: auto;
}

/* Decorative star field -------------------------------------------------- */

.starfield {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.55;
  background-image:
    radial-gradient(1px 1px at 18% 24%, rgba(255, 255, 255, 0.9), transparent),
    radial-gradient(1px 1px at 74% 12%, rgba(255, 255, 255, 0.7), transparent),
    radial-gradient(1.5px 1.5px at 42% 68%, rgba(190, 182, 255, 0.8), transparent),
    radial-gradient(1px 1px at 88% 54%, rgba(255, 255, 255, 0.55), transparent),
    radial-gradient(1px 1px at 9% 78%, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(1.5px 1.5px at 63% 88%, rgba(88, 224, 208, 0.55), transparent);
  background-size: 620px 620px;
  background-repeat: repeat;
  mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, 0.65) 55%, transparent 100%);
}

html[data-theme="light"] .starfield {
  opacity: 0.16;
}

/* Header ----------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(18px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 4.5rem;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.brand:hover {
  color: var(--text);
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  color: var(--accent-soft);
}

.brand-mark svg {
  width: 100%;
  height: 100%;
}

.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface);
  cursor: pointer;
  transition: color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.theme-toggle:hover {
  color: var(--text);
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.theme-toggle .icon {
  width: 1.1rem;
  height: 1.1rem;
}

html[data-theme="dark"] .icon-sun {
  display: none;
}

html[data-theme="light"] .icon-moon {
  display: none;
}

/* Main ------------------------------------------------------------------- */

.main {
  flex: 1;
  padding-block: clamp(3.5rem, 8vw, 7rem);
}

/* Hero ------------------------------------------------------------------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  align-items: center;
  gap: clamp(2rem, 5vw, 5rem);
  min-height: clamp(28rem, 58vh, 42rem);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 1.5rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.eyebrow-dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 4px rgba(88, 224, 208, 0.12), 0 0 18px rgba(88, 224, 208, 0.7);
  animation: pulse 3.2s ease-in-out infinite;
}

.hero h1 {
  margin-bottom: 1.5rem;
  font-size: clamp(2.7rem, 6.2vw, 5.1rem);
  font-weight: 620;
  line-height: 1.02;
  letter-spacing: -0.045em;
}

.accent-text {
  color: var(--accent-soft);
  background-image: linear-gradient(110deg, var(--accent-soft), var(--teal));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.lede {
  max-width: 34rem;
  margin-bottom: 1.6rem;
  color: var(--muted);
  font-size: clamp(1.02rem, 1.4vw, 1.16rem);
  line-height: 1.8;
}

.preview-note {
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 0.65rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--faint);
  background: var(--surface);
  font-size: 0.82rem;
  letter-spacing: 0.01em;
}

/* CSS capsule illustration ----------------------------------------------- */

.capsule-stage {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  min-height: clamp(20rem, 40vw, 31rem);
  isolation: isolate;
}

.capsule-glow {
  position: absolute;
  width: min(70%, 22rem);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(139, 124, 255, 0.34), transparent 68%);
  filter: blur(18px);
  animation: breathe 7s ease-in-out infinite;
}

.capsule {
  position: relative;
  z-index: 2;
  width: clamp(9rem, 18vw, 13rem);
  aspect-ratio: 1;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 26%, rgba(255, 255, 255, 0.95), transparent 9%),
    radial-gradient(circle at 36% 30%, rgba(208, 202, 255, 0.65), transparent 32%),
    radial-gradient(circle at 68% 72%, rgba(20, 25, 55, 0.9), transparent 55%),
    linear-gradient(145deg, #b9b2ff 0%, #5f50c8 45%, #171d40 100%);
  box-shadow:
    inset -18px -24px 40px rgba(2, 4, 12, 0.6),
    inset 10px 10px 30px rgba(255, 255, 255, 0.18),
    0 0 80px rgba(112, 96, 255, 0.4),
    var(--shadow);
  animation: float 7s ease-in-out infinite;
}

.capsule-band {
  position: absolute;
  inset: 35% -18%;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  transform: rotate(-22deg);
  box-shadow: 0 0 18px rgba(88, 224, 208, 0.18);
}

.capsule-window {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 31%;
  aspect-ratio: 1;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(190, 255, 248, 0.85), rgba(30, 146, 136, 0.5) 38%, rgba(6, 22, 30, 0.95) 72%);
  box-shadow: 0 0 24px rgba(88, 224, 208, 0.55), inset 0 0 12px rgba(255, 255, 255, 0.25);
  transform: translate(-50%, -50%);
}

.capsule-highlight {
  position: absolute;
  top: 16%;
  left: 24%;
  width: 30%;
  height: 16%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
  filter: blur(6px);
  transform: rotate(-28deg);
}

.orbit {
  position: absolute;
  width: min(90%, 28rem);
  aspect-ratio: 1;
  border: 1px solid rgba(158, 174, 235, 0.18);
  border-radius: 50%;
  transform: rotateX(68deg) rotateZ(0deg);
  animation: orbit 26s linear infinite;
}

.orbit-two {
  width: min(72%, 22rem);
  border-style: dashed;
  border-color: rgba(88, 224, 208, 0.24);
  animation-duration: 19s;
  animation-direction: reverse;
}

.orbit-three {
  width: min(53%, 16rem);
  border-color: rgba(158, 174, 235, 0.1);
  animation-duration: 34s;
}

.spark {
  position: absolute;
  z-index: 3;
  width: 0.35rem;
  height: 0.35rem;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 12px rgba(88, 224, 208, 0.9);
  animation: twinkle 5s ease-in-out infinite;
}

.spark-a {
  top: 18%;
  right: 16%;
}

.spark-b {
  bottom: 22%;
  left: 12%;
  width: 0.22rem;
  height: 0.22rem;
  animation-delay: 1.2s;
}

.spark-c {
  top: 34%;
  left: 8%;
  width: 0.28rem;
  height: 0.28rem;
  background: var(--accent-soft);
  box-shadow: 0 0 12px rgba(190, 182, 255, 0.9);
  animation-delay: 2.1s;
}

.spark-d {
  right: 7%;
  bottom: 32%;
  width: 0.2rem;
  height: 0.2rem;
  animation-delay: 3.3s;
}

/* Principles ------------------------------------------------------------- */

.principles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: clamp(3rem, 8vw, 6rem);
}

.principle {
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset;
}

.principle-index {
  display: block;
  margin-bottom: 1.4rem;
  color: var(--teal);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.75rem;
  letter-spacing: 0.16em;
}

.principle h2 {
  margin-bottom: 0.55rem;
  font-size: 1.02rem;
  font-weight: 620;
  letter-spacing: -0.01em;
}

.principle p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.7;
}

/* Errors ----------------------------------------------------------------- */

.error-page {
  max-width: 38rem;
  margin: clamp(2rem, 8vh, 6rem) auto;
  text-align: center;
}

.error-page h1 {
  margin-bottom: 1rem;
  font-size: clamp(2rem, 5vw, 3.4rem);
  letter-spacing: -0.035em;
}

.error-page .lede {
  margin-inline: auto;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.8rem;
  padding: 0.7rem 1.25rem;
  border: 1px solid transparent;
  border-radius: 999px;
  color: #080d20;
  background: linear-gradient(120deg, var(--accent-soft), var(--teal));
  font-weight: 650;
  text-decoration: none;
  transition: transform 160ms ease, filter 160ms ease;
}

.button:hover {
  color: #080d20;
  filter: brightness(1.08);
  transform: translateY(-1px);
}

/* Footer ----------------------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 55%, transparent);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-block: 1.6rem;
  color: var(--faint);
  font-size: 0.8rem;
}

.footer-inner p {
  margin: 0;
}

.footer-inner p:first-child {
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* Motion ----------------------------------------------------------------- */

@keyframes float {
  0%,
  100% {
    transform: translateY(-0.35rem);
  }
  50% {
    transform: translateY(0.45rem);
  }
}

@keyframes breathe {
  0%,
  100% {
    opacity: 0.65;
    transform: scale(0.94);
  }
  50% {
    opacity: 1;
    transform: scale(1.04);
  }
}

@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 0 0 4px rgba(88, 224, 208, 0.1), 0 0 14px rgba(88, 224, 208, 0.5);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(88, 224, 208, 0.06), 0 0 24px rgba(88, 224, 208, 0.8);
  }
}

@keyframes orbit {
  from {
    transform: rotateX(68deg) rotateZ(0deg);
  }
  to {
    transform: rotateX(68deg) rotateZ(360deg);
  }
}

@keyframes twinkle {
  0%,
  100% {
    opacity: 0.35;
    transform: scale(0.8);
  }
  50% {
    opacity: 1;
    transform: scale(1.15);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Responsive ------------------------------------------------------------- */

@media (max-width: 860px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 1rem;
    min-height: 0;
  }

  .capsule-stage {
    order: -1;
    min-height: 19rem;
  }

  .capsule {
    width: 8rem;
  }

  .orbit {
    width: min(70%, 18rem);
  }

  .orbit-two {
    width: min(56%, 14rem);
  }

  .orbit-three {
    width: min(42%, 10rem);
  }

  .principles {
    grid-template-columns: 1fr;
  }

  .hero h1 br {
    display: none;
  }
}

@media (max-width: 520px) {
  .container {
    width: min(100% - 1.6rem, var(--max-width));
  }

  .header-inner {
    min-height: 4rem;
  }

  .main {
    padding-block: 2.5rem 3.5rem;
  }

  .hero h1 {
    font-size: clamp(2.4rem, 12vw, 3.1rem);
  }

  .lede {
    font-size: 1rem;
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }
}
