/* nw_wrld — guide
   Editorial monospace. Cream canvas, ink type, red sequencer accent.
*/

:root {
  --canvas: #F5F1E8;
  --canvas-warm: #EFE9DD;
  --paper: #FBF8F1;
  --ink: #14110D;
  --ink-soft: #2A2622;
  --ink-mute: #6B645A;
  --rule: #D9D2C2;
  --rule-soft: #E8E2D2;
  --accent: #C8341E;
  --accent-soft: #E5664F;
  --accent-bg: rgba(200, 52, 30, 0.08);
  --code-bg: #1A1612;
  --code-fg: #EFE9DD;
  --code-mute: #8A8175;
  --code-accent: #E89B6E;
  --code-keyword: #E5664F;
  --code-string: #B5A36A;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 32px; }

body {
  margin: 0;
  font-family: "Iowan Old Style", "Charter", "Georgia", serif;
  font-size: 16.5px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

code, pre, .mono {
  font-family: "Roboto Mono", "JetBrains Mono", "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  font-feature-settings: "ss01", "ss02";
}

a { color: var(--accent); text-decoration: none; border-bottom: 1px solid var(--accent-bg); transition: border-color 120ms; }
a:hover { border-bottom-color: var(--accent); }

p { margin: 0 0 1em; }

strong { color: var(--ink); font-weight: 600; }

hr { border: 0; border-top: 1px solid var(--rule); margin: 3em 0; }

::selection { background: var(--accent); color: var(--paper); }

/* ─── Layout ─────────────────────────────────────────────────────────── */

.shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  max-width: 1180px;
  margin: 0 auto;
  gap: 64px;
  padding: 0 32px;
}

@media (max-width: 880px) {
  .shell { grid-template-columns: 1fr; gap: 0; padding: 0 20px; }
}

/* ─── Sidebar ────────────────────────────────────────────────────────── */

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 32px 0;
  overflow-y: auto;
  border-right: 1px solid var(--rule);
  font-family: "Roboto Mono", ui-monospace, monospace;
  font-size: 12.5px;
  line-height: 1.6;
}

@media (max-width: 880px) {
  .sidebar {
    position: relative;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--rule);
    padding: 20px 0;
    margin-bottom: 24px;
  }
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--rule-soft);
}

.sidebar-brand img {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  background: var(--ink);
  padding: 2px;
}

.sidebar-brand-text {
  display: flex;
  flex-direction: column;
}

.sidebar-brand .title {
  font-size: 14px;
  letter-spacing: 0.02em;
  color: var(--ink);
}

.sidebar-brand .subtitle {
  font-size: 10.5px;
  color: var(--ink-mute);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sidebar-section {
  margin-bottom: 22px;
}

.sidebar-section-title {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 8px;
}

.sidebar nav a {
  display: block;
  color: var(--ink-soft);
  border-bottom: none;
  padding: 3px 0;
  border-left: 2px solid transparent;
  padding-left: 10px;
  margin-left: -10px;
  transition: color 100ms, border-color 100ms;
}

.sidebar nav a:hover { color: var(--accent); }
.sidebar nav a.active {
  color: var(--accent);
  border-left-color: var(--accent);
}

/* ─── Main content ───────────────────────────────────────────────────── */

main {
  padding: 48px 0 120px;
  max-width: 720px;
}

main h1 {
  font-family: "Iowan Old Style", "Charter", Georgia, serif;
  font-weight: 600;
  font-size: 56px;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0 0 12px;
}

main h2 {
  font-family: "Roboto Mono", ui-monospace, monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin: 80px 0 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--rule);
  display: flex;
  align-items: baseline;
  gap: 14px;
}

main h2 .num {
  color: var(--accent);
  font-weight: 600;
}

main h3 {
  font-family: "Iowan Old Style", "Charter", Georgia, serif;
  font-weight: 600;
  font-size: 26px;
  line-height: 1.2;
  letter-spacing: -0.005em;
  color: var(--ink);
  margin: 40px 0 12px;
}

