/* ---------- tokens ---------- */
:root {
  --bg: #0a0a0f;
  --bg-soft: #0e0e15;
  --panel: rgba(255, 255, 255, 0.03);
  --border: rgba(255, 255, 255, 0.08);
  --accent: #2dd4bf;
  --accent-2: #58a6ff;
  --text: #ececf1;
  --muted: #8b8b99;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;
  --sans: -apple-system, "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
}

/* ---------- base ---------- */
* { box-sizing: border-box; margin: 0; }
html { scroll-behavior: auto; overflow-x: hidden; } /* Lenis owns smoothing */
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.7;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
.mono { font-family: var(--mono); }
.kicker {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--accent);
}
.act { position: relative; padding: 18vh 24px; }
.act-inner { max-width: 1080px; margin: 0 auto; }
.glass {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* ---------- background layers ---------- */
.bg-grid {
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, black 40%, transparent 100%);
}
.beam {
  position: absolute; top: 0; bottom: 0; left: 50%; width: 1px; z-index: -1;
  background: linear-gradient(180deg, transparent, rgba(45,212,191,0.35) 15%, rgba(45,212,191,0.12) 85%, transparent);
  pointer-events: none;
}

/* ---------- nav ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px;
  background: rgba(10,10,15,0.6);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.nav .brand { font-size: 14px; color: var(--accent); font-weight: 700; }
.nav-links { display: flex; gap: 26px; font-size: 14px; color: var(--muted); }
.nav-links a:hover { color: var(--text); }
.lang-toggle {
  font-size: 12px; color: var(--accent);
  background: transparent; border: 1px solid var(--border); border-radius: 999px;
  padding: 5px 13px; cursor: pointer; transition: border-color 0.2s, color 0.2s;
}
.lang-toggle:hover { border-color: var(--accent); color: var(--text); }
@media (max-width: 900px) { .lang-toggle { padding: 4px 10px; font-size: 11px; } }

/* ---------- hero ---------- */
#hero { min-height: 100vh; display: flex; align-items: center; }
.hero-title {
  font-size: clamp(38px, 5vw, 76px);
  font-weight: 800; line-height: 1.15; letter-spacing: -0.02em;
  margin: 24px 0;
}
.hero-title,
.hero-title .hero-word {
  background: linear-gradient(180deg, #fff 60%, rgba(255,255,255,0.55));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-sub { max-width: 560px; color: var(--muted); font-size: 17px; }
.hero-inner { display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 56px; align-items: center; width: 100%; }
.hero-glow {
  position: absolute; right: -8%; top: 12%; width: 720px; height: 720px;
  background: radial-gradient(circle, rgba(45,212,191,0.13), transparent 62%);
  filter: blur(24px); pointer-events: none; z-index: -1;
}
/* The chat window IS the product — tilted glass panel, flattens on hover. */
.hero-window {
  padding: 0; overflow: hidden;
  border-color: rgba(45,212,191,0.22);
  box-shadow: 0 30px 80px rgba(0,0,0,0.55), 0 0 48px rgba(45,212,191,0.07);
  transform: perspective(1200px) rotateY(-9deg) rotateX(2.5deg);
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.hero-window:hover { transform: perspective(1200px) rotateY(0deg) rotateX(0deg); }
.hw-bar {
  display: flex; align-items: center; gap: 7px;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
}
.hw-dot { width: 10px; height: 10px; border-radius: 50%; background: rgba(255,255,255,0.14); }
.hw-title { margin-left: 8px; font-size: 12px; color: var(--muted); letter-spacing: 0.06em; }
.hw-body { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.hw-body .msg { font-size: 13.5px; }
.hw-typing { display: inline-flex; gap: 5px; align-items: center; padding: 13px 15px; }
.hw-typing span {
  width: 6px; height: 6px; border-radius: 50%; background: var(--muted);
  animation: hw-blink 1.2s infinite;
}
.hw-typing span:nth-child(2) { animation-delay: 0.2s; }
.hw-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes hw-blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }
@media (max-width: 1000px) {
  .hero-inner { grid-template-columns: 1fr; gap: 40px; }
  .hero-window { transform: none; }
  .hero-glow { display: none; }
}
@media (prefers-reduced-motion: reduce) { .hw-typing { display: none; } }
.hero-meta { display: flex; gap: 22px; margin-top: 36px; font-size: 12px; color: var(--accent); flex-wrap: wrap; }
.hero-meta span { border: 1px solid var(--border); border-radius: 999px; padding: 6px 14px; }
.scroll-hint { position: absolute; bottom: 32px; left: 50%; transform: translateX(-50%); font-size: 11px; letter-spacing: 0.3em; color: var(--muted); }

/* ---------- what (product intro) ---------- */
#what h2 { font-size: clamp(28px, 4vw, 44px); margin: 14px 0 34px; letter-spacing: -0.01em; }
.what-story { max-width: 720px; display: grid; gap: 22px; }
.what-line { color: var(--muted); font-size: 17px; line-height: 1.85; }
.what-line strong { color: var(--text); font-weight: 600; }
.what-note { font-size: 12px; color: var(--accent); letter-spacing: 0.08em; opacity: 0.85; }

/* ---------- principles ---------- */
.thesis {
  font-size: clamp(34px, 5.5vw, 68px);
  font-weight: 800; line-height: 1.25; letter-spacing: -0.02em;
  margin: 18px 0 14px;
  background: linear-gradient(180deg, #fff 60%, rgba(255,255,255,0.55));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.thesis-lead { color: var(--muted); max-width: 640px; margin-bottom: 28px; }
.principle {
  display: grid; grid-template-columns: 180px 1fr; gap: 28px;
  align-items: center; padding: 56px 0;
  border-bottom: 1px solid var(--border);
}
.p-num {
  font-size: clamp(72px, 10vw, 128px); font-weight: 700; line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1px rgba(45, 212, 191, 0.35);
}
.principle h3 { font-size: 26px; margin-bottom: 8px; }
.principle p { color: var(--muted); max-width: 620px; }
@media (max-width: 900px) {
  .principle { grid-template-columns: 1fr; gap: 8px; padding: 36px 0; }
}

/* ---------- arch (pinned scene) ---------- */
#arch h2 { font-size: clamp(28px, 4vw, 44px); margin: 14px 0 34px; letter-spacing: -0.01em; }
.arch-node rect { filter: drop-shadow(0 0 0 transparent); }
.arch-node.lit rect { filter: drop-shadow(0 0 14px rgba(45,212,191,0.35)); }
.arch-notes { margin-top: 28px; display: grid; gap: 10px; min-height: 88px; }
.arch-note { color: var(--muted); font-size: 15px; opacity: 0.25; transition: opacity 0.3s; }
.arch-note.active { opacity: 1; color: var(--text); }

/* ---------- lifecycle (pinned climax) ---------- */
#lifecycle h2 { font-size: clamp(28px, 4vw, 44px); margin: 14px 0 34px; letter-spacing: -0.01em; }
.ls-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: start; }
.ls-chat { padding: 22px; display: flex; flex-direction: column; gap: 12px; min-height: 420px; }
.msg { max-width: 85%; padding: 10px 14px; border-radius: 12px; font-size: 14px; white-space: pre-line; }
.msg.user { align-self: flex-end; background: rgba(45,212,191,0.12); border: 1px solid rgba(45,212,191,0.3); }
.msg.bot { align-self: flex-start; background: var(--panel); border: 1px solid var(--border); color: var(--muted); }
.msg.card { align-self: flex-start; background: var(--bg-soft); border: 1px solid var(--border); width: 85%; }
.card-title { font-weight: 700; margin-bottom: 6px; }
.pill { display: inline-block; border: 1px solid var(--accent); color: var(--accent); border-radius: 999px; padding: 2px 12px; margin: 6px 6px 0 0; font-size: 12px; font-family: var(--mono); }
.ls-steps { list-style: none; padding: 0; display: grid; gap: 14px; }
.ls-step { padding: 14px 18px; border-left: 2px solid var(--border); color: var(--muted); opacity: 0.35; transition: opacity 0.3s, border-color 0.3s; }
.ls-step .mono { display: block; font-size: 11px; color: var(--accent); letter-spacing: 0.2em; margin-bottom: 4px; }
.ls-step.active { opacity: 1; color: var(--text); border-left-color: var(--accent); }
@media (max-width: 900px) { .ls-wrap { grid-template-columns: 1fr; } }

/* ---------- mechanisms (bento) ---------- */
#mechanisms h2 { font-size: clamp(28px, 4vw, 44px); margin: 14px 0 34px; letter-spacing: -0.01em; }
.bento { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.bento-card { padding: 24px; transition: border-color 0.3s, box-shadow 0.3s; }
.bento-card:hover { border-color: rgba(45,212,191,0.4); box-shadow: 0 0 32px rgba(45,212,191,0.08); }
.bento-card.span-2 { grid-column: span 2; }
.bento-card h3 { font-size: 17px; margin-bottom: 10px; }
.bento-card h3 .mono { color: var(--accent); margin-right: 8px; font-size: 13px; }
.bento-card p { color: var(--muted); font-size: 14px; }
.flow { margin-top: 10px; font-size: 13px; }
.flow code { font-family: var(--mono); background: var(--panel); border: 1px solid var(--border); border-radius: 6px; padding: 1px 7px; font-size: 12px; }
.stop { color: #f87171; } .ok { color: var(--accent); }
.note { margin-top: 8px; font-size: 12px; color: var(--muted); opacity: 0.8; }
@media (max-width: 900px) { .bento { grid-template-columns: 1fr; } .bento-card.span-2 { grid-column: span 1; } }

/* ---------- finale ---------- */
#finale { min-height: 90vh; display: flex; align-items: center; text-align: center; }
.finale-inner { width: 100%; }
.finale-line { font-size: clamp(32px, 5.5vw, 64px); font-weight: 800; line-height: 1.3; margin: 20px 0; letter-spacing: -0.02em; }
.finale-line .eq, .finale-line .plus { color: var(--accent); }
#finale .hero-sub { margin: 0 auto; }
.footer { margin-top: 12vh; font-size: 12px; color: var(--muted); opacity: 0.7; }

@media (min-width: 900px) and (prefers-reduced-motion: no-preference) {
  #lifecycle { padding-top: 9vh; padding-bottom: 0; }
  #lifecycle h2 { margin: 10px 0 22px; }
  .ls-chat {
    max-height: calc(100vh - 230px);
    overflow: hidden;
    justify-content: flex-end; /* latest visible messages hug the bottom, like a real IM window */
  }
}

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .act { padding: 12vh 18px; }
  .nav-links { gap: 16px; font-size: 13px; }
}
@media (max-width: 600px) {
  .nav { flex-wrap: wrap; gap: 8px; padding: 10px 16px; }
  .nav-links { flex-wrap: wrap; gap: 8px 14px; font-size: 12px; }
  .nav-links a { white-space: nowrap; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
