/* wiretastix docs — self-hosted fonts, no external requests */
@font-face {
  font-family: "Inter";
  src: url("/fonts/Inter.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/JetBrainsMono.woff2") format("woff2");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #EAEFF6;
  --surface: #ffffff;
  --surface-2: #F4F7FB;
  --border: #DAE2EF;
  --text: #0B1E3B;
  --muted: #5C6E89;
  --navy: #0B1E3B;
  --accent: #0E93A6;
  --accent-ink: #ffffff;
  --shadow: 0 1px 2px rgba(11,30,59,.05), 0 10px 30px rgba(11,30,59,.06);
  --radius: 16px;
  --radius-sm: 9px;
  --hero-bg: linear-gradient(158deg,#EAF0F9 0%,#DDE7F4 52%,#D2E0F1 100%);
  --hero-glow: radial-gradient(680px circle at 80% 12%,rgba(14,147,166,.16),transparent 55%),
               radial-gradient(560px circle at 12% 96%,rgba(14,147,166,.12),transparent 55%);
  --code-bg: #0B1E3B;
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #070F1D;
    --surface: #0E1C31;
    --surface-2: #132842;
    --border: #22385A;
    --text: #E8EEF7;
    --muted: #8FA2BF;
    --accent: #2CC6D6;
    --accent-ink: #04121C;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 12px 34px rgba(0,0,0,.38);
    --hero-bg: linear-gradient(158deg,#0B182B 0%,#070F1D 52%,#0C1D33 100%);
    --hero-glow: radial-gradient(700px circle at 80% 12%,rgba(44,198,214,.18),transparent 55%),
                 radial-gradient(600px circle at 10% 98%,rgba(44,198,214,.12),transparent 55%);
    --code-bg: #070F1D;
  }
}

:root[data-theme="dark"] {
  --bg: #070F1D; --surface: #0E1C31; --surface-2: #132842; --border: #22385A;
  --text: #E8EEF7; --muted: #8FA2BF; --accent: #2CC6D6; --accent-ink: #04121C;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 12px 34px rgba(0,0,0,.38);
  --hero-bg: linear-gradient(158deg,#0B182B 0%,#070F1D 52%,#0C1D33 100%);
  --hero-glow: radial-gradient(700px circle at 80% 12%,rgba(44,198,214,.18),transparent 55%),
               radial-gradient(600px circle at 10% 98%,rgba(44,198,214,.12),transparent 55%);
  --code-bg: #070F1D;
}
:root[data-theme="light"] {
  --bg: #EAEFF6; --surface: #ffffff; --surface-2: #F4F7FB; --border: #DAE2EF;
  --text: #0B1E3B; --muted: #5C6E89; --accent: #0E93A6; --accent-ink: #ffffff;
  --shadow: 0 1px 2px rgba(11,30,59,.05), 0 10px 30px rgba(11,30,59,.06);
  --hero-bg: linear-gradient(158deg,#EAF0F9 0%,#DDE7F4 52%,#D2E0F1 100%);
  --hero-glow: radial-gradient(680px circle at 80% 12%,rgba(14,147,166,.16),transparent 55%),
               radial-gradient(560px circle at 12% 96%,rgba(14,147,166,.12),transparent 55%);
  --code-bg: #0B1E3B;
}

* { box-sizing: border-box; }
html { height: 100%; }
/* min-height (not height) so the body box grows to the full content height.
   A hard height:100% caps it at one viewport, which limits the sticky appbar's
   containing block and makes it scroll away past the first screen. */
body { min-height: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--text); }
h1, h2, h3, h4 { letter-spacing: -.3px; line-height: 1.25; }
::selection { background: var(--accent); color: var(--accent-ink); }
img { max-width: 100%; }

/* ---------- top bar ---------- */
.appbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.appbar-left { display: flex; align-items: center; gap: 28px; }
.appbar-nav { display: flex; align-items: center; gap: 20px; }
.appbar-nav a { color: var(--text); font-weight: 600; font-size: 14.5px; }
.appbar-nav a:hover { color: var(--accent); }
.appbar-right { display: flex; align-items: center; gap: 10px; }

.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { display: block; flex: none; }
.brand-name { font-weight: 700; font-size: 18px; letter-spacing: -.5px; color: var(--text); }
.brand:hover { opacity: .85; }

.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: var(--radius-sm);
  color: var(--muted); background: transparent; border: 1px solid var(--border);
  cursor: pointer; transition: all .12s;
}
.theme-toggle:hover { color: var(--accent); background: var(--surface-2); }
.theme-toggle svg { width: 17px; height: 17px; }
.theme-toggle svg { display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
:root[data-theme="auto"] .theme-toggle .icon-auto { display: block; }

/* ---------- search ---------- */
.search-box { position: relative; width: 260px; }
.search-box input {
  width: 100%; padding: 9px 13px 9px 34px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text); font-family: var(--font-sans); font-size: 14px; outline: none;
}
.search-box input:focus { border-color: var(--accent); }
.search-box svg {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; color: var(--muted); pointer-events: none;
}
.search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  max-height: 60vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow);
  display: none; z-index: 50;
}
.search-results.open { display: block; }
.search-results a {
  display: block; padding: 10px 14px; border-bottom: 1px solid var(--border);
}
.search-results a:last-child { border-bottom: none; }
.search-results a:hover, .search-results a.active { background: var(--surface-2); }
.search-results .r-title { font-weight: 600; font-size: 13.5px; color: var(--text); }
.search-results .r-section { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); margin-bottom: 2px; }
.search-results .r-excerpt { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.search-empty { padding: 16px; text-align: center; color: var(--muted); font-size: 13px; }
.search-box mark { background: rgba(14,147,166,.25); color: inherit; border-radius: 2px; }

/* ---------- hero / home ---------- */
.hero {
  position: relative;
  padding: 90px 28px 100px;
  background: var(--hero-glow), var(--hero-bg);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}
.hero-inner { max-width: 760px; margin: 0 auto; text-align: center; position: relative; z-index: 1; }
.hero-logo { display: flex; justify-content: center; margin: 0 0 30px; }
.hero h1 { font-size: 44px; font-weight: 700; margin: 0 0 18px; letter-spacing: -1px; }
.hero p.lead { font-size: 18px; color: var(--muted); margin: 0 0 34px; line-height: 1.6; }
.hero-ctas { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 24px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font-family: var(--font-sans); font-weight: 600; font-size: 15px; line-height: 1;
  cursor: pointer; white-space: nowrap; transition: filter .12s, background .12s, color .12s, border-color .12s;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(.93); color: var(--accent-ink); }
.btn-outline { background: transparent; color: var(--text); border-color: var(--border); }
.btn-outline:hover { background: var(--surface-2); color: var(--text); }

.features {
  max-width: 1080px; margin: -50px auto 0; padding: 0 28px 90px;
  position: relative; z-index: 2;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px;
}
.feature-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 26px;
}
.feature-card .f-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--accent); margin-bottom: 16px;
}
.feature-card .f-icon svg { width: 20px; height: 20px; }
.feature-card h3 { margin: 0 0 8px; font-size: 16.5px; font-weight: 600; }
.feature-card p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.6; }

