/* Character sheet site. Styled after Paizo's printed Remaster sheet: a white page, bold small-caps
   section headings over a heavy rule, maroon-framed stat boxes and condensed labels. */

:root {
  --desk: #d8d2c6;
  --bg: #ffffff;
  --surface: #ffffff;
  --ink: #1b1714;
  --muted: #625a52;
  --line: #cfc6b8;
  --heading: #1b1714;
  --frame: #6e1f16;
  --accent: #8a2416;
  --gold: #c9a45c;
  --warn-bg: #fbf1dc;
  --warn-line: #b8741a;
  --warn-ink: #6a3a05;
  --rank-0: #8d877f;
  --rank-1: #2f5d34;
  --rank-2: #1f5f82;
  --rank-3: #6b3f8f;
  --rank-4: #8a2416;
  --radius: 2px;
  --font: Barlow, "Helvetica Neue", Arial, sans-serif;
  --font-label: "Barlow Condensed", "Arial Narrow", sans-serif-condensed, sans-serif;
  --font-head: "Alegreya SC", "Palatino Linotype", Palatino, serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --desk: #0f0e0d;
    --bg: #1d1a18;
    --surface: #1d1a18;
    --ink: #eee7da;
    --muted: #a99f92;
    --line: #463f38;
    --heading: #eee7da;
    --frame: #b9604f;
    --accent: #e08a74;
    --gold: #b8944f;
    --warn-bg: #362812;
    --warn-line: #c98a2e;
    --warn-ink: #f0c98b;
    --rank-0: #6f6961;
    --rank-1: #4d8a54;
    --rank-2: #3f86b0;
    --rank-3: #9467b8;
    --rank-4: #c0533f;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--desk);
  color: var(--ink);
  font: 15px/1.45 var(--font);
}

main {
  max-width: 1120px;
  margin: 24px auto 64px;
  padding: 28px 32px 48px;
  background: var(--bg);
  border: 1px solid var(--line);
  box-shadow: 0 1px 0 var(--line), 0 6px 18px rgb(0 0 0 / 0.12);
}

a { color: var(--accent); }

h1, h2, h3, h4 { font-family: var(--font-head); color: var(--heading); line-height: 1.15; font-weight: 800; }
h1 { font-size: 2.5rem; margin: 0.1em 0 0.15em; letter-spacing: 0.01em; }
h2 { font-size: 1.35rem; margin: 0 0 12px; padding-bottom: 1px; border-bottom: 3px solid var(--ink); letter-spacing: 0.03em; }
h3 { font-size: 1.12rem; margin: 18px 0 8px; }
h4 { font-size: 1rem; margin: 14px 0 6px; }

.meta, .note, .source, .crumbs { color: var(--muted); font-size: 0.88rem; }

/* Header */
.sheet-header { margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.identity { display: flex; flex-wrap: wrap; gap: 4px 0; margin: 0 0 10px; font-size: 1.05rem; }
.identity > span + span::before { content: "·"; color: var(--muted); margin: 0 10px; }
.identity .level { font-family: var(--font-label); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--frame); }
.source { margin: 8px 0 0; }

/* Section navigation */
.toc {
  display: flex; flex-wrap: wrap; gap: 2px 18px;
  position: sticky; top: 0; z-index: 1;
  background: var(--bg); padding: 8px 0; margin-bottom: 16px; border-bottom: 2px solid var(--ink);
}
.toc a {
  text-decoration: none; color: var(--ink);
  font-family: var(--font-label); font-weight: 600; font-size: 0.95rem; text-transform: uppercase; letter-spacing: 0.06em;
}
.toc a:hover { color: var(--accent); }

/* Review box */
.review {
  background: var(--warn-bg); border: 2px solid var(--warn-line); color: var(--warn-ink);
  padding: 10px 16px; border-radius: var(--radius); margin-bottom: 24px;
}
.review h2 { color: var(--warn-ink); border: 0; padding: 0; margin: 0 0 6px; font-size: 1.15rem; }
.review ul { margin: 4px 0; padding-left: 20px; }

/* Sections sit straight on the page, like the printed sheet */
.block { margin-bottom: 28px; }

/* Facts */
.facts { display: flex; flex-wrap: wrap; gap: 8px 28px; margin: 12px 0 0; }
.facts dt, .tile-label, thead th, .slot-label {
  font-family: var(--font-label); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted);
}
.facts dt { font-size: 0.85rem; }
.facts dd { margin: 0; font-weight: 600; }
.facts dd.warn { color: var(--warn-ink); }

