/* =========================================================================
   MeltDocs — "Molten" design system
   Dark, single-surface, with a molten amber→orange→magenta gradient as the
   one signature. Everything else stays quiet: near-black surfaces, hairline
   borders, disciplined type. Self-contained; no framework.
   ========================================================================= */

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
img, svg, video { display: block; max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; padding: 0; }

/* ---------- tokens ---------- */
:root {
  --void:    #0B0B0F;   /* base / the cold mold */
  --void-2:  #08080B;   /* deepest (footer) */
  --forge:   #131318;   /* lifted surface (cards) */
  --forge-2: #17171E;   /* hover surface */
  --edge:    rgba(255, 255, 255, 0.09);
  --edge-2:  rgba(255, 255, 255, 0.14);

  --ink:  #FAFAF7;      /* warm off-white */
  --ash:  #9A9AA6;      /* secondary text */
  --ash-2:#6C6C78;      /* faint text */

  --ember-1: #F59E0B;   /* amber */
  --ember-2: #F97316;   /* orange */
  --ember-3: #EC4899;   /* magenta */
  --molten:  linear-gradient(100deg, var(--ember-1) 0%, var(--ember-2) 48%, var(--ember-3) 100%);
  --molten-soft: linear-gradient(100deg, rgba(245,158,11,.16), rgba(249,115,22,.16) 48%, rgba(236,72,153,.16));

  --glow: 0 0 0 1px rgba(249,115,22,.35), 0 12px 40px -12px rgba(249,115,22,.55);

  --font-display: "Bricolage Grotesque", "Inter", system-ui, sans-serif;
  --font-body:    "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --wrap: 1120px;
  --radius: 14px;
  --radius-lg: 22px;
}

/* ---------- base ---------- */
body {
  font-family: var(--font-body);
  background: var(--void);
  color: var(--ink);
  line-height: 1.6;
  font-size: 16px;
  overflow-x: hidden;
}

/* Ambient molten haze behind the top of the page. */
body::before {
  content: "";
  position: fixed;
  inset: -20% 0 auto 0;
  height: 620px;
  background:
    radial-gradient(60% 70% at 72% 0%, rgba(249,115,22,.16), transparent 60%),
    radial-gradient(45% 60% at 20% 4%, rgba(236,72,153,.10), transparent 62%);
  pointer-events: none;
  z-index: 0;
}

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: 24px; }
main { position: relative; z-index: 1; }

/* ---------- type ---------- */
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; line-height: 1.05; letter-spacing: -0.02em; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--ash);
}
.eyebrow::before {
  content: ""; width: 22px; height: 2px; border-radius: 2px; background: var(--molten);
}
.molten-text {
  background: var(--molten);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  background-size: 200% 100%;
  animation: molten-flow 8s ease-in-out infinite;
}
@keyframes molten-flow { 0%,100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }

.lead { color: var(--ash); font-size: 1.15rem; max-width: 52ch; }
.muted { color: var(--ash); }

