/* ==========================================================================
   Timix.AI Developer Portal — styles
   Matches the platform "Ledger" design system: warm cream + navy ink + orange,
   Fraunces (display) / Instrument Sans (body) / Spline Sans Mono. Light + dark.
   ========================================================================== */

:root {
  /* light (default) — the marketing-site "paper" palette */
  --paper: #fdf7ee;
  --paper-card: #fffdf8;
  --paper-deep: #f1e8d8;
  --ink: #0f2742;
  --ink-soft: #3e5571;
  --ink-mute: #546880;
  --rule: rgb(15 39 66 / 0.16);
  --rule-soft: rgb(15 39 66 / 0.09);
  --brand: #f97316;
  --brand-accent: #c2410c; /* accessible orange TEXT on paper */
  --brand-bright: #fb923c;
  --brand-tint: rgb(249 115 22 / 0.09);
  --code-bg: #0d2139;
  --code-fg: #e7eef7;
  --press: #0f2742; /* letterpress shadow color */
  --shadow-card: 0 1px 2px rgb(15 39 66 / 0.05), 0 10px 30px -14px rgb(15 39 66 / 0.22);
  --nav-bg: rgb(253 247 238 / 0.85);
  --code-inline-bg: #f1e8d8;
  --code-inline-fg: #b4530b;
}

html.dark {
  --paper: #0d2139;
  --paper-card: #16314f;
  --paper-deep: #112a47;
  --ink: #e7eef7;
  --ink-soft: #c3d4e8;
  --ink-mute: #9fb2c8;
  --rule: rgb(231 238 247 / 0.16);
  --rule-soft: rgb(231 238 247 / 0.08);
  --brand: #f97316;
  --brand-accent: #fb923c; /* brighter orange TEXT on navy */
  --brand-bright: #fb923c;
  --brand-tint: rgb(251 146 60 / 0.12);
  --code-bg: #081726;
  --code-fg: #e7eef7;
  --press: #02060c;
  --shadow-card: 0 1px 2px rgb(0 0 0 / 0.3), 0 12px 32px -14px rgb(0 0 0 / 0.55);
  --nav-bg: rgb(13 33 57 / 0.85);
  --code-inline-bg: #112a47;
  --code-inline-fg: #fdba74;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink-soft);
  background: var(--paper);
  line-height: 1.65;
  font-size: 1.0125rem;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: var(--brand); color: var(--paper); }

:root {
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body: 'Instrument Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'Spline Sans Mono', ui-monospace, Consolas, monospace;
}

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

/* ---------- Top navigation ---------- */
.nav {
  position: sticky; top: 0; z-index: 40;
  background: var(--nav-bg);
  backdrop-filter: saturate(150%) blur(10px);
  border-bottom: 1px solid var(--rule);
}
.nav-inner { max-width: 1080px; margin: 0 auto; padding: 0 24px; height: 60px; display: flex; align-items: center; gap: 8px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; color: var(--ink); font-size: 1.04rem; letter-spacing: -.02em; margin-right: 14px; white-space: nowrap; font-family: var(--font-body); }
.brand:hover { text-decoration: none; }
.brand .ai { color: var(--brand-accent); }
.brand-chip { width: 26px; height: 26px; flex: 0 0 auto; display: block; }
.nav-links { display: flex; align-items: center; gap: 2px; flex: 1; flex-wrap: wrap; }
.nav-links a {
  color: var(--ink-soft); font-size: .9rem; font-weight: 500; padding: 7px 11px; border-radius: 8px; white-space: nowrap;
}
.nav-links a:hover { background: var(--paper-deep); color: var(--ink); text-decoration: none; }
.nav-links a.active { color: var(--brand-accent); background: var(--brand-tint); }
.nav-cta {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--brand); color: var(--ink) !important;
  font-size: .85rem; font-weight: 600; padding: 8px 14px; border-radius: 8px; white-space: nowrap;
  border: 1.5px solid var(--ink);
  box-shadow: 3px 3px 0 0 var(--press);
  transition: transform .14s ease, box-shadow .14s ease;
}
.nav-cta:hover { text-decoration: none; transform: translate(1px, 1px); box-shadow: 2px 2px 0 0 var(--press); }
.nav-ghost { color: var(--ink-mute) !important; font-size: .85rem; font-weight: 500; padding: 8px 10px; white-space: nowrap; }
.theme-toggle {
  display: inline-grid; place-items: center; width: 36px; height: 36px; flex: 0 0 auto;
  background: transparent; border: 1px solid var(--rule); border-radius: 9px; cursor: pointer;
  color: var(--ink-soft); transition: background .14s ease, color .14s ease, border-color .14s ease;
}
.theme-toggle:hover { background: var(--paper-deep); color: var(--ink); border-color: var(--rule); }
.theme-toggle svg { width: 18px; height: 18px; }

