/* TAIL OS — tail-os.com
   Light-first, theme-aware. IBM Plex Sans for text, IBM Plex Mono for code. */

:root {
  --bg: #ffffff;
  --bg-soft: #fbfcfd;
  --bg-sunken: #f5f7f9;
  --surface: #ffffff;
  --border: rgba(15, 23, 42, 0.11);
  --border-strong: rgba(15, 23, 42, 0.18);
  --text: #16202e;
  --text-dim: #4d5c6e;
  --text-mute: #64748b;
  --accent: #0369a1;
  --accent-soft: rgba(3, 105, 161, 0.08);
  --accent-line: rgba(3, 105, 161, 0.28);
  --warn-bg: #fffaeb;
  --warn-border: rgba(180, 83, 9, 0.26);
  --warn-text: #7c4310;
  --code-bg: #0f172a;
  --code-text: #e2e8f0;
  --code-dim: #64748b;
  --radius: 8px;
  --radius-sm: 6px;
  --side-w: 268px;
  --hdr-h: 57px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1220;
    --bg-soft: #0e1626;
    --bg-sunken: #131c2e;
    --surface: #101a2b;
    --border: rgba(148, 163, 184, 0.16);
    --border-strong: rgba(148, 163, 184, 0.28);
    --text: #e7edf5;
    --text-dim: #b3c0d1;
    --text-mute: #8fa0b5;
    --accent: #5cc4f5;
    --accent-soft: rgba(92, 196, 245, 0.12);
    --accent-line: rgba(92, 196, 245, 0.34);
    --warn-bg: #2a2010;
    --warn-border: rgba(245, 190, 90, 0.30);
    --warn-text: #f0cf9a;
    --code-bg: #060c17;
    --code-text: #dbe6f3;
  }
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

.mono, code, pre, kbd {
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ---------- header ---------- */
.hdr {
  position: sticky; top: 0; z-index: 40;
  height: var(--hdr-h);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(150%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.hdr-in {
  display: flex; align-items: center; gap: 24px;
  height: 100%; padding: 0 20px;
}
.brand {
  display: inline-flex; align-items: center; gap: 9px;
  color: var(--text); font-weight: 600; font-size: 15px;
  flex-shrink: 0;
}
.brand:hover { text-decoration: none; }
.brand .mark { color: var(--accent); }
.ver {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 12px; font-weight: 400; color: var(--text-mute);
  border: 1px solid var(--border); border-radius: 4px; padding: 0 6px;
}
.hdr-search {
  display: flex; align-items: center; gap: 9px;
  flex: 1 1 auto; max-width: 440px;
  height: 34px; padding: 0 12px;
  background: var(--bg-sunken);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-mute);
}
.hdr-search input {
  flex: 1 1 auto; min-width: 0;
  border: 0; background: transparent; color: var(--text);
  font: inherit; font-size: 14px; outline: none;
}
.hdr-search input::placeholder { color: var(--text-mute); }
.hdr-nav {
  display: flex; align-items: center; gap: 20px;
  margin-left: auto; font-size: 14px;
}
.hdr-nav a { color: var(--text-dim); }

/* ---------- home ---------- */
.page-home main { max-width: 940px; margin: 0 auto; padding: 0 24px 96px; }
.hero { padding: 92px 0 0; display: flex; flex-direction: column; align-items: center; gap: 20px; }
.hero h1 {
  margin: 0; font-size: clamp(32px, 4.6vw, 50px); line-height: 1.08;
  letter-spacing: -0.03em; font-weight: 600; text-align: center; text-wrap: pretty;
}
.lede { margin: 0; color: var(--text-dim); font-size: 17px; text-align: center; max-width: 560px; }

.ask { width: 100%; max-width: 720px; display: grid; grid-template-columns: 1fr auto; gap: 10px; margin-top: 10px; }
.ask-field {
  display: flex; align-items: center; gap: 12px;
  height: 56px; padding: 0 18px;
  background: var(--surface);
  border: 1.5px solid var(--accent-line); border-radius: var(--radius);
  color: var(--text-mute);
  box-shadow: 0 10px 30px -18px rgba(3, 105, 161, 0.5);
}
.ask-field:focus-within { border-color: var(--accent); }
.ask-field input {
  flex: 1 1 auto; min-width: 0;
  border: 0; background: transparent; color: var(--text);
  font: inherit; font-size: 16.5px; outline: none;
}
.ask-field input::placeholder { color: var(--text-mute); }
.ask-go {
  display: inline-flex; align-items: center; justify-content: center;
  width: 56px; height: 56px; border: 0; border-radius: var(--radius);
  background: var(--accent); color: #fff; cursor: pointer;
}
.chips {
  grid-column: 1 / -1;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
}
.chip {
  font: inherit; font-size: 13.5px; color: var(--text-dim);
  background: var(--bg-sunken); border: 1px solid var(--border);
  border-radius: 999px; padding: 7px 15px; cursor: pointer;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); text-decoration: none; }

.strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 72px; }
.stat {
  display: flex; flex-direction: column; gap: 3px;
  padding: 18px 20px; background: var(--bg-soft);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.stat-n { font-size: 25px; font-weight: 500; color: var(--accent); letter-spacing: -0.02em; }
.stat-l { font-size: 13.5px; color: var(--text-mute); }

.quick { margin-top: 44px; display: flex; flex-direction: column; gap: 12px; }
.quick-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.quick-head h2 { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: -0.015em; }
.quick-head a { font-size: 14px; }
.quick-note { margin: 0; font-size: 14px; color: var(--text-mute); }

.term {
  margin: 0; padding: 18px 20px; overflow-x: auto;
  background: var(--code-bg); color: var(--code-text);
  border-radius: var(--radius); font-size: 13px; line-height: 1.75;
}
.term .pr { color: var(--code-dim); user-select: none; }

.docs-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-top: 44px; }
.card {
  display: flex; flex-direction: column; gap: 5px;
  padding: 18px 20px; background: var(--bg-soft);
  border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text);
}
.card:hover { border-color: var(--accent-line); text-decoration: none; }
.card-t { font-weight: 600; font-size: 15px; }
.card-d { font-size: 13.5px; color: var(--text-mute); line-height: 1.5; }

/* ---------- documentation shell ---------- */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); align-items: start; }
.side {
  position: sticky; top: var(--hdr-h);
  height: calc(100vh - var(--hdr-h)); overflow-y: auto;
  padding: 26px 14px 40px;
  border-right: 1px solid var(--border);
  background: var(--bg-soft);
}
.nav-docs, .nav-sections { list-style: none; margin: 0; padding: 0; }
.nav-docs { display: flex; flex-direction: column; gap: 22px; }
.nav-doc {
  display: block; padding: 5px 10px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--text-mute);
}
.nav-doc:hover { color: var(--text); text-decoration: none; }
.nav-doc[aria-current="page"] { color: var(--accent); }
.nav-sections { display: flex; flex-direction: column; gap: 1px; margin-top: 4px; }
.nav-sections a {
  display: block; padding: 5px 10px; border-radius: var(--radius-sm);
  font-size: 13.5px; color: var(--text-dim);
}
.nav-sections a:hover { background: var(--bg-sunken); color: var(--text); text-decoration: none; }
.nav-sections a[aria-current="true"] { background: var(--accent-soft); color: var(--accent); }

.content { min-width: 0; padding: 36px 40px 96px; }
/* Bounded so the table of contents sits beside the prose rather than adrift
   at the far edge of a wide window. */
.doc-wrap { display: grid; grid-template-columns: minmax(0, 760px) 200px; gap: 44px; align-items: start; max-width: 1004px; }
.doc { max-width: 760px; min-width: 0; }

.toc { position: sticky; top: calc(var(--hdr-h) + 36px); }
.toc-h {
  display: block; margin-bottom: 10px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--text-mute);
}
.toc ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.toc a { font-size: 13.5px; color: var(--text-dim); }

/* ---------- document typography ---------- */
.doc h1 { font-size: 34px; line-height: 1.15; letter-spacing: -0.03em; font-weight: 600; margin: 0 0 18px; }
.doc h2 {
  font-size: 23px; letter-spacing: -0.02em; font-weight: 600;
  margin: 46px 0 14px; padding-top: 14px; border-top: 1px solid var(--border);
}
.doc h3 { font-size: 17.5px; font-weight: 600; margin: 30px 0 10px; }
.doc h4 { font-size: 15.5px; font-weight: 600; margin: 24px 0 8px; }
.doc p, .doc li { color: var(--text-dim); }
.doc p { margin: 0 0 16px; }
.doc ul, .doc ol { margin: 0 0 16px; padding-left: 22px; }
.doc li { margin-bottom: 6px; }
.doc a { text-decoration: underline; text-underline-offset: 2px; }
.doc strong { color: var(--text); font-weight: 600; }
.doc hr { border: 0; border-top: 1px solid var(--border); margin: 32px 0; }

.doc blockquote {
  margin: 0 0 18px; padding: 14px 18px;
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: var(--radius);
}
.doc blockquote p:last-child { margin-bottom: 0; }

.doc :not(pre) > code {
  font-size: 0.88em; padding: 1.5px 5px;
  background: var(--bg-sunken); border: 1px solid var(--border);
  border-radius: 4px; color: var(--text);
}
.doc pre {
  margin: 0 0 18px; padding: 16px 18px; overflow-x: auto;
  background: var(--code-bg); color: var(--code-text);
  border-radius: var(--radius); font-size: 13px; line-height: 1.7;
}
.doc pre code { background: none; border: 0; padding: 0; color: inherit; font-size: inherit; }

