/* ========================================
   STAR Tools Docs ~ GitHub-esque + Glass
   ======================================== */

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

:root {
  --font-body: 'Inter', sans-serif;
  --font-display: 'Space Grotesk', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-7: 32px; --sp-8: 40px;
  --radius-sm: 8px; --radius-md: 12px; --radius-lg: 16px;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --speed: 0.25s;
  --sidebar-w: 260px;
  --nav-h: 56px;
}

/* -- dark -- */
[data-theme="dark"] {
  --bg: #0d1117;
  --bg-sidebar: #010409;
  --surface: #161b22;
  --surface-hover: #1c2128;
  --border: #30363d;
  --border-subtle: #21262d;
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #484f58;
  --accent: #58a6ff;
  --accent-dim: rgba(88,166,255,0.1);
  --accent-green: #3fb950;
  --accent-purple: #bc8cff;
  --accent-orange: #d29922;
  --code-bg: #0d1117;
  --nav-bg: rgba(1,4,9,0.85);
  --card-new: #1f6feb;
}

/* -- light -- */
[data-theme="light"] {
  --bg: #ffffff;
  --bg-sidebar: #f6f8fa;
  --surface: #f6f8fa;
  --surface-hover: #eef1f5;
  --border: #d0d7de;
  --border-subtle: #e1e4e8;
  --text-primary: #1f2328;
  --text-secondary: #656d76;
  --text-muted: #8b949e;
  --accent: #0969da;
  --accent-dim: rgba(9,105,218,0.08);
  --accent-green: #1a7f37;
  --accent-purple: #8250df;
  --accent-orange: #9a6700;
  --code-bg: #f6f8fa;
  --nav-bg: rgba(246,248,250,0.85);
  --card-new: #0969da;
}

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 24px); }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  transition: background var(--speed) var(--ease), color var(--speed) var(--ease);
}

/* -- nav -- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; height: var(--nav-h); z-index: 100;
  background: var(--nav-bg); backdrop-filter: blur(16px); border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 1400px; margin: 0 auto; height: 100%; padding: 0 var(--sp-6);
  display: flex; align-items: center; justify-content: space-between;
}
.nav-brand {
  display: flex; align-items: center; gap: var(--sp-2); text-decoration: none; color: var(--text-primary);
}
.nav-logo { width: 28px; height: 28px; border-radius: 6px; }
.nav-title { font-family: var(--font-display); font-weight: 700; font-size: 16px; }
.nav-sep { color: var(--text-muted); font-weight: 300; margin: 0 2px; }
.nav-sub { color: var(--text-secondary); font-weight: 500; font-size: 14px; }
.nav-right { display: flex; align-items: center; gap: var(--sp-4); }
.nav-version {
  font-family: var(--font-mono); font-size: 11px; font-weight: 500;
  padding: 2px 8px; border-radius: 20px; background: var(--accent-dim); color: var(--accent);
}
.theme-toggle {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  width: 36px; height: 36px; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background var(--speed) var(--ease);
}
.theme-toggle:hover { background: var(--surface-hover); }
.t-icon { font-size: 16px; }
[data-theme="dark"] .t-icon.sun { display: none; }
[data-theme="light"] .t-icon.moon { display: none; }

/* -- layout -- */
.layout {
  display: flex; min-height: 100vh; padding-top: var(--nav-h);
}

/* -- sidebar -- */
.sidebar {
  position: fixed; top: var(--nav-h); left: 0; bottom: 0; width: var(--sidebar-w);
  background: var(--bg-sidebar); border-right: 1px solid var(--border);
  overflow-y: auto; padding: var(--sp-6) var(--sp-4);
  transition: background var(--speed) var(--ease);
}
.sidebar-section { margin-bottom: var(--sp-6); }
.sidebar-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.5px;
  color: var(--text-muted); padding: 0 var(--sp-3); margin-bottom: var(--sp-2);
}
.sidebar-link {
  display: block; padding: 6px var(--sp-3); border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; color: var(--text-secondary); text-decoration: none;
  transition: color var(--speed) var(--ease), background var(--speed) var(--ease);
  border-left: 2px solid transparent; margin-bottom: 1px;
}
.sidebar-link:hover { color: var(--text-primary); background: var(--surface); }
.sidebar-link.active {
  color: var(--accent); background: var(--accent-dim);
  border-left-color: var(--accent); font-weight: 600;
}

