:root {
  --paper: #eee8db;
  --paper-light: #f8f2e5;
  --paper-deep: #ded5c2;
  --ink: #21362f;
  --muted: #756f62;
  --line: #bdb4a0;
  --accent: #bd422d;
  --accent-soft: rgba(189, 66, 45, .08);
  --success: #35755c;
  --danger: #a6382d;
  --code-bg: #1c2c27;
  --display: Baskerville, "Iowan Old Style", "Palatino Linotype", "Noto Serif SC", serif;
  --body: Aptos, "Gill Sans", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --mono: "Cascadia Code", "JetBrains Mono", "Courier New", monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--body);
  overflow-x: hidden;
}

.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle at 15% 8%, rgba(255,255,255,.78), transparent 29rem),
    radial-gradient(circle at 88% 35%, rgba(126,100,62,.07), transparent 32rem),
    repeating-linear-gradient(0deg, transparent 0 3px, rgba(79,57,31,.018) 3px 4px);
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 100;
  padding: 10px 14px;
  color: var(--paper-light);
  background: var(--ink);
  transform: translateY(-160%);
}

.skip-link:focus { transform: none; }

main {
  position: relative;
  width: min(1220px, calc(100% - 64px));
  margin: 0 auto;
}

.masthead {
  min-height: 82px;
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  align-items: center;
  gap: 15px;
  border-bottom: 3px double var(--ink);
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  color: var(--accent);
  border: 1px solid var(--accent);
  font: 500 19px var(--display);
}

.brand-copy strong {
  display: block;
  font: 600 18px var(--display);
  letter-spacing: .08em;
}

.brand-copy span,
.issue-meta,
.label,
.tag,
.section-number,
footer {
  font-family: var(--mono);
  letter-spacing: .11em;
  text-transform: uppercase;
}

.brand-copy span { display: block; margin-top: 2px; color: var(--muted); font-size: 8px; }
.masthead-rule { display: flex; align-items: center; gap: 14px; color: var(--muted); font: italic 13px var(--display); }
.masthead-rule::before, .masthead-rule::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.issue-meta { text-align: right; font-size: 8px; line-height: 1.6; }
.issue-meta span, .issue-meta strong { display: block; }
.issue-meta span { color: var(--accent); }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(290px, 390px);
  align-items: end;
  gap: clamp(40px, 7vw, 96px);
  padding: clamp(58px, 9vw, 108px) 0 clamp(54px, 8vw, 92px);
  border-bottom: 1px solid var(--ink);
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .22em;
}

.pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }

h1 {
  max-width: 800px;
  margin: 24px 0 26px;
  font: 400 clamp(56px, 8.3vw, 108px)/.88 var(--display);
  letter-spacing: -.055em;
}

h1 em { display: inline-block; color: var(--accent); font-weight: 400; }

.lede {
  max-width: 630px;
  margin: 0;
  color: var(--muted);
  font: italic clamp(16px, 1.7vw, 19px)/1.7 var(--display);
}

.endpoint-card {
  position: relative;
  padding: 24px;
  color: var(--paper-light);
  background: var(--ink);
  border-top: 5px solid var(--accent);
}