.home-cta {
  max-width: 760px; margin: 0 auto; padding: 0 28px 100px; text-align: center;
}
.home-cta h2 { font-size: 26px; margin: 0 0 12px; }
.home-cta p { color: var(--muted); margin: 0 0 26px; }

@media (max-width: 860px) {
  .features { grid-template-columns: 1fr; }
  .hero h1 { font-size: 32px; }
}

/* ---------- docs layout ---------- */
.docs-shell { display: flex; max-width: 1400px; margin: 0 auto; align-items: flex-start; }
.docs-sidebar {
  flex: none; width: 260px; padding: 32px 20px 60px;
  position: sticky; top: var(--appbar-h, 66px); align-self: flex-start;
  max-height: calc(100vh - var(--appbar-h, 66px)); overflow-y: auto;
  border-right: 1px solid var(--border);
}
.docs-sidebar nav ul { list-style: none; margin: 0; padding: 0; }
.docs-sidebar .nav-section { margin-bottom: 28px; }
.docs-sidebar .nav-section + .nav-section { padding-top: 20px; border-top: 1px solid var(--border); }
.docs-sidebar .nav-section-title {
  margin: 0 0 10px; padding: 0 12px;
}
.docs-sidebar .nav-section-title a {
  font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text); display: inline-block; padding: 2px 0;
}
.docs-sidebar .nav-section-title a:hover,
.docs-sidebar .nav-section-title a.active { color: var(--accent); }
.docs-sidebar .nav-section > ul {
  margin-left: 12px;
  padding-left: 11px;
  border-left: 1px solid var(--border);
}
.docs-sidebar a {
  display: block; padding: 6px 12px; border-radius: var(--radius-sm);
  color: var(--muted); font-size: 14px; line-height: 1.4;
}
.docs-sidebar a:hover { background: var(--surface-2); color: var(--accent); }
.docs-sidebar a.active { background: var(--surface-2); color: var(--accent); font-weight: 600; }
.docs-sidebar .nav-sub { padding-left: 14px; }

