/* Kelvin website: design system and page layout.
   Component demos live in assets/demos/<name>.{css,js} and only use the tokens below. */

:root {
  color-scheme: dark;

  /* page */
  --bg: #07080b;
  --bg-raise: #0d1016;
  --panel: rgba(255, 255, 255, 0.025);
  --panel-hi: rgba(255, 255, 255, 0.05);
  --line: rgba(255, 255, 255, 0.075);
  --line-hi: rgba(255, 255, 255, 0.14);
  --text: #f2f5f9;
  --text-2: rgba(242, 245, 249, 0.64);
  --text-3: rgba(242, 245, 249, 0.42);

  /* Kelvin brand (from the app's own assets) */
  --accent: #5aa2e6;          /* dark-mode accent */
  --accent-soft: rgba(90, 162, 230, 0.14);
  --snow: #8cc4f2;            /* snowflake in the mark */
  --brand: #2f6fb0;           /* the cat */
  --ice: #e8f2fc;             /* mark background */

  /* status */
  --ok: #46c48a;
  --warn: #f2a54a;
  --danger: #ee6a6a;

  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --maxw: 1180px;
  --gutter: clamp(16px, 4vw, 40px);
  --radius: 22px;
  --radius-sm: 12px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* ---------- base ---------- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 96px; overflow-x: clip; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
p { margin: 0; }
h1, h2, h3 { margin: 0; font-weight: 500; }
::selection { background: rgba(90, 162, 230, 0.35); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 8px; }

.wrap { width: min(100% - 2 * var(--gutter), var(--maxw)); margin-inline: auto; }
.mono { font-family: var(--mono); }
.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;
}
.skip {
  position: absolute; left: 16px; top: -48px; z-index: 100;
  background: #fff; color: #000; padding: 8px 14px; border-radius: 999px; font-weight: 500;
}
.skip:focus { top: 12px; }

/* ---------- nav ---------- */

.nav {
  position: fixed; z-index: 50; top: 14px; left: 50%;
  width: min(100% - 24px, 1040px);
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px;
  height: 56px; padding: 0 10px 0 16px;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: background 0.35s var(--ease), border-color 0.35s var(--ease), backdrop-filter 0.35s var(--ease);
}
.nav.is-scrolled {
  background: rgba(13, 16, 22, 0.72);
  border-color: var(--line);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 17px; letter-spacing: -0.01em; }
.brand img { width: 28px; height: 28px; border-radius: 8px; }
.nav-links { display: flex; gap: 4px; margin-left: auto; }
.nav-links a {
  font-size: 14.5px; color: var(--text-2); padding: 8px 14px; border-radius: 999px;
  transition: color 0.2s, background 0.2s;
}
.nav-links a:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.nav-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.nav .btn-quiet { background: transparent; border-color: transparent; color: var(--text-2); }
.nav .btn-quiet:hover, .nav .btn-quiet[aria-current="page"] { color: var(--text); background: rgba(255, 255, 255, 0.07); }
@media (max-width: 480px) {
  .nav { gap: 6px; padding: 0 8px 0 12px; }
  .nav .btn { height: 36px; padding: 0 11px; font-size: 13.5px; }
  .nav-actions { gap: 2px; }
}
@media (max-width: 540px) { .brand-name { display: none; } }
.nav .btn { height: 38px; padding: 0 16px; font-size: 14px; }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 46px; padding: 0 22px; border-radius: 999px;
  font-weight: 500; font-size: 15px; letter-spacing: -0.005em; white-space: nowrap;
  border: 1px solid transparent; cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.2s var(--ease), color 0.2s;
}
.btn:active { transform: scale(0.98); }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: #fff; color: #090b0e; }
.btn-primary:hover { background: var(--ice); }
.btn-ghost { background: rgba(255, 255, 255, 0.04); border-color: var(--line-hi); color: var(--text); }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.08); }

/* ---------- hero ---------- */

