/* site.css — krystal.rip, the "build in progress" page.
 * The look is Krystal's own (src/css/base.css in the app): the same greens, the
 * same fonts, surfaces told apart by tone and soft shadow rather than borders,
 * light drawn as an edgeless falloff from a source, never as an outline. */

@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("fonts/Inter.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono"; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url("fonts/JetBrainsMono.woff2") format("woff2");
}
@font-face {
  font-family: "Orbitron"; font-style: normal; font-weight: 900; font-display: swap;
  src: url("fonts/Orbitron-Black.woff2") format("woff2");
}

:root {
  --bg:        #0a0f0b;
  --bg-elev:   #0e140f;
  --bg-card:   #121a15;
  --bg-card-2: #16201a;
  --fg:        #e6efe8;
  --fg-muted:  #93a399;
  --fg-dim:    #647069;
  --accent-2:  #6cc78e;
  --accent-3:  #8fe0aa;
  --warn:      #e29b50;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --read-w: 680px;
  --ease-out: cubic-bezier(.2,.8,.2,1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { background: var(--bg); color-scheme: dark; }
body {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column;
  background: var(--bg); color: var(--fg);
  font-family: var(--sans); font-size: 16px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  }
a { color: var(--accent-3); text-decoration-color: rgba(143,224,170,.35); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--accent-3); }
::selection { background: rgba(108,199,142,.28); }
button, input { font: inherit; color: inherit; }

/* A fine, still grain over everything, so the dark gradients of the light never band. */
body::after {
  content: ""; position: fixed; inset: 0; z-index: 50; pointer-events: none; opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .6 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---- The living light (light.js in the app): a resting room tone, a lamp that
 * sits behind the line being written, the floor under the composer that typing
 * warms, and a beat a finished step lets out. Painted from site.js. ---- */
.light { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.light i, .lamp { position: absolute; display: block; pointer-events: none; }
.room {
  left: 50%; top: 40%; width: 1400px; height: 900px; transform: translate(-50%, -50%);
  background: radial-gradient(closest-side, rgba(108,199,142,0.035), transparent);
}
.lamp { left: 50%; top: 0; width: 0; height: 0; opacity: 0; will-change: transform, opacity; }
.lamp i { border-radius: 50%; transform: translate(-50%, -50%); }
.lamp .core { width: min(950px, 96vw); height: 300px;
  background: radial-gradient(closest-side, rgba(108,199,142,0.16), rgba(108,199,142,0.055) 55%, transparent); }
.lamp .spill { width: 1900px; height: 560px;
  background: radial-gradient(closest-side, rgba(108,199,142,0.05), transparent); }
.floor {
  left: 50%; bottom: -160px; width: min(1140px, 100%); height: 340px; transform: translateX(-50%); opacity: 0;
  background: radial-gradient(closest-side, rgba(108,199,142,0.16), rgba(108,199,142,0.05) 55%, transparent);
}
.light-beat {
  left: 50%; width: 1100px; height: 150px; opacity: 0; transform: translate(-50%, -50%);
  background: radial-gradient(closest-side, rgba(108,199,142,0.14), rgba(108,199,142,0.04) 60%, transparent);
  animation: beat-out 1.6s ease-out forwards;
}
@keyframes beat-out { 0% { opacity: 0; } 12% { opacity: 1; } 100% { opacity: 0; } }

/* ---- Top bar ---- */
.top {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  width: 100%; max-width: 1100px; margin: 0 auto; padding: 22px 28px 0;
}
.logo { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.logo-word { display: flex; flex-direction: column; gap: 5px; }
.logo-name {
  font-family: "Orbitron", var(--sans); font-weight: 900; font-size: 19px;
  letter-spacing: .18em; line-height: 1; color: var(--fg);
  text-shadow: 0 0 14px rgba(108,199,142,.35);
}
.logo-tag { font-family: var(--mono); font-size: 10px; letter-spacing: .06em; color: var(--accent-2); opacity: .85; }
.logo-name .ltr { display: inline-block; }
.logo:hover .logo-name .ltr { animation: ltr-glow 1.7s ease-in-out infinite; }
.logo.wave .logo-name .ltr { animation: ltr-glow 1.7s ease-in-out 1; }
@keyframes ltr-glow {
  0%, 40%, 80%, 100% { color: var(--fg); text-shadow: 0 0 14px rgba(108,199,142,.35); transform: translateY(0); }
  20%, 60% { color: var(--accent-3); text-shadow: 0 0 10px rgba(108,199,142,.95), 0 0 22px rgba(108,199,142,.55); transform: translateY(-2px); }
}

/* The crystal face (face.js). */
.mascot { position: relative; flex: none; width: 52px; height: 52px; cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent; }
.mascot svg { position: relative; display: block; width: 100%; height: 100%; overflow: visible; }
.mascot-lamp {
  position: absolute; inset: -70%; border-radius: 50%; pointer-events: none; opacity: 0;
  background: radial-gradient(closest-side, rgba(var(--tint, 143,224,170), .20), rgba(var(--tint, 143,224,170), .06) 55%, transparent);
}

.top-end { display: flex; align-items: center; gap: 10px; }
.badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 12px 5px 10px; border-radius: 999px;
  font-family: var(--mono); font-size: 11px; letter-spacing: .04em; color: var(--accent-3);
  background: rgba(108,199,142,.07); box-shadow: inset 0 0 0 1px rgba(108,199,142,.18);
}
.badge-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent-2); }
.badge-dot.beat { animation: dot-beat .7s ease-out; }
@keyframes dot-beat { 0% { transform: scale(1.5); box-shadow: 0 0 10px rgba(108,199,142,.9); } 100% { transform: scale(1); } }

.lang { display: inline-flex; padding: 2px; border-radius: 999px; background: rgba(255,255,255,.04); }
.lang button {
  border: 0; background: transparent; cursor: pointer;
  padding: 3px 9px; border-radius: 999px;
  font-family: var(--mono); font-size: 11px; color: var(--fg-dim);
  transition: color .15s ease, background .15s ease;
}
.lang button:hover { color: var(--fg); }
.lang button[aria-pressed="true"] { color: var(--accent-3); background: rgba(108,199,142,.12); }

/* ---- The conversation ---- */
main {
  position: relative; z-index: 1; flex: 1 0 auto;
  width: 100%; max-width: calc(var(--read-w) + 56px); margin: 0 auto;
  padding: 9vh 28px 40px;
}
.hello { margin: 0 0 40px; }
.hello h1 {
  margin: 0; font-size: clamp(30px, 5.2vw, 46px); line-height: 1.12; font-weight: 700; letter-spacing: -.02em;
}
.hello h1 em { font-style: normal; color: var(--accent-3); }
.hello p { margin: 14px 0 0; max-width: 540px; color: var(--fg-muted); font-size: 16.5px; }

.feed { display: flex; flex-direction: column; gap: 22px; }
.msg.user { display: flex; justify-content: flex-end; }
.msg.user .bubble {
  max-width: 82%; padding: 10px 16px; border-radius: 18px 18px 6px 18px;
  background: #17221c; font-size: 14.5px; white-space: pre-wrap; word-break: break-word;
  box-shadow: 0 8px 20px -14px rgba(0,0,0,.9);
}
.msg.assistant { position: relative; font-size: 15.5px; line-height: 1.68; }
.msg.assistant p { margin: 0; }
.msg.assistant p + p, .msg.assistant p + .steps, .msg.assistant .steps + p { margin-top: 12px; }
.msg.assistant strong { color: #f3f8f4; font-weight: 650; }
.msg.assistant .mono { font-family: var(--mono); font-size: .9em; color: var(--accent-3); }

/* The typer's ink: each revealed stretch fades in. */
.tw { animation: ink .42s ease-out both; }
@keyframes ink { from { opacity: 0; } to { opacity: 1; } }

/* A reply that has landed gets one soft sweep of light across it. */
.msg.assistant.landed::after {
  content: ""; position: absolute; inset: -6px -14px; pointer-events: none; border-radius: 14px;
  background: linear-gradient(100deg, transparent 30%, rgba(143,224,170,.07) 50%, transparent 70%);
  background-size: 300% 100%; background-position: 100% 0;
  animation: sweep 1.3s var(--ease-out) forwards;
}
@keyframes sweep { 0% { background-position: 100% 0; opacity: 1; } 100% { background-position: 0 0; opacity: 0; } }

/* ---- Action chips: one per step, a spinning ring while it runs, a check drawn
 * the moment it finishes. A step still being built settles to a still dot. ---- */
.steps { display: flex; flex-direction: column; align-items: flex-start; }
.chip {
  display: flex; align-items: center; gap: 8px; width: fit-content; max-width: 100%;
  margin: 4px 0; padding: 4px 12px; border-radius: 999px; border: 1px solid transparent;
  font-family: var(--mono); font-size: 11.5px; color: var(--fg-muted);
  background: rgba(255,255,255,.04);
  animation: chip-in .32s var(--ease-out) both;
  transition: color .3s ease, border-color .3s ease, background .3s ease;
}
@keyframes chip-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.chip-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-status { flex: none; width: 12px; height: 12px; display: inline-flex; align-items: center; justify-content: center; }
.chip-note { color: var(--fg-dim); font-size: 10.5px; }
.chip.working { color: var(--accent-3); border-color: rgba(108,199,142,.45); background: rgba(108,199,142,.07); }
.chip.working .chip-status { border-radius: 50%; border: 2px solid rgba(108,199,142,.3); border-top-color: var(--accent-2); animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.chip-tick { width: 12px; height: 12px; fill: none; stroke: var(--accent-2); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 11; }
.chip.done.fresh .chip-tick { animation: tick .38s var(--ease-out) both; }
@keyframes tick { from { stroke-dashoffset: 11; } to { stroke-dashoffset: 0; } }
.chip.building { color: var(--accent-3); }
.chip.building .chip-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 10px rgba(108,199,142,.6); }
.chip.next { color: var(--fg-dim); }
.chip.next .chip-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--fg-dim); }

