/* ============================================================
   PyroMetal Documentation — style.css
   Dark graphite theme with fire accents.
   ============================================================ */

:root {
  --bg:          #0d0e11;
  --bg-raise:    #14161b;
  --bg-card:     #191c22;
  --bg-code:     #101216;
  --border:      #262a33;
  --border-soft: #1e222a;
  --text:        #e8eaf0;
  --text-dim:    #9aa1af;
  --text-faint:  #6b7280;
  --accent:      #ff7a29;
  --accent-soft: rgba(255, 122, 41, .13);
  --accent-2:    #ffb347;
  --good:        #4ade80;
  --warn:        #facc15;
  --info:        #60a5fa;
  --radius:      12px;
  --radius-sm:   8px;
  --sidebar-w:   272px;
  --toc-w:       220px;
  --topbar-h:    58px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Top bar ---------- */
.topbar {
  position: fixed; inset: 0 0 auto 0; height: var(--topbar-h);
  display: flex; align-items: center; gap: 14px;
  padding: 0 20px;
  background: rgba(13, 14, 17, .82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-soft);
  z-index: 100;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand img { width: 30px; height: 30px; filter: drop-shadow(0 2px 6px rgba(255,122,41,.35)); }
.brand b { font-size: 16px; letter-spacing: .2px; }
.brand span { color: var(--text-faint); font-size: 12.5px; font-weight: 500; margin-left: 2px; }
.topbar .spacer { flex: 1; }
.version-chip {
  font-size: 11.5px; font-weight: 600; color: var(--accent-2);
  background: var(--accent-soft); border: 1px solid rgba(255,122,41,.25);
  padding: 3px 10px; border-radius: 999px; white-space: nowrap;
}

/* Search */
.search-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 9px; padding: 7px 12px; width: 300px;
  color: var(--text-dim); cursor: text;
  transition: border-color .15s;
}
.search-box:focus-within { border-color: var(--accent); }
.search-box svg { flex: none; opacity: .55; }
.search-box input {
  background: none; border: none; outline: none; color: var(--text);
  font-size: 13.5px; width: 100%; font-family: var(--font);
}
.search-box kbd {
  font-family: var(--mono); font-size: 10.5px; color: var(--text-faint);
  border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px;
}
.search-results {
  position: fixed; top: calc(var(--topbar-h) + 6px); right: 20px; width: 430px;
  max-height: 62vh; overflow: auto;
  background: var(--bg-raise); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: 0 18px 50px rgba(0,0,0,.55);
  z-index: 120; display: none;
}
.search-results.open { display: block; }
.search-results .sr-item {
  display: block; padding: 11px 16px; text-decoration: none;
  border-bottom: 1px solid var(--border-soft); cursor: pointer;
}
.search-results .sr-item:last-child { border-bottom: none; }
.search-results .sr-item:hover, .search-results .sr-item.active { background: var(--accent-soft); }
.sr-item .sr-section { font-size: 11px; font-weight: 700; color: var(--accent-2); text-transform: uppercase; letter-spacing: .6px; }
.sr-item .sr-title { font-size: 13.5px; font-weight: 600; color: var(--text); margin-top: 1px; }
.sr-item .sr-snip { font-size: 12px; color: var(--text-dim); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-empty { padding: 18px; font-size: 13px; color: var(--text-faint); text-align: center; }

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed; top: var(--topbar-h); bottom: 0; left: 0; width: var(--sidebar-w);
  overflow-y: auto; padding: 18px 12px 40px;
  border-right: 1px solid var(--border-soft);
  background: var(--bg);
  z-index: 90;
}
.nav-group { margin-bottom: 4px; }
.nav-group > .nav-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px 4px; cursor: default;
  font-size: 11px; font-weight: 700; letter-spacing: .9px;
  text-transform: uppercase; color: var(--text-faint);
}
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 12px; margin: 1px 0;
  border-radius: var(--radius-sm);
  color: var(--text-dim); text-decoration: none; font-size: 13.5px; font-weight: 500;
  transition: background .12s, color .12s;
}
.nav-item:hover { background: var(--bg-card); color: var(--text); }
.nav-item.active {
  background: var(--accent-soft); color: var(--accent-2);
  font-weight: 600;
}
.nav-item .ni-icon { width: 17px; text-align: center; flex: none; opacity: .85; font-size: 13px; }

