/* ────────────────────────────────────────────
   TRIAPI DOCS · Design System
   Exact match to gpt.hslife.fun main site
──────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

/* ══════════════════════════════════════════
   DARK THEME  (default)
══════════════════════════════════════════ */
:root, [data-theme="dark"] {
  color-scheme: dark;

  /* Background */
  --bg:           #090d1b;
  --bg-sidebar:   #0c1020;
  --bg-card:      #111827;
  --bg-hover:     rgba(255,255,255,0.04);

  /* Borders */
  --border:       rgba(255,255,255,0.07);
  --border-focus: rgba(13,207,160,0.40);

  /* Brand teal */
  --primary:      #0dcfa0;
  --primary-dim:  rgba(13,207,160,0.10);
  --primary-glow: rgba(13,207,160,0.16);

  /* Typography */
  --text:         #f1f5f9;
  --text-body:    #cbd5e1;
  --text-muted:   #64748b;

  /* Code */
  --code-bg:      #0d1117;
  --code-bar:     #080c14;
  --text-code:    #c9d1d9;

  /* Texture dot color */
  --dot-color:    rgba(255,255,255,0.038);

  /* Glow */
  --glow:         radial-gradient(ellipse 55% 55% at 100% 0%, rgba(13,207,160,0.16) 0%, transparent 70%);

  /* Misc */
  --shadow:       0 4px 24px rgba(0,0,0,0.5);
  --radius:       14px;
  --header-h:     68px;
  --sidebar-w:    180px;
}

/* ══════════════════════════════════════════
   LIGHT THEME
══════════════════════════════════════════ */
[data-theme="light"] {
  color-scheme: light;

  --bg:           #eef2f1;
  --bg-sidebar:   #ffffff;
  --bg-card:      #ffffff;
  --bg-hover:     rgba(0,0,0,0.04);

  --border:       rgba(0,0,0,0.07);
  --border-focus: rgba(13,207,160,0.45);

  --primary:      #0dcfa0;
  --primary-dim:  rgba(13,207,160,0.10);
  --primary-glow: rgba(13,207,160,0.14);

  --text:         #0f172a;
  --text-body:    #334155;
  --text-muted:   #64748b;

  --code-bg:      #1e293b;
  --code-bar:     #0f172a;
  --text-code:    #e2e8f0;

  --dot-color:    rgba(0,0,0,0.055);

  --glow:         radial-gradient(ellipse 55% 55% at 100% 0%, rgba(13,207,160,0.13) 0%, transparent 70%);

  --shadow:       0 2px 12px rgba(0,0,0,0.08), 0 8px 32px rgba(0,0,0,0.06);
  --radius:       14px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }

/* ── Body + texture + glow ── */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Noto Sans SC', sans-serif;
  background-color: var(--bg);
  /* dot-grid texture */
  background-image:
    var(--glow),
    radial-gradient(circle, var(--dot-color) 1px, transparent 1px);
  background-size: 100% 100%, 24px 24px;
  background-attachment: fixed, fixed;
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
  transition: background-color .3s, color .3s;
}

a { color: var(--primary); text-decoration: none; transition: opacity .15s; }
a:hover { opacity: .75; }

/* ── Header ── */
.docs-header {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 75%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 24px; z-index: 100; gap: 14px;
  transition: background .3s, border-color .3s;
}

.header-logo {
  display: flex; align-items: center; gap: 12px;
  min-width: 0;
  color: var(--text); text-decoration: none;
}
.header-logo:hover { opacity: 1; }

