/* =====================================================================
   local-mgrep documentation stylesheet
   Dark, glass, modern. Inspired by GitHub Universe / Vercel / Linear
   reference docs. Restrained accent, real content density preserved.
   ===================================================================== */

:root {
  /* Surface */
  --bg:             #13192a;
  --bg-2:           #181f33;
  --panel:          rgba(255, 255, 255, 0.045);
  --panel-2:        rgba(255, 255, 255, 0.065);
  --panel-strong:   rgba(255, 255, 255, 0.085);
  --panel-deep:     #0e1320;

  /* Rules */
  --rule:           rgba(255, 255, 255, 0.07);
  --rule-strong:    rgba(255, 255, 255, 0.12);
  --rule-faint:     rgba(255, 255, 255, 0.04);

  /* Ink */
  --ink:            #f4f4f5;
  --text:           #d4d4d8;
  --muted:          #a1a1aa;
  --soft:           #71717a;
  --faint:          #52525b;

  /* Accent */
  --accent:         #38bdf8;
  --accent-bright:  #a5f3fc;
  --accent-deep:    #0891b2;
  --accent-soft:    rgba(125, 211, 252, 0.088);
  --accent-faint:   rgba(125, 211, 252, 0.035);
  --link:           #a5f3fc;

  /* Code */
  --code-bg:        rgba(255, 255, 255, 0.035);
  --code-bg-deep:   #06080c;
  --code-border:    rgba(255, 255, 255, 0.06);
  --code-text:      #e4e4e7;

  /* Status */
  --warn:           #fbbf24;
  --warn-bg:        rgba(251, 191, 36, 0.06);
  --warn-border:    rgba(251, 191, 36, 0.18);

  /* Typography */
  --sans:    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
             "Helvetica Neue", Arial, system-ui, sans-serif;
  --display: var(--sans);
  --mono:    "JetBrains Mono", ui-monospace, "SF Mono", "SFMono-Regular",
             Menlo, Consolas, "Liberation Mono", monospace;

  /* Layout */
  --content-max: 800px;
  --sidebar-w:   276px;
  --toc-w:       220px;
  --topbar-h:    60px;

  /* Effects */
  --glass-blur:    saturate(140%) blur(20px);
  --glass-blur-sm: saturate(140%) blur(10px);

  color-scheme: dark;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--topbar-h) + 24px);
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  background: var(--bg);
}

body {
  margin: 0;
  font-family: var(--sans);
  font-feature-settings: "ss01", "cv11";
  font-size: 15.5px;
  line-height: 1.65;
  color: var(--text);
  background:
    radial-gradient(1100px 600px at 12% -10%, rgba(125, 211, 252, 0.088), transparent 60%),
    radial-gradient(900px  500px at 88%  0%, rgba(167, 139, 250, 0.07), transparent 65%),
    radial-gradient(700px  500px at 50% 110%, rgba(125, 211, 252, 0.044), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: var(--link);
  text-decoration: none;
  transition: color 120ms ease;
}
a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

p { margin: 0 0 14px; }
strong { font-weight: 600; color: var(--ink); }
em { font-style: normal; color: var(--muted); }
hr { border: 0; border-top: 1px solid var(--rule); margin: 28px 0; }

::selection { background: rgba(125, 211, 252, 0.264); color: var(--ink); }

/* =================================================================
   Code
   ================================================================= */
code, kbd, pre {
  font-family: var(--mono);
  font-size: 0.86em;
}
:not(pre) > code {
  padding: 1.5px 6px;
  border: 1px solid var(--code-border);
  border-radius: 5px;
  background: var(--code-bg);
  color: var(--accent-bright);
  font-size: 0.84em;
  white-space: nowrap;
}
pre {
  margin: 16px 0;
  padding: 16px 18px;
  overflow-x: auto;
  background: var(--code-bg-deep);
  color: var(--code-text);
  border: 1px solid var(--rule);
  border-radius: 10px;
  font-size: 12.75px;
  line-height: 1.65;
  position: relative;
}
pre code { color: inherit; background: none; border: 0; padding: 0; white-space: pre; }

/* =================================================================
   Top bar (glass)
   ================================================================= */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: rgba(10, 13, 18, 0.65);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--rule);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 700;
  letter-spacing: -0.01em;
}
.brand-mark {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--accent-bright);
  background: rgba(125, 211, 252, 0.088);
  border: 1px solid rgba(125, 211, 252, 0.194);
  box-shadow: 0 0 18px rgba(125, 211, 252, 0.158);
}
.brand-mark svg { width: 16px; height: 16px; display: block; }
.brand-text { font-family: var(--mono); font-size: 14.5px; }
.version {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  padding: 2px 8px;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  background: var(--panel);
}

