:root {
  --bg: #f4f1ea;
  --surface: #fffdf8;
  --surface-2: #ebe6db;
  --text: #24221e;
  --muted: #625d53;
  --line: #d6cfc0;
  --accent: #b5651d;
  --accent-text: #ffffff;
  --code-bg: #2a2723;
  --code-text: #ece6d8;
  --res: #4f7a3a;
  --vein: #b08a1e;
  --hazard: #a3362b;
  --unknown: #6b5b8a;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1a18;
    --surface: #242320;
    --surface-2: #2e2c28;
    --text: #e9e4d8;
    --muted: #a8a194;
    --line: #3d3a34;
    --accent: #e08a3c;
    --accent-text: #1b1a18;
    --code-bg: #141311;
    --code-text: #e6dfcf;
    --res: #79a85f;
    --vein: #d4ad3c;
    --hazard: #d0594b;
    --unknown: #9a88c0;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.wrap { max-width: 980px; margin: 0 auto; padding: 0 20px; }

a { color: var(--accent); }

h1, h2, h3 { line-height: 1.2; }
h1 { font-size: clamp(2rem, 5vw, 2.8rem); margin: 0.2em 0 0.4em; }
h2 { font-size: 1.7rem; margin: 0 0 0.6em; padding-top: 0.4em; }
h3 { font-size: 1.15rem; margin: 1.8em 0 0.5em; }

code {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.88em;
  background: var(--surface-2);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

/* Hero */
.hero { background: var(--surface); border-bottom: 1px solid var(--line); padding: 48px 0 40px; }
.hero-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 36px; align-items: center; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.8rem; color: var(--accent); font-weight: 600; margin: 0; }
.lede { font-size: 1.1rem; color: var(--muted); margin: 0 0 1.4em; }
.hero-img { width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--line); }
.buttons { display: flex; flex-wrap: wrap; gap: 10px; margin: 0; }
.btn {
  display: inline-block; padding: 10px 18px; border-radius: 6px;
  border: 1px solid var(--line); background: var(--surface-2);
  color: var(--text); text-decoration: none; font-weight: 600;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn:hover { filter: brightness(1.08); }

/* Top bar: mod name and section tabs */
.topbar { position: sticky; top: 0; z-index: 5; background: var(--bg); border-bottom: 1px solid var(--line); }
/* The tabs sit next to the name, or on their own row when they don't fit. */
.topbar .wrap { display: flex; flex-wrap: wrap; align-items: center; column-gap: 28px; }
.brand { font-weight: 700; color: var(--text); text-decoration: none; white-space: nowrap; padding: 12px 0; }
.tabs { display: flex; flex-shrink: 0; max-width: 100%; gap: 22px; overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
.tabs a { color: var(--muted); text-decoration: none; font-size: 0.95rem; padding: 13px 0 11px; border-bottom: 2px solid transparent; }
.tabs a:hover { color: var(--accent); }
.tabs a.on { color: var(--text); border-bottom-color: var(--accent); }

main section { padding: 44px 0 8px; scroll-margin-top: 56px; }
main section + section { border-top: 1px solid var(--line); }

/* Grid demo */
.grid-demo {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
  max-width: 420px; margin: 24px 0 8px; padding: 8px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px;
}
.cell {
  aspect-ratio: 1; border-radius: 5px; padding: 8px;
  display: flex; flex-direction: column; justify-content: space-between;
  background: var(--surface); border: 2px solid var(--line); font-size: 0.9rem;
}
.cell .item { font-weight: 600; }
.cell .qty { font-variant-numeric: tabular-nums; color: var(--muted); }
.cell .tag { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; }
.cell.res { border-color: var(--res); }
.cell.vein { border-color: var(--vein); }
.cell.vein .tag { color: var(--vein); }
.cell.empty { color: var(--muted); border-style: dashed; }
.cell.hazard { border-color: var(--hazard); color: var(--hazard); }
.cell.unknown { border-color: var(--unknown); color: var(--unknown); }
.cell.unknown .item { font-size: 1.6rem; }
.caption, .note { color: var(--muted); font-size: 0.93rem; }

.actions dt { font-weight: 700; margin-top: 0.8em; }
.actions dd { margin: 0.2em 0 0 0; padding-left: 14px; border-left: 3px solid var(--accent); }

.steps li { margin-bottom: 0.4em; }

/* Code */
pre {
  position: relative; background: var(--code-bg); color: var(--code-text);
  padding: 16px 18px; border-radius: 8px; overflow-x: auto;
  font-size: 0.86rem; line-height: 1.5;
}
pre code { background: none; padding: 0; font-size: inherit; color: inherit; }
.copy {
  position: absolute; top: 8px; right: 8px;
  background: rgba(255, 255, 255, 0.1); color: var(--code-text);
  border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 4px;
  padding: 3px 10px; font-size: 0.78rem; cursor: pointer;
}
.copy:hover { background: rgba(255, 255, 255, 0.2); }

/* Tables */
table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 0.94rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--surface-2); font-weight: 600; }
.fields td:first-child { width: 32%; }
.fields td:nth-child(2) { width: 14%; color: var(--muted); }

footer { margin-top: 48px; padding: 24px 0 40px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.9rem; }

@media (max-width: 720px) {
  body { font-size: 16px; }
  .wrap { padding: 0 16px; }
  .hero { padding: 32px 0; }
  .brand { padding-bottom: 2px; }
  .tabs { width: 100%; }
  table { display: block; overflow-x: auto; }
  .hero-grid { grid-template-columns: 1fr; gap: 24px; }
  .fields td:first-child, .fields td:nth-child(2) { width: auto; }
}

/* ---------- other Bamba mods (footer) ---------- */
.other-mods { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.other-mods-title { margin: 0 0 6px; font-weight: 600; }
.other-mods ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.footer .other-mods ul { justify-content: center; }
.other-mods li { margin: 0; }
.other-mods .ws { color: var(--muted); font-size: 0.9em; margin-left: 4px; }
