@import url('https://fonts.googleapis.com/css2?family=Unbounded:wght@400;500;600&family=Manrope:wght@400;500;600&display=swap');

/* SONA reference (/settings). The palette and the two families are the homepage's; the chrome
   stays quiet — hairlines and surface steps, one sky accent for links and the current tab.
   Spacing sits on a 4 px grid. Dark values come from site/assets/theme.css. */
:root {
  --sky: #2f9bf0;
  --sky-deep: #1577cf;
  --ink: #0d2235;
  --text: #3a5468;
  --muted: #5c7286;            /* ≥ 4.5:1 on the page and on cards */
  --line: #dcebf7;
  --line-2: #eef5fb;
  --tint: #edf7ff;
  --soft: #f7fbff;
  --page: #f6fbff;
  --row: var(--tint);          /* hovered and current tab */
  --ok: #168b67;
  --danger: #cf4a43;
  --warning: #94600f;          /* ≥ 4.5:1 on white */
  --shadow-card: 0 1px 2px rgba(13, 34, 53, .04);
  --ease: cubic-bezier(.22, .78, .24, 1);
}
:root[data-theme="dark"] {
  --soft: var(--surface-2);
  --row: var(--raised);
  --ok: #65d6ab;
  --danger: #ff958c;
  --warning: #f2c47b;
  --shadow-card: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--page);
  font-family: 'Manrope', sans-serif;
  line-height: 1.55;
}

button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--sky-deep); text-decoration: none; }
a:hover { text-decoration: underline; }
:is(a, button, summary):focus-visible { outline: 2px solid var(--sky); outline-offset: 2px; }
b, strong, th { font-weight: 600; }
h1, h2, h3 { margin: 0; color: var(--ink); font-family: 'Unbounded', sans-serif; font-weight: 400; letter-spacing: 0; }
p { margin: 0; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* ── top bar ── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid var(--line-2);
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(16px);
}
:root[data-theme="dark"] .topbar { background: rgba(18, 21, 25, .9); }
.topbar-in {
  display: flex;
  align-items: center;
  gap: 24px;
  width: min(1180px, calc(100% - 48px));
  height: 72px;
  margin: 0 auto;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-family: 'Unbounded', sans-serif;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: .12em;
}
.brand:hover { text-decoration: none; }
.brand-sig { width: 24px; height: 24px; flex: none; display: block; }
.top-spacer { flex: 1; }
.top-link {
  padding: 8px 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  transition: color .15s var(--ease);
}
.top-link:hover { color: var(--ink); text-decoration: none; }
.lang-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  transition: border-color .15s var(--ease);
}
.lang-link:hover { border-color: var(--sky); text-decoration: none; }
.sona-theme-toggle svg { display: block; }

/* ── page head ── */
.page {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  padding: 48px 0 64px;
}
.page-head { margin-bottom: 32px; }
.eyebrow { display: block; margin-bottom: 8px; color: var(--muted); font-size: 14px; font-weight: 500; }
.page-head h1 { font-size: clamp(32px, 4.2vw, 44px); line-height: 1.15; letter-spacing: -.02em; }
.page-head p { max-width: 680px; margin-top: 12px; font-size: 16px; }

/* ── tabs ── */
.settings-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
.side {
  position: sticky;
  top: 96px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
}
.tabs { display: grid; gap: 2px; }
.tab {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 36px;
  padding: 8px 12px;
  border: 0;
  border-radius: 8px;
  color: var(--text);
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  transition: color .15s var(--ease), background-color .15s var(--ease);
}
.tab:focus-visible { outline-offset: -2px; }
.tab:hover { color: var(--ink); background: var(--row); }
/* The current tab carries one bar of the logo's waveform. */
.tab[aria-selected='true'] { color: var(--ink); background: var(--row); box-shadow: inset 3px 0 0 var(--sky); }
.tab-icon { display: grid; place-items: center; flex: none; width: 16px; height: 16px; color: var(--muted); }
.tab-icon svg { display: block; width: 16px; height: 16px; }
.tab[aria-selected='true'] .tab-icon { color: var(--sky-deep); }

/* ── panels and cards ── */
.content { min-width: 0; }
.panel { display: none; animation: panel-in .3s var(--ease); }
.panel.active { display: block; }
@keyframes panel-in { from { opacity: 0; transform: translateY(8px); } }
.panel-head { margin-bottom: 16px; }
.panel-head h2 { font-size: clamp(22px, 3vw, 28px); line-height: 1.2; letter-spacing: -.01em; }
.panel-head p { margin-top: 8px; font-size: 15px; }