.topnav { display: flex; align-items: center; gap: 22px; font-size: 13.5px; }
.topnav a { color: var(--muted); }
.topnav a:hover { color: var(--ink); text-decoration: none; }
.topnav-cta {
  color: var(--bg) !important;
  background: var(--accent-bright);
  padding: 7px 14px;
  border-radius: 6px;
  font-weight: 600;
  box-shadow: 0 0 24px rgba(125, 211, 252, 0.264);
  transition: transform 120ms ease, box-shadow 120ms ease;
}
.topnav-cta:hover {
  background: #a5f3fc;
  text-decoration: none !important;
  transform: translateY(-1px);
  box-shadow: 0 0 30px rgba(125, 211, 252, 0.396);
}

/* =================================================================
   3-column shell: sidebar / content / TOC
   ================================================================= */
.docs-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w);
  max-width: 1380px;
  margin: 0 auto;
}

.sidebar {
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: 28px 16px 56px 28px;
  border-right: 1px solid var(--rule);
}

.sidebar-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--soft);
  margin: 0 0 16px;
}

.nav-section { margin-bottom: 22px; min-width: 0; }
.nav-section p {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--muted);
}
.nav-section a {
  display: block;
  padding: 5px 10px;
  margin-left: -10px;
  border-radius: 6px;
  font-size: 13.5px;
  color: var(--text);
  transition: background 120ms ease, color 120ms ease;
}
.nav-section a:hover {
  background: var(--panel-2);
  color: var(--ink);
  text-decoration: none;
}

/* =================================================================
   Content
   ================================================================= */
.content {
  min-width: 0;
  width: min(100%, var(--content-max));
  justify-self: center;
  padding: 32px 36px 96px;
}

.toc {
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: 32px 24px;
  border-left: 1px solid var(--rule);
  font-size: 13px;
}
.toc p {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--soft);
  margin: 0 0 12px;
}
.toc a {
  display: block;
  padding: 4px 0 4px 12px;
  margin-left: -2px;
  color: var(--muted);
  border-left: 2px solid transparent;
  transition: color 120ms ease, border-color 120ms ease;
}
.toc a:hover {
  color: var(--ink);
  border-left-color: var(--accent);
  text-decoration: none;
}

/* =================================================================
   Sections
   ================================================================= */
.doc-section {
  padding: 44px 0;
  border-bottom: 1px solid var(--rule);
  min-width: 0;
}
.doc-section:first-of-type { padding-top: 16px; }
.doc-section:last-of-type { border-bottom: 0; }

.eyebrow {
  margin: 0 0 8px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

h1, h2, h3, h4 {
  margin: 0;
  color: var(--ink);
  letter-spacing: -0.018em;
  line-height: 1.2;
  font-family: var(--display);
}
h1 {
  font-size: clamp(32px, 4vw, 44px);
  font-weight: 700;
  letter-spacing: -0.030em;
  margin: 0 0 16px;
}
h2 {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.020em;
  margin: 0 0 16px;
}
h3 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.010em;
  margin: 26px 0 8px;
  color: var(--ink);
}
h4 {
  font-size: 12px;
  font-weight: 700;
  margin: 18px 0 6px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.10em;
}

.lead {
  font-size: 16.5px;
  line-height: 1.7;
  color: var(--text);
  max-width: 68ch;
}
.section-intro { color: var(--muted); max-width: 70ch; }

/* =================================================================
   Lists
   ================================================================= */
ul, ol { margin: 0 0 14px; padding-left: 22px; }
li { margin: 6px 0; min-width: 0; }
li::marker { color: var(--soft); }

.def-list {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  row-gap: 10px;
  column-gap: 18px;
  border-top: 1px solid var(--rule);
  padding-top: 16px;
  margin-top: 16px;
}
.def-list dt {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent-bright);
}
.def-list dd { margin: 0; color: var(--muted); font-size: 14px; }

/* =================================================================
   Tables
   ================================================================= */
.table-wrap {
  overflow-x: auto;
  margin: 16px 0;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--panel);
  backdrop-filter: var(--glass-blur-sm);
  -webkit-backdrop-filter: var(--glass-blur-sm);
  max-width: 100%;
  min-width: 0;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
