/* Aesthetic: "warm noir editorial" — deep ink surfaces, amber lamplight, serif display
   headlines against monospace labels. One signature detail: the animated request
   pipeline in the hero that traces a packet through the edge, the key pool, and the models. */

:root {
  /* palette */
  --ink: #0c0b10;
  --ink-2: #121118;
  --surface: #17161e;
  --surface-2: #1e1d27;
  --surface-3: #26252f;
  --line: #2a2933;
  --line-strong: #3b3a47;
  --cream: #f4f1ea;
  --ash: #a7a3b0;
  --ash-dim: #716e7d;
  --amber: #f0b45c;
  --amber-deep: #c98a34;
  --amber-wash: rgba(240, 180, 92, 0.1);
  --jade: #6fd3c4;
  --jade-wash: rgba(111, 211, 196, 0.1);
  --ember: #e8798a;

  /* spacing scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 72px;
  --space-9: 104px;

  /* radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-pill: 999px;

  /* type */
  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-body: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* elevation + motion */
  --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 18px 40px -24px rgba(0, 0, 0, 0.9);
  --shadow-pop: 0 24px 60px -28px rgba(0, 0, 0, 0.95);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
}

body {
  margin: 0;
  background: var(--ink);
  color: var(--cream);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Ambient light: two soft lamps and a faint grid, so flat panels still feel lit. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(620px 380px at 78% -8%, rgba(240, 180, 92, 0.13), transparent 62%),
    radial-gradient(760px 460px at -8% 26%, rgba(111, 211, 196, 0.08), transparent 60%),
    linear-gradient(transparent 0 100%);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.25;
  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;
  mask-image: radial-gradient(1000px 700px at 50% 0%, #000 20%, transparent 78%);
}

main,
header,
footer {
  position: relative;
  z-index: 1;
}

a {
  color: var(--amber);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 3px;
  border-radius: 4px;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.08;
  margin: 0;
}

code,
pre,
.mono {
  font-family: var(--font-mono);
  font-variant-ligatures: none;
}

.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 var(--space-5);
}

.muted {
  color: var(--ash);
}
.dim {
  color: var(--ash-dim);
}
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--amber);
}

.btn {
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  padding: 11px 22px;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  transition: transform 0.18s var(--ease), background 0.18s var(--ease), border-color 0.18s var(--ease);
}
.btn:hover {
  transform: translateY(-1px);
  text-decoration: none;
}
.btn-primary {
  background: var(--amber);
  color: #1a1206;
}
.btn-primary:hover {
  background: #f7c477;
}
.btn-ghost {
  background: rgba(255, 255, 255, 0.03);
  color: var(--cream);
  border-color: var(--line-strong);
}
.btn-ghost:hover {
  border-color: var(--ash-dim);
  background: rgba(255, 255, 255, 0.06);
}

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(12, 11, 16, 0.72);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  height: 64px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.2rem;
  color: var(--cream);
  letter-spacing: -0.01em;
}
.brand:hover {
  text-decoration: none;
}
.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: linear-gradient(150deg, var(--amber), var(--amber-deep));
  color: #1a1206;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
}
.site-header nav {
  display: flex;
  gap: var(--space-5);
  margin-left: auto;
}
.site-header nav a {
  color: var(--ash);
  font-size: 0.9rem;
  font-weight: 500;
  position: relative;
}
.site-header nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -6px;
  width: 100%;
  height: 1px;
  background: var(--amber);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s var(--ease);
}
.site-header nav a:hover {
  color: var(--cream);
  text-decoration: none;
}
.site-header nav a:hover::after {
  transform: scaleX(1);
}

.health {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--ash);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  padding: 5px 12px;
  border-radius: var(--radius-pill);
}
.health i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ash-dim);
}
.health.ok i {
  background: #7dd87d;
  box-shadow: 0 0 0 3px rgba(125, 216, 125, 0.16);
}
.health.bad i {
  background: var(--ember);
  box-shadow: 0 0 0 3px rgba(232, 121, 138, 0.16);
}

.key-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius-pill);
  padding: 4px 5px 4px 13px;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--ash);
  white-space: nowrap;
}
.key-chip code {
  color: var(--cream);
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.key-chip button {
  font: inherit;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--surface-3);
  color: var(--cream);
  border: none;
  border-radius: var(--radius-pill);
  padding: 4px 11px;
}
.key-chip button:hover {
  background: var(--line-strong);
}

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