.card {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
  font-size: 15px;
}
.card + .card { margin-top: 16px; }
.card h3 { font-size: 16px; font-weight: 500; line-height: 1.4; }
/* A long inline token (a JSON body, a path) wraps instead of widening the page on a phone. */
.card :is(p, li) code { overflow-wrap: anywhere; }
.privacy { color: var(--muted); font-size: 13px; }
.privacy b { color: var(--ink); }
.local-note { color: var(--warning); font-size: 14px; }

.reference-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
.reference-table { width: 100%; min-width: 620px; border-collapse: collapse; font-size: 13px; line-height: 1.5; font-variant-numeric: tabular-nums; }
.reference-table th, .reference-table td { padding: 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.reference-table tr:last-child td { border-bottom: 0; }
.reference-table th { color: var(--muted); font-size: 12px; font-weight: 500; }
.reference-table td:first-child { color: var(--ink); font-weight: 500; white-space: nowrap; }

.info-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.info-tile { display: grid; gap: 4px; min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); }
.info-tile code { width: max-content; max-width: 100%; color: var(--sky-deep); font-weight: 500; }
.info-tile b { color: var(--ink); font-size: 14px; }
.info-tile span { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }

.steps { display: grid; gap: 8px; margin: 0; padding-left: 24px; }
.steps li { padding-left: 4px; }

.status-flow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.status-flow code { padding: 4px 8px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); background: var(--soft); font-size: 13px; }
.status-flow span { color: var(--muted); }

.emotion-list { padding: 12px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); }
.emotion-list summary { color: var(--ink); cursor: pointer; font-weight: 600; }
.emotion-list p { margin-top: 8px; color: var(--muted); overflow-wrap: anywhere; font-size: 13px; }

/* Code: the one dark block, the same in both themes. */
.endpoint, .codebox { border-radius: 10px; background: #0d2235; color: #dceaf6; }
:root[data-theme="dark"] :is(.endpoint, .codebox) { background: #09131d; }
.endpoint { display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
.endpoint code { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 13px; }
.codebox { position: relative; padding: 16px 56px 16px 16px; overflow-x: auto; }
.codebox pre { margin: 0; }
.codebox code { font-size: 13px; white-space: pre; }
.codebox .code-comment { color: #8fb2d1; }
.promptbox code { white-space: pre-wrap; }
.copy-btn {
  padding: 4px 0;
  border: 0;
  color: #8fd2ff;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: color .15s var(--ease);
}
.copy-btn:hover { color: #fff; }
.codebox .copy-btn { position: absolute; top: 12px; right: 16px; }

/* Vertical rhythm inside a card: 12 between blocks, 8 under a heading, 16 around a table,
   code or tiles, nothing above the first block. */
.card > * + * { margin-top: 12px; }
.card > h3 + * { margin-top: 8px; }
.card > :is(.reference-table-wrap, .codebox, .endpoint, .info-grid, .status-flow, .steps, .emotion-list) { margin-top: 16px; }
.card > :first-child { margin-top: 0; }

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 50;
  max-width: min(380px, calc(100% - 48px));
  padding: 12px 16px;
  border-radius: 10px;
  color: #fff;
  background: var(--ink);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .16);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity .2s var(--ease), transform .2s var(--ease);
  font-size: 14px;
  font-weight: 500;
}
:root[data-theme="dark"] .toast { color: var(--ink); background: var(--raised); border: 1px solid var(--line); }
.toast.show { opacity: 1; transform: none; }
.footer { padding: 24px 0 0; color: var(--muted); font-size: 13px; text-align: center; }
.footer a { color: var(--text); }

@media (max-width: 860px) {
  .topbar-in { height: 64px; gap: 16px; }
  .brand { font-size: 18px; }
  .settings-shell { grid-template-columns: 1fr; gap: 16px; }
  .side { position: static; overflow-x: auto; }
  .tabs { display: flex; min-width: max-content; gap: 4px; }
  .tab { width: auto; white-space: nowrap; }
  .tab[aria-selected='true'] { box-shadow: inset 0 -2px 0 var(--sky); }
  .info-grid { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .topbar-in, .page { width: calc(100% - 32px); }
  .topbar-in { gap: 12px; }
  .top-link { display: none; }
  .page { padding-top: 32px; }
  .page-head p { font-size: 15px; }
  .card { padding: 16px; }
}

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