/* BG3-inspired: ink-black panels, tarnished gold, parchment text.
   Dark is the default (matches the game); light is a parchment page. */
:root {
  --bg: #0e0c0a;
  --panel: #18140f;
  --panel-2: #211b14;
  --rule: #3a2f22;
  --gold: #c9a45c;
  --gold-dim: #8a7346;
  --text: #e6dac2;
  --text-dim: #a3967f;
  --blood: #a33a2f;
  --missable: #e0675a;          /* brighter than --blood so small red text reads on dark */
  --veil: rgba(14, 12, 10, 0.92);
  --rare: #4d8fd6;
  --uncommon: #5fae5a;
  --verylegendary: #c9a45c;
  --shadow: 0 1px 0 rgba(201, 164, 92, 0.08), 0 8px 24px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #efe5cf;
    --panel: #f7f0df;
    --panel-2: #ebdfc4;
    --rule: #cdb98f;
    --gold: #7d5f22;
    --gold-dim: #9c814c;
    --text: #2b2117;
    --text-dim: #66553f;
    --blood: #8e2a20;
    --missable: #9a2a1f;
    --veil: rgba(239, 229, 207, 0.94);
    --rare: #2a64a8;
    --uncommon: #3c7d38;
    --shadow: 0 1px 0 rgba(125, 95, 34, 0.15), 0 6px 18px rgba(80, 60, 20, 0.12);
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  min-height: 100vh;
  background-image: radial-gradient(ellipse at top, color-mix(in srgb, var(--gold) 7%, transparent), transparent 60%);
  background-repeat: no-repeat;
  background-attachment: fixed;
  color: var(--text);
  font: 1.125rem/1.6 "EB Garamond", Georgia, serif;
}
a { color: var(--gold); text-underline-offset: 3px; }
a:hover { color: var(--text); }
h1, h2, h3, .brand, .act-tag, .tier-label, button, .progress, th {
  font-family: Cinzel, "Trajan Pro", Georgia, serif;
  letter-spacing: 0.04em;
}
h1 { font-size: clamp(1.9rem, 5vw, 2.8rem); color: var(--gold); margin: 0.2em 0; font-weight: 700; }
h2 { font-size: 1.4rem; margin: 0; color: var(--gold); font-weight: 500; }
h3 { font-size: 1.05rem; margin: 0 0 0.6em; font-weight: 500; }

/* header */
.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; flex-wrap: wrap; gap: 0.6rem 1.5rem; align-items: center;
  padding: 0.7rem 16px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--rule);
}
.brand { color: var(--gold); text-decoration: none; font-weight: 700; font-size: 1.05rem; }
.top nav { display: flex; gap: 1rem; flex: 1; }
.top nav a { text-decoration: none; color: var(--text-dim); font-family: Cinzel, serif; font-size: 0.9rem; }
.top nav a[aria-current] { color: var(--gold); }
.progress { font-size: 0.8rem; color: var(--text-dim); display: flex; gap: 0.5rem; align-items: center; }
select {
  font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--gold-dim);
  padding: 0.25rem 0.5rem; border-radius: 2px;
}

main { max-width: 52rem; margin: 0 auto; padding: 1.5rem 16px 3rem; }
.lede, .teaser { color: var(--text-dim); font-size: 1.2rem; font-style: italic; }
.crumbs { font-size: 0.9rem; color: var(--text-dim); }
.meta { color: var(--text-dim); margin: 0; font-size: 0.95rem; }

/* ornamented panels */
.part, .act, .question {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--rule);
  box-shadow: var(--shadow);
}
.part { margin: 2rem 0; padding: 1.25rem 1.25rem 0.5rem; }
.part::before, .act::before {
  content: ""; position: absolute; inset: 4px; pointer-events: none;
  border: 1px solid color-mix(in srgb, var(--gold) 22%, transparent);
}
.part-head { border-bottom: 1px solid var(--rule); padding-bottom: 0.75rem; margin-bottom: 1rem; }
.act-tag { font-size: 0.72rem; text-transform: uppercase; color: var(--gold-dim); }
.place { margin: 0.15rem 0 0; color: var(--text-dim); font-style: italic; }

.question { background: var(--panel-2); padding: 1rem 1.1rem; margin-bottom: 1rem; }
.tiers { list-style: none; padding: 0; margin: 0; }
.tier {
  border-left: 2px solid var(--gold-dim);
  padding: 0.1rem 0 0.1rem 0.9rem; margin: 0.6rem 0;
  animation: rise 0.35s ease-out;
}
.tier p { margin: 0.15rem 0 0; }
.tier-label { display: block; font-size: 0.7rem; text-transform: uppercase; color: var(--gold-dim); }
.tier-solution { border-left-color: var(--gold); }
.tier-solution .tier-label, .tier-outcomes .tier-label { color: var(--gold); }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } }
@media (prefers-reduced-motion: reduce) { .tier { animation: none; } }