.header-logo-icon {
  position: relative;
  width: 42px; height: 42px;
  background:
    radial-gradient(circle at 30% 25%, rgba(255,255,255,0.25), transparent 35%),
    linear-gradient(135deg, #14f1c7, #0dcfa0 48%, #0b7db8 100%);
  border-radius: 14px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  box-shadow:
    inset 0 1px 1px rgba(255,255,255,0.18),
    0 12px 28px rgba(11,125,184,0.26),
    0 0 0 1px rgba(255,255,255,0.08);
  overflow: hidden;
}

.header-logo-icon::after {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: 13px;
  border: 1px solid rgba(255,255,255,0.14);
  pointer-events: none;
}

.header-logo-mark {
  position: relative;
  z-index: 1;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
  text-shadow: 0 1px 10px rgba(0,0,0,0.22);
}

.header-logo-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.header-logo-kicker {
  font-size: 10px;
  line-height: 1;
  color: var(--primary);
  font-weight: 800;
  letter-spacing: .18em;
  text-transform: uppercase;
  margin-bottom: 5px;
}

.header-logo-title {
  font-size: 15px;
  line-height: 1.05;
  font-weight: 800;
  letter-spacing: .01em;
  color: var(--text);
  text-wrap: balance;
}

.header-logo-section {
  /* exact same width as sidebar so the separator aligns with sidebar right border */
  width: calc(var(--sidebar-w) - 24px); /* subtract header padding-left */
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  min-width: 0;
}

.header-sep { width: 1px; height: 18px; background: var(--border); flex-shrink: 0; margin-left: auto; }
.header-subtitle { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.header-spacer { flex: 1; }

.header-link {
  font-size: 13px; color: var(--text-muted);
  padding: 6px 14px; border-radius: 8px;
  border: 1px solid var(--border);
  font-weight: 500; white-space: nowrap;
  transition: color .15s, border-color .15s, background .15s;
}
.header-link:hover {
  color: var(--primary); border-color: var(--border-focus);
  background: var(--primary-dim); opacity: 1;
}

/* Theme toggle */
.theme-toggle {
  width: 34px; height: 34px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: none; border: 1px solid var(--border); border-radius: 8px;
  cursor: pointer; color: var(--text-muted);
  transition: color .15s, border-color .15s, background .15s;
}
.theme-toggle:hover {
  color: var(--primary); border-color: var(--border-focus);
  background: var(--primary-dim);
}

.menu-toggle {
  display: none; background: none; border: none;
  cursor: pointer; padding: 6px; color: var(--text-muted); flex-shrink: 0;
}

/* ── Sidebar ── */
.docs-sidebar {
  position: fixed; top: var(--header-h); left: 0;
  width: var(--sidebar-w);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  padding: 12px 0 32px; z-index: 50;
  transition: background .3s, border-color .3s;
}
.docs-sidebar::-webkit-scrollbar { width: 3px; }
.docs-sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.sidebar-group { margin-bottom: 2px; }

.sidebar-group-title {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .12em;
  color: var(--text-muted); padding: 14px 16px 5px;
}

.sidebar-link, .sidebar-sub {
  display: flex; align-items: center; gap: 9px;
  color: var(--text-muted); padding: 7px 16px;
  border-left: 2px solid transparent;
  transition: color .15s, background .15s, border-color .15s;
  text-decoration: none;
}
.sidebar-link { font-size: 13.5px; }
.sidebar-sub  { font-size: 13px; }
.sidebar-link:hover, .sidebar-sub:hover {
  color: var(--text); background: var(--bg-hover); opacity: 1;
}
.sidebar-link.active, .sidebar-sub.active {
  color: var(--primary); background: var(--primary-dim);
  border-left-color: var(--primary); font-weight: 600;
}

.sidebar-icon, .nav-icon {
  display: flex; align-items: center; justify-content: center;
  width: 16px; flex-shrink: 0; opacity: .5;
  transition: opacity .15s;
}
.sidebar-link:hover .nav-icon, .sidebar-sub:hover .nav-icon  { opacity: .8; }
.sidebar-link.active .nav-icon, .sidebar-sub.active .nav-icon { opacity: 1; color: var(--primary); }

/* ── Main ── */
.docs-main {
  margin-left: var(--sidebar-w); padding-top: var(--header-h);
  min-height: 100vh; position: relative; z-index: 1;
}
.docs-content { max-width: 800px; margin: 0 auto; padding: 44px 48px 96px; }

/* ── Breadcrumb ── */
.breadcrumb {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--text-muted); margin-bottom: 22px;
}
.breadcrumb-sep { opacity: .3; }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--primary); opacity: 1; }

/* ── Page header ── */
.page-header { margin-bottom: 36px; padding-bottom: 24px; border-bottom: 1px solid var(--border); }

.page-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10.5px; font-weight: 700; color: var(--primary);
  background: var(--primary-dim); border: 1px solid var(--border-focus);
  padding: 4px 12px; border-radius: 100px; margin-bottom: 14px;
  text-transform: uppercase; letter-spacing: .08em;
}

