/* react-device-detector — Bricolage Grotesque + DM Mono, magenta accent.
   Fourth distinct identity: purifai is warm-serif editorial, unsmuggle is cool
   instrument, enqiu is cobalt geometric. This one is high-contrast and typographic. */

@font-face {
  font-family: 'Bricolage Grotesque';
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url('/fonts/bricolage-grotesque-latin-wght-normal.woff2') format('woff2');
}

@font-face {
  font-family: 'DM Mono';
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url('/fonts/dm-mono-latin-400-normal.woff2') format('woff2');
}

@font-face {
  font-family: 'DM Mono';
  font-style: normal;
  font-display: swap;
  font-weight: 500;
  src: url('/fonts/dm-mono-latin-500-normal.woff2') format('woff2');
}

:root {
  --paper: #fdfcfd;
  --raised: #ffffff;
  --ink: #191317;
  --muted: #6a6067;
  --rule: #e6e0e4;
  --accent: #a3125b;
  --slab: #17121a;
  --slab-fg: #e4dce4;

  --syn-keyword: #f19ac6;
  --syn-string: #9fd8a8;
  --syn-tag: #8fc4f5;
  --syn-num: #f0c479;
  --syn-comment: #7d7286;

  --display: 'Bricolage Grotesque', ui-sans-serif, system-ui, sans-serif;
  --mono: 'DM Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --measure: 41rem;
  --bar: 3.25rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #120f13;
    --raised: #191419;
    --ink: #ebe4ea;
    --muted: #9b9099;
    --rule: #2b242c;
    --accent: #f286b6;
    --slab: #0a070c;
    --slab-fg: #ded5de;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: clamp(1.5rem, 4vw, 3rem) 1.5rem 4rem;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--display);
  font-size: 1rem;
  line-height: 1.6;
  font-weight: 380;
  text-rendering: optimizeLegibility;
}

main {
  max-width: var(--measure);
  margin: 0 auto;
}

/* ---- sticky bar: bracketed section switches ---- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: var(--bar);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1.5rem;
  margin: calc(-1 * clamp(1.5rem, 4vw, 3rem)) -1.5rem 2.5rem;
  border-bottom: 1px solid var(--rule);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(10px);
  -webkit-backdrop-filter: saturate(1.6) blur(10px);
}

@supports not (backdrop-filter: blur(1px)) {
  .topbar {
    background: var(--paper);
  }
}

.wordmark {
  font-family: var(--mono);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
  flex: none;
  white-space: nowrap;
}

.topbar nav {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.topbar nav::-webkit-scrollbar {
  display: none;
}

/* Links read as bracketed switches — a device-class selector, not a SaaS link row. */
.topbar nav a {
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
}

.topbar nav a::before {
  content: '[';
  color: var(--rule);
}

.topbar nav a::after {
  content: ']';
  color: var(--rule);
}

.topbar nav a:hover {
  color: var(--accent);
}

.topbar nav a:hover::before,
.topbar nav a:hover::after {
  color: var(--accent);
}

:target,
h2[id] {
  scroll-margin-top: calc(var(--bar) + 1rem);
}

/* ---- masthead ---- */

.masthead {
  margin-bottom: 2.5rem;
}

h1 {
  font-size: clamp(2.4rem, 1.8rem + 2.7vw, 3.4rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.03;
  margin: 0 0 0.9rem;
  text-wrap: balance;
}

.lede {
  font-size: 1.1875rem;
  line-height: 1.4;
  margin: 0 0 0.75rem;
  text-wrap: balance;
}

.sub {
  color: var(--muted);
  margin: 0;
}

.spec {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.5rem;
  margin: 1.5rem 0 0;
  padding: 0;
  list-style: none;
}

.spec li {
  font-family: var(--mono);
  font-size: 0.6875rem;
  color: var(--muted);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 0.2rem 0.6rem;
  background: var(--raised);
}

/* ---- structure ---- */

section {
  margin-bottom: 2.75rem;
}

h2 {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.25;
  margin: 0 0 0.8rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--rule);
  text-wrap: balance;
}

p {
  margin: 0 0 0.9rem;
}

.note {
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.label {
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 1.5rem 0 0.4rem;
}

/* ---- code ---- */

code {
  font-family: var(--mono);
  font-size: 0.84em;
  background: color-mix(in srgb, var(--accent) 9%, transparent);
  color: var(--accent);
  padding: 0.1em 0.35em;
  border-radius: 3px;
  overflow-wrap: break-word;
}

pre {
  background: var(--slab);
  color: var(--slab-fg);
  border-radius: 8px;
  padding: 1.1rem 1.2rem;
  margin: 0 0 1rem;
  overflow-x: auto;
  font-size: 0.8125rem;
  line-height: 1.7;
}

pre code {
  background: none;
  color: inherit;
  padding: 0;
  font-size: inherit;
  white-space: pre;
}

pre .k {
  color: var(--syn-keyword);
}
pre .s {
  color: var(--syn-string);
}
pre .t {
  color: var(--syn-tag);
}
pre .f {
  color: var(--syn-num);
}
pre .n {
  color: var(--syn-num);
}
pre .c {
  color: var(--syn-comment);
}

/* ---- the honest-limits section ---- */

.warning {
  border-top: 2px solid var(--accent);
  border-bottom: 1px solid var(--rule);
  padding: 0 0 1.5rem;
}

.warning h2 {
  border-top: none;
  padding-top: 1.5rem;
  color: var(--accent);
}

.warning .big {
  font-size: 1.0625rem;
  font-weight: 600;
}

.callout-line {
  border-left: 3px solid var(--accent);
  padding-left: 0.9rem;
  margin-bottom: 1rem;
}

/* ---- table ----
   The API table's first column carries several code chips and cannot compress
   below its content, so it scrolls inside its own container. Without this the
   whole page scrolls sideways on a phone. tabindex makes the scroller
   keyboard-reachable, which a scrollable region needs. */

.scroller {
  overflow-x: auto;
  margin: 0 0 1rem;
}

.scroller:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

table {
  width: 100%;
  min-width: 30rem;
  border-collapse: collapse;
  margin: 0;
  font-size: 0.875rem;
}

th,
td {
  text-align: left;
  padding: 0.6rem 0.75rem 0.6rem 0;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}

th {
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom-width: 2px;
}

td:nth-child(2) {
  font-family: var(--mono);
  font-size: 0.8em;
  color: var(--muted);
  white-space: nowrap;
}

/* ---- links & footer ---- */

a {
  color: var(--accent);
  text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
  text-underline-offset: 0.15em;
}

a:hover {
  text-decoration-color: currentColor;
}

footer {
  border-top: 1px solid var(--rule);
  padding-top: 1.5rem;
  color: var(--muted);
  font-size: 0.875rem;
}

footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin-bottom: 1.1rem;
  font-family: var(--mono);
  font-size: 0.8125rem;
}

footer p {
  margin: 0;
}

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