.docs-main { flex: 1; min-width: 0; padding: 40px 44px 90px; }
.docs-content { max-width: 760px; }
.docs-toc {
  flex: none; width: 220px; padding: 32px 20px 60px;
  position: sticky; top: var(--appbar-h, 66px); align-self: flex-start;
  max-height: calc(100vh - var(--appbar-h, 66px)); overflow-y: auto;
  display: none;
}
@media (min-width: 1180px) { .docs-toc { display: block; } }
.docs-toc-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 0 0 10px; }
.docs-toc nav ul { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.docs-toc nav ul ul { padding-left: 12px; }
.docs-toc a { display: block; padding: 4px 0; color: var(--muted); }
.docs-toc a:hover { color: var(--accent); }

.breadcrumbs { font-size: 13px; color: var(--muted); margin: 0 0 18px; }
.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--accent); }
.breadcrumbs .sep { margin: 0 6px; }

.docs-content h1 { font-size: 30px; margin: 0 0 10px; }
.docs-content .page-description { color: var(--muted); font-size: 16px; margin: 0 0 30px; }
.docs-content h2 { font-size: 22px; margin: 40px 0 14px; padding-top: 6px; border-top: 1px solid var(--border); }
.docs-content h2:first-child { border-top: none; padding-top: 0; }
.docs-content h3 { font-size: 18px; margin: 28px 0 10px; }
.docs-content p, .docs-content li { line-height: 1.7; font-size: 15.5px; }
.docs-content ul, .docs-content ol { padding-left: 22px; }
.docs-content code:not(pre code) {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 5px; padding: 1px 6px; font-family: var(--font-mono); font-size: .88em;
}
.docs-content table { border-collapse: collapse; width: 100%; margin: 20px 0; font-size: 14px; }
.docs-content th, .docs-content td { border: 1px solid var(--border); padding: 9px 14px; text-align: left; }
.docs-content th { background: var(--surface-2); font-weight: 600; }
.docs-content blockquote {
  margin: 20px 0; padding: 4px 20px; border-left: 3px solid var(--accent);
  background: var(--surface-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--muted);
}

/* ---------- code blocks ---------- */
.docs-content .highlight, .docs-content pre {
  position: relative;
  background: var(--code-bg) !important;
  border-radius: var(--radius-sm);
  margin: 18px 0;
}
.docs-content .highlight pre { margin: 0; }
.docs-content pre {
  padding: 18px 20px; overflow-x: auto;
  font-family: var(--font-mono); font-size: 13.5px; line-height: 1.7;
}
.docs-content pre code { background: none; border: none; padding: 0; color: #E8EEF7; }
.code-copy-btn {
  position: absolute; top: 10px; right: 10px;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 7px;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14);
  color: #E8EEF7; font-family: var(--font-sans); font-size: 12px; font-weight: 600;
  cursor: pointer; opacity: 0; transition: opacity .12s, background .12s;
}
.code-copy-btn svg { width: 13px; height: 13px; }
.highlight:hover .code-copy-btn, pre:hover .code-copy-btn { opacity: 1; }
.code-copy-btn:hover { background: rgba(255,255,255,.16); }
.code-copy-btn.copied { color: #3ED996; }

/* ---------- footer ---------- */
.site-footer {
  border-top: 1px solid var(--border); padding: 26px 28px; text-align: center;
  color: var(--muted); font-size: 13px;
}
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--accent); }

/* ---------- mobile ---------- */
.sidebar-toggle {
  display: none; width: 34px; height: 34px; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); border: 1px solid var(--border); background: transparent;
  color: var(--text); cursor: pointer;
}
.sidebar-toggle svg { width: 18px; height: 18px; }
@media (max-width: 900px) {
  .appbar-nav { display: none; }
  .sidebar-toggle { display: inline-flex; }
  .search-box { width: 170px; }
  .docs-sidebar {
    position: fixed; top: var(--appbar-h, 66px); left: 0; z-index: 39;
    /* Explicit height (not top+bottom): the drawer's own transform makes a
       top/bottom-defined fixed box size to its content instead of the viewport,
       which killed its scroll. dvh accounts for mobile browser chrome. */
    height: calc(100dvh - var(--appbar-h, 66px)); max-height: none;
    background: var(--surface); transform: translateX(-100%);
    transition: transform .18s; width: 280px;
    overflow-y: auto;
  }
  .docs-sidebar.open { transform: translateX(0); box-shadow: var(--shadow); }
  .docs-main { padding: 28px 20px 70px; }
}
