/* WebCLI Spec — style.css
   Furo-inspired design by Pradyun Gedam
   System fonts, CSS custom properties, no framework. */

/* ============================================================
   1. TOKENS
   ============================================================ */
:root {
  --bg-primary:    #ffffff;
  --bg-secondary:  #f8f9fb;
  --bg-hover:      #efeff4;
  --border:        #eeebee;

  --text-primary:  #000000;
  --text-secondary:#5a5c63;
  --text-muted:    #6b6f76;

  --accent:        #2757dd;
  --accent-visited:#872ee0;

  --code-bg:       #f2f2f2;
  --code-fg:       #1e1e1e;
  --prompt-color:  #f6822d;
  --comment-color: #6b7280;

  --sidebar-width: 15em;
  --toc-width:     14em;
  --content-max:   46em;

  --radius:        0.2rem;
  --shadow-sm:     0 .2rem .5rem rgba(0,0,0,.05);
}

[data-theme="dark"] {
  --bg-primary:    #131416;
  --bg-secondary:  #1a1c1e;
  --bg-hover:      #22262a;
  --border:        #303335;

  --text-primary:  #cfd0d0;
  --text-secondary:#9ca0a5;
  --text-muted:    #6b6f76;

  --accent:        #5ca5ff;
  --accent-visited:#b27aeb;

  --code-bg:       #202020;
  --code-fg:       #d0d0d0;

  --shadow-sm:     0 .2rem .5rem rgba(0,0,0,.25);
}

/* ============================================================
   2. RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 100%; scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial,
    sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  -webkit-font-smoothing: antialiased;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
a:visited { color: var(--accent-visited); }

h1, h2, h3, h4 {
  font-weight: 700;
  line-height: 1.25;
  margin: 1.5em 0 .5em;
  color: var(--text-primary);
}
h1 { font-size: 2.5em; margin-top: 0; }
h2 { font-size: 1.75em; border-bottom: 1px solid var(--border); padding-bottom: .3em; }
h3 { font-size: 1.25em; }
h4 { font-size: 1em; }

p { margin: .75em 0; }
ul, ol { margin: .75em 0 .75em 1.5em; }
li { margin: .25em 0; }
hr { border: none; border-top: 1px solid var(--border); margin: 2em 0; }

/* ============================================================
   3. CODE
   ============================================================ */
code {
  font-family: "SFMono-Regular", Menlo, Consolas, Monaco, "Liberation Mono", monospace;
  font-size: 81.25%;
  background: var(--code-bg);
  color: var(--code-fg);
  padding: .1em .3em;
  border-radius: var(--radius);
}

pre {
  background: var(--code-bg);
  color: var(--code-fg);
  border-radius: var(--radius);
  padding: .625rem .875rem;
  overflow-x: auto;
  margin: 1em 0;
  font-size: 81.25%;
  line-height: 1.5;
  box-shadow: var(--shadow-sm);
}

pre code {
  background: none;
  padding: 0;
  font-size: inherit;
}

.prompt { color: var(--prompt-color); user-select: none; }
.comment { color: var(--comment-color); }

/* ============================================================
   4. TABLES
   ============================================================ */
