/* ---------- Tokens ---------- */
:root {
  --bg-0: #0a1120;
  --bg-1: #0d1524;
  --bg-2: #121e31;
  --panel: rgba(12, 20, 35, 0.72);
  --stroke: rgba(167, 186, 216, 0.18);
  --text: #ecf0f3;
  --muted: #aeb8c7;
  --term: #dedfdf;
  --lab: #5e7293;
  --lab-bright: #7d91b6;
  --glow: rgba(125, 145, 182, 0.24);
  --shadow-lg: 0 30px 80px rgba(4, 8, 16, 0.42);
  --shadow-md: 0 18px 40px rgba(2, 5, 11, 0.22);
  --radius-lg: 20px;
  --radius-md: 14px;
  --content-max: 1200px;
  --gutter: clamp(20px, 4vw, 48px);
  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Manrope", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  background:
    radial-gradient(circle at 15% 10%, rgba(125, 145, 182, 0.18), transparent 30%),
    radial-gradient(circle at 85% 5%, rgba(222, 223, 223, 0.06), transparent 22%),
    linear-gradient(135deg, var(--bg-0) 0%, var(--bg-1) 52%, var(--bg-2) 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 80px 80px;
  mask-image: radial-gradient(circle at center, black 40%, transparent 85%);
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

main,
footer {
  position: relative;
  z-index: 1;
}

/* ---------- Utilities ---------- */
.container {
  width: min(calc(100% - (var(--gutter) * 2)), var(--content-max));
  margin-inline: auto;
}

.eyebrow-mono {
  display: inline-block;
  margin: 0 0 18px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--lab-bright);
  text-transform: lowercase;
}

/* ---------- Topbar (skeleton) ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px var(--gutter);
  background: rgba(10, 17, 32, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--stroke);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand > img:first-child {
  width: 28px;
  height: 28px;
  border-radius: 8px;
}

.brand span {
  font-family: var(--font-body);
  font-size: 1.08rem;
  letter-spacing: -0.04em;
  line-height: 1;
}

.brand em {
  color: var(--term);
  font-style: normal;
  font-weight: 200;
}

.brand strong {
  color: var(--lab-bright);
  font-weight: 600;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 0.92rem;
}

.topbar-link {
  color: var(--muted);
  transition: color 160ms ease;
}

.topbar-link:hover,
.topbar-link:focus-visible {
  color: var(--text);
}

.star-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--stroke);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--muted);
  transition: color 160ms ease, border-color 160ms ease;
}

.star-pill:hover,
.star-pill:focus-visible {
  color: var(--text);
  border-color: rgba(167, 186, 216, 0.38);
}

.star-pill__icon {
  color: var(--lab-bright);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease, color 180ms ease;
}

.btn-sm {
  padding: 9px 14px;
  font-size: 0.88rem;
}

.btn-primary {
  color: #07111e;
  background: linear-gradient(135deg, var(--term), #f6f7f7);
}

.btn-primary:hover,
.btn-primary:focus-visible {
  transform: translateY(-1px);
}

.btn-secondary {
  color: var(--text);
  background: linear-gradient(135deg, rgba(95, 114, 147, 0.3), rgba(95, 114, 147, 0.08));
  border-color: rgba(143, 164, 199, 0.3);
}

.btn-secondary:hover,
.btn-secondary:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(143, 164, 199, 0.6);
}

.btn-ghost {
  color: var(--muted);
  border-color: rgba(222, 223, 223, 0.18);
}

.btn-ghost:hover,
.btn-ghost:focus-visible {
  color: var(--text);
  border-color: rgba(222, 223, 223, 0.4);
}

@media (prefers-reduced-motion: reduce) {
  .btn,
  .topbar-link,
  .star-pill {
    transition: none;
  }
  .btn:hover,
  .btn:focus-visible {
    transform: none;
  }
}

@media (max-width: 640px) {
  .topbar {
    padding-inline: 16px;
    gap: 12px;
  }
  .topbar-actions {
    gap: 10px;
    font-size: 0.88rem;
  }
  .star-pill__label {
    display: none;
  }
}

/* ---------- Window chrome (shared) ---------- */
.window-chrome {
  position: relative;
  margin: 0;
  border-radius: 8px;
  overflow: hidden;
  background: #0f1828;
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow-lg);
}