/* ---------- Layout ---------- */
.main {
  margin-left: var(--sidebar-w);
  padding: calc(var(--topbar-h) + 34px) 48px 90px;
  max-width: 1120px;
}
.with-toc { padding-right: calc(var(--toc-w) + 48px); }

.toc {
  position: fixed; top: calc(var(--topbar-h) + 34px); right: 22px; width: var(--toc-w);
  max-height: calc(100vh - var(--topbar-h) - 90px); overflow-y: auto;
  font-size: 12.5px;
}
.toc .toc-head { font-size: 11px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--text-faint); margin-bottom: 8px; }
.toc a {
  display: block; color: var(--text-dim); text-decoration: none;
  padding: 4px 10px; border-left: 2px solid var(--border-soft);
  transition: color .12s, border-color .12s;
}
.toc a:hover { color: var(--text); }
.toc a.active { color: var(--accent-2); border-color: var(--accent); }

/* ---------- Page content ---------- */
.page { display: none; animation: fadein .28s ease; }
.page.visible { display: block; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.crumbs { font-size: 12.5px; color: var(--text-faint); margin-bottom: 14px; }
.crumbs b { color: var(--accent-2); font-weight: 600; }

h1 { font-size: 32px; letter-spacing: -.4px; line-height: 1.2; margin-bottom: 10px; }
.lede { font-size: 16.5px; color: var(--text-dim); max-width: 72ch; margin-bottom: 34px; }

h2 {
  font-size: 21px; letter-spacing: -.2px; margin: 44px 0 14px;
  padding-top: 18px; border-top: 1px solid var(--border-soft);
  scroll-margin-top: calc(var(--topbar-h) + 20px);
}
h2:first-of-type { border-top: none; padding-top: 0; margin-top: 26px; }
h3 { font-size: 16.5px; margin: 28px 0 10px; scroll-margin-top: calc(var(--topbar-h) + 20px); }
p { margin: 0 0 13px; max-width: 78ch; color: #cfd3dc; }
p b, li b { color: var(--text); }
ul, ol { margin: 0 0 14px 22px; max-width: 76ch; color: #cfd3dc; }
li { margin-bottom: 5px; }
a.inline { color: var(--accent-2); text-decoration: none; border-bottom: 1px dotted rgba(255,179,71,.5); }
a.inline:hover { border-bottom-style: solid; }

code {
  font-family: var(--mono); font-size: 12.8px;
  background: var(--bg-code); border: 1px solid var(--border-soft);
  padding: 1.5px 6px; border-radius: 6px; color: var(--accent-2);
}
kbd {
  font-family: var(--mono); font-size: 12px; color: var(--text);
  background: var(--bg-card); border: 1px solid var(--border);
  border-bottom-width: 2px; border-radius: 6px; padding: 2px 7px;
}

/* Tables */
.tbl-wrap { overflow-x: auto; margin: 14px 0 22px; border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: left; font-size: 11.5px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase;
  color: var(--text-faint); background: var(--bg-raise);
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td { padding: 10px 14px; border-bottom: 1px solid var(--border-soft); vertical-align: top; color: #cfd3dc; }
tr:last-child td { border-bottom: none; }
td:first-child { font-weight: 600; color: var(--text); white-space: nowrap; }
td .rng { font-family: var(--mono); font-size: 12px; color: var(--text-dim); white-space: nowrap; }

/* Badges */
.badge {
  display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .4px;
  padding: 2px 8px; border-radius: 999px; vertical-align: 2px; margin-left: 6px;
}
.badge.key { background: rgba(96,165,250,.14); color: var(--info); border: 1px solid rgba(96,165,250,.3); }
.badge.new { background: rgba(74,222,128,.12); color: var(--good); border: 1px solid rgba(74,222,128,.3); }
.badge.png { background: rgba(250,204,21,.1); color: var(--warn); border: 1px solid rgba(250,204,21,.28); }

/* Callouts */
.callout {
  display: flex; gap: 12px; align-items: flex-start;
  border: 1px solid var(--border); border-left: 3px solid var(--info);
  background: var(--bg-raise); border-radius: var(--radius-sm);
  padding: 13px 16px; margin: 16px 0 20px; font-size: 14px; max-width: 82ch;
}
.callout .co-icon { flex: none; font-size: 15px; margin-top: 1px; }
.callout p { margin: 0; }
.callout.tip     { border-left-color: var(--good); }
.callout.warn    { border-left-color: var(--warn); }
.callout.pro     { border-left-color: var(--accent); }

/* Cards / grids */
.grid { display: grid; gap: 14px; margin: 18px 0 24px; }
.grid.g2 { grid-template-columns: repeat(2, 1fr); }
.grid.g3 { grid-template-columns: repeat(3, 1fr); }
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
  transition: transform .15s ease, border-color .15s ease;
}
a.card { text-decoration: none; display: block; }
a.card:hover { transform: translateY(-2px); border-color: rgba(255,122,41,.45); }
.card .c-icon { font-size: 22px; margin-bottom: 8px; display: block; }
.card h4 { font-size: 14.5px; color: var(--text); margin-bottom: 5px; }
.card p { font-size: 13px; color: var(--text-dim); margin: 0; }

/* Hero (home) */
.hero {
  display: flex; align-items: center; gap: 34px;
  background: radial-gradient(1200px 420px at 18% -10%, rgba(255,122,41,.16), transparent 60%),
              linear-gradient(180deg, var(--bg-raise), var(--bg-card));
  border: 1px solid var(--border); border-radius: 18px;
  padding: 44px 44px; margin-bottom: 34px;
}
.hero img { width: 128px; height: 128px; filter: drop-shadow(0 10px 30px rgba(255,122,41,.35)); }
.hero h1 { font-size: 40px; margin-bottom: 8px; }
.hero .h-sub { font-size: 17px; color: var(--text-dim); max-width: 60ch; }
.hero .h-cta { margin-top: 18px; display: flex; gap: 10px; }
.btn {
  display: inline-block; text-decoration: none; font-weight: 600; font-size: 14px;
  padding: 10px 18px; border-radius: 10px; transition: filter .15s;
}
.btn.primary { background: linear-gradient(180deg, #ff8f45, #f26718); color: #1a0d02; }
.btn.ghost   { background: var(--bg-card); color: var(--text); border: 1px solid var(--border); }
.btn:hover { filter: brightness(1.1); }

/* Prev / next footer */
.pager { display: flex; gap: 14px; margin-top: 56px; }
.pager a {
  flex: 1; text-decoration: none; border: 1px solid var(--border);
  background: var(--bg-card); border-radius: var(--radius); padding: 14px 18px;
  transition: border-color .15s;
}
.pager a:hover { border-color: rgba(255,122,41,.45); }
.pager .pg-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--text-faint); }
.pager .pg-title { font-size: 14.5px; font-weight: 600; color: var(--accent-2); margin-top: 3px; }
.pager a.next { text-align: right; }

/* Shortcut table */
.keys td:first-child { font-family: var(--mono); font-size: 13px; }

/* Footer */
.foot {
  margin-top: 70px; padding-top: 22px; border-top: 1px solid var(--border-soft);
  font-size: 12.5px; color: var(--text-faint);
}

/* Anchor links on headings */
h2 .anchor, h3 .anchor {
  opacity: 0; margin-left: 8px; color: var(--text-faint);
  text-decoration: none; font-weight: 400;
}
h2:hover .anchor, h3:hover .anchor { opacity: .8; }

/* Responsive */
@media (max-width: 1280px) {
  .toc { display: none; }
  .with-toc { padding-right: 48px; }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .22s ease; box-shadow: 0 0 60px rgba(0,0,0,.5); }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; padding-left: 24px; padding-right: 24px; }
  .menu-btn { display: inline-flex !important; }
  .search-box { width: 170px; }
  .grid.g2, .grid.g3 { grid-template-columns: 1fr; }
  .hero { flex-direction: column; text-align: center; padding: 34px 22px; }
  .hero .h-cta { justify-content: center; }
}
.menu-btn {
  display: none; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--bg-card); color: var(--text); cursor: pointer; font-size: 17px;
}

::selection { background: rgba(255,122,41,.35); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #2a2f3a; border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }
