/* BloomCraft.
   Structure comes from hairlines and alignment, not from boxes. Square corners,
   no gradients, restrained shadow. The type does the work: a soft serif for
   headings, a humanist grotesque for reading, and monospace kept for figures --
   which is the one place it earns its width.

   COLOUR. A botanical set rather than a terminal one: paper and near-black are
   both biased green so no neutral here is a default grey, bloom-magenta leads
   from the server's own mark, and ember is rationed to the dungeon and to
   anything that wants attention.

   THEMES. Three states, not two. A visitor who picked one gets data-theme
   stamped on <html>; everyone else is un-stamped and separated only by
   prefers-color-scheme. Every colour is defined on bare :root first and only
   REDEFINED in the other two blocks -- a colour whose sole definition sits
   inside a media query never applies in the un-stamped state, which is how a
   page ends up with one theme's text on the other theme's ground. */

:root {
  --bg:        #fbfcf9;   /* paper, faintly green -- chosen, not inherited */
  --raise:     #f2f5ee;   /* form fields and figure grounds */
  --rule:      #dde4d9;   /* the hairline everything is built from */
  --rule-lit:  #c3d0c1;
  --text:      #16211c;   /* near-black with a green bias */
  --muted:     #55645b;   /* 6.1:1 on paper */
  --faint:     #67766d;   /* 4.7:1 -- the weaker of two de-emphasis levels, still AA */

  --blue:      #b23f86;   /* bloom: links, focus, the primary voice */
  --blue-deep: #8e2e6b;
  --pink:      #b2542b;   /* ember: the answering accent, used sparingly */
  --gold:      #a8792a;
  --leaf:      #4f7f5e;
  --blurple:   #5865f2;   /* Discord's own, untouched */
  --danger:    #b3382b;

  --ink-soft:  #33443b;   /* long-form body copy, softer than --text */
  --on-accent: #ffffff;   /* text sitting on a filled accent */
  /* The logo artwork paints its own near-black field, so the circle behind it
     matches in BOTH themes rather than flipping. A brand mark that inverts with
     the page is a different mark; if a light-mode logo is ever wanted it should
     be a second asset, not a background swap. */
  --art-field: #08090c;

  --col:  70rem;
  --font:         "Karla", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-mono:    "JetBrains Mono", ui-monospace, "SFMono-Regular", "Menlo", "Consolas", monospace;

  color-scheme: light;
}

/* Dark, for everyone who has not chosen -- guarded so an explicit light choice
   still beats a dark operating system. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:        #101512;
    --raise:     #182019;
    --rule:      #2a352e;
    --rule-lit:  #3c4c42;
    --text:      #eaf0ea;
    --muted:     #8b9a90;
    --faint:     #74837a;

    --blue:      #e88bc2;
    --blue-deep: #8e2e6b;
    --pink:      #e4915f;
    --gold:      #e0be6a;
    --leaf:      #8fc69c;
    --blurple:   #7c86f7;
    --danger:    #e88b7f;

    --ink-soft:  #bcc9bf;
    --on-accent: #ffffff;
    --art-field: #08090c;

    color-scheme: dark;
  }
}

/* Dark, chosen deliberately. */
:root[data-theme="dark"] {
  --bg:        #101512;
  --raise:     #182019;
  --rule:      #2a352e;
  --rule-lit:  #3c4c42;
  --text:      #eaf0ea;
  --muted:     #8b9a90;
  --faint:     #74837a;

  --blue:      #e88bc2;
  --blue-deep: #8e2e6b;
  --pink:      #e4915f;
  --gold:      #e0be6a;
  --leaf:      #8fc69c;
  --blurple:   #7c86f7;
  --danger:    #e88b7f;

  --ink-soft:  #bcc9bf;
  --on-accent: #ffffff;
  --art-field: #08090c;

  color-scheme: dark;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  font-variant-ligatures: none;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }

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

:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -.02em;
  margin: 0;
  text-wrap: balance;
}

.wrap { width: 100%; max-width: var(--col); margin: 0 auto; padding: 0 1.5rem; }
/* Nothing may make the document wider than the screen: one overflowing element scrolls the whole
   page sideways and every line gets clipped at the right edge, which reads as random words being
   cut off in unrelated paragraphs. */