/* Stat boxes */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.tiles.six { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.tile { border: 2px solid var(--frame); border-radius: var(--radius); padding: 8px 12px 10px; background: var(--surface); }
.tile-head {
  display: flex; justify-content: space-between; align-items: center; gap: 6px;
  margin: -8px -12px 6px; padding: 3px 12px; border-bottom: 1px solid var(--frame);
}
.tile-label { font-size: 0.9rem; color: var(--ink); }
.tile-value { font-family: var(--font-label); font-size: 2.1rem; font-weight: 700; line-height: 1.05; }
.tile-value .of { font-size: 1.1rem; color: var(--muted); font-weight: 500; }
.tile .temp { color: var(--accent); font-size: 0.88rem; }
.partial { font-weight: 700; color: var(--accent); }

/* Breakdowns */
.breakdown { display: flex; flex-wrap: wrap; column-gap: 0.3em; font-size: 0.82rem; color: var(--muted); }
.breakdown span { overflow-wrap: anywhere; }
.breakdown .dropped { flex-basis: 100%; white-space: normal; font-style: italic; }
.breakdown .situational { flex-basis: 100%; }
.situational { margin: 4px 0 0; padding-left: 16px; font-size: 0.8rem; color: var(--muted); font-style: italic; }

/* Proficiency badges */
.rank {
  display: inline-block; min-width: 1.5em; padding: 0 4px; border-radius: 0; text-align: center;
  font-family: var(--font-label); font-size: 0.85rem; font-weight: 700; color: #fff; line-height: 1.45;
}
.rank-0 { background: var(--rank-0); }
.rank-1 { background: var(--rank-1); }
.rank-2 { background: var(--rank-2); }
.rank-3 { background: var(--rank-3); }
.rank-4 { background: var(--rank-4); }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; vertical-align: top; padding: 6px 8px; border-bottom: 1px solid var(--line); }
thead th { font-size: 0.88rem; border-bottom: 2px solid var(--ink); }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 700; }
.skills tbody.lores { border-top: 2px solid var(--line); }
.map { color: var(--muted); font-weight: 400; }
.range { display: block; color: var(--muted); font-size: 0.8rem; font-weight: 400; }
.slots { width: auto; margin-bottom: 8px; }
.slots td, .slots th { text-align: center; }