/* ---------- signature: the molten seam ---------- */
.seam {
  height: 1px; border: 0; width: 100%;
  background: linear-gradient(90deg, transparent, rgba(249,115,22,.55) 20%, rgba(236,72,153,.55) 80%, transparent);
  position: relative;
}
.seam::after {
  content: ""; position: absolute; inset: -2px 10% auto 10%; height: 6px;
  background: var(--molten); filter: blur(14px); opacity: .5;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 600; font-size: .95rem; line-height: 1;
  padding: 13px 22px; border-radius: 999px; border: 1px solid transparent;
  cursor: pointer; transition: transform .15s ease, box-shadow .2s ease, background .2s ease, border-color .2s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-molten { background: var(--molten); color: #1a0d02; box-shadow: var(--glow); }
.btn-molten:hover { box-shadow: 0 0 0 1px rgba(249,115,22,.5), 0 16px 48px -12px rgba(249,115,22,.7); transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--edge-2); }
.btn-ghost:hover { background: var(--forge); border-color: var(--ash-2); }
.btn-block { width: 100%; }
.btn-sm { padding: 9px 16px; font-size: .875rem; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  background: rgba(11,11,15,.72);
  border-bottom: 1px solid var(--edge);
}
.nav { display: flex; align-items: center; gap: 28px; height: 66px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; letter-spacing: -.03em; }
.brand .drop {
  width: 16px; height: 16px; border-radius: 60% 60% 62% 62% / 68% 68% 55% 55%;
  background: var(--molten); box-shadow: 0 0 14px -2px rgba(249,115,22,.8); transform: rotate(8deg);
}
.nav-links { display: flex; align-items: center; gap: 22px; margin-left: 8px; }
.nav-links a { color: var(--ash); font-size: .92rem; font-weight: 500; transition: color .15s ease; }
.nav-links a:hover, .nav-links a.active { color: var(--ink); }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.langsw { display: inline-flex; gap: 2px; font-family: var(--font-mono); font-size: .72rem; border: 1px solid var(--edge); border-radius: 999px; padding: 3px; }
.langsw a { padding: 3px 8px; border-radius: 999px; color: var(--ash-2); letter-spacing: .04em; }
.langsw a.active { color: var(--ink); background: var(--forge-2); }
.nav-toggle { display: none; background: none; border: 0; cursor: pointer; padding: 8px; }
.nav-toggle span { display: block; width: 20px; height: 2px; background: var(--ink); border-radius: 2px; }
.nav-toggle span + span { margin-top: 4px; }

/* ---------- hero ---------- */
.hero { padding: 96px 0 72px; position: relative; }
.hero h1 { font-size: clamp(2.6rem, 6.5vw, 4.6rem); font-weight: 700; max-width: 15ch; }
.hero .lead { margin-top: 22px; font-size: clamp(1.05rem, 2.2vw, 1.3rem); }
.hero-cta { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 34px; }
.hero-note { margin-top: 16px; font-size: .85rem; color: var(--ash-2); font-family: var(--font-mono); }

/* format-transformation chips (hero signature support) */
.formats { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 46px; align-items: center; }
.fmt {
  font-family: var(--font-mono); font-size: .8rem; letter-spacing: .02em;
  padding: 7px 13px; border-radius: 9px; border: 1px solid var(--edge);
  background: var(--forge); color: var(--ash);
}
.fmt.out { border-color: transparent; background: var(--molten-soft); color: var(--ink); position: relative; }
.fmt-arrow { color: var(--ember-2); font-family: var(--font-mono); }

/* ---------- sections ---------- */
.section { padding: 84px 0; position: relative; }
.section-head { max-width: 60ch; margin-bottom: 46px; }
.section-head h2 { font-size: clamp(1.9rem, 4vw, 2.7rem); margin-top: 16px; }
.section-head p { color: var(--ash); margin-top: 14px; font-size: 1.05rem; }

/* ---------- capability grid ---------- */
.grid { display: grid; gap: 18px; grid-template-columns: repeat(3, 1fr); }
.card {
  background: var(--forge); border: 1px solid var(--edge); border-radius: var(--radius);
  padding: 26px; transition: border-color .2s ease, transform .2s ease, background .2s ease;
}
.card:hover { border-color: var(--edge-2); background: var(--forge-2); transform: translateY(-2px); }
.card h3 { font-size: 1.2rem; margin-bottom: 10px; }
.card p { color: var(--ash); font-size: .96rem; }
.card .ic {
  width: 40px; height: 40px; border-radius: 11px; margin-bottom: 18px;
  display: grid; place-items: center; background: var(--molten-soft); border: 1px solid var(--edge);
}
.card .ic span { width: 16px; height: 16px; border-radius: 5px; background: var(--molten); box-shadow: 0 0 12px -2px rgba(249,115,22,.7); }

/* ---------- code sample ---------- */
.code-panel {
  background: var(--void-2); border: 1px solid var(--edge); border-radius: var(--radius-lg);
  overflow: hidden;
}
.code-top { display: flex; align-items: center; gap: 8px; padding: 14px 18px; border-bottom: 1px solid var(--edge); }
.code-top .dot { width: 11px; height: 11px; border-radius: 50%; background: var(--forge-2); border: 1px solid var(--edge-2); }
.code-top .lbl { margin-left: auto; font-family: var(--font-mono); font-size: .74rem; color: var(--ash-2); letter-spacing: .1em; text-transform: uppercase; }
pre.code { margin: 0; padding: 22px; overflow-x: auto; font-family: var(--font-mono); font-size: .86rem; line-height: 1.7; color: #d7d7de; }
pre.code .k { color: var(--ember-1); }
pre.code .s { color: #7ee0b8; }
pre.code .c { color: var(--ash-2); }
code.inline { font-family: var(--font-mono); font-size: .86em; background: var(--forge); border: 1px solid var(--edge); border-radius: 6px; padding: 1px 6px; overflow-wrap: break-word; }

.split { display: grid; grid-template-columns: 1fr 1.1fr; gap: 48px; align-items: center; }

/* ---------- pricing ---------- */
.tiers { display: grid; gap: 20px; grid-template-columns: repeat(4, 1fr); align-items: stretch; }
.tier {
  background: var(--forge); border: 1px solid var(--edge); border-radius: var(--radius-lg);
  padding: 28px 24px; display: flex; flex-direction: column; position: relative;
}
.tier.pop { border-color: transparent; box-shadow: var(--glow); background: linear-gradient(var(--forge), var(--forge)) padding-box, var(--molten) border-box; border: 1px solid transparent; }
.tier .badge {
  position: absolute; top: -11px; left: 24px; font-family: var(--font-mono); font-size: .68rem;
  letter-spacing: .12em; text-transform: uppercase; padding: 4px 10px; border-radius: 999px;
  background: var(--molten); color: #1a0d02; font-weight: 600;
}
.tier .tname { font-family: var(--font-display); font-size: 1.15rem; font-weight: 600; }
.tier .price { margin: 16px 0 4px; font-family: var(--font-display); font-size: 2.4rem; font-weight: 700; letter-spacing: -.03em; }
.tier .price small { font-size: .95rem; color: var(--ash); font-weight: 400; font-family: var(--font-body); }
.tier .quota { font-family: var(--font-mono); font-size: .84rem; color: var(--ember-2); margin-bottom: 20px; }
.tier ul { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; flex: 1; }
.tier li { color: var(--ash); font-size: .92rem; padding-left: 24px; position: relative; }
.tier li::before { content: ""; position: absolute; left: 0; top: 8px; width: 12px; height: 2px; border-radius: 2px; background: var(--molten); }
.pricing-note { text-align: center; color: var(--ash-2); font-size: .84rem; margin-top: 26px; font-family: var(--font-mono); }

/* ---------- CTA band ---------- */
.band {
  border-radius: var(--radius-lg); border: 1px solid var(--edge);
  background:
    radial-gradient(120% 160% at 100% 0%, rgba(249,115,22,.22), transparent 55%),
    radial-gradient(120% 160% at 0% 100%, rgba(236,72,153,.16), transparent 55%),
    var(--forge);
  padding: 56px 44px; text-align: center;
}
.band h2 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
.band p { color: var(--ash); margin: 14px auto 28px; max-width: 46ch; }

/* ---------- auth / centered card ---------- */
.slab { min-height: calc(100vh - 66px); display: grid; place-items: center; padding: 60px 0; }
.panel {
  width: 100%; max-width: 440px; background: var(--forge); border: 1px solid var(--edge);
  border-radius: var(--radius-lg); padding: 38px;
}
.panel h1 { font-size: 1.7rem; }
.panel .lead { margin: 12px 0 26px; font-size: .98rem; }
.field { display: block; margin-bottom: 16px; }
.field label { display: block; font-size: .82rem; color: var(--ash); margin-bottom: 8px; font-weight: 500; }
.input {
  width: 100%; padding: 13px 15px; border-radius: 11px; background: var(--void-2);
  border: 1px solid var(--edge-2); color: var(--ink); transition: border-color .15s ease, box-shadow .15s ease;
}
.input:focus { outline: none; border-color: var(--ember-2); box-shadow: 0 0 0 3px rgba(249,115,22,.2); }
.input.mono { font-family: var(--font-mono); font-size: .85rem; }

/* ---------- notices ---------- */
.notice { border-radius: 11px; padding: 14px 16px; font-size: .9rem; border: 1px solid var(--edge-2); background: var(--forge); margin-bottom: 20px; }
.notice.ok { border-color: rgba(126,224,184,.4); background: rgba(126,224,184,.08); }
.notice.err { border-color: rgba(236,72,153,.4); background: rgba(236,72,153,.08); }
.notice.molten { border-color: transparent; background: var(--molten-soft); }

/* ---------- dashboard ---------- */
.dash-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; align-items: start; }
.stat-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.plan-pill { font-family: var(--font-mono); font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; padding: 5px 12px; border-radius: 999px; background: var(--molten-soft); border: 1px solid var(--edge); }
.meter { height: 12px; border-radius: 999px; background: var(--void-2); border: 1px solid var(--edge); overflow: hidden; margin: 16px 0 10px; }
.meter > i { display: block; height: 100%; background: var(--molten); border-radius: 999px; box-shadow: 0 0 16px -2px rgba(249,115,22,.7); transition: width .4s ease; }
.usage-nums { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: .82rem; color: var(--ash); }
.token-box { display: flex; gap: 8px; margin: 14px 0; }
.token-box .input { flex: 1; }
.kv { display: flex; justify-content: space-between; padding: 12px 0; border-top: 1px solid var(--edge); font-size: .92rem; }
.kv:first-child { border-top: 0; }
.kv .k { color: var(--ash); }

.card-lg { background: var(--forge); border: 1px solid var(--edge); border-radius: var(--radius-lg); padding: 30px; }
.card-lg h2 { font-size: 1.3rem; margin-bottom: 6px; }
.card-lg > .muted { font-size: .92rem; }

/* ---------- docs ---------- */
.doc-layout { display: grid; grid-template-columns: 220px 1fr; gap: 48px; align-items: start; padding-top: 40px; }
/* Let the columns collapse below their content so inner scrollers (code blocks,
   tables, the section nav) handle overflow instead of widening the page. */
.doc-layout > * { min-width: 0; }
.doc-nav { position: sticky; top: 90px; display: flex; flex-direction: column; gap: 4px; }
.doc-nav a { color: var(--ash); font-size: .9rem; padding: 6px 10px; border-radius: 8px; border-left: 2px solid transparent; }
.doc-nav a:hover { color: var(--ink); background: var(--forge); }
.doc-body { max-width: 72ch; }
.doc-body h2 { font-size: 1.7rem; margin: 44px 0 16px; scroll-margin-top: 90px; }
.doc-body h3 { font-size: 1.2rem; margin: 28px 0 12px; }
.doc-body p, .doc-body li { color: #c9c9d2; margin-bottom: 12px; overflow-wrap: break-word; }
.doc-body ul { list-style: disc; padding-left: 22px; }
.doc-body ul li { margin-bottom: 8px; }
.doc-body .code-panel { margin: 18px 0; }
.doc-body table { width: 100%; border-collapse: collapse; margin: 18px 0; font-size: .9rem; }
.doc-body th, .doc-body td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--edge); }
.doc-body th { color: var(--ash); font-weight: 600; font-family: var(--font-mono); font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--edge); background: var(--void-2); padding: 56px 0 40px; margin-top: 40px; position: relative; z-index: 1; }
.foot-grid { display: flex; flex-wrap: wrap; gap: 40px; justify-content: space-between; }
.foot-brand { max-width: 30ch; }
.foot-brand p { color: var(--ash); font-size: .9rem; margin-top: 12px; }
.foot-col h4 { font-family: var(--font-mono); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ash-2); margin-bottom: 14px; }
.foot-col a { display: block; color: var(--ash); font-size: .92rem; padding: 5px 0; }
.foot-col a:hover { color: var(--ink); }
.foot-bottom { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; margin-top: 40px; padding-top: 22px; border-top: 1px solid var(--edge); color: var(--ash-2); font-size: .84rem; }

