/* FeyForged — character sheets, stat blocks and spell blocks.
   They are drawn from the colour tokens below: parchment and ink in the light
   theme, and a dark leather-and-ink version in the dark theme. Layout lives in
   the rules further down and is the same in both. */

.paper,
.statblock {
  --ink: #2b1d12;
  --ink-soft: #5d4733;
  --crimson: #7a1d1d;
  --crimson-2: #9d2a24;
  --gold: #c9a227;
  --gold-soft: #e7cf7a;
  --rule: #a8834e;
  --parchment: #f4e8cc;
  --parchment-2: #ead9b0;
  --parchment-3: #dcc592;
  --font-head: 'Cinzel', Georgia, serif;
  --font-body: 'EB Garamond', Georgia, serif;
  /* Generic components (prose, links, tags) rendered inside a sheet. */
  --text: #2b1d12;
  --muted: #5d4733;
  --border: #c8b38c;
  --surface: #fffaf0;
  --surface-2: #f4e8cc;
  --accent: #7a1d1d;
  --link: #7a1d1d;
  --wl-character: #1f4e79;
  --wl-npc: #7a1d1d;
  --wl-location: #2f5d34;
  --wl-map: #6b4a12;
  --wl-article: #4b2b6b;
  /* Sheet parts */
  --sheet-box: #fffaf0;
  --sheet-line: #3b2a1c;
  --sheet-rule: #8a7155;
  --sheet-hi: #ffffff;
  --hp-track: #d9c9a8;
  --hp-a: #7a1d1d;
  --hp-b: #b8402f;
  --coin-gold: #b8901e;
  --coin-gold-bg: #fbf1cc;
  --paper-texture:
    radial-gradient(ellipse at 20% 10%, rgba(255, 255, 255, 0.45), transparent 55%),
    radial-gradient(ellipse at 80% 90%, rgba(168, 131, 78, 0.22), transparent 60%);
  /* Stat blocks */
  --sb-bg: #fdf1dc;
  --sb-red: #7a200d;
  --sb-border: #e69a28;
  --sb-outline: #d6b98c;
  --sb-taper: #922610;
  --sb-sheen: rgba(255, 255, 255, 0.35);
  --sb-shadow: rgba(60, 35, 10, 0.3);
  color: var(--ink);
  font-family: var(--font-body);
}

.paper {
  background-color: var(--parchment);
  background-image: var(--paper-texture);
  border-radius: 14px;
  padding: 1.4rem;
  box-shadow: var(--shadow-lg, 0 10px 30px rgba(0, 0, 0, 0.35));
  margin-bottom: 1.5rem;
}
.paper .sheet-section:first-child,
.paper > :first-child {
  margin-top: 0;
}
.paper h2 {
  font-family: var(--font-head);
  color: var(--crimson);
  border-bottom: 2px solid var(--gold);
  font-size: 1.35rem;
  padding-bottom: 0.15em;
}
.paper .prose,
.statblock .prose {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.5;
  max-width: none;
}
.paper table th,
.paper table td {
  border-color: var(--border);
}
.paper .tag {
  background: var(--parchment-2);
  border-color: var(--rule);
  color: var(--ink-soft);
}


/* Dark theme: the same sheets in dark leather, bronze lines and warm ink.
   Screen only, so printed sheets stay parchment-and-ink. */
@media screen {
  [data-theme='dark'] .paper,
  [data-theme='dark'] .statblock {
    --ink: #ece3d0;
    --ink-soft: #b5a68a;
    --crimson: #e58b72;
    --crimson-2: #f0a088;
    --gold: #c99a3e;
    --gold-soft: #e2bf72;
    --rule: #8a7350;
    --parchment: #1c1915;
    --parchment-2: #2a251e;
    --parchment-3: #3a3226;
    --text: #ece3d0;
    --muted: #b5a68a;
    --border: #4a3f30;
    --surface: #221e18;
    --surface-2: #2a251e;
    --accent: #e58b72;
    --link: #f0b45a;
    --wl-character: #8fb7ff;
    --wl-npc: #ff9a8f;
    --wl-location: #74dba6;
    --wl-map: #f0b45a;
    --wl-article: #cfadff;
    --sheet-box: #221e18;
    --sheet-line: #a88b5e;
    --sheet-rule: #6b5a43;
    --sheet-hi: #2c2720;
    --hp-track: #3a3226;
    --hp-a: #b8402f;
    --hp-b: #e8705a;
    --coin-gold: #c99a3e;
    --coin-gold-bg: #3a2f1a;
    --paper-texture:
      radial-gradient(ellipse at 15% 0%, rgba(201, 154, 62, 0.1), transparent 55%),
      radial-gradient(ellipse at 90% 100%, rgba(157, 42, 36, 0.12), transparent 60%);
    --sb-bg: #1f1b16;
    --sb-red: #e8907a;
    --sb-border: #b9802a;
    --sb-outline: #3d3427;
    --sb-taper: #c0533a;
    --sb-sheen: rgba(255, 255, 255, 0.03);
    --sb-shadow: rgba(0, 0, 0, 0.45);
  }
  [data-theme='dark'] .paper {
    border: 1px solid #3a3226;
  }
}

