/* ---------- tokens ---------- */
:root {
  --navy: #0B2559;
  --blue: #1A7CFF;
  --blue-strong: #0F66E0; /* AA-contrast blue for text and filled buttons */
  --blue-strong-hover: #0B52B8;

  --bg: #FFFFFF;
  --bg-alt: #F4F7FC;
  --surface: #FFFFFF;
  --text: #0E1A33;
  --muted: #51607A;
  --line: #DDE4F0;
  --accent: #0F66E0;
  --accent-strong: #0B2559;
  --code-bg: #0B1730;
  --code-text: #E6EDF8;

  --radius: 12px;
  --maxw: 1120px;
  --font-head: "Lexend", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #070F1F;
    --bg-alt: #0C1730;
    --surface: #0F1C38;
    --text: #E6EDF8;
    --muted: #9AA8C2;
    --line: #1E2D4D;
    --accent: #4D9BFF;
    --accent-strong: #BFD6FF;
    --code-bg: #050B18;
  }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.65 var(--font-body); }
img, svg { max-width: 100%; height: auto; }
a { color: var(--accent); text-underline-offset: 3px; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--font-head); line-height: 1.2; letter-spacing: -0.01em; }
code, pre { font-family: var(--font-mono); font-size: 0.9em; }
[id] { scroll-margin-top: 80px; }
.skip-link {
  position: absolute; left: 16px; top: -48px; z-index: 20; padding: 8px 16px;
  background: var(--accent); color: #fff; border-radius: 0 0 8px 8px; font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 0; }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .container { padding: 0 32px; } }

/* ---------- header / footer ---------- */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav { display: flex; align-items: center; gap: 24px; height: 64px; }
.brand {
  display: flex; align-items: center; gap: 10px;
  font: 600 1.25rem var(--font-head); color: var(--accent-strong); text-decoration: none;
}
.brand img { display: block; width: 32px; height: 32px; }
.brand b { color: var(--blue); font-weight: inherit; }
.nav-links { display: flex; gap: 20px; margin: 0 0 0 auto; padding: 0; list-style: none; }
.nav-links a { color: var(--muted); font-size: 0.95rem; font-weight: 500; text-decoration: none; }
.nav-links a:hover { color: var(--text); }
@media (max-width: 760px) { .nav-links .optional { display: none; } }
@media (max-width: 400px) {
  .nav { gap: 12px; }
  .nav-links { gap: 12px; }
  .nav-links a { font-size: 0.9rem; }
}

.site-footer { border-top: 1px solid var(--line); padding: 32px 0; color: var(--muted); font-size: 0.9rem; }
.site-footer .container { display: flex; flex-wrap: wrap; gap: 12px 24px; justify-content: space-between; align-items: center; }
.site-footer p { margin: 0; }
.site-footer .affiliation { order: 3; flex-basis: 100%; }
.site-footer ul { display: flex; gap: 20px; margin: 0; padding: 0; list-style: none; }
.site-footer a { color: var(--muted); }

/* ---------- shared content: tables, code ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-family: var(--font-head); font-weight: 600; }
td.center, th.center { text-align: center; }
:not(pre) > code { padding: 0.1em 0.35em; background: var(--bg-alt); border: 1px solid var(--line); border-radius: 6px; }

.highlight { position: relative; margin: 0 0 1rem; }
pre {
  margin: 0; padding: 16px 76px 16px 18px; overflow-x: auto;
  background: var(--code-bg); color: var(--code-text);
  border-radius: var(--radius); line-height: 1.55;
}
.copy {
  position: absolute; top: 8px; right: 8px; padding: 4px 10px; cursor: pointer;
  font: 500 0.75rem var(--font-body); color: var(--code-text);
  background: var(--code-bg); border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 6px;
  box-shadow: -12px 0 12px var(--code-bg);
}
.copy:hover { border-color: rgba(255, 255, 255, 0.45); }

.highlight .c, .highlight .c1, .highlight .cm { color: #7C8BA8; font-style: italic; }
.highlight .s, .highlight .s1, .highlight .s2, .highlight .sh, .highlight .dl { color: #9FE0A8; }
.highlight .k, .highlight .kd, .highlight .nb { color: #7DB5FF; }
.highlight .nv, .highlight .nt, .highlight .nl { color: #F2C879; }
.highlight .m, .highlight .mi, .highlight .mf, .highlight .kc { color: #F59E8B; }
.highlight .o, .highlight .p { color: #B7C3D9; }

/* ---------- Markdown pages (tutorials) ---------- */
.prose { max-width: 760px; padding-top: 48px; padding-bottom: 64px; overflow-wrap: anywhere; }
.prose h1 { font-size: clamp(1.8rem, 4vw, 2.4rem); }
.prose h2 { margin-top: 2.5rem; }
.prose img { border-radius: var(--radius); }
.prose table { display: block; overflow-x: auto; }

/* ---------- landing: sections ---------- */
.section { padding: 72px 0; }
.section-alt { background: var(--bg-alt); }
.section h2 { margin: 0 0 0.5rem; font-size: clamp(1.6rem, 3vw, 2.2rem); }
.section-lead { max-width: 680px; margin: 0 0 2.5rem; color: var(--muted); font-size: 1.05rem; }

/* hero */
.hero {
  padding: 64px 0 72px; text-align: center;
  background: radial-gradient(60% 60% at 50% 0%, color-mix(in srgb, var(--blue) 12%, transparent), transparent);
}
.hero-logo { width: min(320px, 70vw); height: auto; }
.hero h1 { max-width: 820px; margin: 24px auto 16px; font-size: clamp(1.9rem, 4.5vw, 3rem); }
.lead { max-width: 680px; margin: 0 auto 32px; color: var(--muted); font-size: 1.15rem; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.btn { display: inline-block; padding: 12px 22px; border: 1px solid transparent; border-radius: 999px; font-weight: 600; text-decoration: none; }
.btn-primary { background: var(--blue-strong); color: #fff; }
.btn-primary:hover { background: var(--blue-strong-hover); }
.btn-ghost { border-color: var(--line); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); }
.badges { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 32px 0 0; padding: 0; list-style: none; }
.badges li { padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 0.85rem; }
.badges a { color: inherit; }

/* highlight cards */
.cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); margin: 0; padding: 0; list-style: none; }
.card { padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.card h3 { margin: 0 0 8px; font-size: 1.1rem; }
.card h3::before {
  content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 10px;
  border-radius: 50%; background: var(--blue); vertical-align: middle;
}
.card p { margin: 0; color: var(--muted); }

/* quick start steps */
.steps { display: grid; gap: 32px; max-width: 860px; margin: 0; padding: 0; list-style: none; counter-reset: step; }
.steps > li { position: relative; min-width: 0; padding-left: 52px; counter-increment: step; }
.steps > li::before {
  content: counter(step); position: absolute; left: 0; top: 0;
  width: 34px; height: 34px; border-radius: 50%; background: var(--blue); color: #fff;
  font: 600 1rem/34px var(--font-head); text-align: center;
}
.steps h3 { margin: 4px 0 8px; font-size: 1.15rem; }
.steps p { margin: 0 0 12px; color: var(--muted); }
.two-col { display: grid; gap: 32px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr)); margin-top: 48px; }
.two-col > * { min-width: 0; }
.two-col h3 { margin: 0 0 8px; }
.two-col p { margin: 0 0 12px; color: var(--muted); }

