:root {
  --bg: #f7f9fc;
  --text: #0f1729;
  --text-dim: #5b6478;
  --line: #dfe5ef;
  --accent: #3b6ef5;
  --accent-hover: #2d5de0;
  --accent-soft: #e8efff;

  --header-h: 88px;
  --gutter: clamp(16px, 5vw, 96px);
  --col-w: clamp(260px, 28vw, 400px);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0b0e14;
  --text: #eef2f8;
  --text-dim: #98a2b6;
  --line: #262e3d;
  --accent: #5b8bff;
  --accent-hover: #7aa1ff;
  --accent-soft: #1a2440;
  color-scheme: dark;
}

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

html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

a { color: inherit; text-decoration: none; }
svg { flex: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 8px; }

#scene {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  z-index: 0;
  pointer-events: none;
}

.loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 20px;
  background: var(--bg);
  transition: opacity 0.6s ease, visibility 0.6s ease;
}
.loader.is-done { opacity: 0; visibility: hidden; }
.loader__mark { width: 36px; height: 36px; animation: pulse 1.6s ease-in-out infinite; }
.loader__bar {
  width: min(200px, 60vw);
  height: 2px;
  border-radius: 2px;
  background: var(--line);
  overflow: hidden;
}
.loader__bar span {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.2s ease;
}
.loader__text {
  margin: 0;
  max-width: 80vw;
  text-align: center;
  font-size: 13px;
  color: var(--text-dim);
}
@keyframes pulse { 50% { opacity: 0.35; } }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  height: 52px;
  padding: 0 28px;
  border-radius: 999px;
  font: 500 15px/1 var(--font);
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.btn svg { width: 18px; height: 18px; }
.btn .arrow { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.2s ease; }
.btn:hover .arrow { transform: translateX(3px); }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-hover); }
.btn--primary .win-icon { fill: currentColor; width: 16px; height: 16px; }
.btn--outline { border: 1px solid var(--line); background: transparent; color: var(--text); }
.btn--outline:hover { border-color: var(--text-dim); }
.btn--sm { height: 44px; padding: 0 24px; }

.icon-btn {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: color 0.2s ease, background-color 0.2s ease;
}
.icon-btn:hover { color: var(--text); background: var(--accent-soft); }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: block; }

.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  height: var(--header-h);
  padding: 0 var(--gutter);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  transition: background-color 0.3s ease, backdrop-filter 0.3s ease;
}
.header.is-scrolled {
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.header__logo {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 500;
  font-size: 28px;
  letter-spacing: -0.02em;
}
.logo-mark { width: 36px; height: 36px; }

.header__nav {
  display: flex;
  gap: clamp(20px, 4vw, 60px);
  font-size: 15px;
}
.header__nav a {
  position: relative;
  padding: 8px 0;
  color: var(--text-dim);
  transition: color 0.2s ease;
}
.header__nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transition: transform 0.25s ease;
}
.header__nav a:hover { color: var(--text); }
.header__nav a[aria-current="page"] { color: var(--text); font-weight: 500; }
.header__nav a[aria-current="page"]::after { transform: scaleX(1); }

.header__actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 16px;
}

.story { position: relative; z-index: 1; }

.page {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  padding: calc(var(--header-h) + 24px) var(--gutter) 64px;
  display: grid;
  grid-template-columns: var(--col-w) 1fr var(--col-w);
  align-items: center;
  gap: 32px;
}

.eyebrow {
  margin: 0 0 16px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

h1 {
  margin: 0 0 20px;
  font-size: clamp(34px, 3.6vw, 54px);
  line-height: 1.08;
  font-weight: 600;
  letter-spacing: -0.03em;
}
.lead { margin: 0; font-size: clamp(16px, 1.2vw, 18px); color: var(--text-dim); }

.specs { margin: 0; }
.specs div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.specs div:first-child { border-top: 1px solid var(--line); }
.specs dt { color: var(--text-dim); font-size: 14px; }
.specs dd { margin: 0; font-weight: 500; font-size: 15px; text-align: right; }

.scroll-hint {
  position: absolute;
  left: 50%;
  bottom: 32px;
  width: 26px;
  height: 42px;
  margin-left: -13px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
}
.scroll-hint span {
  position: absolute;
  left: 50%;
  top: 8px;
  width: 4px;
  height: 8px;
  margin-left: -2px;
  border-radius: 2px;
  background: var(--text-dim);
  animation: scroll-dot 1.8s ease-in-out infinite;
}
@keyframes scroll-dot { 60% { transform: translateY(12px); opacity: 0; } 100% { opacity: 0; } }

.card {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}
.card__icon {
  flex: none;
  padding-top: 8px;
  color: var(--accent);
}
.card__icon svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.card h2 { margin: 6px 0 12px; font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }
.card p { margin: 0 0 28px; color: var(--text-dim); font-size: 15px; }
.card .meta { margin: 18px 0 0; font-size: 14px; }
.card .meta span { margin: 0 8px; }

.subpage {
  min-height: 100vh;
  min-height: 100svh;
  padding: calc(var(--header-h) + 64px) var(--gutter) 64px;
}

.footer {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 360px)) 1fr;
  gap: 32px;
  padding: 48px var(--gutter);
  border-top: 1px solid var(--line);
  background: var(--bg);
  font-size: 14px;
  color: var(--text-dim);
}
.footer h3 { margin: 0 0 8px; font-size: 14px; font-weight: 600; color: var(--text); }
.footer p { margin: 0; }
.footer a:hover { color: var(--text); }
.footer__copy { align-self: end; justify-self: end; }