/* ---- The working line under a reply still being made (working.js) ---- */
.work-line {
  display: flex; align-items: center; gap: 8px; margin: 2px 0 0;
  font-size: 12.5px; color: var(--accent-3); transition: opacity .3s ease;
}
.work-line.out { opacity: 0; }
.wl-dot { flex: none; width: 7px; height: 7px; margin: 0 2px; border-radius: 50%; background: var(--accent-2); opacity: .75; }
.wl-dot.beat { animation: wl-beat .7s ease-out; }
@keyframes wl-beat { 0% { opacity: 1; transform: scale(1.35); } 100% { opacity: .75; transform: scale(1); } }
.work-line[data-tone="think"] .wl-label {
  color: transparent; -webkit-background-clip: text; background-clip: text;
  background-image: linear-gradient(90deg, rgba(143,224,170,.6) 0%, rgba(143,224,170,.6) 38%, var(--fg) 50%, rgba(143,224,170,.6) 62%, rgba(143,224,170,.6) 100%);
  background-size: 250% 100%; animation: shimmer 2s linear infinite;
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* ---- The download card a reply ends on ---- */
.get {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin-top: 18px; padding: 14px 14px 14px 18px; border-radius: 16px;
  background: var(--bg-card); box-shadow: 0 16px 36px -14px rgba(0,0,0,.8), 0 0 0 1px rgba(255,255,255,.05);
  animation: chip-in .5s var(--ease-out) both;
}
.get-text { flex: 1 1 220px; min-width: 0; }
.get-title { font-weight: 650; font-size: 14.5px; }
.get-sub { font-family: var(--mono); font-size: 11px; color: var(--fg-dim); }
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 12px; border: 0;
  font-size: 14px; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background .15s ease, box-shadow .2s ease, translate .2s var(--ease-out);
}
.btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn-primary { color: #06120a; background: var(--accent-3); box-shadow: 0 8px 22px -10px rgba(108,199,142,.8); }
.btn-primary:hover { background: #a6ebbd; translate: 0 -1px; }
.btn-quiet { color: var(--fg-muted); background: rgba(255,255,255,.05); }
.btn-quiet:hover { color: var(--fg); background: rgba(255,255,255,.08); translate: 0 -1px; }
.btn:focus-visible, .lang button:focus-visible, .send:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

/* ---- The composer: a dock at the foot of the column, the feed fading under it ---- */
.composer {
  position: sticky; bottom: 0; z-index: 3;
  width: 100%; max-width: calc(var(--read-w) + 56px); margin: 0 auto;
  padding: 34px 28px 14px;
  background: linear-gradient(to top, var(--bg) 62%, transparent);
}
.dock {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 8px 8px 8px 16px; border-radius: 16px; background: var(--bg-card);
  box-shadow: 0 16px 36px -12px rgba(0,0,0,.75), 0 0 0 1px rgba(255,255,255,.055);
  transition: box-shadow .28s ease;
}
.dock:focus-within { box-shadow: 0 16px 36px -12px rgba(0,0,0,.75), 0 0 0 1px rgba(108,199,142,.42), 0 0 30px -6px rgba(108,199,142,.2); }
.dock input {
  flex: 1 1 auto; min-width: 0; padding: 8px 0; border: 0; outline: 0; background: transparent;
  font-size: 15px;
}
.dock input::placeholder { color: var(--fg-dim); }
.send {
  flex: none; width: 36px; height: 36px; border-radius: 11px; border: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  color: #06120a; background: var(--accent-3);
  transition: opacity .2s ease, background .15s ease;
}
.send:disabled { opacity: .3; cursor: default; }
.send svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.composer-note { margin: 9px 4px 0; text-align: center; font-size: 11.5px; color: var(--fg-dim); }

footer {
  position: relative; z-index: 1;
  padding: 6px 28px 26px; text-align: center; font-size: 11.5px; color: var(--fg-dim);
}
footer a { color: var(--fg-muted); }

/* A message on its way from the composer into the feed (site.js, flyFromComposer). */
.flying { will-change: transform, opacity; }

@media (max-width: 640px) {
  .top { padding: 16px 18px 0; }
  .badge-text { display: none; }
  .badge { padding: 7px; }
  main { padding: 6vh 18px 30px; }
  .composer { padding: 28px 14px 10px; }
  .mascot { width: 44px; height: 44px; }
  .logo-name { font-size: 16px; }
}

/* Reduced motion keeps every state (the colours, the checks, the words) and drops the movement. */
@media (prefers-reduced-motion: reduce) {
  .tw, .chip, .get, .light-beat, .badge-dot.beat, .wl-dot.beat, .chip.done.fresh .chip-tick,
  .logo:hover .logo-name .ltr, .logo.wave .logo-name .ltr, .msg.assistant.landed::after { animation: none !important; }
  .work-line[data-tone="think"] .wl-label { animation: none; color: var(--accent-3); background: none; }
  .chip.working .chip-status { animation-duration: 2.4s; }
  .btn, .lang button { transition: none; }
}