.hero { position: relative; padding: clamp(100px, 13vh, 140px) 0 0; text-align: center; isolation: isolate; }
.hero-sky {
  position: absolute; inset: 0 0 auto 0; height: min(1180px, 140vh); z-index: -1; overflow: hidden;
  background:
    radial-gradient(70% 55% at 50% -5%, rgba(47, 111, 176, 0.62), transparent 72%),
    radial-gradient(35% 35% at 12% 18%, rgba(140, 196, 242, 0.10), transparent 70%),
    radial-gradient(35% 35% at 88% 12%, rgba(90, 162, 230, 0.12), transparent 70%),
    linear-gradient(180deg, #0f1c30 0%, #0a0f18 45%, var(--bg) 82%);
}
.hero-sky::after { /* faint graticule, like an oscilloscope screen */
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(60% 50% at 50% 30%, #000 0%, transparent 75%);
  mask-image: radial-gradient(60% 50% at 50% 30%, #000 0%, transparent 75%);
}
.hero h1 { letter-spacing: -0.035em; line-height: 1.02; }
.hero h1 .name { display: block; font-size: clamp(52px, 7.4vw, 92px); font-weight: 500; }
.hero h1 .tag {
  display: block; margin-top: 14px;
  font-size: clamp(24px, 3.3vw, 40px); font-weight: 400; letter-spacing: -0.025em; line-height: 1.15;
  color: rgba(242, 245, 249, 0.86);
}
.hero-sub {
  max-width: 640px; margin: 26px auto 0;
  font-size: clamp(16px, 1.6vw, 18px); line-height: 1.65; color: var(--text-2);
}
.hero-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 34px; }
.hero-note { margin-top: 16px; font-size: 13.5px; color: var(--text-3); }

/* stage for the big product window */
.stage {
  position: relative; margin: clamp(36px, 4.5vw, 56px) auto 0; perspective: 2000px; animation: stage-in 1s 0.25s var(--ease) both;
  /* the whole window fits on one screen: never wider than the window's height allows (16:10.2 plus the nav) */
  width: min(100% - 2 * var(--gutter), 1040px, (100vh - 150px) * 1.57);
  width: min(100% - 2 * var(--gutter), 1040px, (100svh - 150px) * 1.57);
}
@keyframes stage-in { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
.stage::before { /* light spill under the window */
  content: ""; position: absolute; left: 8%; right: 8%; top: 12%; bottom: -6%; z-index: -1;
  background: radial-gradient(50% 50% at 50% 50%, rgba(90, 162, 230, 0.32), transparent 70%);
  filter: blur(40px);
}
.demo-caption { margin: 22px 0 0; text-align: center; font-size: 13px; color: var(--text-3); }
.stage-tilt {
  transform-origin: 50% 0%;
  transform: rotateX(calc(var(--tilt, 0) * 10deg)) scale(calc(1 - var(--tilt, 0) * 0.03));
  transition: transform 0.12s linear;
  will-change: transform;
}

/* ---------- sections ---------- */

.section { padding: clamp(96px, 13vw, 168px) 0 0; }
.section-head { text-align: center; max-width: 760px; margin: 0 auto clamp(40px, 6vw, 64px); }
.section-head h2, .feature-text h2 {
  font-size: clamp(32px, 4.4vw, 52px); line-height: 1.08; letter-spacing: -0.03em;
}
.section-head p, .feature-text p { margin-top: 18px; font-size: clamp(16px, 1.5vw, 18px); line-height: 1.65; color: var(--text-2); }

/* a feature: text beside a live demo */
.feature {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(32px, 5vw, 72px); align-items: center;
}
.feature--flip { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
.feature--flip .feature-text { order: 2; }
.feature-text { max-width: 480px; }
.feature-points { list-style: none; margin: 26px 0 0; padding: 0; display: grid; gap: 12px; }
.feature-points li { position: relative; padding-left: 22px; color: var(--text-2); font-size: 15.5px; line-height: 1.55; }
.feature-points li::before {
  content: ""; position: absolute; left: 0; top: 0.62em; width: 8px; height: 8px; border-radius: 50%;
  border: 1.5px solid var(--accent);
}
.feature-points b { color: var(--text); font-weight: 500; }
@media (max-width: 920px) {
  .feature, .feature--flip { grid-template-columns: 1fr; }
  .feature--flip .feature-text { order: 0; }
  .feature-text { max-width: 640px; }
}

/* a feature: text on top, wide demo below */
.feature-wide .feature-text { max-width: 720px; margin: 0 auto clamp(36px, 5vw, 56px); text-align: center; }
.section--tight { padding-top: clamp(48px, 7vw, 88px); }

/* three short points under a wide demo */
.points-row { list-style: none; margin: clamp(32px, 4vw, 48px) 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; }
.points-row li { padding-top: 18px; border-top: 1px solid var(--line); color: var(--text-2); font-size: 15.5px; line-height: 1.6; }
.points-row b { display: block; margin-bottom: 4px; color: var(--text); font-weight: 500; }
@media (max-width: 920px) { .points-row { grid-template-columns: 1fr; gap: 20px; } }

.fineprint, .feature-text .fineprint, .card > p.fineprint { margin-top: 20px; font-size: 13.5px; line-height: 1.55; color: var(--text-3); }
.fineprint.center { text-align: center; margin-top: 32px; }

/* two cards side by side */
.duo { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
@media (max-width: 920px) { .duo { grid-template-columns: 1fr; } }

/* ---------- cards ---------- */

.card {
  position: relative; overflow: hidden; isolation: isolate;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(24px, 3.4vw, 40px);
}
.card::before { /* soft light that follows the pointer */
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: 0;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 0%), rgba(90, 162, 230, 0.10), transparent 60%);
  transition: opacity 0.4s var(--ease);
}
.card:hover::before { opacity: 1; }
.card h3 { font-size: clamp(21px, 2vw, 24px); letter-spacing: -0.02em; line-height: 1.2; }
.card > p { margin-top: 12px; color: var(--text-2); font-size: 15.5px; line-height: 1.6; max-width: 520px; }
.card .demo { margin-top: 28px; }

/* every demo sits in one of these */
.demo { position: relative; }
.demo-frame {
  position: relative; overflow: hidden;
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: 16px;
}

/* ---------- instruments marquee ---------- */

.marquee {
  position: relative; overflow: hidden; margin-top: 8px;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
}
.marquee + .marquee { margin-top: 12px; }
.marquee-track { display: flex; gap: 12px; width: max-content; animation: marquee var(--marquee-time, 60s) linear infinite; }
.marquee--rev .marquee-track { animation-direction: reverse; }
.marquee:hover .marquee-track { animation-play-state: paused; }
.chip {
  display: inline-flex; align-items: center; gap: 10px; white-space: nowrap;
  height: 44px; padding: 0 18px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel);
  font: 400 14px/1 var(--mono); color: var(--text-2);
}
.chip i { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 10px var(--ok); }
@keyframes marquee { to { transform: translateX(calc(-50% - 6px)); } }

/* ---------- closing ---------- */

.closing { position: relative; text-align: center; padding: clamp(120px, 16vw, 200px) 0 clamp(96px, 12vw, 150px); isolation: isolate; }
.closing::before {
  content: ""; position: absolute; left: 50%; top: 50%; z-index: -1;
  width: min(900px, 100%); height: 420px; transform: translate(-50%, -50%);
  background: radial-gradient(50% 50% at 50% 50%, rgba(47, 111, 176, 0.45), transparent 70%);
  filter: blur(30px);
}
.closing img { width: 72px; height: 72px; border-radius: 20px; margin: 0 auto 30px; box-shadow: 0 20px 60px rgba(47, 111, 176, 0.45); }
.closing h2 { font-size: clamp(34px, 5vw, 60px); letter-spacing: -0.035em; line-height: 1.06; }
.closing p { margin: 20px auto 0; max-width: 560px; color: var(--text-2); font-size: clamp(16px, 1.5vw, 18px); }
.closing .hero-cta { margin-top: 36px; }
.closing .closing-links { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 22px; font-size: 14.5px; color: var(--text-3); }
.closing-links a { color: var(--text-2); text-decoration: underline; text-decoration-color: rgba(255, 255, 255, 0.25); text-underline-offset: 3px; }
.closing-links a:hover { color: var(--text); }

/* ---------- footer ---------- */

.footer { border-top: 1px solid var(--line); padding: 28px 0 40px; color: var(--text-3); font-size: 13.5px; }
.footer .wrap { display: flex; gap: 20px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.footer .brand { font-size: 15px; color: var(--text-2); }
.footer .brand img { width: 22px; height: 22px; border-radius: 6px; }
.footer-tag { margin-left: 6px; font-weight: 400; color: var(--text-3); }
.footer nav { display: flex; gap: 20px; flex-wrap: wrap; }
.footer a:hover { color: var(--text); }

/* ---------- reveal on scroll (only when JS runs) ---------- */

.js .reveal { opacity: 0; transform: translateY(28px); transition: opacity 1s var(--ease), transform 1s var(--ease); }
.js .reveal.is-in { opacity: 1; transform: none; }
.js .reveal[data-delay="1"] { transition-delay: 0.08s; }
.js .reveal[data-delay="2"] { transition-delay: 0.16s; }
.js .reveal[data-delay="3"] { transition-delay: 0.24s; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .demo-caption { margin: 22px 0 0; text-align: center; font-size: 13px; color: var(--text-3); }
.stage-tilt { transform: none !important; }
  .stage { animation: none; }
  .marquee-track { animation: none; }
}

/* ---------- contact page ---------- */

.contact { position: relative; isolation: isolate; min-height: calc(100vh - 90px); padding: clamp(120px, 16vh, 160px) 0 80px; }
.contact .hero-sky { height: 760px; }
.contact-wrap { max-width: 640px; }
.contact h1 { font-size: clamp(40px, 6vw, 64px); font-weight: 500; letter-spacing: -0.035em; line-height: 1.05; }
.contact-sub { margin-top: 16px; font-size: 17px; line-height: 1.6; color: var(--text-2); }
.about-cta { justify-content: flex-start; margin-top: 32px; }
.contact-form { margin-top: 36px; display: grid; gap: 18px; }
.contact-form label { display: grid; gap: 8px; font-size: 14px; color: var(--text-2); }
.contact-form input, .contact-form textarea {
  font: inherit; font-size: 16px; color: var(--text); background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line-hi); border-radius: 12px; padding: 12px 14px; outline: none;
  transition: border-color 0.2s, background 0.2s;
}
.contact-form input:focus, .contact-form textarea:focus { border-color: var(--accent); background: rgba(255, 255, 255, 0.05); }
.contact-form textarea { min-height: 150px; resize: vertical; }
.contact-form .btn { justify-self: start; }
.contact-form .btn:disabled { opacity: 0.6; cursor: progress; }
.form-status { min-height: 1.5em; font-size: 14.5px; color: var(--text-2); }
.form-status.ok { color: var(--ok); }
.form-status.bad { color: var(--danger); }
.contact-form .hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* ---------- labs using Kelvin ---------- */

.labs { padding: 8px 0 72px; text-align: center; }
.labs h2 { font-size: 14px; font-weight: 500; color: var(--text-3); letter-spacing: 0.01em; }
.labs-list { list-style: none; margin: 22px 0 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 18px 48px; }
.labs-list li { display: flex; align-items: center; }
.labs-list img { display: block; width: auto; height: 34px; filter: brightness(0) invert(1); opacity: 0.6; transition: opacity 0.25s; }
.labs-list img:hover { opacity: 0.9; }
.labs-list img.harvard { height: 38px; }
.labs-list img.mit { height: 28px; }
.labs-list img.princeton { height: 32px; }
.labs-list img.berkeley { height: 40px; }
.labs-list img.ucsb { height: 44px; }
@media (max-width: 600px) { .labs-list { gap: 22px 32px; } .labs-list img { transform: scale(0.82); } }
