/* LévyQuant hub — shared navy / mint / grid palette (matches rexy.levyquant.ai). */
:root {
  color-scheme: dark;
  --bg: #0b1420;
  --nav-bg: #101d2a;
  --card: #132231;
  --text: #e3edf4;
  --text-light: #adbdca;
  --accent: #9cf0df;
  --accent-hover: #c2fff1;
  --on-accent: #102530;
  --divider: #2e4356;
  --grid: rgba(156, 240, 223, 0.033);
  --glow: rgba(70, 149, 164, 0.13);
  --spark: #ffb27a;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: "IBM Plex Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f8fa;
  --nav-bg: #eaf2f5;
  --card: #fff;
  --text: #14283a;
  --text-light: #3b5668;
  --accent: #006b67;
  --accent-hover: #005451;
  --on-accent: #fff;
  --divider: #c2d4de;
  --grid: rgba(0, 107, 103, 0.045);
  --glow: rgba(114, 184, 190, 0.16);
  --spark: #b5541c;
}

* {
  box-sizing: border-box;
}

html {
  scroll-padding-top: 4.5rem;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  background-color: var(--bg);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
  color: var(--text);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.65;
}

/* Language switch: English by default, Chinese on request. */
/* Buttons are excluded: the language button is tagged with the language it names. */
html[data-lang="en"] [lang="zh"]:not(button),
html[data-lang="zh"] [lang="en"]:not(button) {
  display: none !important;
}

a {
  color: var(--accent);
  text-decoration: none;
}

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

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 16px;
}

.skip {
  position: absolute;
  left: -999px;
}

.skip:focus {
  left: 16px;
  top: 8px;
  z-index: 20;
  padding: 0.4rem 0.8rem;
  background: var(--accent);
  color: var(--on-accent);
}

/* Navigation */
.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--nav-bg);
  border-bottom: 1px solid var(--divider);
}

.nav .wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 3.5rem;
  flex-wrap: wrap;
}

.brand {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--text);
  letter-spacing: 0.01em;
}

.brand b {
  color: var(--accent);
  font-weight: 600;
}

.nav-links {
  display: flex;
  gap: 1.1rem;
  margin-left: auto;
  flex-wrap: wrap;
}

.nav-links a {
  color: var(--text-light);
  font-size: 0.93rem;
}

.nav-links a:hover {
  color: var(--accent);
  text-decoration: none;
}

.controls {
  display: flex;
  gap: 0.4rem;
}

.controls button {
  font: inherit;
  font-family: var(--mono);
  font-size: 0.8rem;
  padding: 0.25rem 0.6rem;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--divider);
  border-radius: 4px;
  cursor: pointer;
}

.controls button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Hero */
.hero {
  padding: 4.5rem 0 3rem;
  background: radial-gradient(ellipse at 75% 20%, var(--glow), transparent 60%);
  border-bottom: 1px solid var(--divider);
}

.eyebrow {
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.9rem;
}

h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.15;
  margin: 0 0 1rem;
  max-width: 18em;
  font-weight: 600;
}

.lede {
  font-size: 1.12rem;
  color: var(--text-light);
  max-width: 40em;
  margin: 0 0 1.8rem;
}

.cta {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-block;
  padding: 0.6rem 1.15rem;
  border-radius: 4px;
  border: 1px solid var(--accent);
  font-weight: 500;
  font-size: 0.97rem;
}

.btn.primary {
  background: var(--accent);
  color: var(--on-accent);
}

.btn.primary:hover {
  background: var(--accent-hover);
  color: var(--on-accent);
  text-decoration: none;
}

.btn:hover {
  text-decoration: none;
}

/* Animated backdrop (assets/hero.js): Lévy–OU path and Rips complex in the
   hero's bottom strip, and a wireframe torus beside the hero copy. */
.has-quant-backdrop {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.has-quant-backdrop > *:not(.quant-backdrop) {
  position: relative;
  z-index: 1;
}

.quant-backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  animation: lq-fade-in 1.2s ease-out both;
}

.hero {
  position: relative;
  padding-bottom: 8rem;
}

.hero-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 1.5rem;
  align-items: center;
}

.hero-torus {
  height: 260px;
}

.hero .strip-label,
.has-quant-backdrop > .strip-label {
  position: absolute;
  right: 16px;
  bottom: 0.5rem;
  z-index: 2;
  margin: 0;
  padding: 0.1rem 0.45rem;
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-light);
  background: var(--card);
  border: 1px solid var(--divider);
  border-radius: 4px;
  pointer-events: none;
}

