/* cero.run — terminal aesthetic, pastel accents on charcoal.
   Palette:
   --bg:      #0b0f0d  (near-black charcoal, slight green cast)
   --bg-soft: #10150f
   --fg:      #d9e3db
   --dim:     #8a9a90
   --green:   #5df08c
   --blue:    #55b9ff
   --purple:  #b98cff
   Accents are used sparingly: syntax roles, not decoration. */

:root {
  --bg: #0b0f0d;
  --bg-soft: #10150f;
  --bg-panel: #0e1411;
  --line: #1d2a22;
  --fg: #d9e3db;
  --dim: #8a9a90;
  --green: #5df08c;
  --blue: #55b9ff;
  --purple: #b98cff;
  --mono: "JetBrains Mono", "IBM Plex Mono", "Fira Code", ui-monospace,
          SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--purple); color: var(--bg); }

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---- background canvas ---- */
#token-stream {
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.5;
  pointer-events: none;
}

/* ---- header ---- */
.site-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.9rem clamp(1.5rem, 5vw, 5rem);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(6px);
  z-index: 10;
}

.brand {
  color: var(--fg);
  font-weight: 700;
  letter-spacing: 0.02em;
  font-size: 1.05rem;
}
.brand:hover { text-decoration: none; color: var(--green); }
.brand-mark {
  color: var(--bg);
  background: var(--green);
  border-radius: 3px;
  padding: 0 0.35em;
  margin-right: 0.35em;
  font-weight: 700;
}

.site-nav {
  display: flex;
  gap: 1.2rem;
  margin-left: auto;
  font-size: 0.85rem;
}
.site-nav a { color: var(--dim); }
.site-nav a::before { content: "# "; color: var(--line); }
.site-nav a:hover { color: var(--fg); text-decoration: none; }

.lang-toggle { display: flex; align-items: center; gap: 0.35rem; font-size: 0.8rem; }
.lang-sep { color: var(--line); }
.lang-btn {
  background: none;
  border: none;
  color: var(--dim);
  font: inherit;
  cursor: pointer;
  padding: 0.15rem 0.3rem;
  border-radius: 3px;
}
.lang-btn.active { color: var(--bg); background: var(--blue); }
.lang-btn:hover:not(.active) { color: var(--fg); }

/* small viewports: let the header wrap so nothing clips at ~360px */
@media (max-width: 640px) {
  .site-header {
    flex-wrap: wrap;
    gap: 0.4rem 1rem;
    padding: 0.6rem 1rem;
  }
  .site-nav {
    order: 3;
    flex-basis: 100%;
    margin-left: 0;
    gap: 0.9rem;
  }
  .lang-toggle { margin-left: auto; }
}
@media (max-width: 480px) {
  .site-header { padding: 0.5rem 0.85rem; }
  .site-nav { gap: 0.6rem; font-size: 0.75rem; }
}

/* ---- layout ---- */
main, .site-footer {
  max-width: none;
  padding: 0 clamp(1.5rem, 5vw, 5rem);
}

section { padding: 4.5rem 0 3.5rem; }

.ascii-divider {
  color: var(--line);
  white-space: nowrap;
  overflow: hidden;
  user-select: none;
  font-size: 0.8rem;
}

.prompt-line { color: var(--dim); margin-bottom: 1.2rem; }
.tok-comment { color: var(--green); }
.tok-flag { color: var(--purple); }

.section-label {
  color: var(--dim);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  margin-bottom: 1.8rem;
}
.sec-num { color: var(--green); }

.section-title { font-size: 1.5rem; margin-bottom: 0.6rem; color: var(--fg); }

/* ---- hero ---- */
.hero { padding-top: 4rem; }

.hero-title {
  font-size: clamp(1.7rem, 4.5vw, 2.6rem);
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 1.2rem;
  text-wrap: balance;
}
.hero-title-accent { color: var(--green); }

.hero-sub {
  color: var(--dim);
  max-width: 62ch;
  margin-bottom: 1.6rem;
}

.btn {
  display: inline-block;
  font: inherit;
  font-size: 0.95rem;
  padding: 0.65rem 1.3rem;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--green); color: var(--bg); border-color: var(--green); font-weight: 700; }
.btn-primary:hover { background: var(--fg); border-color: var(--fg); }

/* hero grid: copy left, gpu right */
.hero-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 2.5rem;
  align-items: center;
}
@media (max-width: 820px) {
  .hero-grid { grid-template-columns: 1fr; }
  .gpu-figure { max-width: 460px; margin: 0 auto; }
}

/* ---- features ---- */

.features-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(2rem, 5vw, 5rem);
  align-items: center;
}
@media (max-width: 880px) {
  .features-grid { grid-template-columns: 1fr; }
}

