/*
 * Tailend shared shell: "Dusk" tokens, self-hosted fonts, the site header
 * and the pieces both /docs and /playground draw (code cards, method
 * badges, buttons). Loaded first by every page; /playground/style.css and
 * /assets/docs.css only add their own layout on top.
 *
 * Fonts are served from this origin (font-src 'self'); see fonts/OFL.txt.
 */
@font-face {
  font-family: 'Libre Franklin';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('/assets/fonts/libre-franklin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Instrument Sans';
  font-style: normal;
  font-display: swap;
  font-weight: 400 700;
  src: url('/assets/fonts/instrument-sans.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-display: swap;
  font-weight: 100 800;
  src: url('/assets/fonts/jetbrains-mono.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light dark;
  --bg: #fffefc;
  --surface: #ffffff;
  --soft: #f8f7f4;
  --ink: #24212f;
  --ink-2: #45404f;
  --muted: #645e6c;
  --line: #ebe7e0;
  --line-2: #d8d2c8;
  --lead: #4f48c4;
  --lead-hover: #433cb0;
  --lead-ink: #4a43bd;
  --lead-soft: #eeecf9;
  --on-lead: #ffffff;
  --accent: #ec9a55;
  --accent-ink: #9c5219;
  --accent-soft: #fdf1e6;
  --danger: #b42318;
  --ok: #1d7a4d;
  --ok-soft: #e4f4ec;
  --warn-soft: #fbeedd;
  --err-soft: #fbe7e4;
  --deep: #201d2a;
  --deep-2: #2a2636;
  --deep-line: #3a3447;
  --deep-text: #ece8f2;
  --deep-muted: #a59fb2;
  --code-k: #bdb7ff;
  --code-s: #f4bb8c;
  --code-n: #a3cbe8;
  --shadow-rgb: 52, 40, 30;
  --paper: 0 1px 1px rgba(var(--shadow-rgb), 0.04), 0 2px 6px rgba(var(--shadow-rgb), 0.04), 0 14px 32px -16px rgba(var(--shadow-rgb), 0.16);
  --radius: 16px;
  --radius-sm: 10px;
  --header-h: 56px;
  --display: 'Libre Franklin', 'Instrument Sans', system-ui, sans-serif;
  --text: 'Instrument Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Warm "Dusk" dark: matches tailend.dev's deep panels (#201d2a) instead of a cool purple-black */
    --bg: #1b1922;
    --surface: #221f2a;
    --soft: #282530;
    --ink: #f1ede7;
    --ink-2: #d6d0c8;
    --muted: #aaa39b;
    --line: #36323e;
    --line-2: #4a4552;
    --lead: #958fe6;
    --lead-hover: #a9a4ee;
    --lead-ink: #aba6ef;
    --lead-soft: #2e2b46;
    --on-lead: #16141c;
    --accent-ink: #f0b07c;
    --accent-soft: #3a2c1f;
    --danger: #f19488;
    --ok: #5fd39a;
    --ok-soft: #1c3a2e;
    --warn-soft: #3a2c1f;
    --err-soft: #43221f;
    --deep: #15131b;
    --deep-2: #1d1a24;
    --shadow-rgb: 0, 0, 0;
  }
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  max-width: 100%;
  overflow-x: clip;
}

body {
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 var(--text);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

code,
kbd,
pre {
  font-family: var(--mono);
}

:focus-visible {
  outline: 2px solid var(--lead);
  outline-offset: 2px;
  border-radius: 6px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.sr-only:focus {
  position: fixed;
  top: 8px;
  left: 8px;
  width: auto;
  height: auto;
  clip: auto;
  z-index: 50;
  background: var(--surface);
  padding: 8px 12px;
  border-radius: 8px;
}

/* Header: brand · section tabs · actions */
.site-header {
  min-height: var(--header-h);
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  min-width: 0;
  flex: none;
}

.brand-mark {
  width: 28px;
  height: 28px;
  flex: none;
}
.brand-mark .bm-ink { fill: var(--ink); }
.brand-mark .bm-face { fill: var(--surface); }
.brand-mark .bm-ring { stroke: var(--ink); }
.brand-mark .bm-dot { fill: var(--accent); }

.brand-name {
  font: 800 19px/1 var(--display);
  letter-spacing: -0.02em;
}

.brand-tag {
  font: 500 11px/1 var(--mono);
  color: var(--muted);
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 9px;
  white-space: nowrap;
}

.top-tabs {
  display: flex;
  align-items: stretch;
  gap: 4px;
  align-self: stretch;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.top-tabs::-webkit-scrollbar {
  display: none;
}

.top-tabs a {
  display: flex;
  align-items: center;
  padding: 0 10px;
  text-decoration: none;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.top-tabs a:hover {
  color: var(--ink);
}

.top-tabs a[aria-current='page'] {
  color: var(--ink);
  border-bottom-color: var(--lead);
  font-weight: 600;
}

.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.btn,
.btn-primary,
.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: 600 13px/1 var(--text);
  text-decoration: none;
  border-radius: 999px;
  padding: 8px 14px;
  white-space: nowrap;
  cursor: pointer;
}

.btn-primary {
  background: var(--lead);
  color: var(--on-lead);
  border: 1px solid var(--lead);
}

.btn-primary:hover {
  background: var(--lead-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--ink-2);
  border: 1px solid var(--line-2);
}

.btn-ghost:hover {
  background: var(--soft);
  color: var(--ink);
}

.menu-btn {
  display: none;
  font: 600 13px/1 var(--text);
  background: var(--soft);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
}

@media (max-width: 900px) {
  .site-header {
    flex-wrap: wrap;
    padding: 0 16px;
    gap: 0 12px;
  }
  .site-header .brand {
    height: 52px;
  }
  .top-tabs {
    order: 3;
    flex-basis: calc(100% + 32px);
    height: 42px;
    margin: 0 -16px;
    padding: 0 10px;
    border-top: 1px solid var(--line);
  }
  .header-actions .btn-ghost {
    display: none;
  }
  .menu-btn {
    display: inline-flex;
  }
}

@media (max-width: 420px) {
  .brand-tag {
    display: none;
  }
  .header-actions .btn-primary {
    padding: 8px 11px;
  }
}

/* Method badges (sidebar, reference headers, playground) */
.method,
.url-method,
.verb {
  font: 600 11px/1 var(--mono);
  letter-spacing: 0.02em;
  color: var(--lead-ink);
  background: var(--lead-soft);
  padding: 5px 8px;
  border-radius: 7px;
}

.verb {
  font-size: 9.5px;
  padding: 3px 5px;
  border-radius: 5px;
  flex: none;
}

/* Code cards: deep pane, tabs, copy */
.code-card {
  background: var(--deep);
  color: var(--deep-text);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin: 16px 0;
  border: 1px solid var(--deep-line);
  min-width: 0;
}

.code-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px 0 12px;
  min-height: 40px;
  background: var(--deep-2);
  border-bottom: 1px solid var(--deep-line);
}

.code-label {
  font: 600 12px/1 var(--text);
  color: var(--deep-text);
  margin-right: 4px;
}

.code-tabs {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  min-width: 0;
  scrollbar-width: none;
}

.code-tabs button {
  font: 500 12px/1 var(--text);
  color: var(--deep-muted);
  background: none;
  border: 0;
  border-radius: 7px;
  padding: 7px 9px;
  cursor: pointer;
  white-space: nowrap;
}

.code-tabs button:hover {
  color: var(--deep-text);
}

.code-tabs button.active {
  color: var(--deep-text);
  background: rgba(255, 255, 255, 0.08);
}

.code-actions {
  margin-left: auto;
  display: flex;
  gap: 6px;
  align-items: center;
  flex: none;
}

.copy-btn,
.code-link {
  font: 500 11.5px/1 var(--text);
  color: var(--deep-muted);
  background: none;
  border: 1px solid var(--deep-line);
  border-radius: 7px;
  padding: 6px 9px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.copy-btn:hover,
.code-link:hover {
  color: var(--deep-text);
  border-color: var(--deep-muted);
}

.code-card pre {
  margin: 0;
  padding: 14px 16px;
  overflow: auto;
  font: 12.5px/1.6 var(--mono);
  color: var(--deep-text);
  tab-size: 2;
}

.tok-key {
  color: var(--code-k);
}

.tok-str {
  color: var(--code-s);
}

.tok-num,
.tok-lit {
  color: var(--code-n);
}

.tok-com {
  color: var(--deep-muted);
  font-style: italic;
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
