/* Druid ve WoW: Forever – in-game look taken from wow.morialab.org (wood frame,
   gold trim, parchment quest log), drawn in CSS only: no game textures, icons or fonts. */

@font-face { font-family: "Marcellus"; src: url("../fonts/Marcellus-Regular.woff") format("woff"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Spectral"; src: url("../fonts/Spectral-Regular.woff") format("woff"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Spectral"; src: url("../fonts/Spectral-SemiBold.woff") format("woff"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Spectral"; src: url("../fonts/Spectral-Italic.woff") format("woff"); font-weight: 400; font-style: italic; font-display: swap; }

:root {
  --frame: #2b2018; --frame-2: #3a2b1f; --frame-edge: #120c08;
  --gold: #c8a456; --gold-dim: #8f7440;
  --parch: #e6d3a7; --parch-2: #d6bd8a; --ink: #3a2817; --ink-soft: #6b5236;
  --red: #8e2216; --red-2: #b03323;
  --done: #3e7a4c; --active: #a67c1f; --open: #7d6a52;
  --map-bg: #1d1611;
  --title-font: "Marcellus", "Palatino Linotype", Georgia, serif;
  --body-font: "Spectral", Georgia, "Times New Roman", serif;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; }
body {
  height: 100%; margin: 0; background: var(--map-bg); color: var(--parch);
  font-family: var(--body-font); font-size: 16px; line-height: 1.45;
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px);
}
button, input { font: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
a { color: var(--red); }

/* ---------- Window frame ---------- */
.window {
  height: 100%; display: flex; flex-direction: column;
  background: var(--frame); border: 3px solid var(--frame-edge);
  box-shadow: inset 0 0 0 1px var(--gold-dim), inset 0 0 0 4px var(--frame-2);
}
.titlebar {
  display: flex; align-items: center; gap: 14px; padding: 6px 14px;
  background: linear-gradient(var(--frame-2), var(--frame));
  border-bottom: 1px solid var(--gold-dim);
}
.brand { flex: none; display: block; line-height: 0; color: var(--gold); }
.brand svg { width: 30px; height: 30px; }
.titlebar h1 {
  margin: 0; flex: 1; text-align: center; font-family: var(--title-font); font-weight: 400;
  font-size: 19px; letter-spacing: .02em; color: var(--gold);
}
.titlebar .sub { flex: none; font-size: 14px; color: var(--parch-2); }

.crumbs {
  display: flex; align-items: center; gap: 8px; padding: 6px 12px; min-height: 39px;
  background: #1f1711; border-bottom: 1px solid var(--gold-dim); flex-wrap: wrap;
}
.crumb {
  font-family: var(--title-font); font-size: 14px; color: var(--parch); background: var(--red);
  border: 1px solid #4a110b; padding: 3px 18px 3px 12px;
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%);
}
.crumb.wait { background: #4a3626; color: var(--parch-2); font-style: italic; font-family: var(--body-font); }
.crumb[aria-current] { background: var(--frame-2); color: var(--gold); }
.crumbs .faction { margin-left: auto; font-size: 14px; color: var(--parch-2); }

.body { flex: 1; display: flex; min-height: 0; }

/* ---------- The book (main content, parchment) ---------- */
.book {
  flex: 1; min-width: 0; overflow: auto; padding: 20px 26px 32px; color: var(--ink);
  background: var(--parch); border-right: 2px solid var(--frame-edge);
  background-image: radial-gradient(ellipse at 30% 20%, rgba(255,255,255,.18), transparent 60%),
                    radial-gradient(ellipse at 80% 90%, rgba(110,80,40,.18), transparent 55%);
}
.book-inner { max-width: 980px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.book .muted { color: var(--ink-soft); }
.book h2 { margin: 0; font-family: var(--title-font); font-weight: 400; font-size: 28px; line-height: 1.2; }
.book h3 {
  margin: 18px 0 2px; font-family: var(--title-font); font-weight: 400; font-size: 21px;
  border-bottom: 1px solid #b59c6c; padding-bottom: 3px; scroll-margin-top: 12px;
}
.book p { margin: 0; }
.lead { font-size: 17px; }
.note {
  padding: 8px 12px; font-size: 14px; border-left: 3px solid var(--active);
  background: rgba(166,124,31,.12);
}
.note.warn { border-left-color: var(--red); background: rgba(142,34,22,.08); }

/* Welcome (nothing picked yet) */
.welcome { display: flex; flex-direction: column; gap: 12px; }
.welcome ul { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 4px; }
.welcome .start { font-family: var(--title-font); font-size: 19px; color: var(--red); }

/* Level blocks and their rows (like the Important quests book) */
.chain { border: 1px solid #c2a874; border-radius: 4px; background: rgba(255,255,255,.14); }
.chain > summary, .step > summary { list-style: none; cursor: pointer; }
.chain > summary::-webkit-details-marker, .step > summary::-webkit-details-marker { display: none; }
.chain > summary { display: flex; align-items: center; gap: 12px; padding: 10px 14px; }
.chain > summary:hover { background: rgba(142,34,22,.08); }
.chain-title { flex: 1; font-family: var(--title-font); font-size: 19px; white-space: nowrap; }
.chain-count { flex: none; font-size: 14px; color: var(--ink-soft); }
.chain-arrow { flex: none; width: 12px; height: 12px; color: var(--ink-soft); transition: transform .15s; }
.chain[open] > summary .chain-arrow { transform: rotate(180deg); }
.chain-note { margin: 0 14px 8px; font-size: 14px; color: var(--ink-soft); font-style: italic; }

.step > summary {
  display: flex; align-items: baseline; gap: 10px; padding: 6px 14px 6px 12px; border-top: 1px solid #d9c497;
}
.step > summary:hover, .step[open] > summary { background: rgba(142,34,22,.1); }
.lv { flex: none; width: 26px; text-align: right; font-size: 14px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.name { flex: 1; min-width: 0; }
.src { flex: none; font-size: 12px; color: var(--ink-soft); border: 1px solid #b59c6c; border-radius: 3px; padding: 0 5px; white-space: nowrap; }
.buy { flex: none; font-size: 12px; border: 1px solid; border-radius: 3px; padding: 0 6px; white-space: nowrap; }
.buy.k { color: #2f6a3d; border-color: #7aa683; background: rgba(62,122,76,.14); }
.buy.u { color: #7a5a12; border-color: #c4a052; background: rgba(166,124,31,.14); }
.buy.n { color: #8a7a62; border-color: #c2ad85; }
.step.skip .name { color: var(--ink-soft); }
.step.past > summary .name::after { content: " ✓"; color: var(--done); }
.step.past > summary { opacity: .72; }
.step.next > summary { background: rgba(255,209,0,.2); }
.rk { font-size: 13px; color: var(--ink-soft); font-style: italic; }
.step.rank .name { color: var(--ink-soft); }
.step.rank .ico { opacity: .8; }

/* The game's tooltip: a dark box like in the game, white name, gold description. */
.ico {
  flex: none; width: 22px; height: 22px; align-self: center; border-radius: 3px;
  border: 1px solid #1a120c; box-shadow: 0 1px 2px rgba(0,0,0,.35);
}
.ico.blank { display: inline-block; border-color: transparent; box-shadow: none; }
.card h4 { display: flex; align-items: center; gap: 8px; }
.card h4 .ico { width: 28px; height: 28px; }
/* Like the game: the icon sits outside the tooltip box, at its top left. */
.ttwrap { display: flex; align-items: flex-start; gap: 4px; }
.tt-ico { flex: none; width: 40px; height: 40px; border: 1px solid #6b6f86; border-radius: 4px; box-shadow: 0 2px 8px rgba(0,0,0,.6); }
.tt {
  max-width: 340px; padding: 8px 10px; background: rgba(8,10,22,.96); border: 1px solid #6b6f86; border-radius: 4px;
  box-shadow: 0 4px 14px rgba(0,0,0,.6); font-size: 13px; line-height: 1.4; color: #f3f1ea;
}
.tt-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; margin-bottom: 2px; }
.tt-head b { font-family: var(--title-font); font-weight: 400; font-size: 15px; color: #fff; }
.tt-head span { color: #a8a8b8; font-size: 12px; white-space: nowrap; }
.tt-l { display: flex; justify-content: space-between; gap: 12px; }
.tt-d { margin: 4px 0 0; color: #ffd100; max-width: none; }
.tt-lv { margin: 4px 0 0; color: #a8a8b8; font-size: 12px; }
.tt-old { margin: 2px 0 0; color: #d47b72; font-size: 12px; }
.tipfloat { position: fixed; z-index: 2000; pointer-events: none; }
.name[data-tip] { text-decoration: underline dotted rgba(58,40,23,.45); text-underline-offset: 3px; }
.nexttag { flex: none; font-size: 12px; color: var(--parch); background: var(--red); border-radius: 3px; padding: 0 6px; white-space: nowrap; }

.det {
  display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 6px 12px; margin: 0 14px 10px 48px;
  padding: 10px 12px; font-size: 15px; border-left: 3px solid var(--red); background: rgba(255,255,255,.22);
}
.det dt { font-family: var(--title-font); color: var(--ink-soft); }
.det dd { margin: 0; }
.det .warn { color: var(--red); }
.det .unsure { color: var(--ink-soft); font-style: italic; }

/* Plain tables on the parchment */
.scroll { overflow-x: auto; }
.grid { width: 100%; border-collapse: collapse; font-size: 15px; }
.grid th { text-align: left; font-family: var(--title-font); font-weight: 400; border-bottom: 1px solid #9b8152; padding: 5px 8px; color: var(--ink-soft); }
.grid td { border-bottom: 1px solid var(--parch-2); padding: 5px 8px; vertical-align: top; }
.grid .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.grid .key { font-family: var(--title-font); font-size: 16px; white-space: nowrap; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.card { border: 1px solid #c2a874; border-radius: 4px; background: rgba(255,255,255,.14); padding: 10px 12px; }
.card h4 { margin: 0 0 2px; font-family: var(--title-font); font-weight: 400; font-size: 18px; }
.card h4 a { color: var(--ink); text-decoration: none; }
.card h4 a:hover { color: var(--red); text-decoration: underline; }
.card .meta { font-size: 13px; color: var(--ink-soft); margin-bottom: 4px; }
.card p { font-size: 15px; }
.card.dim { opacity: .62; }
.card .imp { display: inline-block; margin-top: 6px; }

.sources-list { margin: 0; padding-left: 20px; font-size: 15px; display: flex; flex-direction: column; gap: 2px; }
.legal { font-size: 13px; color: var(--ink-soft); }

/* ---------- Side panel (the quest log) ---------- */
.log {
  width: 360px; flex: none; display: flex; flex-direction: column; min-height: 0;
  background: var(--parch); color: var(--ink);
  background-image: radial-gradient(ellipse at 30% 20%, rgba(255,255,255,.18), transparent 60%),
                    radial-gradient(ellipse at 80% 90%, rgba(110,80,40,.18), transparent 55%);
}
.log-head { padding: 14px 16px 8px; border-bottom: 1px solid var(--parch-2); }
.log-head h2 { margin: 0; font-family: var(--title-font); font-weight: 400; font-size: 22px; }
.log-head p { margin: 2px 0 0; color: var(--ink-soft); font-size: 14px; }
.reset {
  margin-top: 8px; padding: 3px 12px; border: 1px solid #9b8152; background: #dcc697; color: var(--ink);
  border-radius: 3px; cursor: pointer; font-size: 14px;
}
.reset:hover { background: var(--red); color: var(--parch); border-color: #4a110b; }
.list { flex: 1; overflow: auto; padding: 4px 8px 14px; }
.group {
  margin: 12px 8px 2px; font-family: var(--title-font); font-size: 15px; color: var(--ink-soft);
  border-bottom: 1px solid var(--parch-2);
}
.item {
  display: flex; align-items: baseline; gap: 10px; width: 100%; text-align: left; text-decoration: none;
  background: none; border: 0; border-radius: 3px; padding: 6px 8px; cursor: pointer; color: var(--ink);
}
.item:hover { background: rgba(142,34,22,.10); }
.item[aria-pressed="true"] { background: var(--red); color: var(--parch); }
.item[aria-pressed="true"] .tag { color: var(--parch-2); border-color: rgba(230,211,167,.5); }
.item .iname { flex: 1; font-family: var(--title-font); font-size: 16px; }
.item .tag { flex: none; font-size: 12px; color: var(--ink-soft); border: 1px solid #b59c6c; border-radius: 3px; padding: 0 5px; }
.item .hint { display: block; font-family: var(--body-font); font-size: 13px; color: inherit; opacity: .8; }
a.item .iname { font-family: var(--body-font); font-size: 15px; }

.levelrow { display: flex; align-items: center; gap: 10px; padding: 8px 8px 2px; font-size: 15px; }
.levelrow input {
  width: 72px; padding: 3px 6px; border: 1px solid #9b8152; border-radius: 3px;
  background: #efe0bb; color: var(--ink); font-variant-numeric: tabular-nums;
}
.levelrow button, .filters button {
  padding: 3px 10px; border: 1px solid #9b8152; background: #dcc697; color: var(--ink);
  border-radius: 3px; cursor: pointer; font-size: 14px;
}
.levelrow button:hover, .filters button:hover { background: #e6d3a7; }
.filters { display: flex; gap: 4px; padding: 8px 8px 2px; }
.filters button { flex: 1; padding: 4px 0; }
.filters button[aria-pressed="true"] { background: var(--red); color: var(--parch); border-color: #4a110b; }
.panel-note { margin: 4px 8px 0; font-size: 13px; color: var(--ink-soft); }

/* ---------- Footer ---------- */
.footer {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 6px 12px;
  background: linear-gradient(var(--frame), var(--frame-2)); border-top: 1px solid var(--gold-dim);
  font-size: 14px; color: var(--parch-2);
}
.legend { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.legend .buy.k { color: #8fc79c; border-color: #4f7d58; background: rgba(62,122,76,.2); }
.legend .buy.u { color: #e0b75a; border-color: #8a6a26; background: rgba(166,124,31,.18); }
.legend .buy.n { color: var(--parch-2); border-color: #6b5a44; }
.footer .source { margin-left: auto; color: var(--gold-dim); }

@media (max-width: 860px) {
  /* On phones the page scrolls: the choice panel on top, the book below. */
  .window { height: auto; min-height: 100%; }
  .body { flex: none; flex-direction: column; }
  .log { order: -1; width: auto; border-bottom: 2px solid var(--frame-edge); }
  .list { overflow: visible; }
  .book { flex: none; overflow: visible; border-right: 0; padding: 16px 14px 24px; }
  .titlebar { flex-wrap: wrap; }
  .titlebar h1 { text-align: left; }
  .titlebar .sub { display: none; }
  .det { grid-template-columns: minmax(0, 1fr); margin-left: 12px; gap: 2px 0; }
  .det dd + dt { margin-top: 6px; }
  .step > summary { flex-wrap: wrap; row-gap: 3px; }
  .step > summary .name { flex-basis: calc(100% - 40px); }
  .step > summary .src { margin-left: 36px; }
  .book h2 { font-size: 24px; }
  .footer .source { margin-left: 0; }
  .chain > summary { flex-wrap: wrap; row-gap: 2px; }
  .chain-count { order: 3; flex-basis: 100%; }
  /* Compact choice on phones: two columns, so the guide starts sooner. */
  #races, #roles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; padding: 4px 0; }
  #races .item, #roles .item { flex-direction: column; gap: 2px; padding: 6px 8px; border: 1px solid #c2a874; }
  #races .item[aria-pressed="true"], #roles .item[aria-pressed="true"] { border-color: #4a110b; }
  #toc .item { display: inline-flex; width: auto; padding: 3px 8px; }
  /* Tables become stacked rows with their labels. */
  .grid.stack thead { display: none; }
  .grid.stack tr { display: block; padding: 6px 2px; border-bottom: 1px solid var(--parch-2); }
  .grid.stack td { display: block; border: 0; padding: 1px 4px; text-align: left; white-space: normal; }
  .grid.stack td[data-label]::before { content: attr(data-label) ": "; color: var(--ink-soft); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