.log-terminal {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-panel);
  overflow: hidden;
}
.log-terminal .terminal-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.8rem;
  border-bottom: 1px solid var(--line);
}
.log-terminal .terminal-title { color: var(--dim); font-size: 0.75rem; margin-left: 0.5rem; }
.log-body {
  padding: 1.1rem 1.2rem;
  font-size: 0.8rem;
  line-height: 1.8;
  color: var(--dim);
  overflow-x: auto;
}
.log-body .tok-comment { color: var(--green); }
.log-body .tok-flag { color: var(--purple); }
.log-cursor { color: var(--green); animation: blink 1.1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .log-cursor { animation: none; } }

/* ---- capacity board (simulated server fill) ---- */
.capacity { padding: 0.5rem 0 3rem; }
#capacity-board { display: block; width: 100%; height: auto; }

.feature-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.feature-list li {
  padding-left: 1.4em;
  position: relative;
  font-size: 0.92rem;
}
.feature-list li::before {
  content: ">";
  position: absolute;
  left: 0;
  color: var(--green);
}
.feature-list li:nth-child(3n+2)::before { color: var(--blue); }
.feature-list li:nth-child(3n)::before { color: var(--purple); }

.gpu-figure {
  position: relative;
}
#gpu-jet {
  display: block;
  width: 100%;
  height: auto;
}

.models-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin-top: 1.4rem;
  margin-bottom: 0.8rem;
}
.models-table th {
  text-align: left;
  color: var(--dim);
  font-weight: 400;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  padding: 0.4rem 0.7rem;
  border-bottom: 1px solid var(--line);
}
.models-table td {
  padding: 0.5rem 0.7rem;
  border-bottom: 1px solid var(--line);
  color: var(--fg);
}
.models-table tr:last-child td { border-bottom: none; }
.models-table td:first-child { color: var(--blue); }
.models-table .unlimited { color: var(--green); }
.models-note {
  color: var(--dim);
  font-size: 0.78rem;
  margin-bottom: 1.2rem;
}

/* ---- pricing (centered) ---- */
.pricing .section-label { text-align: center; }
.pricing-card {
  border: 1px solid var(--line);
  border-left: 3px solid var(--green);
  border-radius: 8px;
  background: var(--bg-panel);
  padding: 2rem;
  max-width: 560px;
  margin: 0 auto;
}
.pricing-headline { display: flex; align-items: baseline; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 0.7rem; }
.price-amount { font-size: 2.4rem; font-weight: 700; color: var(--green); }
.price-period { color: var(--dim); }
.price-badge {
  color: var(--purple);
  border: 1px dashed var(--purple);
  border-radius: 4px;
  font-size: 0.72rem;
  padding: 0.15rem 0.5rem;
}
.pricing-lead { color: var(--dim); margin-bottom: 1.3rem; max-width: 55ch; }
.pricing-includes { list-style: none; margin-bottom: 1.6rem; display: flex; flex-direction: column; gap: 0.5rem; }
.pricing-includes li { padding-left: 1.4em; position: relative; font-size: 0.9rem; }
.pricing-includes li::before { content: "+"; position: absolute; left: 0; color: var(--green); }

/* ---- waitlist form ---- */
#waitlist-form { max-width: 560px; display: flex; flex-direction: column; gap: 1.15rem; }
.form-row { display: flex; flex-direction: column; gap: 0.4rem; }
.form-row label { color: var(--dim); font-size: 0.82rem; }

.region-select { display: flex; gap: 0.5rem; }
.region-btn {
  flex: 1;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--dim);
  font: inherit;
  font-size: 0.88rem;
  padding: 0.5rem 0.6rem;
  cursor: pointer;
}
.region-btn.selected {
  border-color: var(--green);
  color: var(--fg);
  background: color-mix(in srgb, var(--green) 8%, var(--bg-panel));
}
.form-label { color: var(--dim); font-size: 0.82rem; }
.hero-ghost-link { color: var(--dim); font-size: 0.85rem; }
.hero-ghost-link:hover { color: var(--blue); text-decoration: none; }

#waitlist-form input[type="email"],
#waitlist-form input[type="text"] {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--fg);
  font: inherit;
  padding: 0.6rem 0.8rem;
}
#waitlist-form input:focus { outline: none; border-color: var(--blue); }
#waitlist-form input::placeholder { color: color-mix(in srgb, var(--dim) 90%, transparent); }

.hp-field {
  position: absolute;
  left: -9999px;
  opacity: 0;
  height: 0;
  overflow: hidden;
}

#turnstile-box { min-height: 65px; }

.btn-submit { align-self: flex-start; }
.btn-submit:disabled { opacity: 0.5; cursor: wait; }