/* ---------- Layout ---------- */
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 24px; }
.page { max-width: 820px; margin: 0 auto; padding: 44px 24px 96px; }

footer.foot { border-top: 1px solid var(--rule); background: var(--paper-deep); color: var(--ink-mute); font-size: .85rem; }
footer.foot .wrap { padding-top: 26px; padding-bottom: 26px; display: flex; flex-wrap: wrap; gap: 12px 28px; align-items: center; justify-content: space-between; }
footer.foot a { color: var(--ink-soft); }

/* ---------- Hero ---------- */
.hero {
  border-bottom: 1px solid var(--rule);
  background-image:
    linear-gradient(var(--rule-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--rule-soft) 1px, transparent 1px);
  background-size: 56px 56px;
}
.hero-inner { max-width: 1080px; margin: 0 auto; padding: 70px 24px 58px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); text-transform: uppercase; letter-spacing: .18em; font-size: .72rem; font-weight: 500;
  color: var(--brand-accent); margin-bottom: 18px;
}
.eyebrow .badge { background: var(--brand-tint); padding: 3px 9px; border-radius: 999px; letter-spacing: .12em; }
.hero h1 { font-family: var(--font-display); font-size: clamp(2.2rem, 4.6vw, 3.3rem); line-height: 1.05; letter-spacing: -.018em; color: var(--ink); margin: 0 0 16px; font-weight: 560; max-width: 18ch; text-wrap: balance; }
.hero p.lede { font-size: 1.15rem; color: var(--ink-soft); max-width: 60ch; margin: 0 0 28px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---------- Buttons (letterpress) ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-body);
  font-weight: 600; font-size: .95rem; padding: 12px 20px; border-radius: 9px;
  border: 1.5px solid var(--ink); cursor: pointer; transition: transform .14s ease, box-shadow .14s ease, background .14s ease;
}
.btn-primary { background: var(--brand); color: var(--ink); box-shadow: 4px 4px 0 0 var(--press); }
.btn-primary:hover { text-decoration: none; transform: translate(2px, 2px); box-shadow: 1px 1px 0 0 var(--press); }
.btn-primary:active { transform: translate(4px, 4px); box-shadow: none; }
.btn-secondary { background: transparent; color: var(--ink); }
.btn-secondary:hover { text-decoration: none; background: var(--paper-deep); }
.btn .arrow { transition: transform .15s ease; }
.btn:hover .arrow { transform: translateX(2px); }