.hero {
  padding: var(--space-9) 0 var(--space-8);
}
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: var(--space-8);
  align-items: center;
}
.hero h1 {
  font-size: clamp(2.6rem, 5.6vw, 4.2rem);
  margin: var(--space-4) 0 var(--space-5);
}
.hero h1 em {
  font-style: italic;
  color: var(--amber);
}
.hero h1 .strike {
  color: var(--ash-dim);
  text-decoration: line-through;
  text-decoration-color: var(--line-strong);
}
.lede {
  color: var(--ash);
  font-size: 1.08rem;
  max-width: 54ch;
  margin: 0 0 var(--space-6);
}
.lede strong {
  color: var(--cream);
  font-weight: 600;
}
.hero-cta {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.hero-facts {
  display: flex;
  gap: var(--space-7);
  margin-top: var(--space-7);
  flex-wrap: wrap;
}
.hero-facts div b {
  display: block;
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 600;
}
.hero-facts div span {
  color: var(--ash-dim);
  font-size: 0.8rem;
}

/* signature detail: the request pipeline */
.pipeline {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.012));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-pop);
}
.pipeline-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ash-dim);
  margin-bottom: var(--space-5);
}
.pipeline-node {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.pipeline-node .dot {
  width: 34px;
  height: 34px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ash);
}
.pipeline-node .dot.accent {
  border-color: rgba(240, 180, 92, 0.45);
  background: var(--amber-wash);
  color: var(--amber);
}
.pipeline-node b {
  display: block;
  font-size: 0.92rem;
  color: var(--cream);
  font-weight: 600;
}
.pipeline-node span {
  font-size: 0.78rem;
  color: var(--ash-dim);
}
.pipeline-track {
  position: relative;
  height: 46px;
  margin: var(--space-2) 0;
}
.pipeline-track svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}
.pipeline-track .wire {
  stroke: var(--line-strong);
  stroke-width: 1.5;
  fill: none;
  stroke-dasharray: 5 7;
  animation: flow 1.6s linear infinite;
}
@keyframes flow {
  to {
    stroke-dashoffset: -24;
  }
}
.pipeline-track .packet {
  fill: var(--amber);
  filter: drop-shadow(0 0 6px rgba(240, 180, 92, 0.85));
  animation: packet 3.6s var(--ease) infinite;
}
.pipeline-track .packet.p2 {
  animation-delay: 1.2s;
}
.pipeline-track .packet.p3 {
  animation-delay: 2.4s;
}
@keyframes packet {
  0% {
    offset-distance: 0%;
    opacity: 0;
  }
  12% {
    opacity: 1;
  }
  88% {
    opacity: 1;
  }
  100% {
    offset-distance: 100%;
    opacity: 0;
  }
}
.pipeline-keys {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.pipeline-keys i {
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--ash-dim);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 2px 8px;
}

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

section.block {
  padding: var(--space-8) 0;
}
section.block > .wrap > .section-head {
  max-width: 68ch;
  margin-bottom: var(--space-6);
}
section.block h2 {
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  margin: var(--space-3) 0 var(--space-3);
}
section.block .section-head p {
  color: var(--ash);
  margin: 0;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-card);
}
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
}
@media (max-width: 940px) {
  .hero-grid,
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }
  .site-header nav {
    display: none;
  }
}

.feature h3 {
  font-size: 1.12rem;
  margin: var(--space-3) 0 var(--space-2);
}
.feature p {
  margin: 0;
  color: var(--ash);
  font-size: 0.94rem;
}
.feature .glyph {
  font-family: var(--font-mono);
  color: var(--amber);
  font-size: 1rem;
}

/* endpoint rows */
.endpoint {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}
.endpoint .verb {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: var(--jade-wash);
  color: var(--jade);
  border: 1px solid rgba(111, 211, 196, 0.3);
}
.endpoint .verb.get {
  background: var(--amber-wash);
  color: var(--amber);
  border-color: rgba(240, 180, 92, 0.3);
}
.endpoint .path {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: var(--cream);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.endpoint .note {
  color: var(--ash-dim);
  font-size: 0.84rem;
}
.copy-mini {
  font: inherit;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--surface-3);
  color: var(--ash);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
}
.copy-mini:hover {
  color: var(--cream);
  border-color: var(--ash-dim);
}

/* ---------- playground ---------- */

