*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -0.01em; }
p { margin: 0 0 0.75em; }
a { color: inherit; }
button { font: inherit; color: inherit; }
code, kbd, pre { font-family: var(--font-mono); font-variant-ligatures: none; }
@media (min-width: 1281px) { .menu-btn { display: none !important; } }
svg { display: block; }
[hidden] { display: none !important; }

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

.skip-link {
  position: absolute; left: 8px; top: -40px; z-index: 100;
  background: var(--ink); color: var(--bg); padding: 6px 10px; border-radius: 6px;
}
.skip-link:focus { top: 8px; }

/* Inline code inside prose */
:not(pre) > code {
  font-size: 0.86em;
  background: var(--surface-3);
  border: 1px solid var(--line-soft);
  border-radius: 5px;
  padding: 0.05em 0.35em;
  white-space: nowrap;
}

kbd {
  font-size: 11px;
  border: 1px solid var(--line-soft);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 0 5px;
  background: var(--surface);
  color: var(--ink-2);
}

/* SVG icon defaults */
.icon-btn svg, .topnav-link svg, .search-btn svg, .btn svg {
  width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round; flex: none;
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 20px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line-soft);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; margin-right: 12px; }
.brand-mark svg { width: 30px; height: 30px; }
.brand-mark rect { fill: var(--ink); }
.brand-mark path { fill: none; stroke: var(--bg); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.brand-name { font-weight: 600; font-size: 18px; letter-spacing: -0.02em; }
.brand-name b { font-weight: 700; color: var(--accent); margin-left: 1px; }

.topnav { display: flex; gap: 4px; }
.topnav-link {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 12px; border-radius: 9px; font-weight: 500; font-size: 14px;
  text-decoration: none; color: var(--ink-2); border: 1.5px solid transparent;
}
.topnav-link:hover { color: var(--ink); background: var(--surface-3); }
.topnav-link.is-active { color: var(--accent-ink); background: var(--accent-soft); border-color: var(--line); box-shadow: var(--shadow); }
.topnav-link.is-soon { opacity: 0.55; cursor: default; }
.topnav-link.is-soon:hover { background: none; color: var(--ink-2); }
.topnav-link small { font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; }

.search-btn {
  margin-left: auto;
  display: flex; align-items: center; gap: 10px;
  min-width: 240px; padding: 7px 10px;
  background: var(--surface); border: 1.5px solid var(--line-soft); border-radius: 10px;
  color: var(--ink-3); cursor: pointer; font-size: 13px;
}
.search-btn:hover { border-color: var(--line); }
.search-btn kbd { margin-left: auto; }

.icon-btn {
  display: grid; place-items: center; width: 38px; height: 38px; flex: none;
  background: var(--surface); border: 1.5px solid var(--line-soft); border-radius: 10px; cursor: pointer;
}
.icon-btn:hover { border-color: var(--line); }
.i-sun { display: none; }
:root[data-theme="dark"] .i-sun { display: block; }
:root[data-theme="dark"] .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: block; }
  :root:not([data-theme="light"]) .i-moon { display: none; }
}

@media (max-width: 860px) {
  .topnav { display: none; }
  .search-btn { min-width: 0; }
  .search-btn-text, .search-btn kbd { display: none; }
  .topbar { padding: 0 16px; gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