body { overflow-wrap: break-word; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 1rem; top: 1rem; z-index: 10; background: var(--bg);
              border: 1px solid var(--rule-lit); padding: .5rem .9rem; }

/* A micro-label. Wide tracking is what makes it read as a label and not as text. */
.eyebrow {
  font-size: .69rem;
  text-transform: uppercase;
  letter-spacing: .19em;
  color: var(--faint);
}

/* --- top bar ----------------------------------------------------------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1.1rem 0;
}

.discord-btn {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  font-size: .82rem;
  color: var(--text);
  border: 1px solid var(--rule-lit);
  padding: .42rem .8rem;
  transition: border-color .12s, color .12s;
}
.discord-btn:hover { border-color: var(--blurple); text-decoration: none; }
.discord-btn svg { width: 15px; height: 15px; fill: var(--blurple); flex: none; }
.discord-btn[aria-disabled="true"] { color: var(--faint); border-color: var(--rule); cursor: not-allowed; }
.discord-btn[aria-disabled="true"] svg { fill: var(--faint); }

.who { display: flex; align-items: center; gap: .55rem; font-size: .8rem; color: var(--muted); }
.who img { width: 20px; height: 20px; border-radius: 50%; flex: none; }
.who .name { color: var(--text); }
.who .badge { color: var(--pink); font-size: .69rem; letter-spacing: .12em; text-transform: uppercase; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--faint); cursor: pointer; }
.linkbtn:hover { color: var(--danger); }

/* --- hero: logo, address, nav ------------------------------------------ */

.hero { display: flex; flex-direction: column; align-items: center; text-align: center; }

.logo {
  display: grid;
  place-items: center;
  width: clamp(150px, 30vw, 268px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--art-field);  /* the artwork's own field, per theme */
  overflow: hidden;
  margin-top: clamp(1rem, 4vw, 2.75rem);
}
.logo img { width: 100%; height: 100%; object-fit: cover; display: block; }
body.inner .logo { width: clamp(72px, 11vw, 92px); margin-top: 1rem; }

.addr {
  margin-top: 1.15rem;
  display: inline-flex;
  align-items: baseline;
  gap: .8rem;
  font-size: .88rem;
}
.addr .copy {
  border: 0; background: none; padding: 0;
  font: inherit; font-size: .72rem;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--faint); cursor: pointer;
}
.addr .copy:hover { color: var(--text); }
.addr .copy.done { color: var(--leaf); }

.nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(1rem, 4vw, 2.25rem);
  margin-top: clamp(1.5rem, 4vw, 2.4rem);
  padding-bottom: clamp(1.5rem, 4vw, 2.4rem);
}
.nav a {
  color: var(--muted);
  font-size: .95rem;
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
}
.nav a:hover { color: var(--text); border-bottom-color: var(--rule-lit); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--text); border-bottom-color: var(--blue); }

/* --- section headings: title, then a rule running to the edge ----------- */

main { padding-bottom: 6rem; }
.section { margin-top: clamp(2.5rem, 7vw, 4rem); }

.section-head {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.75rem;
}
.section-head h2 { font-size: clamp(1.1rem, 3vw, 1.3rem); flex: none; }
.section-head .rule { flex: 1 1 auto; height: 1px; background: var(--rule); }
.section-head .act { flex: none; font-size: .78rem; color: var(--faint); letter-spacing: .1em; text-transform: uppercase; }
.section-head .act:hover { color: var(--blue); }

.page-title { font-size: clamp(1.9rem, 6vw, 2.75rem); margin: clamp(2rem, 6vw, 3rem) 0 .75rem; }
.page-sub { color: var(--muted); margin: 0 0 2.5rem; max-width: 44rem; }

/* --- changelog: a date rail, then the entry ----------------------------- */

.entries { border-top: 1px solid var(--rule); }

.entry {
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  gap: 0 2rem;
  padding: 1.6rem 0;
  border-bottom: 1px solid var(--rule);
}
.entry-meta {
  font-size: .78rem;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  display: flex;
  flex-direction: column;
  gap: .15rem;
}
.entry-meta .mark { color: var(--pink); }
.entry h3 { font-size: 1.12rem; letter-spacing: -.035em; }
.entry h3 a { color: var(--text); }
.entry h3 a:hover { color: var(--blue); text-decoration: none; }
.entry .excerpt { margin: .45rem 0 0; color: var(--muted); font-size: .92rem; }
.entry .byline { margin-top: .55rem; font-size: .76rem; color: var(--faint); }