.playground {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: var(--space-4);
  align-items: start;
}
@media (max-width: 980px) {
  .playground {
    grid-template-columns: 1fr;
  }
}
.field {
  display: block;
  margin-bottom: var(--space-4);
}
.field > span {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ash-dim);
  margin-bottom: 7px;
}
select,
input[type="text"],
input[type="password"],
input[type="number"],
input[type="search"],
textarea {
  width: 100%;
  background: var(--ink-2);
  color: var(--cream);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font: inherit;
  font-size: 0.9rem;
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
textarea {
  resize: vertical;
  min-height: 78px;
  font-family: var(--font-mono);
  font-size: 0.84rem;
  line-height: 1.6;
}
select:hover,
input:hover,
textarea:hover {
  border-color: var(--ash-dim);
}
select:focus,
input:focus,
textarea:focus {
  outline: none;
  border-color: var(--amber);
  box-shadow: 0 0 0 3px var(--amber-wash);
}
.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

.tabs {
  display: flex;
  gap: 3px;
  background: var(--ink-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  padding: 4px;
}
.tabs button {
  flex: 1;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  padding: 8px 10px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ash);
  cursor: pointer;
  white-space: nowrap;
}
.tabs button[aria-selected="true"] {
  background: var(--surface-3);
  color: var(--cream);
}
.tabs button:hover {
  color: var(--cream);
}

.output-col {
  display: grid;
  gap: var(--space-3);
}
.output {
  background: var(--ink-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  min-height: 300px;
  max-height: 520px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.96rem;
  line-height: 1.7;
}
.output:empty::before {
  content: "The model's words will appear here, streamed token by token.";
  color: var(--ash-dim);
}
.output.error-box {
  border-color: rgba(232, 121, 138, 0.6);
  color: #f4b6bf;
}
.cursor {
  display: inline-block;
  width: 8px;
  height: 1.05em;
  background: var(--amber);
  vertical-align: text-bottom;
  animation: blink 1.05s steps(2) infinite;
}
@keyframes blink {
  50% {
    opacity: 0;
  }
}

.live-log {
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  max-height: 190px;
  overflow: auto;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  line-height: 1.75;
  color: var(--ash);
}
.live-log b {
  color: var(--jade);
  font-weight: 600;
}
.live-log i {
  font-style: normal;
  color: var(--ash-dim);
  margin-right: 10px;
}
.meta {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--ash-dim);
}

/* ---------- code ---------- */

.code-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.code-head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.code-head .tabs {
  margin: 0;
  border: none;
  background: transparent;
  padding: 0;
  flex-wrap: wrap;
}
.code-head .tabs button {
  flex: none;
  padding: 6px 12px;
}
.code-head .tabs button[aria-selected="true"] {
  background: var(--surface-3);
}
pre.code {
  margin: 0;
  padding: var(--space-5);
  overflow: auto;
  font-size: 0.79rem;
  line-height: 1.75;
  color: #dcd9e3;
  max-height: 460px;
}
.tok-k {
  color: var(--jade);
}
.tok-s {
  color: var(--amber);
}
.tok-c {
  color: var(--ash-dim);
}
.tok-n {
  color: var(--ember);
}
.tok-f {
  color: #c9a6f5;
}

/* ---------- models ---------- */

.catalog-head {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
}
.search {
  max-width: 280px;
}
table.models {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
table.models th,
table.models td {
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
}
table.models th {
  color: var(--ash-dim);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
}
table.models tbody tr:hover {
  background: rgba(255, 255, 255, 0.025);
}
table.models tbody tr:last-child td {
  border-bottom: none;
}
table.models td.mono {
  color: var(--cream);
}
.pill {
  display: inline-block;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  padding: 2px 10px;
  font-size: 0.7rem;
  color: var(--ash);
  font-family: var(--font-mono);
}
.empty-row {
  color: var(--ash-dim);
  padding: var(--space-6) 14px !important;
  text-align: center;
}

/* ---------- onboarding ---------- */

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
  counter-reset: step;
}
@media (max-width: 940px) {
  .steps {
    grid-template-columns: 1fr;
  }
}
.step {
  position: relative;
  padding: var(--space-5);
}
.step::before {
  counter-increment: step;
  content: "0" counter(step);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--amber);
  letter-spacing: 0.1em;
}
.step h3 {
  margin: var(--space-2) 0 var(--space-2);
  font-size: 1.08rem;
}
.step p {
  margin: 0 0 var(--space-3);
  color: var(--ash);
  font-size: 0.92rem;
}
.step pre {
  margin: 0;
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.74rem;
  overflow-x: auto;
  color: var(--ash);
}

/* ---------- keys ---------- */

.key-form {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.key-form input[type="password"] {
  flex: 1;
  min-width: 240px;
}

footer {
  border-top: 1px solid var(--line);
  padding: var(--space-6) 0 var(--space-8);
  color: var(--ash-dim);
  font-size: 0.85rem;
  background: rgba(0, 0, 0, 0.25);
}
footer .wrap {
  display: flex;
  gap: var(--space-5);
  align-items: center;
  flex-wrap: wrap;
}
footer strong {
  color: var(--cream);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
}
footer nav {
  display: flex;
  gap: var(--space-4);
  margin-left: auto;
}
footer nav a {
  color: var(--ash);
}

/* ---------- toast ---------- */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translate(-50%, 16px);
  opacity: 0;
  background: var(--surface-3);
  border: 1px solid var(--line-strong);
  color: var(--cream);
  border-radius: var(--radius-md);
  padding: 11px 20px;
  font-size: 0.88rem;
  box-shadow: var(--shadow-pop);
  transition: opacity 0.22s var(--ease), transform 0.22s var(--ease);
  pointer-events: none;
  z-index: 60;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

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

.js-reveal .reveal {
  opacity: 0;
  transform: translateY(16px);
}
.js-reveal .reveal.is-visible {
  opacity: 1;
  transform: none;
  transition: opacity 0.55s var(--ease), transform 0.55s var(--ease);
}

/* ---------- scrollbars ---------- */

* {
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
*::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: var(--radius-pill);
  border: 3px solid transparent;
  background-clip: content-box;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .js-reveal .reveal {
    opacity: 1;
    transform: none;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
