/* Winters Frosty Wiki — Design System */
:root {
  --bg:         #0a0e1a;
  --bg2:        #0d1b2a;
  --bg3:        #111f33;
  --border:     #1e3a5f;
  --text:       #b8d4e8;
  --text-dim:   #4a6a8a;
  --heading:    #e0f3ff;
  --accent:     #74c0fc;
  --accent-dim: #3a7ab8;
  --link:       #74c0fc;
  --link-hover: #a8d8ff;
  --success:    #51cf66;
  --warn:       #ffd43b;
  --danger:     #ff6b6b;
  --table-head: #0f2640;
  --table-row1: #0d1b2a;
  --table-row2: #0a1525;
  --table-hover:#132d4a;
  --radius:     6px;
  --sidebar-w:  220px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Layout: sidebar + content ── */
.wiki-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* Sidebar */
.wiki-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  padding: 20px 0;
  font-size: 0.85em;
}
.wiki-sidebar::-webkit-scrollbar { width: 4px; }
.wiki-sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.sidebar-brand {
  display: block;
  padding: 0 16px 14px;
  color: var(--heading);
  font-weight: 700;
  font-size: 1.1em;
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.sidebar-brand:hover { color: var(--accent); text-decoration: none; }

.sidebar-section {
  padding: 0 16px;
  margin-bottom: 16px;
}
.sidebar-section-title {
  color: var(--text-dim);
  font-size: 0.78em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}
.sidebar-nav { list-style: none; }
.sidebar-nav li { margin-bottom: 2px; }
.sidebar-nav a {
  display: block;
  padding: 5px 10px;
  color: var(--text);
  text-decoration: none;
  border-radius: 4px;
  transition: background 0.15s, color 0.15s;
}
.sidebar-nav a:hover { background: var(--bg3); color: var(--accent); text-decoration: none; }
.sidebar-nav a.active { background: var(--bg3); color: var(--accent); font-weight: 600; }

/* Page anchors (indented sub-items in sidebar) */
.sidebar-nav .sub { list-style: none; margin: 2px 0 4px 12px; }
.sidebar-nav .sub a {
  padding: 3px 10px;
  font-size: 0.92em;
  color: var(--text-dim);
}
.sidebar-nav .sub a:hover { color: var(--accent); }

/* Content area */
.wiki-content {
  max-width: 860px;
  padding: 32px 36px;
}

/* Fallback for pages without sidebar */
.wiki-wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 24px;
}

/* ── Breadcrumb ── */
.breadcrumb {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 0.82em;
  color: var(--text-dim);
  margin-bottom: 20px;
}
.breadcrumb a { color: var(--accent-dim); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { color: var(--text-dim); }

/* ── Headings ── */
h1 { color: var(--heading); font-size: 1.6em; margin-bottom: 6px; font-weight: 700; }
h2 { color: var(--heading); font-size: 1.25em; margin: 32px 0 12px; padding-bottom: 6px; border-bottom: 1px solid var(--border); font-weight: 600; }
h3 { color: var(--accent); font-size: 1.05em; margin: 24px 0 8px; font-weight: 600; }
h4 { color: var(--text); font-size: 0.95em; margin: 16px 0 6px; font-weight: 600; }

.subtitle {
  color: var(--text-dim);
  font-size: 0.9em;
  margin-bottom: 24px;
}

/* ── Links ── */
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }

/* ── Guide / TOC list ── */
.guide-list { list-style: none; }
.guide-list li { margin-bottom: 10px; }
.guide-list a {
  display: block;
  padding: 14px 18px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  transition: border-color 0.2s, background 0.2s;
}
.guide-list a:hover { border-color: var(--accent); background: var(--bg3); text-decoration: none; }
.guide-list .desc {
  color: var(--text-dim);
  font-size: 0.82em;
  font-weight: 400;
  margin-top: 4px;
}

/* ── Section cards (TOC pages) ── */
.section-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-bottom: 16px;
}
.section-card h3 { margin-top: 0; }
.section-card ul { list-style: none; margin-top: 8px; }
.section-card li { margin-bottom: 6px; }
.section-card li a { font-size: 0.92em; }

/* ── Tables ── */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0 20px;
  font-size: 0.9em;
  table-layout: fixed;
}
thead th {
  background: var(--table-head);
  color: var(--heading);
  font-weight: 600;
  text-align: left;
  padding: 10px 12px;
  border-bottom: 2px solid var(--border);
  position: sticky;
  top: 0;
}
tbody td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  word-wrap: break-word;
}
tbody tr:nth-child(odd) { background: var(--table-row1); }
tbody tr:nth-child(even) { background: var(--table-row2); }
tbody tr:hover { background: var(--table-hover); }

/* Standard column widths for 3-col tables */
.tbl-3 col:nth-child(1) { width: 50%; }
.tbl-3 col:nth-child(2) { width: 25%; }
.tbl-3 col:nth-child(3) { width: 25%; }

/* Load split tables (Commodity / Tons / Buy from) */
.tbl-load col:nth-child(1) { width: 45%; }
.tbl-load col:nth-child(2) { width: 15%; }
.tbl-load col:nth-child(3) { width: 40%; }

/* ── Inline labels ── */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 0.78em;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.tag-buy   { background: #1a3a2a; color: var(--success); }
.tag-sell  { background: #3a2a1a; color: var(--warn); }
.tag-info  { background: #1a2a3a; color: var(--accent); }

/* ── Callout boxes ── */
.callout {
  padding: 14px 18px;
  border-radius: var(--radius);
  margin: 16px 0;
  font-size: 0.9em;
  line-height: 1.5;
  border-left: 3px solid;
}
.callout-info  { background: #0d1f33; border-color: var(--accent); }
.callout-tip   { background: #0d2a1a; border-color: var(--success); }
.callout-warn  { background: #2a2a0d; border-color: var(--warn); }
.callout strong { color: var(--heading); }
.callout ul { margin: 6px 0 0 18px; }
.callout li { margin-bottom: 4px; }

/* ── Paragraph ── */
p { margin-bottom: 12px; }

/* ── Horizontal rule ── */
hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 28px 0;
}

/* ── Code inline ── */
code {
  background: var(--bg3);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.88em;
  color: var(--accent);
}

/* ── Back to top ── */
.back-to-top {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.8em;
  color: var(--text-dim);
}
.back-to-top:hover { color: var(--accent); }

/* ── Responsive ── */
@media (max-width: 800px) {
  .wiki-layout {
    grid-template-columns: 1fr;
  }
  .wiki-sidebar {
    position: relative;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
  }
  .wiki-content { padding: 20px 16px; }
  table { font-size: 0.82em; }
  thead th, tbody td { padding: 6px 8px; }
}