.empty { color: var(--faint); padding: 2.25rem 0; border-bottom: 1px solid var(--rule); }

/* rendered update bodies */
.prose { color: var(--ink-soft); max-width: 44rem; }
.prose p { margin: 0 0 1.15rem; }
.prose ul { margin: 0 0 1.15rem; padding-left: 1.1rem; }
.prose li { margin: .3rem 0; }
.prose li::marker { color: var(--faint); }
.prose strong { color: var(--text); font-weight: 700; }
.prose code { color: var(--blue); }
.prose a { text-decoration: underline; text-underline-offset: 3px; }

/* --- key/value rows: guides, and anything else that is really a list ---- */

.rowlist { border-top: 1px solid var(--rule); margin: 0; }
.rowlist > div {
  display: grid;
  grid-template-columns: 12rem 1fr;
  gap: 0 2rem;
  padding: 1.05rem 0;
  border-bottom: 1px solid var(--rule);
}
.rowlist dt { color: var(--text); font-size: .92rem; }
.rowlist dd { margin: 0; color: var(--muted); font-size: .92rem; }
.rowlist dd code { color: var(--blue); }
.rowlist dd a { text-decoration: underline; text-underline-offset: 3px; }

/* --- guides: click to reveal ------------------------------------------- */

.guides { border-top: 1px solid var(--rule); }

.guide { border-bottom: 1px solid var(--rule); }

.guide > summary {
  cursor: pointer;
  list-style: none;                 /* the default triangle is not ours */
  padding: 1.05rem 0;
  display: grid;
  grid-template-columns: 1.75rem 1fr;
  align-items: baseline;
  gap: 0 .5rem;
}
.guide > summary::-webkit-details-marker { display: none; }
.guide > summary::before {
  content: "+";
  color: var(--faint);
  font-size: .95rem;
  line-height: 1;
}
.guide[open] > summary::before { content: "\2212"; color: var(--blue); }
.guide > summary:hover::before { color: var(--blue); }
.guide > summary:hover .g-title { color: var(--blue); }
.guide > summary:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

.g-title { color: var(--text); font-size: .98rem; }
.g-gist  { color: var(--faint); font-size: .85rem; display: block; margin-top: .12rem; }

/* The body lines up under the title, not under the marker. */
.guide-body {
  padding: .25rem 0 1.75rem 2.25rem;
  max-width: 46rem;
  color: var(--ink-soft);
  font-size: .92rem;
}
.guide-body > :first-child { margin-top: 0; }
.guide-body p { margin: 0 0 1rem; }
.guide-body ul { margin: 0 0 1rem; padding-left: 1.1rem; }
.guide-body li { margin: .28rem 0; }
.guide-body li::marker { color: var(--faint); }
.guide-body strong { color: var(--text); font-weight: 700; }
.guide-body code { color: var(--blue); }
.guide-body a { text-decoration: underline; text-underline-offset: 3px; }
.guide-body h4 {
  font-size: .69rem;
  text-transform: uppercase;
  letter-spacing: .19em;
  color: var(--faint);
  font-weight: 400;
  margin: 1.75rem 0 .7rem;
}

/* a compact two-column fact table inside a guide */
.facts { width: 100%; border-collapse: collapse; margin: 0 0 1rem; font-size: .88rem; }
.facts td { padding: .32rem 0; border-bottom: 1px solid var(--rule); vertical-align: baseline; }
.facts tr:last-child td { border-bottom: 0; }
.facts td:first-child { width: 14rem; color: var(--muted); padding-right: 1.5rem; }
.facts td:last-child { font-variant-numeric: tabular-nums; }

@media (max-width: 640px) {
  .guide-body { padding-left: 0; }
  .facts td:first-child { width: 9.5rem; padding-right: .9rem; }
}

/* At 320px the 9.5rem label column leaves 117px for the value, and "bloomcraftmc.com" needs
   ~135px as a single unbreakable token -- so the row, and with it the page, overflowed. Stack
   the pairs rather than shaving the column further. */