thead th {
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 12px 14px;
  border-bottom: 1px solid var(--rule-strong);
  background: var(--panel-2);
  white-space: nowrap;
}
tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
  color: var(--text);
}
tbody tr:last-child td { border-bottom: 0; }
tbody td code { white-space: nowrap; }

/* =================================================================
   Figures, callouts, notes
   ================================================================= */
figure {
  margin: 20px 0;
  border: 1px solid var(--rule);
  border-radius: 12px;
  overflow: hidden;
  background: var(--panel);
  backdrop-filter: var(--glass-blur-sm);
  -webkit-backdrop-filter: var(--glass-blur-sm);
}
figure img, figure svg {
  display: block;
  width: 100%;
  height: auto;
  background: transparent;
}
figcaption {
  padding: 12px 16px;
  font-size: 12.5px;
  color: var(--muted);
  border-top: 1px solid var(--rule);
  background: var(--panel-2);
}

.note {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 8px;
  margin: 18px 0;
  padding: 14px 18px;
  border: 1px solid var(--rule-strong);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  background: var(--accent-soft);
  backdrop-filter: var(--glass-blur-sm);
  -webkit-backdrop-filter: var(--glass-blur-sm);
}
.note .label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-bright);
  padding-top: 2px;
}
.note p { margin: 0; color: var(--text); font-size: 13.5px; }
.note.warn {
  border-left-color: var(--warn);
  background: var(--warn-bg);
  border-color: var(--warn-border);
}
.note.warn .label { color: var(--warn); }

/* =================================================================
   Reference: command cards, env vars
   ================================================================= */
.ref-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-top: 1px solid var(--rule);
  min-width: 0;
}
.ref-item {
  padding: 18px 0;
  border-bottom: 1px solid var(--rule);
  min-width: 0;
}
.ref-item h3 {
  font-family: var(--mono);
  font-size: 14px;
  margin: 0 0 4px;
  color: var(--ink);
}
.ref-item p { margin: 0 0 10px; color: var(--muted); font-size: 14px; }
.ref-item .signature {
  display: block;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent-bright);
  background: var(--code-bg-deep);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
  white-space: pre;
  overflow-x: auto;
  min-width: 0;
}

.flag-table th { background: var(--panel-2); }
.flag-table td:first-child { white-space: nowrap; font-family: var(--mono); }

/* =================================================================
   Hero
   ================================================================= */
.hero {
  padding: 44px 0 36px;
  border-bottom: 1px solid var(--rule);
  min-width: 0;
}
.hero h1 {
  font-size: clamp(36px, 5vw, 50px);
  letter-spacing: -0.034em;
  font-weight: 700;
  max-width: 22ch;
  background: linear-gradient(180deg, #ffffff 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero .lead { margin-top: 16px; max-width: 64ch; color: var(--muted); }

.kpi-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 28px;
}
.kpi-row > div {
  padding: 16px 18px;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--panel);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  min-width: 0;
  transition: border-color 120ms ease, background 120ms ease;
}
.kpi-row > div:hover {
  border-color: var(--rule-strong);
  background: var(--panel-2);
}
.kpi-row strong {
  display: block;
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.kpi-row span {
  display: block;
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.55;
}
.kpi-row code {
  background: rgba(125, 211, 252, 0.07);
  border-color: rgba(125, 211, 252, 0.158);
}

.button-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 24px; }
.button {
  display: inline-flex;
  align-items: center;
  height: 38px;
  padding: 0 16px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  transition: transform 120ms ease, background 120ms ease, box-shadow 120ms ease;
}
.button.primary {
  color: var(--bg);
  background: var(--accent-bright);
  box-shadow: 0 0 28px rgba(125, 211, 252, 0.246);
}
.button.primary:hover {
  background: #a5f3fc;
  transform: translateY(-1px);
  box-shadow: 0 0 36px rgba(125, 211, 252, 0.37);
  text-decoration: none;
}
.button.secondary {
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--rule-strong);
  backdrop-filter: var(--glass-blur-sm);
  -webkit-backdrop-filter: var(--glass-blur-sm);
}
.button.secondary:hover {
  background: var(--panel-2);
  border-color: rgba(255, 255, 255, 0.20);
  text-decoration: none;
}

/* =================================================================
   Inline anchors and scroll padding
   ================================================================= */
h2, h3 { scroll-margin-top: calc(var(--topbar-h) + 16px); }