main h4 {
  font-family: "Roboto Mono", ui-monospace, monospace;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--ink);
  margin: 28px 0 8px;
  text-transform: none;
}

main h4::before {
  content: "—";
  color: var(--accent);
  margin-right: 8px;
}

/* Hero */

.hero {
  border-bottom: 1px solid var(--rule);
  padding-bottom: 48px;
  margin-bottom: 8px;
}

.eyebrow {
  font-family: "Roboto Mono", ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 24px;
}

.lede {
  font-size: 21px;
  line-height: 1.5;
  color: var(--ink-soft);
  font-family: "Iowan Old Style", "Charter", Georgia, serif;
  margin: 16px 0 32px;
  max-width: 640px;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  font-family: "Roboto Mono", ui-monospace, monospace;
  font-size: 11.5px;
  color: var(--ink-mute);
  letter-spacing: 0.02em;
}

.hero-meta span strong { color: var(--ink); font-weight: 500; }

/* Big idea callout */

.big-idea {
  margin: 32px 0;
  padding: 24px 28px;
  background: var(--paper);
  border-left: 3px solid var(--accent);
}

.big-idea-label {
  font-family: "Roboto Mono", ui-monospace, monospace;
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 6px;
}

.big-idea-text {
  font-family: "Iowan Old Style", "Charter", Georgia, serif;
  font-size: 22px;
  line-height: 1.4;
  color: var(--ink);
  font-weight: 500;
  margin: 0;
}

/* Code blocks */

pre {
  background: var(--code-bg);
  color: var(--code-fg);
  padding: 18px 22px;
  border-radius: 4px;
  overflow-x: auto;
  font-size: 12.5px;
  line-height: 1.6;
  margin: 16px 0;
}

pre .c { color: var(--code-mute); font-style: italic; }
pre .k { color: var(--code-keyword); }
pre .s { color: var(--code-string); }
pre .n { color: var(--code-accent); }
pre .p { color: var(--code-fg); opacity: 0.7; }
pre .v { color: #B7CFD8; }

code:not(pre code) {
  font-size: 0.88em;
  padding: 1px 6px;
  background: var(--canvas-warm);
  border-radius: 3px;
  color: var(--ink);
  border: 1px solid var(--rule-soft);
}

/* Inline kbd (UI button reference) */

kbd {
  font-family: "Roboto Mono", ui-monospace, monospace;
  font-size: 11.5px;
  background: var(--ink);
  color: var(--paper);
  padding: 2px 8px;
  border-radius: 2px;
  letter-spacing: 0.04em;
  font-weight: 500;
  white-space: nowrap;
}

/* ─── Tables ─────────────────────────────────────────────────────────── */

table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 14.5px;
}

table th {
  font-family: "Roboto Mono", ui-monospace, monospace;
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-mute);
  text-align: left;
  font-weight: 500;
  padding: 8px 12px;
  border-bottom: 1px solid var(--ink);
}

table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--rule-soft);
  vertical-align: top;
}

table td:first-child {
  font-family: "Roboto Mono", ui-monospace, monospace;
  font-size: 13px;
  color: var(--ink);
  white-space: nowrap;
}

table tr:hover td { background: var(--paper); }

/* ─── Lists ──────────────────────────────────────────────────────────── */

ul, ol {
  padding-left: 24px;
  margin: 12px 0 20px;
}

li { margin-bottom: 6px; }

/* Quick-start ordered list (numbered, bigger) */

.steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
  margin: 24px 0;
}

.steps li {
  counter-increment: step;
  position: relative;
  padding-left: 56px;
  padding-top: 4px;
  padding-bottom: 18px;
  margin: 0;
  border-left: 1px solid var(--rule);
  margin-left: 16px;
}

.steps li:last-child { border-left-color: transparent; }