@media (max-width: 480px) {
  .facts, .facts tbody, .facts tr, .facts td { display: block; width: auto; }
  .facts tr { padding: .45rem 0; border-bottom: 1px solid var(--rule); }
  .facts tr:last-child { border-bottom: 0; }
  .facts td { padding: 0; border-bottom: 0; }
  .facts td:first-child { width: auto; padding: 0 0 .1rem; font-size: .82rem; }
}

/* --- server records: one ranked list, chosen from a picker --------------- */
/* Tabs, not a <select>: a native dropdown paints its open option list with the OS widget, which
   ignores the page palette and lands on white-on-white in a dark theme. Tabs also take one click.

   One row that scrolls sideways rather than wrapping: with seven labels a wrapped second row
   would need a negative margin to sit on the rule, and that collapses badly at the wrap point. */
.tabs {
  display: flex; gap: .1rem; margin: 0 0 1.4rem;
  border-bottom: 1px solid var(--rule);
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.tabs::-webkit-scrollbar { display: none; }
/* Marks where all-time server records end and the contested path ladders begin. Decorative --
   each board also says what it is in its own sub-line. */
.tab-split { flex: none; width: 1px; margin: .45rem .5rem; background: var(--rule-lit); }
.tabs .tab {
  flex: none; padding: .45rem .75rem; margin-bottom: -1px;
  /* --muted, not --faint: these are interactive controls. --faint is 3.9:1 on the page
     background, under the 4.5:1 AA threshold for text this size. --muted is 7.0:1. */
  font-size: .84rem; color: var(--muted); text-decoration: none; white-space: nowrap;
  border-bottom: 2px solid transparent;
}
.tabs .tab:hover { color: var(--text); }
/* Sits ON the strip's rule, not floating above it. */
.tabs .tab.is-active { color: var(--text); border-bottom-color: var(--gold); }
.tabs .tab:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }

/* The swap relies on the hidden attribute; a stray display rule would silently defeat it. */
[hidden] { display: none !important; }

.statboard-head { margin: 0 0 .35rem; font-size: 1.05rem; }
/* The records strip leads the page directly under the intro, so it must not inherit the big
   top margin every following section gets. */
.section--first { margin-top: clamp(1.25rem, 3vw, 2rem); }
.statboard .board-sub { margin: 0 0 1rem; }

/* A quiet count on a dormant path card: the number is the useful part, the label is not. */
.dormant .tally { color: var(--muted); font-variant-numeric: tabular-nums; }
.note-quiet { margin: 1.75rem 0 0; font-size: .82rem; color: var(--faint); max-width: 44rem; }

/* --- ladders: real tables, figures aligned ------------------------------ */

.boards { display: grid; gap: 2.5rem 3rem; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); }

.board h3 { font-size: .95rem; }
.board .board-sub { margin: .3rem 0 .9rem; font-size: .8rem; color: var(--faint); }

table.ladder { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.ladder td { padding: .34rem 0; border-bottom: 1px solid var(--rule); vertical-align: baseline; }
table.ladder tr:last-child td { border-bottom: 0; }
table.ladder .rank { width: 1.9rem; color: var(--faint); font-variant-numeric: tabular-nums; }
table.ladder tr:first-child .rank { color: var(--gold); }
table.ladder--numbered .rank { width: 2.3rem; text-align: right; padding-right: .7rem; }
table.ladder--numbered td { padding: .45rem 0; }
/* Past Reckonings lists one champion per path, so its first column holds a path name
   rather than a rank number and needs the room. */
table.ladder--path .rank { width: 5.5rem; color: var(--faint); font-variant-numeric: normal; }
table.ladder--path tr:first-child .rank { color: var(--faint); }
/* width:100%, NOT max-width:0. Both are used to get an ellipsis inside a table, but max-width:0
   only works if the layout algorithm then hands that column the leftover space -- when it does
   not, the cell collapses to zero and the name vanishes entirely. width:100% says plainly "this
   column absorbs the slack", which every engine agrees on, and the ellipsis still triggers
   because the cell cannot exceed the table. This rule had never rendered with content in it
   before the server records list existed. */
table.ladder .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; width: 100%; }
table.ladder .nm .sub { color: var(--faint); font-size: .78rem; }
table.ladder .val { text-align: right; color: var(--muted); font-size: .8rem;
                    white-space: nowrap; font-variant-numeric: tabular-nums; }