.outcomes { margin: 0.3rem 0 0; display: grid; gap: 0.5rem; }
.outcomes div { display: grid; grid-template-columns: minmax(8rem, 12rem) 1fr; gap: 0.75rem; }
.outcomes dt { color: var(--gold); font-weight: 600; }
.outcomes dd { margin: 0; }
@media (max-width: 34rem) { .outcomes div { grid-template-columns: 1fr; gap: 0; } }

.dots { display: flex; gap: 6px; margin: 0.8rem 0 0.5rem; }
.dots span { width: 7px; height: 7px; transform: rotate(45deg); border: 1px solid var(--gold-dim); }
.dots span.on { background: var(--gold); border-color: var(--gold); }

button {
  font-size: 0.8rem; cursor: pointer; color: var(--gold);
  background: transparent; border: 1px solid var(--gold-dim);
  padding: 0.45rem 0.9rem; border-radius: 2px;
}
button:hover { background: color-mix(in srgb, var(--gold) 12%, transparent); color: var(--text); }
button:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
button[disabled] { opacity: 0.45; cursor: default; }

.missable { border: 1px solid color-mix(in srgb, var(--blood) 60%, transparent); padding: 0.5rem 0.75rem; margin: 0.8rem 0 0; }
.missable strong { font-family: Cinzel, serif; font-size: 0.75rem; color: var(--blood); margin-right: 0.4rem; text-transform: uppercase; }
/* question-level flag: says something is missable, not what */
.missable-flag {
  font-family: Cinzel, serif; font-size: 0.68rem; letter-spacing: 0.06em; text-transform: uppercase; vertical-align: middle;
  color: var(--missable); border: 1px solid var(--missable); padding: 0.05rem 0.4rem; border-radius: 2px; margin-left: 0.3rem; cursor: pointer;
  white-space: nowrap; background: transparent;
}
.missable-flag:hover, .missable-flag[aria-expanded="true"] { color: var(--missable); background: color-mix(in srgb, var(--missable) 14%, transparent); }
/* the badge's explanation, shown under the question on click or tap */
.missable-explain { margin: -0.3rem 0 0.4rem; font-size: 0.9rem; font-style: italic; color: var(--missable); }
.tier .missable { margin-top: 0.5rem; }
.item-link, .note { font-size: 0.9rem; color: var(--text-dim); margin: 0.6rem 0 0; }
.note { font-style: italic; }
.verify {
  font-family: "EB Garamond", serif; font-size: 0.72rem; letter-spacing: 0; vertical-align: middle;
  color: var(--text-dim); border: 1px dashed var(--gold-dim); padding: 0 0.35rem; border-radius: 2px; cursor: help;
}

/* spoiler veil for later acts */
.veil {
  position: absolute; inset: 0; z-index: 2; display: none; place-content: center; text-align: center; gap: 0.6rem;
  background: var(--veil);
}
.veil p { margin: 0; color: var(--text-dim); font-style: italic; }
.part.veiled .part-body { filter: blur(6px); user-select: none; pointer-events: none; max-height: 9rem; overflow: hidden; }
.part.veiled .veil { display: grid; }
.part.veiled { padding-bottom: 1.25rem; }