.steps li::before {
  content: counter(step, decimal-leading-zero);
  position: absolute;
  left: -16px;
  top: 0;
  width: 32px;
  height: 32px;
  background: var(--canvas);
  border: 1px solid var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Roboto Mono", ui-monospace, monospace;
  font-size: 11px;
  color: var(--accent);
  font-weight: 600;
}

/* ─── Diagrams (ASCII) ───────────────────────────────────────────────── */

.diagram {
  background: var(--paper);
  border: 1px solid var(--rule);
  padding: 18px 20px;
  margin: 20px 0;
  font-family: "Roboto Mono", ui-monospace, monospace;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink-soft);
  overflow-x: auto;
  white-space: pre;
}

/* ─── Cards (signal sources, modules) ────────────────────────────────── */

.cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin: 20px 0;
}

@media (max-width: 600px) {
  .cards { grid-template-columns: 1fr; }
}

.card {
  background: var(--paper);
  border: 1px solid var(--rule-soft);
  padding: 16px 18px;
  font-size: 14px;
}

.card-title {
  font-family: "Roboto Mono", ui-monospace, monospace;
  font-size: 12.5px;
  letter-spacing: 0.02em;
  color: var(--ink);
  margin-bottom: 4px;
  font-weight: 500;
}

.card-body {
  color: var(--ink-soft);
  font-size: 13.5px;
  line-height: 1.5;
}

/* ─── Sequencer mock (16-step grid visual) ───────────────────────────── */

.seq-mock {
  margin: 24px 0;
  padding: 20px;
  background: var(--code-bg);
  border-radius: 4px;
  font-family: "Roboto Mono", ui-monospace, monospace;
  font-size: 11px;
}

.seq-mock-header {
  display: flex;
  justify-content: space-between;
  color: var(--code-mute);
  font-size: 10.5px;
  margin-bottom: 14px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.seq-row {
  display: flex;
  gap: 4px;
  align-items: center;
  margin-bottom: 6px;
}

.seq-label {
  width: 90px;
  color: var(--code-mute);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.seq-cell {
  width: 22px;
  height: 22px;
  border: 1px solid #2D2924;
  background: #1F1B16;
}

.seq-cell.on { background: var(--accent); border-color: var(--accent); }
.seq-cell.beat-1 { border-left: 1px solid var(--code-mute); }
.seq-cell.playhead { box-shadow: 0 0 0 1px var(--accent-soft); }

/* ─── Footer ─────────────────────────────────────────────────────────── */

footer {
  margin-top: 80px;
  padding-top: 32px;
  border-top: 1px solid var(--rule);
  font-family: "Roboto Mono", ui-monospace, monospace;
  font-size: 11.5px;
  color: var(--ink-mute);
  letter-spacing: 0.02em;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

footer a { color: var(--ink-mute); border-bottom: 1px dotted var(--rule); }
footer a:hover { color: var(--accent); }

/* ─── Note / warning blocks ──────────────────────────────────────────── */

.note {
  margin: 18px 0;
  padding: 14px 18px;
  background: var(--canvas-warm);
  border-left: 2px solid var(--ink-mute);
  font-size: 14.5px;
  color: var(--ink-soft);
}

.note .label {
  font-family: "Roboto Mono", ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-right: 8px;
}

.note.warn { border-left-color: var(--accent); background: var(--accent-bg); }
.note.warn .label { color: var(--accent); }

/* ─── Mobile nav toggle (hidden by default) ──────────────────────────── */

.menu-toggle { display: none; }

@media (max-width: 880px) {
  .menu-toggle {
    display: inline-block;
    margin: 12px 0;
    padding: 8px 14px;
    font-family: "Roboto Mono", ui-monospace, monospace;
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    background: transparent;
    border: 1px solid var(--ink);
    color: var(--ink);
    cursor: pointer;
  }
  .sidebar nav { display: none; }
  .sidebar.open nav { display: block; }
}