.reveal-ready .reveal {
  opacity: 0;
  transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.reveal-ready .col--left.reveal { transform: translateX(-32px); }
.reveal-ready .col--right.reveal { transform: translateX(32px); transition-delay: 0.1s; }
.reveal-ready .reveal.is-visible { opacity: 1; transform: none; }
.page--download,
.story ~ .footer {
  --bg: #ffffff;
  --text: #0f1729;
  --text-dim: #5b6478;
  --line: #dfe5ef;
  --accent: #3b6ef5;
  --accent-hover: #2d5de0;
  --accent-soft: #e8efff;
  color: var(--text);
  color-scheme: light;
}

.page--download {
  align-content: center;
  row-gap: clamp(28px, 5vw, 64px);
  background: #ffffff;
  border-radius: clamp(24px, 3vw, 48px) clamp(24px, 3vw, 48px) 0 0;
  box-shadow: 0 -16px 48px rgba(15, 23, 41, 0.16);
  overflow-x: clip;
}

.story ~ .footer {
  background: #ffffff;
  border-top: 0;
}

.download-gif {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  width: 100%;
  min-width: 0;
}

.download-gif__img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: min(48vh, 480px);
  border-radius: 16px;
}

@media (max-width: 1100px) {
  .header__logo { font-size: 24px; }
  .logo-mark { width: 30px; height: 30px; }
  .card { flex-direction: column; gap: 12px; }
}

@media (max-width: 900px) and (orientation: portrait) {
  :root { --header-h: 108px; }

  .header {
    grid-template-columns: 1fr auto;
    grid-template-rows: 64px 40px;
    padding-top: env(safe-area-inset-top);
    height: calc(var(--header-h) + env(safe-area-inset-top));
    background: color-mix(in srgb, var(--bg) 85%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }
  .header__nav {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: center;
    gap: 28px;
    font-size: 14px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .header__actions { gap: 8px; }

  .page {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(30vh, 1fr) auto;
    align-items: stretch;
    gap: 16px;
    padding-bottom: 48px;
  }
  .col--left { align-self: end; }
  .col--right { align-self: start; }
  #home .col--left { text-align: center; }
  h1 { font-size: 30px; }
  .lead { font-size: 15px; }
  .scroll-hint { display: none; }

  .card { flex-direction: row; gap: 14px; }
  .card__icon { padding-top: 4px; }
  .card__icon svg { width: 22px; height: 22px; }
  .card h2 { margin-top: 2px; font-size: 19px; }
  .card p { margin-bottom: 16px; font-size: 14px; }
  .btn { height: 46px; padding: 0 20px; font-size: 14px; }
  .btn--sm { height: 40px; padding: 0 18px; }

  .footer { grid-template-columns: 1fr; }
  .footer__copy { justify-self: start; }

  .reveal-ready .col--left.reveal { transform: translateY(-20px); }
  .reveal-ready .col--right.reveal { transform: translateY(20px); }
}

@media (prefers-reduced-motion: reduce) {
  @media (max-width: 900px) {
  .page--download {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
    grid-auto-rows: auto;
    align-items: start;
    row-gap: 28px;
  }
  .page--download .col--middle { display: none; }
  .page--download .col--left,
  .page--download .col--right { align-self: start; min-width: 0; }
  .page--download .card { flex-direction: row; gap: 14px; }
  .page--download .card__body { min-width: 0; }
  .page--download .btn { max-width: 100%; }

  .reveal-ready .page--download .col--left.reveal { transform: translateX(-28px); }
  .reveal-ready .page--download .col--right.reveal { transform: translateX(28px); }
  .reveal-ready .page--download .reveal.is-visible { opacity: 1; transform: none; }
}

@media (max-width: 400px) {
  .page--download .btn {
    white-space: normal;
    height: auto;
    min-height: 46px;
    padding-top: 12px;
    padding-bottom: 12px;
    line-height: 1.25;
  }
}
  html { scroll-behavior: auto; }
  .reveal-ready .reveal,
  .reveal-ready .col--left.reveal,
    .reveal-ready .col--right.reveal,
  .reveal-ready .page--download .col--left.reveal,
  .reveal-ready .page--download .col--right.reveal { transform: none; transition: opacity 0.4s ease; }
  .loader__mark, .scroll-hint span { animation: none; }
}