/* ---------------------------------------------------------------- character sheet */

.sheet {
  --box-border: 2px solid var(--sheet-line);
  font-size: 0.98rem;
}
.sheet-header {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 2fr;
  gap: 1rem;
  align-items: stretch;
  margin-bottom: 1.2rem;
}
.sheet-name {
  border: var(--box-border);
  border-radius: 10px 0 0 10px;
  padding: 0.6rem 1rem;
  background: var(--sheet-box);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.sheet-name .value {
  font-family: var(--font-head);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--ink);
}
.sheet-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.2rem 1rem;
  border: var(--box-border);
  border-radius: 0 10px 10px 0;
  padding: 0.6rem 1rem;
  background: var(--sheet-box);
}
.sf .value {
  border-bottom: 1px solid var(--sheet-rule);
  min-height: 1.5em;
  font-size: 1.02rem;
}
.sf .label,
.sheet .label {
  font-family: var(--font-head);
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}
.sheet-body {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(0, 1.2fr) minmax(0, 1.1fr);
  gap: 1rem;
  align-items: start;
}
.sheet-col {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
.sheet-box {
  border: var(--box-border);
  border-radius: 10px;
  padding: 0.6rem 0.8rem;
  background: var(--sheet-box);
  position: relative;
}
.sheet-box > .box-title {
  text-align: center;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
  margin-top: 0.4rem;
}
.abil-skills {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 0.8rem;
}
.ability-col {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  background: var(--sheet-line);
  padding: 0.5rem 0.35rem;
  border-radius: 10px;
}
.ability {
  background: var(--sheet-box);
  border-radius: 10px 10px 30% 30% / 10px 10px 18px 18px;
  text-align: center;
  padding: 0.25rem 0.2rem 0.85rem;
  position: relative;
}
.ability .name {
  font-family: var(--font-head);
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}
.ability .mod {
  font-family: var(--font-head);
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.1;
}
.ability .score {
  position: absolute;
  left: 50%;
  bottom: -0.55rem;
  transform: translateX(-50%);
  background: var(--sheet-box);
  border: 2px solid var(--sheet-line);
  border-radius: 50%/45%;
  min-width: 2.4rem;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0 0.3rem;
}
.pill-stat {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  border: var(--box-border);
  border-radius: 999px;
  background: var(--sheet-box);
  padding: 0.2rem 0.8rem 0.2rem 0.25rem;
  margin-bottom: 0.6rem;
}
.pill-stat .num {
  border: 2px solid var(--sheet-line);
  border-radius: 50%;
  width: 2.3rem;
  height: 2.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-family: var(--font-head);
  background: var(--sheet-hi);
}
.pill-stat .label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--ink);
}
.prof-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.prof-list li {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.9rem;
  padding: 0.07rem 0;
}
.prof-list .val {
  width: 2.1rem;
  text-align: center;
  border-bottom: 1px solid var(--sheet-rule);
  font-weight: 600;
}
.prof-list .ab {
  color: var(--ink-soft);
  font-size: 0.75rem;
  margin-left: auto;
  text-transform: uppercase;
}
.bubble {
  width: 0.8rem;
  height: 0.8rem;
  border: 1.5px solid var(--sheet-line);
  border-radius: 50%;
  flex: none;
  background: var(--sheet-hi);
}
.bubble.on {
  background: var(--sheet-line);
}
.bubble.expert {
  background: var(--sheet-line);
  box-shadow:
    0 0 0 2px var(--sheet-box),
    0 0 0 3.5px var(--sheet-line);
}
.combat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
  margin-bottom: 0.8rem;
}
.shield,
.stat-square {
  border: var(--box-border);
  background: var(--sheet-box);
  text-align: center;
  padding: 0.4rem 0.2rem 0.3rem;
}
.shield {
  clip-path: polygon(0 0, 100% 0, 100% 62%, 50% 100%, 0 62%);
  padding-bottom: 1.1rem;
  background: var(--sheet-line);
  position: relative;
}
.shield .ac-note {
  font-size: 0.62rem;
  line-height: 1.15;
  color: var(--ink-soft);
  font-style: italic;
  margin-bottom: 0.1rem;
}
.shield .inner {
  background: var(--sheet-box);
  clip-path: polygon(0 0, 100% 0, 100% 62%, 50% 100%, 0 62%);
  margin: -0.2rem;
  padding: 0.4rem 0.2rem 1.1rem;
}
.stat-square {
  border-radius: 8px;
}
.big {
  font-family: var(--font-head);
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.2;
}
.hp-box .hp-max {
  font-size: 0.85rem;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--sheet-rule);
  padding-bottom: 0.2rem;
}
.hp-box .big {
  text-align: center;
  padding: 0.3rem 0;
}
.hp-bar {
  height: 8px;
  background: var(--hp-track);
  border-radius: 99px;
  overflow: hidden;
}
.hp-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--hp-a), var(--hp-b));
}
.two-boxes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}
.death-saves .row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-family: var(--font-head);
  text-transform: uppercase;
}
.death-saves .dots {
  display: flex;
  gap: 0.2rem;
}
.sheet-table {
  margin: 0;
  font-size: 0.9rem;
}
.sheet-table th {
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--sheet-rule);
}
.trait-box .prose,
.sheet-box .prose {
  font-size: 0.95rem;
}
.trait-box .prose p:first-child {
  margin-top: 0;
}
.trait-box .prose p:last-child {
  margin-bottom: 0;
}
.trait-box + .trait-box {
  margin-top: -0.4rem;
}
.currency {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 0.6rem;
}
.coin {
  border: 2px solid var(--sheet-line);
  border-radius: 999px;
  padding: 0.05rem 0.55rem;
  font-size: 0.85rem;
  background: var(--sheet-hi);
}
.coin b {
  font-family: var(--font-head);
  font-size: 0.65rem;
  text-transform: uppercase;
  margin-right: 0.25rem;
  color: var(--ink-soft);
}
.coin.gp {
  border-color: var(--coin-gold);
  background: var(--coin-gold-bg);
}
.sheet-section {
  margin-top: 1.6rem;
}
.spell-head {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.6rem;
  margin-bottom: 1rem;
}
.spell-levels {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.8rem;
}
.spell-level h4 {
  margin: 0 0 0.3rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--sheet-line);
  color: var(--sheet-box);
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-size: 0.85rem;
}
.spell-level ul {
  list-style: none;
  margin: 0;
  padding: 0 0.3rem;
}
.spell-level li {
  display: flex;
  gap: 0.4rem;
  align-items: baseline;
  border-bottom: 1px solid var(--border);
  padding: 0.12rem 0;
  font-size: 0.93rem;
}
.spell-level li .note {
  color: var(--ink-soft);
  font-size: 0.8rem;
  margin-left: auto;
  text-align: right;
}
.slots {
  font-size: 0.75rem;
  font-family: var(--font-body);
  display: flex;
  gap: 0.15rem;
  align-items: center;
}
.slots .pip {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  border: 1.5px solid var(--sheet-box);
}
.slots .pip.used {
  background: var(--sheet-box);
}