.page-title { font-size: 28px; font-weight: 800; line-height: 1.25; margin-bottom: 10px; }
.page-desc  { font-size: 15px; color: var(--text-muted); line-height: 1.7; }

/* ── Sections ── */
.section { margin-bottom: 48px; }
.section-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }

.section-num {
  width: 28px; height: 28px;
  background: var(--primary-dim); border: 1px solid var(--border-focus);
  color: var(--primary); border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; flex-shrink: 0;
}

.section-title { font-size: 19px; font-weight: 700; }
.subsection    { margin: 22px 0; }

.subsection-title {
  font-size: 14.5px; font-weight: 600; margin-bottom: 12px;
  padding-left: 13px; border-left: 2px solid var(--primary);
}

p      { font-size: 14.5px; color: var(--text-body); margin-bottom: 14px; line-height: 1.75; }
ul, ol { font-size: 14.5px; color: var(--text-body); margin: 12px 0 12px 20px; }
li     { margin-bottom: 8px; line-height: 1.65; }

/* ── Code blocks ── */
.code-block {
  margin: 16px 0; border-radius: var(--radius);
  overflow: hidden; border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.code-bar {
  display: flex; align-items: center;
  padding: 9px 14px; background: var(--code-bar);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  position: relative; gap: 8px;
}

.code-dots { display: flex; gap: 5px; align-items: center; flex-shrink: 0; }
.code-dot   { width: 10px; height: 10px; border-radius: 50%; }
.code-dot-r { background: #ff5f56; }
.code-dot-y { background: #ffbd2e; }
.code-dot-g { background: #27c93f; }

.code-lang {
  position: absolute; left: 50%; transform: translateX(-50%);
  font-size: 10.5px; font-weight: 600; color: #64748b;
  text-transform: uppercase; letter-spacing: .09em; font-family: monospace;
}

.copy-btn {
  margin-left: auto; position: relative; z-index: 1; flex-shrink: 0;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1);
  color: #64748b; font-size: 11px; padding: 4px 11px; border-radius: 6px;
  cursor: pointer; font-family: 'Inter', sans-serif;
  transition: background .15s, color .15s, border-color .15s;
}
.copy-btn:hover  { background: rgba(13,207,160,0.15); color: #0dcfa0; border-color: rgba(13,207,160,.35); }
.copy-btn.copied { background: rgba(39,201,63,0.15); border-color: rgba(39,201,63,.3); color: #27c93f; }

pre { background: var(--code-bg); margin: 0; overflow-x: auto; }
pre::-webkit-scrollbar { height: 4px; }
pre::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 4px; }
pre code {
  display: block; padding: 16px 20px; font-size: 13px; line-height: 1.85;
  font-family: 'Fira Code', 'Cascadia Code', 'JetBrains Mono', Consolas, monospace;
  color: var(--text-code);
}

:not(pre) > code {
  background: var(--primary-dim); color: var(--primary);
  padding: 2px 7px; border-radius: 5px;
  font-size: .85em; font-family: 'Fira Code', Consolas, monospace;
  border: 1px solid var(--border-focus);
}

/* ── Alerts ── */
.alert { padding: 14px 18px; border-radius: 10px; margin: 18px 0; border: 1px solid; font-size: 14px; line-height: 1.7; }
.alert-label { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 6px; display: flex; align-items: center; gap: 5px; }

.alert-tip  { background: rgba(13,207,160,0.07);  border-color: rgba(13,207,160,0.22); color: var(--text-body); }
.alert-tip  .alert-label { color: var(--primary); }
.alert-warn { background: rgba(245,158,11,0.07);  border-color: rgba(245,158,11,0.25); color: var(--text-body); }
.alert-warn .alert-label { color: #f59e0b; }
.alert-note { background: rgba(99,102,241,0.07);  border-color: rgba(99,102,241,0.25); color: var(--text-body); }
.alert-note .alert-label { color: #818cf8; }

/* ── Page nav ── */
.page-nav { display: flex; justify-content: space-between; gap: 14px; margin-top: 60px; padding-top: 24px; border-top: 1px solid var(--border); }

.nav-btn {
  display: flex; flex-direction: column; gap: 5px;
  padding: 14px 18px; border: 1px solid var(--border); border-radius: var(--radius);
  text-decoration: none; color: var(--text); background: var(--bg-card);
  flex: 1; max-width: 256px;
  transition: border-color .2s, background .2s, box-shadow .2s;
  box-shadow: var(--shadow);
}
.nav-btn:hover { border-color: var(--border-focus); background: var(--primary-dim); opacity: 1; }
.nav-btn-label { font-size: 11.5px; color: var(--text-muted); }
.nav-btn-title { font-size: 13.5px; font-weight: 600; color: var(--primary); }
.nav-btn-next  { text-align: right; margin-left: auto; }

/* ── Home hero ── */
.hero { text-align: center; padding: 52px 0 40px; border-bottom: 1px solid var(--border); margin-bottom: 44px; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--primary-dim); color: var(--primary); border: 1px solid var(--border-focus);
  font-size: 10.5px; font-weight: 700; padding: 5px 14px; border-radius: 100px; margin-bottom: 18px;
  text-transform: uppercase; letter-spacing: .08em;
}
.hero-title { font-size: 34px; font-weight: 900; margin-bottom: 12px; line-height: 1.15; }
.hero-desc  { font-size: 15px; color: var(--text-muted); max-width: 440px; margin: 0 auto; }

/* ── Cards (home) ── */
.card-section-title { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--text-muted); margin-bottom: 12px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-bottom: 36px; }

.doc-card {
  display: flex; flex-direction: column; gap: 12px;
  padding: 20px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius);
  text-decoration: none; color: var(--text);
  box-shadow: var(--shadow);
  transition: border-color .2s, box-shadow .2s, transform .2s;
}
.doc-card:hover {
  border-color: var(--border-focus);
  transform: translateY(-2px); opacity: 1;
  box-shadow: 0 12px 32px rgba(0,0,0,0.2), 0 0 0 1px var(--primary-dim);
}
.doc-card-icon { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.doc-card-name { font-size: 15px; font-weight: 700; }
.doc-card-meta { font-size: 11.5px; color: var(--text-muted); margin-top: 1px; }
.doc-card-desc { font-size: 13px; color: var(--text-muted); line-height: 1.65; flex: 1; margin: 0; }
.doc-card-platforms { display: flex; gap: 7px; flex-wrap: wrap; }
.platform-tag {
  font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 100px;
  background: var(--bg-hover); color: var(--text-muted); border: 1px solid var(--border);
  transition: background .15s, color .15s, border-color .15s;
}
.doc-card:hover .platform-tag { background: var(--primary-dim); color: var(--primary); border-color: var(--border-focus); }

/* ── Table ── */
.data-table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 13.5px; }
.data-table th { background: var(--bg-hover); padding: 11px 16px; text-align: left; font-weight: 600; font-size: 12px; color: var(--text-muted); border-bottom: 1px solid var(--border); text-transform: uppercase; letter-spacing: .05em; }
.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); color: var(--text-body); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg-hover); }
.badge-teal { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 100px; background: var(--primary-dim); color: var(--primary); border: 1px solid var(--border-focus); }

/* ── Responsive ── */
@media (max-width: 768px) {
  .menu-toggle { display: block; }
  .docs-sidebar { transform: translateX(-100%); transition: transform .25s cubic-bezier(.4,0,.2,1); z-index: 200; }
  .docs-sidebar.open { transform: translateX(0); box-shadow: 0 0 0 100vmax rgba(0,0,0,.65); }
  .docs-main { margin-left: 0; }
  .docs-content { padding: 28px 18px 60px; }
  .page-title { font-size: 22px; }
  .hero-title { font-size: 24px; }
  .page-nav { flex-direction: column; }
  .nav-btn { max-width: 100%; }
  .card-grid { grid-template-columns: 1fr; }
  .docs-header { padding: 0 16px; gap: 12px; }
  .header-logo-section { width: auto; }
  .header-sep { display: none; }
  .header-logo-icon { width: 38px; height: 38px; border-radius: 12px; }
  .header-logo-kicker { display: none; }
  .header-logo-title { font-size: 13px; }
  .header-subtitle { display: none; }
  .code-lang { display: none; }
}
