:root {
  --bg:            #0a0a0a;
  --surface:       #1a1a1a;
  --surface-alt:   #111;
  --border:        #222;
  --border-strong: #333;
  --text:          #e0e0e0;
  --muted:         #888;
  --muted-dim:     #555;
  --btn-text:      #aaa;
  --accent:        #8b5cf6;
  color-scheme: light dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg:            #f4f4f5;
    --surface:       #ffffff;
    --surface-alt:   #eaeaec;
    --border:        #e2e2e5;
    --border-strong: #d2d2d6;
    --text:          #1a1a1a;
    --muted:         #6a6a70;
    --muted-dim:     #9a9aa0;
    --btn-text:      #555;
    --accent:        #7c3aed;
  }
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, sans-serif;
  font-size: 0.85rem;
  min-height: 100vh;
}

/* ── Header ── */
header {
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;

  h1 {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.5px;

    a { color: inherit; text-decoration: none; }
    span { color: var(--accent); }
  }
}

/* ── Layout ── */
.container {
  max-width: 640px;
  margin: 0 auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ── Hero ── */
.hero {
  padding: 40px 0 20px;

  h2 {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--accent);
    margin-bottom: 8px;
  }

  p {
    color: var(--muted);
    font-size: 0.9rem;
  }
}

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
}

.card-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

/* ── Resource list (home) ── */
.resource-list { display: flex; flex-direction: column; gap: 8px; }

.resource-item {
  display: block;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 12px 14px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, background 0.15s;

  &:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--bg)); }

  .resource-name { font-size: 0.9rem; font-weight: 600; margin-bottom: 3px; }
  .resource-desc { font-size: 0.78rem; color: var(--muted); }
}

/* ── Breadcrumb ── */
.breadcrumb {
  font-size: 0.78rem;
  color: var(--muted);

  a { color: var(--muted); text-decoration: none; &:hover { color: var(--text); } }
}

/* ── Article / doc ── */
.doc {
  display: flex;
  flex-direction: column;
  gap: 28px;

  h2 {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.4px;
    color: var(--accent);
    margin-bottom: 4px;
  }

  h3 {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 8px;
    padding: 5px 10px;
    background: color-mix(in srgb, var(--accent) 14%, var(--surface));
    border-radius: 4px;
  }

  h4 {
    font-size: 0.88rem;
    font-weight: 600;
    margin-bottom: 6px;
  }

  h5 {
    font-size: 0.82rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--muted);
    margin-bottom: 10px;
  }

  p { line-height: 1.6; margin-bottom: 8px; }
  p:last-child { margin-bottom: 0; }

  ul, ol { padding-left: 1.4em; line-height: 1.7; }
  li { margin-bottom: 3px; }
  section { display: flex; flex-direction: column; gap: 14px; }
}

/* ── Trait blocks ── */
.trait {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 14px;
}

/* ── Skill groups ── */
.skill-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 14px;
}

dl { display: flex; flex-direction: column; gap: 10px; }

dt {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
}

dd {
  margin-left: 0;
  font-size: 0.83rem;
  line-height: 1.6;
  color: var(--text);
}

.sub-list { margin-top: 6px; padding-left: 1.2em; }
.sub-list li { margin-bottom: 3px; font-size: 0.82rem; }

.skill-note {
  font-size: 0.78rem;
  color: var(--muted);
  font-style: italic;
  margin-bottom: 10px;
}

/* ── Tables ── */
.table-wrap {
  overflow-x: auto;

  table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;

    caption {
      font-size: 0.72rem;
      text-transform: uppercase;
      letter-spacing: 0.4px;
      color: var(--muted);
      text-align: left;
      padding-bottom: 6px;
    }

    thead th {
      color: var(--muted);
      font-weight: 500;
      font-size: 0.72rem;
      text-transform: uppercase;
      letter-spacing: 0.3px;
      padding: 6px 8px;
      border-bottom: 1px solid var(--border);
      text-align: center;
      white-space: nowrap;
      &:first-child, &:nth-child(2), &:nth-child(3) { text-align: left; }
    }

    tbody tr {
      border-bottom: 1px solid var(--border);
      &:hover { background: color-mix(in srgb, var(--accent) 4%, var(--bg)); }
    }

    &.xp-table tr.level-divider td {
      border-top: 2px solid var(--accent);
      color: var(--accent);
    }

    &.xp-table th:nth-child(5),
    &.xp-table td:nth-child(5),
    &.xp-table th:nth-child(10),
    &.xp-table td:nth-child(10) {
      border-left: 1px solid var(--border);
    }

    td {
      padding: 6px 8px;
      text-align: center;
      vertical-align: middle;
      &:first-child, &:nth-child(2), &:nth-child(3) { text-align: left; font-variant-numeric: tabular-nums; }
    }
  }
}

.table-note {
  font-size: 0.78rem;
  color: var(--muted);
  font-style: italic;
  margin-bottom: 8px;
}

.table-notes {
  font-size: 0.78rem;
  color: var(--muted);
  padding-left: 1.4em;
  margin-top: 8px;
  li { margin-bottom: 4px; }
}

/* ── Spell level tables ── */
.spell-level-tables {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.spell-level-table {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;

  h4 {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--accent);
    margin-bottom: 8px;
  }
}

.spell-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;

  li { font-size: 0.8rem; line-height: 1.4; }
  a { color: var(--accent); text-decoration: none; &:hover { text-decoration: underline; } }
  em { font-style: normal; }
}

/* ── Spell blocks ── */
.spell-block {
  h5 {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 8px;
    padding: 5px 10px;
    background: color-mix(in srgb, var(--accent) 14%, var(--surface));
    border-radius: 4px;
    text-transform: none;
    letter-spacing: normal;
    color: var(--text);
  }
}

dl.spell-stats {
  flex-direction: column;
  gap: 2px;
  margin-bottom: 10px;

  div { display: flex; gap: 6px; align-items: baseline; }
  dt { font-size: 0.8rem; font-weight: 700; text-transform: capitalize; color: var(--text); white-space: nowrap; }
  dd { font-size: 0.8rem; color: var(--text); margin: 0; }
}

/* ── Example block ── */
.example-sheet {
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 10px 12px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.78rem;
  line-height: 1.6;
  color: var(--muted);
  overflow-x: auto;
  white-space: pre;
  margin-top: 8px;
}

/* ── Section banner (full-width divider heading) ── */
.section-banner {
  font-size: 1rem;
  font-weight: 700;
  padding: 8px 14px;
  background: color-mix(in srgb, var(--accent) 22%, var(--surface));
  border-radius: 4px;
  letter-spacing: -0.2px;
  column-span: all;
  margin: 20px 0 12px;
}

/* ── Doc page layout ── */
.container--doc {
  max-width: 960px;
}

.doc-cols {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.doc-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.char-block {
  display: block;
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--border));
  border-radius: 6px;
  padding: 12px 14px;

  p { margin-bottom: 3px; line-height: 1.5; }
  p:last-child { margin-bottom: 0; }
}

@media (min-width: 720px) {
  .doc-cols {
    display: block;
    columns: 2;
    column-gap: 2.5rem;
  }

  .doc-cols > * {
    break-inside: avoid;
    margin-bottom: 20px;
  }
}

/* ── Responsive ── */
@media (min-width: 481px) {
  .container { padding: 20px; }
}