/* index pages */
.act { padding: 1.25rem; margin: 1.5rem 0; }
.regions { list-style: none; padding: 0; margin: 0.75rem 0 0; }
.regions > li { margin-bottom: 0.75rem; }
.regions ul { margin: 0.25rem 0 0; padding-left: 1.1rem; }
.span, .empty { color: var(--text-dim); font-size: 0.9rem; }
.table-wrap { overflow-x: auto; border: 1px solid var(--rule); background: var(--panel); }
table.index { border-collapse: collapse; width: 100%; font-size: 1rem; }
.index th, .index td { text-align: left; padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
.index thead th { font-size: 0.75rem; color: var(--gold-dim); font-weight: 500; }
.index tbody th { font-family: "EB Garamond", serif; letter-spacing: 0; color: var(--gold); font-weight: 600; }
.index tr.hidden-act { display: none; }
.rarity-rare { color: var(--rare); }
.rarity-uncommon { color: var(--uncommon); }
.rarity-veryrare { color: #a55fd0; }
.rarity-legendary { color: var(--verylegendary); }
.hidden-count, .search-hidden { color: var(--text-dim); font-style: italic; }

.coverage { margin-top: 2rem; padding: 0.75rem 1rem; border: 1px dashed var(--rule); color: var(--text-dim); font-size: 0.85rem; }
footer { max-width: 52rem; margin: 0 auto; padding: 1.5rem 16px 3rem; border-top: 1px solid var(--rule); color: var(--text-dim); font-size: 0.85rem; }
.build { opacity: 0.7; }

/* contents for long quest pages */
.toc {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 0.5rem 1.5rem;
  margin: 1.5rem 0 0; padding: 1rem 1.25rem; border: 1px solid var(--rule); background: var(--panel);
}
.toc[hidden] { display: none; }   /* short pages have no contents panel */
.toc h2 { grid-column: 1 / -1; font-size: 0.8rem; text-transform: uppercase; color: var(--gold-dim); }
.toc h3 { font-size: 0.85rem; color: var(--gold); margin: 0.2rem 0 0.3rem; }
.toc ul { list-style: none; margin: 0; padding: 0; font-size: 1rem; }
.toc li { margin: 0.15rem 0; }
.toc a { text-decoration: none; }
.toc a:hover { text-decoration: underline; }
.toc-hidden { color: var(--text-dim); font-style: italic; font-size: 0.9rem; }

/* playtest checklist (verify.html) */
.checklist { list-style: none; padding: 0; margin: 0 0 1.2rem; }
.check-item { border-top: 1px solid var(--rule); padding: 0.5rem 0; }
.check-item label { cursor: pointer; }
.check-item .note, .check-how { margin: 0.25rem 0 0 1.6rem; font-size: 0.9rem; }
.check-how { color: var(--text); }
.prio { font-family: Cinzel, serif; font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.06em; padding: 0 0.35rem; border: 1px solid var(--rule); border-radius: 2px; color: var(--text-dim); }
.prio-high { color: var(--missable); border-color: var(--missable); }
.check-filter { font-size: 0.95rem; color: var(--text-dim); }
.check-item:has(input:checked) > label { text-decoration: line-through; color: var(--text-dim); }

/* search: header box on every page, search.html results */
.search-box input, .search-page input {
  font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--gold-dim);
  border-radius: 2px; padding: 0.25rem 0.5rem; width: 100%;
}
.search-box { flex: 0 1 12rem; font-size: 0.9rem; }
.search-page { margin: 1rem 0 0.5rem; }
.search-page input { font-size: 1.2rem; padding: 0.5rem 0.75rem; }
.search-box input:focus-visible, .search-page input:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.results { list-style: none; padding: 0; margin: 0; }
.result { border-top: 1px solid var(--rule); padding: 0.6rem 0; display: grid; grid-template-columns: 6rem 1fr; gap: 0 0.75rem; }
.result-kind { grid-row: span 2; font-family: Cinzel, serif; font-size: 0.68rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--gold-dim); padding-top: 0.3rem; }
.result-context { color: var(--text-dim); font-size: 0.9rem; }
@media (max-width: 34rem) {
  .search-box { flex-basis: 100%; }
  .result { grid-template-columns: 1fr; }
  .result-kind { grid-row: auto; padding: 0; }
}
.support { color: var(--text); font-size: 0.95rem; }

/* landing page */
.about h2 { font-size: 1.1rem; margin: 1.6rem 0 0.4rem; }
.about p { margin: 0.5rem 0; }
.about .missable-flag, .about .verify { cursor: default; }
.start { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 0.75rem; margin: 2rem 0 0; }
.start a {
  display: block; text-decoration: none; padding: 0.9rem 1rem;
  background: var(--panel); border: 1px solid var(--rule); box-shadow: var(--shadow);
}
.start a:hover { border-color: var(--gold-dim); }
.start strong { display: block; font-family: Cinzel, serif; font-weight: 500; letter-spacing: 0.04em; color: var(--gold); }
.start span { color: var(--text-dim); font-size: 0.95rem; }
.start .start-main { grid-column: 1 / -1; }

/* in-page links land below the sticky header (--top-h is set by site.js) */
.part { scroll-margin-top: calc(var(--top-h, 3.5rem) + 1rem); }

/* quest pages with a contents list: on wide screens it sits in a left
   column and stays in view while the parts scroll past */
@media (min-width: 60rem) {
  main:has(> .toc:not([hidden])) {
    max-width: 72rem;
    display: grid; grid-template-columns: 14rem minmax(0, 1fr); column-gap: 2.5rem;
  }
  main:has(> .toc:not([hidden])) > * { grid-column: 2; }
  main > .toc:not([hidden]) {
    grid-column: 1; grid-row: 1 / span 4; align-self: start;
    position: sticky; top: calc(var(--top-h, 3.5rem) + 1rem);
    max-height: calc(100vh - var(--top-h, 3.5rem) - 2rem); overflow-y: auto;
    display: block; margin: 1.5rem 0 0;
  }
  main > .toc h2 { margin-bottom: 0.5rem; }
  main > .toc div + div { margin-top: 0.75rem; }
}