/* =================================================================
   Responsive
   ================================================================= */
@media (max-width: 1180px) {
  .docs-shell { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); max-width: 1100px; }
  .toc { display: none; }
}
@media (max-width: 820px) {
  .topbar { padding: 0 16px; }
  .topnav { gap: 14px; }
  .docs-shell { display: block; max-width: 100%; }
  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--rule);
    padding: 18px 16px;
    background: rgba(10, 13, 18, 0.50);
    backdrop-filter: var(--glass-blur-sm);
    -webkit-backdrop-filter: var(--glass-blur-sm);
  }
  .sidebar nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
  .nav-section { margin-bottom: 14px; }
  .content { padding: 28px 18px 64px; }
  h1 { font-size: clamp(28px, 7vw, 40px); }
  .kpi-row { grid-template-columns: 1fr; }
  .def-list { grid-template-columns: minmax(0, 1fr); row-gap: 4px; }
  .def-list dt { margin-top: 8px; }
  .def-list dd { margin-bottom: 8px; }
}
@media (max-width: 520px) {
  .topnav a:not(.topnav-cta) { display: none; }
  .sidebar nav { grid-template-columns: 1fr; }
}

/* ============== v0.1.0 overview punch — stats + comparison + use cases ============== */

.hero-accent {
  background: linear-gradient(180deg, #a5f3fc 0%, #a78bfa 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 32px;
}
.stat-tile {
  position: relative;
  padding: 22px 20px 20px;
  border: 1px solid var(--rule);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.012) 100%);
  overflow: hidden;
  transition: border-color 0.18s ease;
}
.stat-tile:hover { border-color: var(--rule-strong); }
.stat-tile::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(103,232,249,0.6), transparent);
}
.stat-num {
  font-family: var(--mono);
  font-size: clamp(22px, 2.6vw, 30px);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.1;
  letter-spacing: -0.018em;
  word-break: break-word;
  hyphens: auto;
}
.stat-num.accent { color: #a5f3fc; }
.stat-num.green { color: #34d399; }
.stat-label {
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.stat-sub {
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--soft);
}

.overview-h2 {
  font-size: 22px;
  font-weight: 600;
  margin: 48px 0 16px;
  color: var(--ink);
  letter-spacing: -0.012em;
}
.overview-h2 code { font-size: 18px; }

.compare-grid {
  display: grid;
  grid-template-columns:
    minmax(170px, 1.1fr)
    minmax(170px, 1.1fr)
    minmax(220px, 2fr);
  gap: 0;
  border: 1px solid var(--rule);
  border-radius: 14px;
  overflow: hidden;
  background: var(--panel);
}
.compare-head {
  display: contents;
}
.compare-head > span {
  padding: 12px 18px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--soft);
  background: rgba(255,255,255,0.025);
  border-bottom: 1px solid var(--rule-faint);
}
.compare-row {
  display: contents;
}
.compare-row > span {
  padding: 14px 18px;
  border-top: 1px solid var(--rule-faint);
  font-size: 13.5px;
  line-height: 1.55;
}
.compare-task { font-weight: 600; color: var(--text); }
.compare-tool { color: var(--soft); }
.compare-skygrep {
  color: var(--text);
  border-left: 1px solid var(--rule-faint);
  background: linear-gradient(90deg, rgba(125, 211, 252, 0.035), transparent 60%);
}
.compare-check { color: #34d399; font-weight: 700; margin-right: 4px; }

.usecase-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.usecase-card {
  padding: 20px 18px;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--panel);
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}
.usecase-card:hover {
  border-color: var(--rule-strong);
  background: var(--panel-2);
  transform: translateY(-1px);
}
.usecase-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #a5f3fc;
  background: rgba(125, 211, 252, 0.088);
  border: 1px solid rgba(125, 211, 252, 0.264);
  margin-bottom: 10px;
}
.usecase-title {
  font-weight: 600;
  font-size: 15px;
  color: var(--ink);
  margin-bottom: 6px;
}
.usecase-body {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.55;
}
.usecase-body code { font-size: 11.5px; }

@media (max-width: 1100px) {
  .stat-grid     { grid-template-columns: repeat(2, 1fr); }
  .usecase-grid  { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .compare-grid  { grid-template-columns: 1fr; }
  .compare-row > span:first-child { border-top: 1px solid var(--rule); padding-top: 16px; }
  .compare-skygrep { border-left: none; border-top: 1px dashed var(--rule-faint) !important; }
}