.endpoint-card::before { content: "ENDPOINT / 00"; position: absolute; top: -27px; right: 0; color: var(--muted); font: 8px var(--mono); letter-spacing: .12em; }
.endpoint-card > div { min-width: 0; }
.label { display: block; margin-bottom: 10px; color: #c5bda9; font-size: 9px; }
code, pre, input { font-family: var(--mono); }
.endpoint-card code { display: block; overflow-wrap: anywhere; font-size: clamp(12px, 1.45vw, 16px); line-height: 1.55; }
.endpoint-card .copy { width: 100%; margin-top: 22px; border-color: rgba(255,255,255,.28); }

section {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: clamp(20px, 4vw, 54px);
  padding: clamp(52px, 7vw, 82px) 0;
  border-bottom: 1px solid var(--line);
}

.section-number { position: relative; padding-top: 10px; color: var(--accent); font-size: 11px; }
.section-number::after { content: ""; position: absolute; top: 31px; left: 0; width: 28px; height: 1px; background: var(--accent); }
.section-body { min-width: 0; }
h2 { margin: 0 0 14px; font: 400 clamp(34px, 5vw, 54px)/1.05 var(--display); letter-spacing: -.035em; }
.section-body > p, article p { max-width: 720px; color: var(--muted); line-height: 1.75; }

button, input { border-radius: 0; }
button { min-height: 44px; cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 3px solid rgba(189,66,45,.42); outline-offset: 3px; }

.copy, .action, .tab {
  padding: 11px 16px;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  font: 700 10px var(--mono);
  letter-spacing: .05em;
  transition: color .18s ease, background .18s ease, border-color .18s ease, transform .18s ease;
}

.copy:hover, .tab:hover { color: var(--accent); border-color: var(--accent); }
.endpoint-card .copy { color: var(--paper-light); }
.endpoint-card .copy:hover { color: var(--paper-light); background: var(--accent); }
.action { color: #fff9ed; background: var(--accent); border-color: var(--accent); }
.action:hover { background: #a83825; transform: translateY(-1px); }

.key-row { display: grid; grid-template-columns: 118px minmax(0, 1fr) auto; margin-top: 28px; }
.key-row label { display: grid; place-items: center; padding: 0 12px; color: var(--muted); border: 1px solid var(--line); border-right: 0; font: 700 10px var(--mono); letter-spacing: .08em; }
.key-row input { width: 100%; min-width: 0; min-height: 48px; padding: 13px 15px; color: var(--ink); background: rgba(255,252,244,.55); border: 1px solid var(--line); outline: none; }
.key-row input:focus { background: var(--paper-light); border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.result { min-height: 22px; margin-top: 13px; color: var(--muted); font: 11px/1.6 var(--mono); }
.result.ok { color: var(--success); }
.result.error { color: var(--danger); }
.model-list { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
.model-list span { padding: 7px 9px; background: rgba(255,252,244,.45); border: 1px solid var(--line); font: 10px var(--mono); }

.tabs { display: flex; margin-top: 30px; border-bottom: 1px solid var(--ink); }
.tab { min-width: 98px; color: var(--muted); border-width: 1px 1px 0 0; }
.tab:first-child { border-left-width: 1px; }
.tab.active { color: var(--paper-light); background: var(--ink); border-color: var(--ink); }
.code-shell { position: relative; min-height: 280px; color: #f3ecde; background: var(--code-bg); border-top: 4px solid var(--accent); }
.code-shell pre { margin: 0; padding: 30px; overflow: auto; font-size: 12px; line-height: 1.75; tab-size: 2; }
.code-copy { position: absolute; top: 12px; right: 12px; z-index: 1; min-height: 36px; color: #f3ecde; background: var(--code-bg); border-color: rgba(255,255,255,.3); }

.integration-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(28px, 5vw, 64px); margin-top: 32px; }
article { min-width: 0; padding: 22px 0 0; border-top: 3px double var(--ink); }
.tag { color: var(--accent); font-size: 8px; }
article h3 { margin: 15px 0 8px; font: 500 29px var(--display); }
article pre { margin: 20px 0 0; padding: 18px; overflow: auto; color: #f3ecde; background: var(--code-bg); border-left: 3px solid var(--accent); font-size: 11px; line-height: 1.75; }
article p code, .notes code { padding: 2px 5px; color: var(--ink); background: var(--paper-deep); }

.notes ul { margin: 26px 0 0; padding: 0; list-style: none; border-top: 3px double var(--ink); }
.notes li { position: relative; padding: 17px 16px 17px 34px; color: var(--muted); border-bottom: 1px solid var(--line); line-height: 1.7; }
.notes li::before { content: "§"; position: absolute; left: 7px; color: var(--accent); font: italic 17px var(--display); }
.notes strong { color: var(--ink); }

footer { display: flex; justify-content: space-between; gap: 20px; padding: 34px 0 52px; color: var(--muted); font-size: 8px; }
footer span:first-child { color: var(--accent); font-weight: 700; }

.reveal { animation: rise .55s both cubic-bezier(.2,.8,.2,1); }
.delay-1 { animation-delay: .06s; }
.delay-2 { animation-delay: .12s; }
.delay-3 { animation-delay: .18s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

@media (max-width: 900px) {
  main { width: calc(100% - 40px); max-width: 760px; }
  .masthead { grid-template-columns: auto auto 1fr; }
  .masthead-rule { display: none; }
  .issue-meta { margin-left: auto; }
  .hero { grid-template-columns: minmax(0, 1fr); align-items: start; gap: 52px; }
  .hero-copy { min-width: 0; }
  .endpoint-card { width: 100%; max-width: 560px; }
  section { grid-template-columns: 58px minmax(0, 1fr); }
}

@media (max-width: 640px) {
  main { width: calc(100% - 28px); max-width: 560px; }
  .masthead { min-height: 70px; grid-template-columns: auto 1fr; gap: 10px; }
  .brand-mark { width: 38px; height: 38px; }
  .issue-meta { display: none; }
  .hero { padding: 52px 0 54px; gap: 46px; }
  h1 { margin-top: 20px; font-size: clamp(50px, 16vw, 76px); }
  h1 em { display: block; }
  .lede { font-size: 16px; }
  section { grid-template-columns: 1fr; gap: 18px; padding: 48px 0; }
  .section-number { padding-top: 0; }
  .section-number::after { top: 7px; left: 30px; width: 42px; }
  .key-row { grid-template-columns: 1fr; gap: 8px; }
  .key-row label { min-height: 40px; border-right: 1px solid var(--line); }
  .action { width: 100%; }
  .tabs { display: grid; grid-template-columns: repeat(3, 1fr); }
  .tab { min-width: 0; padding-inline: 8px; }
  .code-shell { min-height: 320px; }
  .code-shell pre { padding: 64px 20px 24px; font-size: 11px; }
  .code-copy { left: 12px; right: auto; }
  .integration-grid { grid-template-columns: 1fr; }
  footer { flex-direction: column; gap: 8px; }
}

@media (max-width: 400px) {
  .eyebrow { font-size: 8px; }
  h1 { font-size: 49px; }
  .endpoint-card { padding: 20px; }
  .endpoint-card code { font-size: 11px; }
  h2 { font-size: 36px; }
  article pre { margin-inline: -4px; padding: 15px; font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