.dormant { color: var(--faint); font-size: .85rem; margin: 0; }
.stamp { color: var(--faint); font-size: .78rem; font-variant-numeric: tabular-nums; }

.caveat {
  border-left: 2px solid var(--pink);
  padding: .1rem 0 .1rem 1.1rem;
  margin: 0 0 2.5rem;
  color: var(--muted);
  font-size: .88rem;
  max-width: 46rem;
}

/* --- controls ----------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  font: inherit;
  font-size: .82rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: .55rem 1rem;
  border: 1px solid var(--rule-lit);
  background: none;
  color: var(--text);
  cursor: pointer;
  transition: border-color .12s, background .12s;
}
.btn:hover { border-color: var(--text); text-decoration: none; }
.btn-primary { background: var(--blue-deep); border-color: var(--blue-deep); color: var(--on-accent); }
.btn-primary:hover { background: var(--blue); border-color: var(--blue); }
.btn-danger { color: var(--danger); border-color: var(--rule-lit); }
.btn-danger:hover { border-color: var(--danger); }
.btn-row { display: flex; flex-wrap: wrap; gap: .65rem; align-items: center; }

.field { margin-bottom: 1.5rem; }
.field label { display: block; font-size: .69rem; text-transform: uppercase;
               letter-spacing: .19em; color: var(--faint); margin-bottom: .5rem; }
.field input[type="text"], .field select, .field textarea {
  width: 100%;
  background: var(--raise);
  border: 1px solid var(--rule);
  color: var(--text);
  font: inherit;
  padding: .6rem .7rem;
}
.field textarea { min-height: 20rem; resize: vertical; line-height: 1.7; }
.field :is(input, select, textarea):focus { outline: none; border-color: var(--blue); }
.hint { margin-top: .5rem; font-size: .8rem; color: var(--faint); }
.hint code { color: var(--muted); }

.flashes { margin: .75rem 0 0; }
.flash { font-size: .85rem; padding: .5rem 0 .5rem .9rem; border-left: 2px solid var(--rule-lit); }
.flash.ok { border-left-color: var(--leaf); }
.flash.error { border-left-color: var(--danger); }

.pager {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-top: 2rem; font-size: .8rem; color: var(--faint);
  letter-spacing: .1em; text-transform: uppercase;
}
.pager span { font-variant-numeric: tabular-nums; letter-spacing: .06em; }

.foot {
  border-top: 1px solid var(--rule);
  padding: 1.75rem 0 3rem;
  color: var(--faint);
  font-size: .78rem;
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}
.foot a { color: var(--faint); }
.foot a:hover { color: var(--text); }

.oops { padding: clamp(4rem, 14vw, 8rem) 0; }
.oops .code { font-size: clamp(3.5rem, 15vw, 6rem); color: var(--blue-deep);
              line-height: 1; letter-spacing: -.06em; font-weight: 700; }
.oops p { color: var(--muted); margin: .75rem 0 2rem; }

/* --- narrow screens: the rails collapse, nothing else changes ----------- */