.spec-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1em 0;
  font-size: 87.5%;
}
.spec-table th {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-weight: 600;
  text-align: left;
  padding: .5em .75em;
  border-bottom: 2px solid var(--border);
}
.spec-table td {
  padding: .5em .75em;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.spec-table tr:last-child td { border-bottom: none; }

/* ============================================================
   5. ADMONITIONS
   ============================================================ */
.admonition {
  border-left: 3.2px solid var(--accent);
  padding: .75em 1em;
  margin: 1.25em 0;
  box-shadow: var(--shadow-sm);
}
.admonition.warning { border-left-color: #ff9100; }
.admonition-title {
  font-weight: 700;
  font-size: 87.5%;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-secondary);
  margin-bottom: .35em;
}
.admonition p:last-child { margin-bottom: 0; }

/* ============================================================
   6. LAYOUT
   ============================================================ */
.sidebar-toggle-input { display: none; }

.page-wrap {
  display: flex;
  min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-inner {
  padding: 1.5em 1em;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.sidebar-brand {
  margin-bottom: 1.5em;
  display: flex;
  align-items: baseline;
  gap: .5em;
}
.sidebar-brand a {
  font-weight: 700;
  font-size: 1.1em;
  color: var(--text-primary);
}
.sidebar-brand a:visited { color: var(--text-primary); }
.version-badge {
  font-size: 68%;
  font-family: "SFMono-Regular", Menlo, Consolas, Monaco, monospace;
  background: var(--bg-hover);
  color: var(--text-muted);
  padding: .1em .4em;
  border-radius: .25rem;
}

/* Nav tree */
.nav-tree, .nav-tree ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-tree > li { margin: .1em 0; }
.nav-tree a {
  display: block;
  padding: .25em .5em;
  border-radius: var(--radius);
  font-size: 87.5%;
  color: var(--text-secondary);
  transition: background .12s, color .12s;
}
.nav-tree > li > a {
  font-weight: 600;
  color: var(--text-primary);
}
.nav-tree a:hover {
  background: var(--bg-hover);
  color: var(--accent);
  text-decoration: none;
}
.nav-tree a:visited { color: inherit; }
.nav-tree ul {
  margin: .1em 0 .2em 1em;
  border-left: 1px solid var(--border);
  padding-left: .5em;
}

.sidebar-footer { margin-top: auto; padding-top: 1em; }

/* --- Content --- */
.content {
  flex: 1;
  min-width: 0;
  max-width: var(--content-max);
  padding: 2.5em 3em;
  margin: 0 auto;
}

.content section { margin-bottom: 3em; }

/* Anchor headings */
.headerlink { color: inherit; text-decoration: none; }
.pilcrow {
  color: var(--border);
  font-size: .75em;
  margin-left: .25em;
  transition: color .1s;
}
h2:hover .pilcrow,
h3:hover .pilcrow { color: var(--accent); }

/* --- Right TOC --- */
.right-toc {
  width: var(--toc-width);
  min-width: var(--toc-width);
  flex-shrink: 0;
  padding: 2.5em 1em 2.5em 1.5em;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  font-size: 75%;
  border-left: 1px solid var(--border);
}
.toc-title {
  font-size: 62.5%;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin-bottom: .75em;
}
.right-toc ul, .right-toc ul ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.right-toc ul ul { margin-left: 1em; }
.right-toc a {
  display: block;
  padding: .2em 0;
  color: var(--text-secondary);
  line-height: 1.3;
}
.right-toc a:hover { color: var(--accent); text-decoration: none; }
.right-toc a:visited { color: var(--text-secondary); }

/* ============================================================
   7. HERO
   ============================================================ */
.hero { padding: 1em 0 2em; }
.hero-eyebrow {
  font-size: 75%;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin-bottom: .5em;
}
.hero h1 { margin-bottom: .4em; }
.hero-lead {
  font-size: 1.1em;
  color: var(--text-secondary);
  max-width: 36em;
  margin-bottom: 1.5em;
}
.hero-actions {
  display: flex;
  gap: .75em;
  flex-wrap: wrap;
  margin-bottom: 1.75em;
}
.btn-primary, .btn-secondary {
  display: inline-block;
  padding: .5em 1.25em;
  border-radius: .25rem;
  font-size: 87.5%;
  font-weight: 600;
  transition: opacity .12s;
  text-decoration: none;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { opacity: .88; text-decoration: none; color: #fff; }
.btn-primary:visited { color: #fff; }
.btn-secondary {
  border: 1px solid var(--border);
  color: var(--text-secondary);
  background: var(--bg-secondary);
}
.btn-secondary:hover { background: var(--bg-hover); text-decoration: none; }
.btn-secondary:visited { color: var(--text-secondary); }

.hero-code { margin-top: .5em; }

/* ============================================================
   8. MOBILE HEADER
   ============================================================ */
.mobile-header {
  display: none;
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: .75em 1em;
  align-items: center;
  gap: 1em;
}
.mobile-header .site-title {
  font-weight: 700;
  color: var(--text-primary);
  flex: 1;
}
.nav-icon {
  cursor: pointer;
  font-size: 1.2em;
  color: var(--text-secondary);
  user-select: none;
}

/* ============================================================
   9. THEME TOGGLE
   ============================================================ */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 87.5%;
  padding: .25em .5em;
  display: flex;
  align-items: center;
  gap: .3em;
}
.theme-toggle:hover { background: var(--bg-hover); }

/* ============================================================
   10. PAGE FOOTER
   ============================================================ */
.page-footer {
  margin-top: 3em;
  padding-top: 1.5em;
  border-top: 1px solid var(--border);
  font-size: 81.25%;
  color: var(--text-muted);
}

/* ============================================================
   11. RESPONSIVE
   ============================================================ */

/* Collapse right TOC at ~82em */
@media (max-width: 82em) {
  .right-toc { display: none; }
}

/* Collapse sidebar to drawer at ~63em */
@media (max-width: 63em) {
  .mobile-header { display: flex; }

  .sidebar {
    position: fixed;
    left: -100%;
    top: 0;
    z-index: 99;
    height: 100vh;
    transition: left .25s ease-in-out;
    box-shadow: 2px 0 12px rgba(0,0,0,.12);
  }

  /* CSS checkbox hack: show sidebar when checked */
  .sidebar-toggle-input:checked ~ .page-wrap .sidebar {
    left: 0;
  }

  .content { padding: 1.5em 1.25em; }
  .theme-toggle-sidebar { display: none; }
}

/* Full-width content on small screens */
@media (max-width: 46em) {
  .content { padding: 1em .75em; }
  h1 { font-size: 1.75em; }
  h2 { font-size: 1.35em; }
  .hero-lead { font-size: 1em; }
  pre { font-size: 75%; }
}
