/* Kimi K3 — homepage styles. Midnight, moonlight, and one good gold. */

:root {
  --bg: #070a18;
  --panel: rgba(255, 255, 255, .045);
  --line: rgba(255, 255, 255, .09);
  --text: #e9ecf8;
  --muted: #9aa3c5;
  --gold: #ffd97a;
  --gold-2: #ff9d6f;
  --indigo: #8ea0ff;
  --radius: 18px;
  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; }

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

body {
  font-family: var(--font-body);
  color: var(--text);
  background:
    radial-gradient(1100px 700px at 85% -10%, #1c2152 0%, transparent 60%),
    radial-gradient(900px 700px at 5% 110%, #101a3d 0%, transparent 55%),
    var(--bg);
  background-attachment: fixed;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 760px; margin: 0 auto; padding: 0 20px; }

::selection { background: rgba(255, 217, 122, .3); }

a { color: var(--gold); }

/* ---------- nav ---------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(7, 10, 24, .72);
  border-bottom: 1px solid var(--line);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: .02em;
}

.nav-links { display: flex; gap: 4px; }

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: .9rem;
  font-weight: 500;
  padding: 7px 11px;
  border-radius: 999px;
  transition: color .15s ease, background .15s ease;
}

.nav-links a:hover { color: var(--text); background: var(--panel); }

/* ---------- hero ---------- */

.hero { padding: 64px 0 40px; }

.hero-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 28px;
}

.portrait-wrap { display: flex; flex-direction: column; align-items: center; gap: 12px; }

#portrait {
  width: min(66vw, 290px);
  height: auto;
  display: block;
}

.portrait-caption {
  font-size: .8rem;
  color: var(--muted);
  line-height: 1.5;
}

.kicker {
  font-family: var(--font-display);
  font-size: .8rem;
  font-weight: 500;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--indigo);
  margin-bottom: 10px;
}

h1 {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 7vw, 3.4rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -.02em;
}