/* module catalog */
.module-groups > h3 { margin: 40px 0 6px; font-size: 1.2rem; }
.module-groups > h3:first-child { margin-top: 0; }
.group-note { margin: 0 0 14px; color: var(--muted); }
.modules-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); margin: 12px 0 0; padding: 0; list-style: none; }
.module { min-width: 0; padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.module-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.module-head code { font-size: 0.95rem; font-weight: 500; color: var(--text); background: none; border: 0; padding: 0; overflow-wrap: anywhere; }
.module p { margin: 0; color: var(--muted); }
.module .module-needs { margin-top: 10px; font-size: 0.9rem; color: var(--text); }
.tag { padding: 2px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.tag-default { border-color: var(--accent); color: var(--accent); }

/* recipe feature list */
.ticks { margin: 0 0 16px; padding: 0; list-style: none; }
.ticks li { position: relative; margin-bottom: 10px; padding-left: 26px; color: var(--muted); }
.ticks li::before { content: ""; position: absolute; left: 4px; top: 0.6em; width: 10px; height: 10px; border-radius: 50%; background: var(--blue); }
.ticks strong { color: var(--text); font-weight: 600; }
#recipes > .container > h3 { margin: 40px 0 12px; }

/* architecture diagram */
.diagram { margin: 0 0 2.5rem; padding: 24px; overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.diagram svg { display: block; width: 100%; min-width: 640px; max-width: 820px; margin: 0 auto; }
.d-box { fill: var(--bg-alt); stroke: var(--line); stroke-width: 1.5; }
.d-core { fill: var(--bg-alt); fill: color-mix(in srgb, var(--blue) 14%, var(--surface)); stroke: var(--blue); stroke-width: 1.5; }
.d-frame { fill: none; stroke: var(--accent-strong); stroke-width: 1.5; stroke-dasharray: 6 5; }
.d-pill { fill: var(--accent-strong); }
.d-pill-text { font: 600 13px var(--font-body); fill: var(--bg); text-anchor: middle; }
.d-title { font: 600 15px var(--font-head); fill: var(--text); text-anchor: middle; }
.d-sub { font: 12px var(--font-body); fill: var(--muted); text-anchor: middle; }
.d-label { font: 500 11px var(--font-mono); fill: var(--muted); text-anchor: middle; }
.d-line { fill: none; stroke: var(--muted); stroke-width: 1.5; }
.d-arrowhead { fill: var(--muted); }

/* SDK chips */
.chips { display: flex; flex-wrap: wrap; gap: 12px; margin: 0 0 24px; padding: 0; list-style: none; }
.chips li { padding: 10px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; font: 600 1rem var(--font-head); }

/* ---------- blog: post ---------- */
.post-meta { margin: 0 0 8px; color: var(--muted); font-size: 0.9rem; }
.post-meta a { color: inherit; }
.post h1 { margin-top: 0; }
.post-figure { margin: 2rem 0; padding: 16px; overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.post-figure img { display: block; width: 100%; min-width: 600px; border-radius: 0; }
.post-figure figcaption { margin-top: 10px; color: var(--muted); font-size: 0.9rem; }
.post-footer { margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--line); }
.share { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; }
.share-label { font: 600 1rem var(--font-head); }
.share ul { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.share a, .share button {
  display: inline-block; padding: 6px 14px; cursor: pointer;
  background: none; border: 1px solid var(--line); border-radius: 999px;
  color: var(--text); font: 500 0.9rem var(--font-body); text-decoration: none;
}
.share a:hover, .share button:hover { border-color: var(--accent); }
.back { margin: 24px 0 0; }

/* ---------- blog: cards and index ---------- */
#updates { padding-top: 24px; }
.section-head { display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: baseline; justify-content: space-between; margin-bottom: 24px; }
.section-head h2 { margin: 0; }
.section-head a { font-weight: 600; text-decoration: none; }
.post-cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); margin: 0; padding: 0; list-style: none; }
.post-card { position: relative; display: flex; flex-direction: column; gap: 8px; }
.post-card:hover { border-color: var(--accent); }
.post-card time { color: var(--muted); font-size: 0.85rem; }
.card.post-card h3 { margin: 0; }
.card.post-card h3::before { content: none; }
.post-card h3 a { color: var(--text); text-decoration: none; }
.post-card h3 a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.post-card .more { margin-top: auto; color: var(--accent); font-size: 0.95rem; font-weight: 600; }
.page { padding-top: 48px; padding-bottom: 64px; }
.page h1 { margin: 0 0 8px; font-size: clamp(1.8rem, 4vw, 2.4rem); }

/* ---------- blog: new post form ---------- */
.new-post { display: grid; gap: 16px; margin: 24px 0 8px; }
.new-post label { display: grid; gap: 6px; font-weight: 600; }
.new-post .hint { color: var(--muted); font-size: 0.9rem; font-weight: 400; }
.new-post input, .new-post textarea {
  width: 100%; padding: 10px 12px; color: var(--text); font: 400 1rem var(--font-body);
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
}
.new-post input:focus-visible, .new-post textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.new-post .row { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.np-status { min-height: 1.65em; margin: 8px 0; color: var(--muted); }
.btn[aria-disabled="true"] { opacity: 0.5; pointer-events: none; }