/* -- content -- */
.content {
  flex: 1; max-width: 880px;
  margin-left: var(--sidebar-w); margin-right: auto;
  padding: var(--sp-8);
  padding-left: max(var(--sp-8), calc((100vw - var(--sidebar-w) - 880px) / 2));
}

/* -- doc hero -- */
.doc-hero { margin-bottom: var(--sp-8); }
.doc-hero h1 {
  font-family: var(--font-display); font-size: 36px; font-weight: 800;
  letter-spacing: -0.5px; margin-bottom: var(--sp-3);
}
.doc-hero-sub { font-size: 16px; color: var(--text-secondary); max-width: 600px; margin-bottom: var(--sp-4); }
.doc-hero-meta { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.meta-tag {
  font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 20px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-secondary);
}

/* -- cards -- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: var(--sp-7); margin-bottom: var(--sp-7); position: relative;
  transition: background var(--speed) var(--ease), border-color var(--speed) var(--ease);
}
.card:hover { border-color: var(--accent); }
.card h2 {
  font-family: var(--font-display); font-size: 22px; font-weight: 700;
  margin-bottom: var(--sp-4); letter-spacing: -0.3px;
}
.card h4 { font-size: 15px; font-weight: 700; margin: var(--sp-5) 0 var(--sp-2); }
.card p { color: var(--text-secondary); font-size: 14px; margin-bottom: var(--sp-4); }
.card-new {
  position: absolute; top: var(--sp-4); right: var(--sp-4);
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px;
  padding: 3px 10px; border-radius: 20px; background: var(--card-new); color: #fff;
}

/* -- two col -- */
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: var(--sp-4); margin: var(--sp-4) 0; }
.mini-card {
  padding: var(--sp-5); border-radius: var(--radius-md); border: 1px solid var(--border-subtle);
  background: var(--bg); transition: border-color var(--speed) var(--ease);
}
.mini-card:hover { border-color: var(--accent); }
.mini-card h4 { margin: var(--sp-3) 0 var(--sp-2); font-size: 14px; }
.mini-card p { font-size: 13px; margin: 0; }
.mini-icon { width: 40px; height: 40px; }
.mini-img { width: 40px; height: 40px; border-radius: 8px; }

/* -- tables -- */
.doc-table-wrap { overflow-x: auto; margin: var(--sp-4) 0; }
.doc-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 480px; }
.doc-table th {
  text-align: left; padding: var(--sp-3) var(--sp-4); font-weight: 600; font-size: 11px;
  text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted);
  border-bottom: 2px solid var(--border); white-space: nowrap;
}
.doc-table td {
  padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}
.doc-table td:nth-child(2) { min-width: 200px; }
.doc-table tr:hover td { background: var(--surface-hover); }

/* -- badges -- */
.badge {
  font-size: 11px; font-weight: 600; padding: 2px 10px; border-radius: 20px; display: inline-block;
}
.badge-blue { background: rgba(88,166,255,0.15); color: var(--accent); }
.badge-green { background: rgba(63,185,80,0.15); color: var(--accent-green); }
.badge-purple { background: rgba(188,140,255,0.15); color: var(--accent-purple); }

/* -- feature list -- */
.feature-list { list-style: none; padding: 0; }
.feature-list li {
  padding: var(--sp-2) 0; padding-left: var(--sp-6); position: relative;
  font-size: 14px; color: var(--text-secondary);
}
.feature-list li::before {
  content: ''; position: absolute; left: 0; top: 12px;
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
}

/* -- numbered list -- */
.numbered-list { padding-left: var(--sp-6); }
.numbered-list li {
  padding: var(--sp-2) 0; font-size: 14px; color: var(--text-secondary);
}