/* Traits and tags */
.traits { display: inline-flex; flex-wrap: wrap; gap: 3px; margin-left: 6px; }
/* Paizo-style trait tags: white on maroon with a gold edge */
.trait, .tag {
  font-family: var(--font-label); font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
  background: var(--frame); color: #fff; border: 2px solid var(--gold); border-radius: 0; padding: 0 5px; line-height: 1.35;
}
.tag { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.actions { font-size: 0.8rem; color: var(--accent); margin-left: 6px; letter-spacing: -1px; }
.actions.text { letter-spacing: 0; font-size: 0.8rem; }
.from { color: var(--muted); font-size: 0.85rem; margin-left: 6px; }

/* Expandable items */
details.item > summary { cursor: pointer; list-style: none; }
details.item > summary::-webkit-details-marker { display: none; }
details.item > summary::before { content: "▸"; color: var(--muted); margin-right: 6px; display: inline-block; width: 0.8em; }
details.item[open] > summary::before { content: "▾"; }
.item-name { font-weight: 600; }
.item .meta { margin-left: 6px; }
.lead { display: block; color: var(--muted); font-size: 0.85rem; margin-left: 1.3em; }
details.item[open] .lead { display: none; }
.description { margin: 6px 0 4px 1.3em; padding: 8px 12px; border-left: 3px solid var(--frame); font-size: 0.92rem; }
.description p { margin: 0 0 8px; }
.aon { font-size: 0.82rem; }
details.steps > summary, details.known > summary { cursor: pointer; color: var(--muted); font-size: 0.82rem; }
details.steps ul { margin: 4px 0; padding-left: 18px; font-size: 0.82rem; }

ul.plain { list-style: none; margin: 0; padding: 0; }
ul.plain > li { padding: 4px 0; border-bottom: 1px dashed var(--line); }
ul.plain > li:last-child { border-bottom: 0; }
.spells .expended .item-name { text-decoration: line-through; color: var(--muted); }
.missing { color: var(--warn-ink); font-weight: 600; }

/* Feat timeline */
.timeline th[scope="row"] { width: 3.5em; }
.timeline .lvl {
  display: inline-grid; place-items: center; width: 2em; height: 2em;
  background: var(--frame); color: #fff; border-radius: 0; font-family: var(--font-label); font-weight: 700; font-size: 1rem;
}
.timeline tr.future .lvl { background: var(--rank-0); }
.timeline tr.future { opacity: 0.55; }
.slot { padding: 3px 0; }
.slot-label { display: block; font-size: 0.82rem; }
.slot.empty { background: var(--warn-bg); border-left: 3px solid var(--warn-line); padding-left: 8px; }
.slot.future .slot-label::after { content: " (later)"; text-transform: none; }

/* Inventory */
ul.inventory, ul.inventory ul { list-style: none; padding-left: 0; margin: 8px 0 0; }
ul.inventory ul { padding-left: 1.4em; border-left: 2px solid var(--line); margin-left: 0.4em; }
ul.inventory li { padding: 3px 0; }

/* Notes */
dl.notes > div { margin-bottom: 10px; }
dl.notes dt { font-family: var(--font-label); font-weight: 700; font-size: 1.05rem; text-transform: uppercase; letter-spacing: 0.04em; }
dl.notes dd { margin: 2px 0 0; }
dl.notes dd p { margin: 0 0 6px; }

/* Spell entries and familiars */
.spell-entry, .familiar { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 12px; }
.spell-entry:first-of-type, .familiar:first-of-type { border-top: 0; margin-top: 0; padding-top: 0; }
.spell-entry header h3 { margin: 0; }
.spell-entry .tiles { margin: 10px 0; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
ul.profs { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; }

/* Index */
.cards { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.card {
  background: var(--surface); border: 2px solid var(--frame); border-radius: var(--radius); padding: 12px 14px;
  display: flex; flex-direction: column; gap: 4px;
}
.card a { color: var(--ink); text-decoration: none; }
.card a strong { font-family: var(--font-head); font-weight: 800; font-size: 1.3rem; }
.card a:hover strong { color: var(--accent); }
.card a.familiar-link { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; font-size: 0.88rem; }
.card a.familiar-link:hover { color: var(--ink); }
.badge {
  align-self: flex-start; margin-top: 6px; padding: 1px 8px; border-radius: 0;
  font-family: var(--font-label); font-weight: 600; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em;
}
.badge.warn { background: var(--warn-bg); color: var(--warn-ink); border: 1px solid var(--warn-line); }

/* Phones: stack table cells and two-column blocks */
@media (max-width: 700px) {
  main { margin: 0; padding: 16px 16px 48px; border: 0; box-shadow: none; }
  h1 { font-size: 1.9rem; }
  .two-col { grid-template-columns: 1fr; }
  .skills thead, .strikes thead, .timeline thead { display: none; }
  .skills tr, .strikes tr {
    display: grid; grid-template-columns: 1fr auto auto; gap: 2px 8px; padding: 6px 0; border-bottom: 1px solid var(--line);
  }
  .skills td, .skills th, .strikes td, .strikes th { border: 0; padding: 0; }
  .skills td:last-child, .strikes td:nth-child(4), .strikes td:last-child { grid-column: 1 / -1; }
  .timeline tr { display: grid; grid-template-columns: 3em 1fr; border-bottom: 1px solid var(--line); }
  .timeline td, .timeline th { border: 0; }
  .timeline td:last-child { grid-column: 2; }
  .tile-value { font-size: 1.5rem; }
}

/* Print: a compact reference in the Remaster sheet's page order. Items show their one-line
   summary instead of the full description; the screen version has the full text. */
@media print {
  :root { --desk: #fff; --bg: #fff; --surface: #fff; }
  body { font-size: 9.5pt; }
  main { max-width: none; margin: 0; padding: 0; border: 0; box-shadow: none; }
  .toc, .crumbs, .aon, details.known, details.steps, .description { display: none; }
  details.item > summary::before { display: none; }
  details.item[open] .lead { display: block; }
  .page { break-before: page; }
  .page:first-of-type { break-before: auto; }
  .tile, tr, li, .spell-entry header, h2, h3, h4 { break-inside: avoid; }
  h2, h3, h4 { break-after: avoid; }
  .block { margin-bottom: 12px; }
  .lead { margin-left: 0; }
  .timeline tr.future { display: none; }
  a { color: inherit; text-decoration: none; }
}