/* ---------- modal (reusable confirm/alert) ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  background: rgba(6, 6, 9, .74);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .18s ease, visibility .18s ease;
}
.modal-overlay.open { opacity: 1; visibility: visible; pointer-events: auto; }
.modal {
  width: 100%; max-width: 430px; background: var(--forge); border: 1px solid var(--edge-2);
  border-radius: var(--radius-lg); padding: 28px;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .7);
  transform: translateY(10px) scale(.985); transition: transform .18s ease;
}
.modal-overlay.open .modal { transform: none; }
.modal-icon { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; margin-bottom: 16px; background: var(--molten-soft); border: 1px solid var(--edge); }
.modal-icon span { width: 16px; height: 16px; border-radius: 5px; background: var(--molten); box-shadow: 0 0 12px -2px rgba(249, 115, 22, .7); }
.modal h3 { font-size: 1.25rem; margin-bottom: 8px; }
.modal p { color: var(--ash); font-size: .95rem; margin-bottom: 24px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
@media (max-width: 480px) {
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .btn { width: 100%; }
}

/* ---------- utilities ---------- */
.stack-sm > * + * { margin-top: 10px; }
.center { text-align: center; }
.hide { display: none !important; }
.copy-btn { position: relative; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr 1fr; }
  .tiers { grid-template-columns: 1fr 1fr; }
  .split, .dash-grid, .doc-layout { grid-template-columns: 1fr; }
  /* Section nav becomes a swipeable horizontal tab strip above the body. */
  .doc-nav {
    position: static; flex-direction: row; flex-wrap: nowrap; gap: 8px;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    padding-bottom: 12px; margin-bottom: 8px; border-bottom: 1px solid var(--edge);
  }
  .doc-nav a { white-space: nowrap; border-left: 0; border: 1px solid var(--edge); border-radius: 999px; }
}
@media (max-width: 640px) {
  .nav-links, .nav-right .desktop { display: none; }
  .nav-toggle { display: block; }
  .nav.open .nav-links { display: flex; position: absolute; top: 66px; left: 0; right: 0; flex-direction: column; align-items: flex-start; gap: 4px; padding: 16px 24px; background: var(--void); border-bottom: 1px solid var(--edge); }
  .nav.open .nav-links a { padding: 8px 0; width: 100%; }
  .grid, .tiers { grid-template-columns: 1fr; }
  .hero { padding: 64px 0 48px; }
  .section { padding: 60px 0; }
  .band { padding: 40px 22px; }
  .panel { padding: 28px 22px; }
  /* Wide data tables scroll horizontally instead of being clipped by the page. */
  .doc-body table { display: block; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* ---------- a11y ---------- */
:focus-visible { outline: 2px solid var(--ember-2); outline-offset: 2px; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .molten-text { animation: none; }
}