/* ---------------------------------------------------------------- NPC stat block */

.statblock {
  background: var(--sb-bg);
  background-image: linear-gradient(180deg, var(--sb-sheen), transparent 40%);
  border-top: 5px solid var(--sb-border);
  border-bottom: 5px solid var(--sb-border);
  box-shadow:
    0 0 0 1px var(--sb-outline),
    0 4px 14px var(--sb-shadow);
  padding: 0.8rem 1.1rem 1rem;
  font-size: 0.98rem;
  margin-bottom: 1.5rem;
}
.statblock h2 {
  font-family: var(--font-head);
  font-variant: small-caps;
  font-size: 1.7rem;
  color: var(--sb-red);
  border: 0;
  margin: 0;
  padding: 0;
}
.statblock .sb-sub {
  font-style: italic;
  margin: 0 0 0.3rem;
}
.taper {
  height: 5px;
  margin: 0.5rem 0;
  background: var(--sb-taper);
  clip-path: polygon(0 0, 100% 50%, 0 100%);
  border: 0;
}
.statblock .sb-line {
  color: var(--sb-red);
  margin: 0.15rem 0;
}
.statblock .sb-line b {
  color: var(--sb-red);
}
.statblock .sb-line span {
  color: var(--ink);
}
.statblock .sb-abilities {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  text-align: center;
  color: var(--sb-red);
  margin: 0.3rem 0;
}
.statblock .sb-abilities b {
  display: block;
  font-family: var(--font-head);
}
.statblock .sb-abilities span {
  color: var(--ink);
}
.statblock h3 {
  font-family: var(--font-head);
  font-variant: small-caps;
  color: var(--sb-red);
  border-bottom: 1px solid var(--sb-red);
  font-size: 1.25rem;
  margin: 1rem 0 0.4rem;
  font-weight: 400;
}
.statblock .prose p {
  margin: 0.35rem 0;
}
.statblock .prose strong em,
.statblock .prose em strong {
  color: var(--ink);
}


@media (max-width: 1100px) {
  .sheet-body {
    grid-template-columns: 1fr 1fr;
  }
  .sheet-body .sheet-col:last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 900px) {
  .sheet-header {
    grid-template-columns: 1fr;
  }
  .sheet-name,
  .sheet-fields {
    border-radius: 10px;
  }
  .spell-head {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .paper {
    padding: 0.9rem;
  }
  .sheet-body {
    grid-template-columns: 1fr;
  }
  .sheet-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .statblock .sb-abilities {
    grid-template-columns: repeat(3, 1fr);
    row-gap: 0.4rem;
  }
}