.window-chrome img {
  width: 100%;
  height: auto;
  display: block;
  background: #0f1828;
}

.window-chrome video {
  width: 100%;
  height: auto;
  display: block;
  background: #0f1828;
}

/* ---------- Hero ---------- */
.hero {
  padding: clamp(56px, 9vw, 120px) 0 clamp(40px, 6vw, 72px);
  position: relative;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: clamp(32px, 5vw, 72px);
  align-items: center;
}

.hero-copy {
  max-width: 48ch;
}

.hero-headline {
  margin: 0 0 18px;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.02;
  font-size: clamp(2.4rem, 5.4vw, 4.6rem);
}

.hero-headline span {
  display: block;
}

.hero-headline span:first-child {
  color: var(--lab-bright);
}

.hero-lede {
  margin: 0 0 28px;
  max-width: 40ch;
  color: var(--muted);
  font-size: clamp(1rem, 1.2vw, 1.1rem);
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 22px;
}

.hero-trust {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 6px 12px;
  border: 1px solid var(--stroke);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
}

.hero-trust__icon {
  color: var(--lab-bright);
}

.hero-trust__sep {
  opacity: 0.5;
}

.hero-visual {
  position: relative;
  aspect-ratio: 16 / 11;
}

.hero-glow {
  position: absolute;
  inset: -10% -8% -6% -6%;
  background: radial-gradient(ellipse at 55% 45%, var(--glow), transparent 60%);
  filter: blur(20px);
  z-index: 0;
  pointer-events: none;
}

.hero-back,
.hero-front {
  /* Promote rotated tiles to their own compositing layer so the
     browser uses GPU-side antialiasing on the rotated edges. Without
     this, the window-chrome border + border-radius produce visibly
     jagged diagonals at 2.5° / -1°. */
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.hero-back {
  position: absolute;
  top: 2%;
  left: 0;
  right: 6%;
  transform: rotate(2.5deg) translateZ(0);
  transform-origin: center center;
  z-index: 1;
}

.hero-front {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 68%;
  transform: rotate(-1deg) translateZ(0);
  transform-origin: center center;
  z-index: 2;
}

.hero-ticker {
  margin: clamp(32px, 5vw, 56px) 0 0;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.28em;
  color: var(--muted);
  opacity: 0.55;
}

@media (max-width: 860px) {
  .hero {
    padding-top: clamp(36px, 6vw, 72px);
  }
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .hero-visual {
    order: -1;
    aspect-ratio: 16 / 10;
  }
  .hero-back {
    position: static;
    transform: none;
    margin: 0 auto;
    max-width: 520px;
  }
  .hero-front {
    display: none;
  }
  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .hero-actions .btn {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-back,
  .hero-front {
    transform: none;
  }
}

/* ---------- Tour ---------- */
.tour {
  padding: clamp(56px, 9vw, 120px) 0;
  border-top: 1px solid var(--stroke);
}

.tour-container {
  display: grid;
  gap: clamp(96px, 10vw, 140px);
}

.tour-step {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.4fr);
  gap: clamp(32px, 5vw, 72px);
  align-items: center;
}

.tour-step--img-right > .tour-copy {
  grid-column: 1;
}
.tour-step--img-right > .tour-image {
  grid-column: 2;
}

.tour-step--img-left > .tour-image {
  grid-column: 1;
}
.tour-step--img-left > .tour-copy {
  grid-column: 2;
}

.tour-copy {
  max-width: 44ch;
}

.tour-headline {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.05;
  font-size: clamp(1.7rem, 3vw, 2.4rem);
  color: var(--text);
}

.tour-caption {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.65;
}

.tour-note {
  margin: 14px 0 0;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  color: var(--lab-bright);
  opacity: 0.85;
}

.tour-image {
  box-shadow: var(--shadow-lg);
}

@media (max-width: 860px) {
  .tour-container {
    gap: 48px;
  }
  .tour-step,
  .tour-step--img-left,
  .tour-step--img-right {
    grid-template-columns: 1fr;
    gap: 28px;
  }
  .tour-step--img-left > .tour-image,
  .tour-step--img-left > .tour-copy,
  .tour-step--img-right > .tour-image,
  .tour-step--img-right > .tour-copy {
    grid-column: 1;
  }
  /* Copy above image on mobile regardless of desktop alternation */
  .tour-step--img-left > .tour-copy {
    order: -1;
  }
}

/* ---------- Inside TermLab ---------- */
.inside {
  padding: clamp(56px, 9vw, 120px) 0;
  border-top: 1px solid var(--stroke);
}

.inside-header {
  max-width: 52ch;
  margin-bottom: clamp(28px, 4vw, 48px);
}

.inside-headline {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.025em;
  font-size: clamp(1.3rem, 2.2vw, 1.8rem);
  line-height: 1.25;
  color: var(--text);
}

.inside-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(20px, 3vw, 36px);
}