.form-msg { font-size: 0.88rem; min-height: 1.4em; }
.form-msg.ok { color: var(--green); }
.form-msg.err { color: var(--purple); }
.form-note { color: var(--dim); font-size: 0.85rem; }

/* ---- faq ---- */
.faq-item {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg-panel);
  margin-bottom: 0.7rem;
}
.faq-item summary {
  cursor: pointer;
  padding: 0.85rem 1.1rem;
  font-size: 0.95rem;
  list-style: none;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary:hover { color: var(--green); }
.faq-item[open] { border-color: color-mix(in srgb, var(--green) 40%, var(--line)); }
.faq-item p {
  padding: 0 1.1rem 1rem 2.2rem;
  color: var(--dim);
  font-size: 0.9rem;
  max-width: 68ch;
}

/* ---- privacy ---- */
.privacy-body p {
  color: var(--dim);
  font-size: 0.88rem;
  max-width: 70ch;
  margin-bottom: 0.9rem;
}

/* ---- footer ---- */
.site-footer {
  padding: 3rem clamp(1.5rem, 5vw, 5rem) 2.5rem;
  border-top: 1px solid var(--line);
  margin-top: 3rem;
}
.footer-line { color: var(--dim); font-size: 0.8rem; margin-top: 1rem; }

/* ---- scroll fx: reveal, parallax, hud ----
   Parallax writes --py from JS; reveal is a one-shot CSS
   animation so the two effects compose without fighting over transform. */

.js-anim [data-parallax] {
  transform: translateY(var(--py, 0px));
  will-change: transform;
}

.js-anim [data-reveal]:not(.ascii-divider) { opacity: 0; }

.js-anim [data-reveal]:not(.ascii-divider).in-view {
  opacity: 1;
  animation: fx-up 0.75s cubic-bezier(0.22, 0.75, 0.25, 1) var(--d, 0s) both;
}
.js-anim [data-reveal="left"]:not(.ascii-divider).in-view { animation-name: fx-left; }
.js-anim [data-reveal="right"]:not(.ascii-divider).in-view { animation-name: fx-right; }
.js-anim [data-reveal="scale"]:not(.ascii-divider).in-view { animation-name: fx-scale; }

@keyframes fx-up {
  from { opacity: 0; transform: translateY(calc(var(--py, 0px) + 28px)); }
  to   { opacity: 1; transform: translateY(var(--py, 0px)); }
}
@keyframes fx-left {
  from { opacity: 0; transform: translateX(-44px) translateY(var(--py, 0px)); }
  to   { opacity: 1; transform: translateX(0) translateY(var(--py, 0px)); }
}
@keyframes fx-right {
  from { opacity: 0; transform: translateX(44px) translateY(var(--py, 0px)); }
  to   { opacity: 1; transform: translateX(0) translateY(var(--py, 0px)); }
}
@keyframes fx-scale {
  from { opacity: 0; transform: scale(0.96) translateY(calc(var(--py, 0px) + 24px)); }
  to   { opacity: 1; transform: scale(1) translateY(var(--py, 0px)); }
}

/* ascii divider "draws" itself when it enters the viewport */
.js-anim .ascii-divider[data-reveal] {
  opacity: 1;
  clip-path: inset(0 100% 0 0);
  transition: clip-path 1s ease 0.15s;
}
.js-anim .ascii-divider[data-reveal].in-view { clip-path: inset(0 0 0 0); }

/* section titles decode character by character (JS) — add a subtle chromatic
   ghost while .decoding so the scramble reads as intentional, not broken */
.js-anim .decoding {
  text-shadow: 2px 0 color-mix(in srgb, var(--blue) 55%, transparent),
               -2px 0 color-mix(in srgb, var(--purple) 55%, transparent);
}

/* scroll progress hud, bottom-right */
#scroll-hud {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 20;
  color: var(--dim);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.3rem 0.55rem;
  user-select: none;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
}
#scroll-hud.visible { opacity: 1; }
#scroll-hud .hud-bar { color: var(--green); }

@media (prefers-reduced-motion: reduce) {
  .js-anim [data-reveal]:not(.ascii-divider) { opacity: 1; animation: none; }
  .js-anim .ascii-divider[data-reveal] { clip-path: none; transition: none; }
  .js-anim [data-parallax] { transform: none; }
  #scroll-hud { display: none; }
  .js-anim .decoding { text-shadow: none; }
}

/* ---- reduced motion: no canvas animation, no typing ---- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  #token-stream { display: none; }
}

/* three.js hero unavailable (no WebGL) — hide the empty canvas, keep layout */
.gpu-unavailable #gpu-jet { display: none; }
.gpu-unavailable .gpu-caption { display: none; }