.gold {
  background: linear-gradient(120deg, var(--gold), var(--gold-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.tagline {
  color: var(--muted);
  font-size: 1.08rem;
  max-width: 34rem;
  margin-top: 14px;
}

.tagline strong { color: var(--text); font-weight: 600; }

.cta {
  display: inline-block;
  margin-top: 24px;
  padding: 12px 26px;
  border-radius: 999px;
  border: 1px solid rgba(255, 217, 122, .45);
  color: var(--gold);
  font-weight: 600;
  font-size: .95rem;
  text-decoration: none;
  transition: background .15s ease, transform .15s ease;
}

.cta:hover { background: rgba(255, 217, 122, .1); transform: translateY(-2px); }

/* ---------- sections ---------- */

section { padding: 56px 0 8px; }

h2 {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 4.5vw, 2rem);
  font-weight: 700;
  letter-spacing: -.01em;
  margin-bottom: 18px;
}

h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 8px;
}

section p { color: #c6cbe4; margin-bottom: 14px; }
section p.fine { color: var(--muted); font-size: .85rem; }

/* ---------- cards ---------- */

.cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  transition: transform .18s ease, border-color .18s ease;
}

.card:hover { transform: translateY(-3px); border-color: rgba(255, 217, 122, .35); }

.card h3 { color: var(--gold); }
.card p { margin: 0; font-size: .95rem; color: #c6cbe4; }

/* ---------- chat demo ---------- */

.demo-intro { max-width: 38rem; }

.chat {
  margin-top: 22px;
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
}

.chat-head {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(0, 0, 0, .2);
}

.dot { width: 10px; height: 10px; border-radius: 50%; background: rgba(255,255,255,.18); }
.dot:first-child { background: rgba(255, 157, 111, .7); }
.dot:nth-child(2) { background: rgba(255, 217, 122, .7); }
.dot:nth-child(3) { background: rgba(142, 160, 255, .7); }

.chat-title {
  margin-left: 8px;
  font-size: .78rem;
  color: var(--muted);
  font-family: var(--font-mono);
}

.chat-log {
  position: relative;
  padding: 18px 16px 8px;
  max-height: 420px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.msg {
  max-width: 88%;
  padding: 12px 15px;
  border-radius: 16px;
  font-size: .94rem;
  line-height: 1.6;
  overflow-wrap: break-word;
}

.msg.kimi {
  align-self: flex-start;
  background: rgba(142, 160, 255, .1);
  border: 1px solid rgba(142, 160, 255, .22);
  border-bottom-left-radius: 4px;
}

.msg.user {
  align-self: flex-end;
  background: rgba(255, 217, 122, .13);
  border: 1px solid rgba(255, 217, 122, .3);
  border-bottom-right-radius: 4px;
}

.msg pre {
  margin: 10px 0;
  padding: 14px 16px;
  background: #0a0e24;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: .8rem;
  line-height: 1.55;
  color: #cdd6ff;
}

.msg pre::before {
  content: attr(data-lang);
  display: block;
  font-size: .68rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.msg code { font-family: var(--font-mono); }

.msg p + p { margin-top: 8px; }

.caret {
  display: inline-block;
  width: 8px;
  height: 1.05em;
  margin-left: 2px;
  vertical-align: text-bottom;
  background: var(--gold);
  animation: blink-caret .8s steps(1) infinite;
}

@keyframes blink-caret { 50% { opacity: 0; } }

/* The live button from the demo answer */

.moon-btn {
  display: inline-block;
  margin: 6px 0;
  padding: .8em 1.6em;
  border: 0;
  border-radius: 999px;
  font: 600 1rem/1 var(--font-body);
  color: #10142c;
  cursor: pointer;
  background: linear-gradient(135deg, #ffd97a, #ff9d6f);
  box-shadow: 0 6px 24px rgba(255, 183, 110, .35);
  transition: transform .15s ease, box-shadow .15s ease;
}

.moon-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 32px rgba(255, 183, 110, .5); }
.moon-btn:active { transform: translateY(0); }

.particle {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 5;
}

/* chips + form */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px 4px;
}

.chips button {
  font: 500 .84rem var(--font-body);
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}

.chips button:hover:not(:disabled) { border-color: rgba(255, 217, 122, .5); background: rgba(255, 217, 122, .08); }
.chips button:disabled { opacity: .45; cursor: default; }

.chat-form {
  display: flex;
  gap: 8px;
  padding: 12px 16px 16px;
}

.chat-form input {
  flex: 1;
  min-width: 0;
  font: 400 .94rem var(--font-body);
  color: var(--text);
  background: rgba(0, 0, 0, .3);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 11px 18px;
  outline: none;
  transition: border-color .15s ease;
}

.chat-form input:focus { border-color: rgba(142, 160, 255, .55); }
.chat-form input::placeholder { color: var(--muted); }

.chat-form button {
  flex: none;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  font-size: 1.15rem;
  font-weight: 700;
  color: #10142c;
  cursor: pointer;
  background: linear-gradient(135deg, #ffd97a, #ff9d6f);
  transition: transform .15s ease;
}

.chat-form button:hover:not(:disabled) { transform: scale(1.07); }
.chat-form button:disabled { opacity: .45; cursor: default; }

.noscript { padding: 0 16px 16px; color: var(--muted); font-size: .85rem; }

/* ---------- footer ---------- */

footer {
  margin-top: 72px;
  padding: 28px 0 36px;
  border-top: 1px solid var(--line);
  text-align: center;
}

footer p { color: var(--muted); font-size: .82rem; }
footer a { color: var(--muted); text-decoration: underline; }
footer a:hover { color: var(--gold); }

/* ---------- portrait animation ---------- */

.stars .tw { animation: twinkle 3.4s ease-in-out infinite; }
@keyframes twinkle { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }

.eye { transform-box: fill-box; transform-origin: center; }
.eye.blink { animation: blink-eye .18s ease; }
@keyframes blink-eye { 50% { transform: scaleY(.08); } }

/* ---------- reveal on scroll ---------- */

.reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ---------- wider screens ---------- */

@media (min-width: 640px) {
  .hero { padding: 84px 0 56px; }
  .hero-inner { flex-direction: row; text-align: left; gap: 48px; }
  .hero-text { flex: 1; }
  .portrait-caption { text-align: center; }
  .cards { grid-template-columns: 1fr 1fr; }
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .stars .tw, .eye.blink, .caret { animation: none; }
  .caret { opacity: 1; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .cta:hover, .card:hover, .moon-btn:hover, .chat-form button:hover { transform: none; }
}