.inside-card {
  margin: 0;
  display: grid;
  gap: 12px;
}

.inside-card .window-chrome {
  box-shadow: var(--shadow-md);
}

.inside-card figcaption {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--muted);
  letter-spacing: 0.02em;
  text-align: left;
}

@media (max-width: 860px) {
  .inside-grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }
}

/* ---------- Download ---------- */
.download {
  padding: clamp(72px, 10vw, 140px) 0 clamp(56px, 8vw, 100px);
  border-top: 1px solid var(--stroke);
  text-align: center;
}

.download-container {
  max-width: 760px;
}

.download-headline {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  font-size: clamp(2.4rem, 5vw, 4rem);
}

.download-sub {
  margin: 0 0 32px;
  color: var(--muted);
  font-size: 1.05rem;
}

.download-row {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}

.download-row .btn {
  min-width: 180px;
}

.download-info {
  margin: 0 auto;
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--muted);
}

.download-info__sep {
  opacity: 0.5;
}

.download-info__icon {
  color: var(--lab-bright);
}

.download-info__link {
  color: var(--lab-bright);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(125, 145, 182, 0.4);
}

.download-info__link:hover,
.download-info__link:focus-visible {
  color: var(--text);
  text-decoration-color: var(--text);
}

/* When JS hides the date span, also hide the sep that follows it
   so we don't render a double-dot ("·  ·") in the fallback state. */
.download-info__date[hidden] + .download-info__sep {
  display: none;
}

@media (max-width: 640px) {
  .download-row {
    flex-direction: column;
    align-items: stretch;
  }
  .download-row .btn {
    width: 100%;
  }
}

/* ---------- Footer ---------- */
.site-footer {
  padding: 28px 0 48px;
  border-top: 1px solid var(--stroke);
  color: var(--muted);
  font-size: 0.88rem;
}

.site-footer__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.brand--sm img {
  width: 22px;
  height: 22px;
  border-radius: 6px;
}

.brand--sm span {
  font-size: 1rem;
}

.site-footer__links {
  display: flex;
  gap: 18px;
}

.site-footer__links a {
  color: var(--muted);
  transition: color 160ms ease;
}

.site-footer__links a:hover,
.site-footer__links a:focus-visible {
  color: var(--text);
}

.site-footer__note {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 720px) {
  .site-footer__row {
    justify-content: center;
    text-align: center;
  }
  .site-footer__links {
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .site-footer__links a {
    transition: none;
  }
}

/* ---------- Reveal-on-scroll ---------- */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 600ms ease, transform 600ms ease;
  will-change: opacity, transform;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .reveal,
  .reveal.is-visible {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