@media (max-width: 640px) {
  body { font-size: 14.5px; }
  .wrap { padding: 0 1.15rem; }
  .entry, .rowlist > div { grid-template-columns: 1fr; gap: .5rem; }
  .entry-meta { flex-direction: row; gap: .75rem; align-items: baseline; }
  .rowlist dt { color: var(--faint); font-size: .72rem;
                text-transform: uppercase; letter-spacing: .16em; }
  .nav { gap: .9rem 1.25rem; }
  .foot { flex-direction: column; gap: .35rem; }
  .section-head .act { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---- /economy ------------------------------------------------------------
   Money in is --leaf, money out is --danger. Sub-labels use --muted (7.0:1),
   never --faint (3.9:1), which is below AA for anything you have to read. */
#flows .board-sub { margin: .3rem 0 .9rem; font-size: .85rem; color: var(--muted); }

.eco-heads {
  display: flex;
  flex-wrap: wrap;          /* wraps instead of forcing the page to scroll sideways */
  gap: .75rem;
  margin: 1.1rem 0 1.6rem;
}
.eco-head {
  flex: 1 1 8rem;           /* 8rem = 128px, well under a 320px viewport */
  min-width: 0;
  background: var(--raise);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: .7rem .85rem;
}
.eco-label {
  display: block;
  font-size: .72rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.eco-val {
  display: block;
  margin-top: .25rem;
  font-size: 1.35rem;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;  /* a large figure wraps rather than widening the page */
}
.eco-in  { color: var(--leaf); }
.eco-out { color: var(--danger); }

/* ---- wiki ---------------------------------------------------------------- */
.crumbs { font-size: .82rem; color: var(--muted); margin: 0 0 .4rem; }
.crumbs a { color: var(--muted); }
.crumbs span[aria-hidden] { margin: 0 .35rem; color: var(--faint); }

.wiki-index { list-style: none; margin: 0 0 1.6rem; padding: 0; }
.wiki-index li { padding: .5rem 0; border-bottom: 1px solid var(--rule); }
.wiki-index li:last-child { border-bottom: 0; }
.wiki-index a { font-weight: 600; }
.wiki-gist { display: block; font-size: .85rem; color: var(--muted); margin-top: .15rem; }

/* Contents, then article, then full index -- see the comment in wiki_article.html. On a wide
   screen the grid lifts both nav blocks into the right column beside the article. */
.wiki-layout { display: block; }

.wiki-toc:empty { display: none; }
.wiki-toc { margin: 0 0 1.75rem; padding: .9rem 1rem; background: var(--raise);
            border: 1px solid var(--rule); border-radius: 8px; }

.wiki-side { margin: 2.5rem 0 0; padding-top: 1.1rem; border-top: 1px solid var(--rule); }
.wiki-side-head {
  margin: 0 0 .3rem; font-size: .72rem; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted);
}
.wiki-side ul { list-style: none; margin: 0 0 .2rem; padding: 0; }
.wiki-side li { padding: .18rem 0; font-size: .9rem; line-height: 1.4; }
.wiki-side li.is-here > a { color: var(--gold); font-weight: 600; }

@media (min-width: 900px) {
  .wiki-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 15rem;
    grid-template-rows: auto 1fr;
    column-gap: 3rem;
    align-items: start;
  }
  /* The article spans both rows in column one; the two nav blocks stack in column two. */
  .wiki-body { grid-column: 1; grid-row: 1 / span 2; }
  .wiki-toc  { grid-column: 2; grid-row: 1; position: sticky; top: 1.5rem; margin-bottom: 1.25rem; }
  .wiki-side { grid-column: 2; grid-row: 2; margin: 0; padding-top: 0; border-top: 0; }
}

.wiki-nextprev {
  display: flex; justify-content: space-between; gap: 1rem;
  margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid var(--rule);
  font-size: .9rem;
}
.wiki-nextprev a { display: block; max-width: 48%; }
.wiki-next { text-align: right; margin-left: auto; }
.wiki-nextprev span {
  display: block; font-size: .7rem; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted);
}

/* Tier badge. Colour is a hint, never the only signal -- the tier is spelled out in the text. */
.wiki-tier {
  display: inline-block; margin: 0 0 1rem;
  padding: .3rem .7rem; border-radius: 999px;
  font-size: .78rem; font-weight: 600;
  border: 1px solid var(--rule); background: var(--raise);
}
.wiki-tier-1 { color: var(--leaf); }
.wiki-tier-2 { color: var(--blue); }
.wiki-tier-3 { color: var(--danger); }

/* ---- wiki article: built for reading, not for an accordion ----------------
   .guide-body's indent, small type and eyebrow-styled headings came from being a row in a list.
   An article is the whole page, so it gets a real reading measure and real headings. */
.wiki-body {
  color: var(--ink-soft);
  font-size: 1rem;
  line-height: 1.75;
  max-width: 68ch;          /* ch, not rem: the measure follows the font, which is the point */
}
.wiki-body > :first-child { margin-top: 0; }
.wiki-body p { margin: 0 0 1.15rem; }
.wiki-body ul, .wiki-body ol { margin: 0 0 1.25rem; padding-left: 1.35rem; }
.wiki-body li { margin: .4rem 0; }
.wiki-body li::marker { color: var(--muted); }
.wiki-body strong { color: var(--text); font-weight: 650; }
.wiki-body a { text-decoration: underline; text-underline-offset: 3px; }
.wiki-body code {
  color: var(--blue); background: var(--raise);
  padding: .08em .38em; border-radius: 4px;
  font-size: .92em; overflow-wrap: anywhere;
}