/* -- info grid -- */
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--sp-3); margin: var(--sp-4) 0; }
.info-item {
  padding: var(--sp-4); border-radius: var(--radius-sm); border: 1px solid var(--border-subtle);
  background: var(--bg);
}
.info-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); margin-bottom: var(--sp-1); }
.info-value { font-size: 13px; color: var(--text-secondary); }

/* -- steps -- */
.steps { display: flex; flex-direction: column; gap: var(--sp-4); }
.step { display: flex; gap: var(--sp-4); align-items: flex-start; }
.step-num {
  width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: #fff;
  font-family: var(--font-display); font-weight: 700; font-size: 14px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.step-body h4 { margin: 0 0 var(--sp-1); font-size: 14px; }
.step-body p { margin: 0; font-size: 13px; }

/* -- accordion -- */
.accordion { margin: var(--sp-4) 0; }
.acc-item { border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); margin-bottom: var(--sp-2); overflow: hidden; }
.acc-header {
  padding: var(--sp-3) var(--sp-4); font-size: 14px; font-weight: 600; cursor: pointer;
  background: var(--bg); transition: background var(--speed) var(--ease);
  position: relative; padding-left: var(--sp-7);
}
.acc-header::before {
  content: '+'; position: absolute; left: var(--sp-4); font-family: var(--font-mono);
  font-size: 14px; color: var(--text-muted); transition: transform var(--speed) var(--ease);
}
.acc-item.open .acc-header::before { content: '-'; }
.acc-header:hover { background: var(--surface-hover); }
.acc-body {
  max-height: 0; overflow: hidden; padding: 0 var(--sp-4);
  font-size: 13px; color: var(--text-secondary); transition: max-height var(--speed) var(--ease), padding var(--speed) var(--ease);
}
.acc-item.open .acc-body { max-height: 200px; padding: var(--sp-3) var(--sp-4) var(--sp-4); }

/* -- callout -- */
.callout {
  padding: var(--sp-3) var(--sp-4); border-radius: var(--radius-sm);
  background: var(--accent-dim); border-left: 3px solid var(--accent);
  font-size: 13px; font-weight: 500; color: var(--accent); margin: var(--sp-4) 0;
}

/* -- code -- */
code {
  font-family: var(--font-mono); font-size: 12px; padding: 2px 6px;
  background: var(--code-bg); border: 1px solid var(--border-subtle); border-radius: 4px;
}
.code-block {
  background: var(--code-bg); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: var(--sp-5); overflow-x: auto; margin: var(--sp-4) 0;
}
.code-block pre {
  font-family: var(--font-mono); font-size: 12px; line-height: 1.7; color: var(--text-secondary);
  margin: 0; white-space: pre;
}

/* -- timeline -- */
.timeline { position: relative; padding-left: var(--sp-7); }
.timeline::before {
  content: ''; position: absolute; left: 7px; top: 8px; bottom: 8px;
  width: 2px; background: var(--border);
}
.timeline-item { position: relative; margin-bottom: var(--sp-6); }
.timeline-item::before {
  content: ''; position: absolute; left: calc(-25px); top: 6px;
  width: 10px; height: 10px; border-radius: 50%; background: var(--accent);
  border: 2px solid var(--bg);
}
.timeline-date { font-size: 11px; font-weight: 600; color: var(--text-muted); margin-bottom: var(--sp-1); }
.timeline-body h4 { font-size: 14px; margin-bottom: var(--sp-1); }
.timeline-body p { font-size: 13px; color: var(--text-secondary); margin: 0; }

/* -- footer -- */
.doc-footer {
  padding: var(--sp-8) 0; margin-top: var(--sp-10);
  border-top: 1px solid var(--border); text-align: center;
}
.doc-footer p { font-size: 12px; color: var(--text-muted); }

/* -- responsive -- */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .content { margin-left: 0; padding: var(--sp-6) var(--sp-4); }
  .two-col { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: 1fr; }
}