/* ---------- Sections + cards ---------- */
.section-title { font-family: var(--font-display); font-size: 1.6rem; font-weight: 560; color: var(--ink); letter-spacing: -.015em; margin: 56px 0 6px; }
.section-sub { color: var(--ink-mute); margin: 0 0 22px; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.card { display: block; background: var(--paper-card); border: 1px solid var(--rule); border-radius: 14px; padding: 22px; box-shadow: var(--shadow-card); transition: transform .14s ease, border-color .14s ease; }
a.card:hover { text-decoration: none; transform: translateY(-2px); border-color: var(--brand-bright); }
.card .ic { width: 38px; height: 38px; border-radius: 10px; margin-bottom: 14px; display: grid; place-items: center; font-size: 1.1rem; background: var(--brand-tint); }
.card h3 { font-family: var(--font-display); margin: 0 0 5px; color: var(--ink); font-size: 1.12rem; font-weight: 560; }
.card p { margin: 0; color: var(--ink-soft); font-size: .92rem; }
.card .more { display: inline-block; margin-top: 12px; color: var(--brand-accent); font-weight: 600; font-size: .86rem; font-family: var(--font-mono); }

/* ---------- Steps ---------- */
.steps { counter-reset: step; display: grid; gap: 14px; margin: 22px 0; }
.step { position: relative; padding-left: 50px; }
.step::before { counter-increment: step; content: counter(step); position: absolute; left: 0; top: 0; width: 32px; height: 32px; border-radius: 50%; background: var(--ink); color: var(--paper); font-weight: 700; font-size: .92rem; font-family: var(--font-mono); display: grid; place-items: center; }
.step h4 { font-family: var(--font-display); margin: 4px 0 4px; color: var(--ink); font-size: 1.05rem; font-weight: 560; }
.step p { margin: 0; font-size: .93rem; }

/* ---------- Callouts ---------- */
.callout { border-radius: 10px; padding: 14px 16px; margin: 20px 0; font-size: .92rem; border: 1px solid var(--rule); border-left: 3px solid var(--brand-bright); background: var(--brand-tint); color: var(--ink-soft); }
.callout strong { color: var(--ink); font-weight: 650; }

/* ---------- Prose / markdown ---------- */
.prose h1 { font-family: var(--font-display); font-size: 2.1rem; color: var(--ink); letter-spacing: -.018em; margin: 0 0 10px; font-weight: 560; }
.prose h2 { font-family: var(--font-display); font-size: 1.5rem; color: var(--ink); letter-spacing: -.01em; margin: 46px 0 12px; font-weight: 560; padding-bottom: 8px; border-bottom: 1px solid var(--rule); }
.prose h3 { font-family: var(--font-display); font-size: 1.2rem; color: var(--ink); margin: 30px 0 8px; font-weight: 560; }
.prose h4 { font-size: 1rem; color: var(--ink); margin: 22px 0 6px; font-weight: 700; }
.prose p, .prose li { font-size: .97rem; color: var(--ink-soft); }
.prose ul, .prose ol { padding-left: 22px; }
.prose li { margin: 5px 0; }
.prose blockquote { margin: 18px 0; padding: 12px 16px; border-left: 3px solid var(--brand-bright); background: var(--brand-tint); border-radius: 0 8px 8px 0; color: var(--ink-soft); }
.prose blockquote p { margin: 0; }
.prose hr { border: none; border-top: 1px solid var(--rule); margin: 36px 0; }
.prose strong { color: var(--ink); font-weight: 650; }

/* ---------- Code ---------- */
code { font-family: var(--font-mono); font-size: .86em; background: var(--code-inline-bg); color: var(--code-inline-fg); padding: .12em .42em; border-radius: 5px; }
pre { position: relative; background: var(--code-bg); color: var(--code-fg); border-radius: 10px; padding: 16px 18px; overflow: auto; font-size: .84rem; line-height: 1.55; margin: 18px 0; border: 1px solid rgb(231 238 247 / 0.08); }
pre code { background: none; color: inherit; padding: 0; font-size: inherit; }
.copy-btn { position: absolute; top: 8px; right: 8px; background: rgb(255 255 255 / .08); color: #cbd5e1; border: 1px solid rgb(255 255 255 / .16); border-radius: 7px; font-size: .7rem; font-weight: 600; font-family: var(--font-mono); padding: 4px 9px; cursor: pointer; opacity: 0; transition: opacity .12s ease; }
pre:hover .copy-btn { opacity: 1; }
.copy-btn:hover { background: rgb(255 255 255 / .16); color: #fff; }
.copy-btn.ok { color: #4ade80; border-color: rgb(74 222 128 / .4); }

/* ---------- Tables ---------- */
.prose table { width: 100%; border-collapse: collapse; margin: 18px 0; font-size: .9rem; }
.prose th, .prose td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--rule); vertical-align: top; color: var(--ink-soft); }
.prose th { color: var(--ink); font-weight: 700; background: var(--paper-deep); }
.prose tr:last-child td { border-bottom: none; }

/* ---------- Misc ---------- */
.muted { color: var(--ink-mute); }
.loading { padding: 60px 0; text-align: center; color: var(--ink-mute); }

@media (max-width: 720px) {
  .nav-ghost { display: none; }
  .nav-links { gap: 0; }
  .nav-links a { padding: 7px 8px; font-size: .84rem; }
  .hero-inner { padding: 52px 20px 44px; }
}