.doc table { width: 100%; border-collapse: collapse; margin: 0 0 18px; font-size: 14.5px; display: block; overflow-x: auto; }
.doc th, .doc td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); }
.doc th { font-weight: 600; color: var(--text); }
.doc td { color: var(--text-dim); }

.doc-src {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  margin-top: 48px; padding-top: 18px; border-top: 1px solid var(--border);
  font-size: 13px; color: var(--text-mute);
}

.idx { list-style: none; margin: 28px 0 0; padding: 0; display: flex; flex-direction: column; gap: 20px; }
.idx-t { font-size: 17px; font-weight: 600; }
.idx-d { margin: 4px 0 0; font-size: 14.5px; color: var(--text-mute); }

/* ---------- answer view ---------- */
.ask-root { max-width: 940px; }
.ask-empty { display: flex; flex-direction: column; gap: 14px; padding-top: 24px; }
.ask-empty h1 { margin: 0; font-size: 30px; letter-spacing: -0.025em; font-weight: 600; }
.ask-empty .lede, .ask-empty .chips { text-align: left; justify-content: flex-start; max-width: none; }

.q { margin: 0 0 26px; font-size: 25px; font-weight: 600; letter-spacing: -0.022em; }
.ans-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 40px; align-items: start; }
.ans-label {
  display: flex; align-items: center; gap: 9px; margin-bottom: 14px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--text-mute);
}
.dot { width: 6px; height: 6px; border-radius: 50%; background: #10b981; flex: none; }
.dot.is-wait { background: var(--text-mute); animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .dot.is-wait { animation: none; } }

.ans p { margin: 0 0 15px; color: var(--text-dim); font-size: 16.5px; line-height: 1.68; }
.ans pre { margin: 0 0 16px; padding: 15px 18px; overflow-x: auto; background: var(--code-bg); color: var(--code-text); border-radius: var(--radius); font-size: 12.5px; line-height: 1.7; white-space: pre; }
.ans :not(pre) > code { font-size: 0.88em; padding: 1.5px 5px; background: var(--bg-sunken); border: 1px solid var(--border); border-radius: 4px; color: var(--text); }
.cite {
  display: inline-block; vertical-align: 1px; margin: 0 2px;
  font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 11px;
  color: var(--accent); background: var(--accent-soft);
  border-radius: 4px; padding: 1px 5px; text-decoration: none;
}
.cite:hover { text-decoration: none; background: var(--accent-line); }
.ans-note { display: flex; align-items: center; gap: 9px; margin-top: 20px; font-size: 13px; color: var(--text-mute); }

.srcs { display: flex; flex-direction: column; gap: 11px; }
.srcs-h { font-size: 12px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-mute); }
.src {
  display: flex; flex-direction: column; gap: 6px;
  padding: 14px 16px; background: var(--bg-soft);
  border: 1px solid var(--border); border-radius: var(--radius); color: var(--text);
}
.src:hover { border-color: var(--accent-line); text-decoration: none; }
.src-top { display: flex; align-items: center; gap: 8px; }
.src-n { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 11px; color: var(--accent); background: var(--accent-soft); border-radius: 4px; padding: 1px 5px; }
.src-t { font-size: 13.5px; font-weight: 600; }
.src-p { font-size: 12.5px; color: var(--text-mute); line-height: 1.45; }

.notice {
  display: flex; flex-direction: column; gap: 12px;
  padding: 22px 26px; margin: 0 0 26px;
  background: var(--warn-bg); border: 1px solid var(--warn-border);
  border-radius: var(--radius); color: var(--warn-text);
}
.notice-h { display: flex; align-items: center; gap: 10px; font-size: 16.5px; font-weight: 600; }
.notice p { margin: 0; color: inherit; font-size: 15px; line-height: 1.6; }

.covers { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }

/* ---------- footer ---------- */
.ftr {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px;
  padding: 28px 24px 40px; border-top: 1px solid var(--border);
  font-size: 13px; color: var(--text-mute);
}
.page-shell .ftr { border-top: 0; }
.ftr-sep { color: var(--border-strong); }

/* ---------- narrow ---------- */
@media (max-width: 1080px) {
  .doc-wrap { grid-template-columns: minmax(0, 1fr); }
  .toc { display: none; }
  .ans-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side {
    position: static; height: auto; border-right: 0;
    border-bottom: 1px solid var(--border); padding: 18px 16px;
  }
  .content { padding: 26px 20px 72px; }
  .hdr-in { gap: 14px; }
  .hdr-nav { gap: 14px; }
  .strip { grid-template-columns: minmax(0, 1fr); }
  .hero { padding-top: 56px; }
}