/* Headings are the landmarks you skim by, so they read as headings. The old .69rem uppercase
   --faint treatment was a label: invisible at a glance and below AA contrast. */
.wiki-body h2 {
  font-size: 1.22rem;
  line-height: 1.35;
  color: var(--text);
  font-weight: 650;
  margin: 2.4rem 0 .75rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--rule);
  scroll-margin-top: 1.5rem;   /* so a TOC jump does not tuck it under the top edge */
}
.wiki-body h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }

/* Click a heading to get a link to it. Hidden until hover/focus so it never adds visual noise. */
.wiki-body h2 .anchor {
  opacity: 0; margin-left: .45rem; font-size: .8em;
  color: var(--muted); text-decoration: none;
  transition: opacity .12s ease;
}
.wiki-body h2:hover .anchor, .wiki-body h2 .anchor:focus { opacity: 1; }

.wiki-body .facts { font-size: .95rem; margin: 0 0 1.25rem; }
.wiki-body .caveat {
  margin: 1.5rem 0 0; padding: .85rem 1rem;
  border-left: 3px solid var(--gold);
  background: var(--raise); border-radius: 0 6px 6px 0;
  font-size: .92rem; color: var(--muted);
}

/* ---- "On this page" ------------------------------------------------------ */
.wiki-toc { margin: 0 0 1.6rem; }
.wiki-toc ul { list-style: none; margin: 0; padding: 0; }
.wiki-toc li { padding: .2rem 0; font-size: .88rem; line-height: 1.4; }
.wiki-toc a { color: var(--muted); }
.wiki-toc a:hover { color: var(--text); }
.wiki-toc li.is-current > a { color: var(--gold); }

/* ---- index filter -------------------------------------------------------- */
.wiki-filter { margin: 0 0 1.75rem; }
.wiki-filter input {
  width: 100%; max-width: 26rem;
  padding: .6rem .85rem;
  background: var(--raise); color: var(--text);
  border: 1px solid var(--rule); border-radius: 8px;
  font: inherit; font-size: .95rem;
}
.wiki-filter input::placeholder { color: var(--muted); }
.wiki-filter input:focus { outline: 2px solid var(--blue); outline-offset: 1px; }
.wiki-cat.is-hidden, .wiki-index li.is-hidden { display: none; }
.wiki-empty { color: var(--muted); font-size: .92rem; }
.wiki-side-cat {
  margin: .9rem 0 .25rem; font-size: .7rem; letter-spacing: .07em;
  text-transform: uppercase; color: var(--muted);
}
.wiki-side-cat:first-of-type { margin-top: .35rem; }

/* ---- figures keep the monospace ------------------------------------------
   Everything reads in Karla now, but anywhere digits stack into a column the
   mono face is doing real work rather than setting a mood. */
table.ladder td, table.ladder th,
.facts td:last-child,
.eco-figure, .stamp, .pager span, .tally,
code, kbd, samp, pre {
  font-family: var(--font-mono);
}
table.ladder td, .facts td:last-child, .stamp, .pager span, .tally {
  font-variant-numeric: tabular-nums;
}

/* ---- theme toggle --------------------------------------------------------- */
.theme-toggle {
  background: none;
  border: 1px solid var(--rule-lit);
  color: var(--muted);
  font: inherit;
  font-size: .78rem;
  letter-spacing: .06em;
  padding: .38rem .7rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  transition: color .12s, border-color .12s;
}
.theme-toggle:hover { color: var(--text); border-color: var(--blue); }
.theme-toggle .theme-ico { width: 14px; height: 14px; flex: none; fill: currentColor; }
.theme-toggle .theme-dark  { display: none; }
:root[data-theme="dark"] .theme-toggle .theme-dark  { display: inline; }
:root[data-theme="dark"] .theme-toggle .theme-light { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .theme-dark  { display: inline; }
  :root:not([data-theme="light"]) .theme-toggle .theme-light { display: none; }
}