@keyframes lq-fade-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes lq-rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

/* Entrance: hero copy line by line, then the cards. */
.hero-copy > * {
  animation: lq-rise 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.hero-copy > :nth-child(2) {
  animation-delay: 0.06s;
}

.hero-copy > :nth-child(3) {
  animation-delay: 0.12s;
}

.hero-copy > :nth-child(4) {
  animation-delay: 0.18s;
}

.card {
  animation: lq-rise 0.55s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.grid > .card:nth-child(2) {
  animation-delay: 0.05s;
}

.grid > .card:nth-child(3) {
  animation-delay: 0.1s;
}

.grid > .card:nth-child(4) {
  animation-delay: 0.15s;
}

.grid > .card:nth-child(5) {
  animation-delay: 0.2s;
}

a.card:hover,
a.card:focus-visible {
  box-shadow:
    0 0 0 1px var(--accent),
    0 10px 28px -14px var(--accent);
  transform: translateY(-2px);
}

.grid.systems-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 900px) {
  .grid.systems-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .grid.systems-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 900px) {
  .hero-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero-torus {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .quant-backdrop,
  .hero-copy > *,
  .card {
    animation: none !important;
    transition: none !important;
  }

  a.card:hover,
  a.card:focus-visible {
    transform: none;
  }
}
/* Sections */
section {
  padding: 3.2rem 0;
}

section + section {
  border-top: 1px solid var(--divider);
}

.label {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-light);
  margin: 0 0 0.4rem;
}

h2 {
  font-size: 1.6rem;
  margin: 0 0 0.6rem;
  font-weight: 600;
}

.intro {
  color: var(--text-light);
  max-width: 44em;
  margin: 0 0 1.6rem;
}

.grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--divider);
  border-radius: 6px;
  padding: 1.1rem 1.15rem 1.2rem;
}

a.card {
  color: inherit;
}

a.card:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.card h3 {
  margin: 0 0 0.4rem;
  font-size: 1.08rem;
  font-weight: 600;
  color: var(--text);
}

.card p {
  margin: 0;
  color: var(--text-light);
  font-size: 0.94rem;
}

.card .host {
  margin-top: auto;
  padding-top: 0.9rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--accent);
  overflow-wrap: anywhere;
}

.tag {
  align-self: flex-start;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.1rem 0.45rem;
  margin-bottom: 0.7rem;
  border: 1px solid var(--divider);
  border-radius: 3px;
  color: var(--text-light);
}

.tag.live {
  color: var(--accent);
  border-color: var(--accent);
}

.tag.sim {
  color: var(--spark);
  border-color: var(--spark);
}

.num {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--divider);
}

.list li {
  display: flex;
  gap: 1rem;
  align-items: baseline;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--divider);
  flex-wrap: wrap;
}

.list time,
.list .kind {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-light);
  min-width: 6.5rem;
}

.person {
  max-width: 26rem;
}

footer {
  border-top: 1px solid var(--divider);
  background: var(--nav-bg);
  padding: 1.8rem 0 2.2rem;
  color: var(--text-light);
  font-size: 0.86rem;
}

footer p {
  margin: 0 0 0.5rem;
  max-width: 56em;
}

@media (max-width: 720px) {
  .nav-links {
    order: 3;
    width: 100%;
    margin-left: 0;
    gap: 0.9rem;
    padding-bottom: 0.6rem;
  }

  .controls {
    margin-left: auto;
  }

  .hero {
    padding-top: 3rem;
  }

  html {
    scroll-padding-top: 8rem;
  }
}

@media print {
  /* Dark-theme text would print pale on white paper: print with the light palette. */
  :root,
  html[data-theme="light"] {
    color-scheme: light;
    --bg: #fff;
    --nav-bg: #fff;
    --card: #fff;
    --text: #14283a;
    --text-light: #3b5668;
    --accent: #006b67;
    --accent-hover: #005451;
    --on-accent: #fff;
    --divider: #c2d4de;
    --spark: #b5541c;
  }

  body {
    background-image: none;
  }

  .hero {
    background: none;
  }

  .quant-backdrop,
  .hero-torus,
  .strip-label {
    display: none;
  }

  .nav,
  .controls {
    display: none;
  }
}
