/* Hero overview (/heroes): candlelit, gothic. Scoped under .heroes. */
.heroes {
  --h-ink: #17110d;
  --h-surface: #211812;
  --h-raise: #2c2018;
  --h-bone: #e8dcc4;
  --h-dim: #a8977d;
  --h-torch: #e3a548;
  --h-blood: #9a2a22;
  --h-heal: #8fbf7f;
  --h-stress: #b49ae0;
  --h-line: rgba(232, 220, 196, 0.13);
  --h-gothic: "Grenze Gotisch", "Palatino Linotype", serif;
  --h-text: "Alegreya Sans", system-ui, sans-serif;

  font-family: var(--h-text);
  font-size: 1.0625rem;
  line-height: 1.5;
  color: var(--h-bone);
}
.heroes :focus-visible { outline: 2px solid var(--h-torch); outline-offset: 3px; border-radius: 4px; }
.h-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Type */
.h-display {
  font-family: var(--h-gothic);
  font-weight: 700;
  font-size: clamp(2.6rem, 7vw, 4.25rem);
  line-height: 0.95;
  letter-spacing: 0.01em;
  color: var(--h-bone);
  text-shadow: 0 0 28px rgba(227, 165, 72, 0.25);
}
.h-display--hero { font-size: clamp(3.2rem, 11vw, 6.5rem); }
.h-heading {
  font-family: var(--h-gothic);
  font-weight: 500;
  font-size: clamp(1.9rem, 4.5vw, 2.6rem);
  line-height: 1;
  color: var(--h-torch);
}
.h-lead { color: var(--h-dim); max-width: 62ch; margin-top: 0.5rem; }

/* Index */
.h-intro { padding: 0.5rem 0 1.75rem; }
.h-intro .h-lead { font-size: 1.15rem; }
.h-filters { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.25rem; }
.h-seg { display: inline-flex; border: 1px solid var(--h-line); border-radius: 999px; padding: 2px; }
.h-seg .h-chip { border: 0; }
.h-chip {
  font: inherit; font-size: 0.95rem; color: var(--h-dim);
  padding: 0.35rem 0.9rem; border-radius: 999px; border: 1px solid var(--h-line);
  background: transparent; cursor: pointer;
}
.h-chip:hover { color: var(--h-bone); }
.h-chip[aria-pressed="true"] { background: var(--h-raise); color: var(--h-bone); }
.h-chip--heal[aria-pressed="true"] { color: var(--h-heal); border-color: currentColor; }
.h-chip--stress[aria-pressed="true"] { color: #ece6da; border-color: currentColor; }
.h-chip--light[aria-pressed="true"] { color: #f3d27a; border-color: currentColor; }

.h-roster { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr)); }
.h-roster > li[hidden] { display: none; }
.h-tile {
  display: grid; grid-template-rows: 11rem auto; height: 100%;
  background: var(--h-surface); border: 1px solid var(--h-line); border-radius: 10px; overflow: hidden;
  transition: border-color 0.15s;
}
.h-tile:hover { border-color: rgba(227, 165, 72, 0.5); }
.h-tile:hover .h-tile__name { color: var(--h-torch); }
.h-tile__art {
  position: relative; overflow: hidden;
  background: radial-gradient(ellipse 70% 90% at 50% 100%, rgba(227, 165, 72, 0.22), transparent 70%), var(--h-ink);
}
.h-tile__art img { position: absolute; inset: 0.5rem 0 0; width: 100%; height: calc(100% - 0.5rem); object-fit: contain; object-position: 50% 100%; }
.h-tile__art--cut img { inset: 0; height: 100%; object-fit: cover; object-position: 50% 30%; }
.h-tile__body { padding: 0.9rem 1rem 1rem; display: flex; flex-direction: column; gap: 0.75rem; }
.h-tile__head { display: flex; gap: 0.75rem; align-items: center; }
.h-portrait { width: 2.75rem; height: 2.75rem; border-radius: 6px; object-fit: cover; border: 1px solid var(--h-line); }
.h-tile__name { font-family: var(--h-gothic); font-weight: 700; font-size: 1.75rem; line-height: 1; transition: color 0.15s; }
.h-tile__kind { color: var(--h-dim); font-size: 0.85rem; }
.h-empty { color: var(--h-dim); padding: 2rem 0; }

/* Stats */
.h-stats { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; }
.h-stats dt { color: var(--h-dim); font-size: 0.85rem; }
.h-stats dt .h-ico { height: 1.5rem; width: auto; display: block; }
.h-stats--compact dt .h-ico { height: 1.25rem; }
.h-stats dd { font-family: var(--h-gothic); font-size: 1.6rem; line-height: 1.1; }
.h-stats dd .rt-img { font-size: 1rem; }
.h-stats--compact { gap: 0.25rem 1.25rem; }
.h-stats--compact > div { display: flex; align-items: center; gap: 0.4rem; }
.h-stats--compact dd { font-size: 1.3rem; }

/* Badges: one pill per effect */
.h-badges { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.h-badge {
  display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.25rem 0.6rem; border-radius: 999px; border: 1px solid currentColor;
}
.h-badge .h-ico { display: block; height: 1.5rem; width: auto; }
.h-badge .h-badge__self { height: 0.95rem; border-radius: 2px; }
.h-badge__party { display: inline-flex; }
.h-badge .h-badge__token { height: 1.35rem; }
.h-badge__party .h-ico { height: 1.2rem; }
.h-badge__party .h-ico + .h-ico { margin-left: -0.45rem; filter: brightness(0.8); }
.h-badge__sign { font-family: var(--h-gothic); font-weight: 700; font-size: 1.3rem; line-height: 1; margin: 0 -0.1rem; }
.h-badge--heal { color: var(--h-heal); background: rgba(143, 191, 127, 0.08); }
.h-badge--stress { color: #ece6da; background: rgba(236, 230, 218, 0.07); }
.h-badge--light { color: #f3d27a; background: rgba(243, 210, 122, 0.08); }
.h-badge--none { color: rgba(168, 151, 125, 0.7); border-color: var(--h-line); }
.h-badge--none .h-ico { filter: grayscale(1) brightness(0.55); opacity: 0.6; }
.h-badges--tight { margin-left: auto; justify-content: flex-end; }

/* Formation: the stance icons themselves are the heat — grey, lit, glowing. Enemies on the right. */
.h-formation { display: flex; align-items: center; gap: 6px; }
.h-rank { position: relative; display: flex; flex-direction: column; align-items: center; gap: 0.3rem; }
.h-rank__icon {
  display: block; width: 100%; height: auto; border-radius: 4px;
  outline: 1px solid rgba(247, 243, 136, 0.12);
  filter: brightness(0.55) saturate(0); opacity: 0.6;
  transition: filter 0.2s;
}
.h-rank[data-heat="1"] .h-rank__icon { filter: none; opacity: 1; outline-color: rgba(247, 243, 136, 0.35); }
.h-rank[data-heat="2"] .h-rank__icon {
  filter: brightness(1.15) saturate(1.15); opacity: 1; outline-color: rgba(247, 243, 136, 0.9);
  box-shadow: 0 0 10px rgba(247, 243, 136, 0.55), 0 0 26px rgba(227, 165, 72, 0.45);
}
.h-rank__count { font-size: 0.8rem; line-height: 1; color: rgba(232, 220, 196, 0.45); font-variant-numeric: tabular-nums; }
.h-rank[data-heat="2"] .h-rank__count { color: var(--h-torch); }
.h-formation__enemy { align-self: stretch; display: flex; align-items: center; padding-left: 4px; border-left: 2px solid rgba(154, 42, 34, 0.7); }
.h-formation--small .h-rank { width: 2.6rem; }
.h-formation--small .h-formation__enemy-icon { width: 0.9rem; height: auto; }
.h-formation--large { gap: clamp(0.6rem, 3vw, 1.5rem); margin-top: 1.5rem; padding: 0.5rem 0; }
.h-formation--large .h-rank { width: clamp(3.75rem, 17vw, 6.5rem); }
.h-formation--large .h-rank[data-heat="2"] .h-rank__icon { box-shadow: 0 0 16px rgba(247, 243, 136, 0.55), 0 0 44px rgba(227, 165, 72, 0.5); }
.h-formation--large .h-rank__count { font-size: 0.95rem; }
.h-formation--large .h-formation__enemy { padding-left: clamp(0.5rem, 2vw, 1rem); }
.h-formation--large .h-formation__enemy-icon { width: clamp(1.4rem, 5vw, 2rem); height: auto; }

/* Hero page */
.h-backlink { display: inline-block; color: var(--h-dim); font-size: 0.95rem; margin-bottom: 1rem; }
.h-backlink:hover { color: var(--h-torch); }
.h-hero { display: grid; gap: 1.5rem; grid-template-columns: minmax(0, 1fr); align-items: end; padding-bottom: 1rem; }
.h-hero__art {
  height: clamp(11rem, 45vw, 24rem); position: relative;
  background: radial-gradient(ellipse 60% 70% at 50% 100%, rgba(227, 165, 72, 0.3), transparent 70%);
  border-bottom: 1px solid var(--h-line);
}
.h-hero__art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; object-position: 50% 100%; }
.h-hero__art--cut img { object-fit: cover; object-position: 50% 30%; border-radius: 10px; mask-image: radial-gradient(ellipse 75% 85% at 50% 45%, #000 55%, transparent 100%); }
.h-hero__info { display: flex; flex-direction: column; gap: 1rem; }
.h-jump { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.h-jump a { font-size: 0.95rem; padding: 0.3rem 0.85rem; border-radius: 999px; border: 1px solid var(--h-line); color: var(--h-dim); }
.h-jump a:hover { color: var(--h-torch); border-color: rgba(227, 165, 72, 0.5); }
@media (min-width: 768px) {
  .h-hero { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); }
  .h-hero__art { border-bottom: 0; }
}
.h-display--hero { overflow-wrap: anywhere; }

.h-section { padding-top: 3rem; scroll-margin-top: 4.5rem; }
.h-section--first { padding-top: 1.5rem; }

/* Abilities */
.h-abilities { display: flex; flex-direction: column; gap: 1rem; margin-top: 1.5rem; }
.h-ability { background: var(--h-surface); border: 1px solid var(--h-line); border-radius: 10px; padding: 1rem; }
.h-ability__head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; }
.h-ability__icon { width: 3rem; height: 3rem; border-radius: 6px; border: 1px solid rgba(227, 165, 72, 0.4); object-fit: cover; }
.h-ability__title h3 { font-family: var(--h-gothic); font-weight: 700; font-size: 1.6rem; line-height: 1.05; }
.h-pips { display: flex; gap: 3px; margin-top: 0.3rem; }
.h-pips { gap: 4px; }
.h-pips li { width: 1.6rem; height: 1.6rem; border-radius: 3px; overflow: hidden; outline: 0.5px solid rgba(247, 243, 136, 0.15); }
.h-pips li img { width: 100%; height: 100%; display: block; filter: brightness(0.6) saturate(0); opacity: 0.55; }
.h-pips li.is-on { outline-color: rgba(247, 243, 136, 0.7); box-shadow: 0 0 6px rgba(247, 243, 136, 0.25); }
.h-pips li.is-on img { filter: none; opacity: 1; }

.h-levels { display: grid; gap: 1rem; margin-top: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); }
.h-levels--rules { grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr)); }
.h-levels--herocards { grid-template-columns: repeat(auto-fill, minmax(min(100%, 13rem), 17rem)); }
.h-level { display: flex; flex-direction: column; gap: 0.6rem; min-width: 0; position: relative; }
.h-level__label { color: var(--h-torch); font-family: var(--h-gothic); font-size: 1.25rem; line-height: 1; }
.h-level__cards { display: flex; gap: 0.5rem; }
.h-level__cards > * { flex: 1 1 0; min-width: 0; }

.h-cardimg { display: block; padding: 0; border: 0; background: none; cursor: zoom-in; border-radius: 6px; overflow: hidden; }
.h-cardimg img { width: 100%; height: auto; display: block; }
.h-cardimg--missing {
  display: grid; place-items: center; aspect-ratio: 3 / 2; padding: 0.5rem; text-align: center;
  color: var(--h-dim); font-size: 0.85rem; border: 1px dashed var(--h-line); cursor: default;
}

.h-form { font-weight: 700; color: var(--h-torch); font-size: 0.95rem; }
.h-effects { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.95rem; line-height: 1.6; }
.h-effects > div { display: block; }
.h-effects dt { color: var(--h-dim); font-size: 0.82rem; }
.h-effects .h-effects__roll { display: flex; gap: 1.25rem; }
.h-effects .h-effects__roll dd { font-family: var(--h-gothic); font-size: 1.15rem; }

.rt-img { display: inline-block; width: auto; margin: 0 0.1em; }
.rt-dmg { height: 1.3em; vertical-align: -0.35em; margin-left: 0.3em; }
.rt-num { font-family: var(--h-gothic); font-size: 1.1em; }
.rt-accent { color: var(--h-torch); }

.h-hamlet { font-size: 0.95rem; line-height: 1.6; display: flex; flex-direction: column; gap: 0.35rem; }
.h-hamlet__title { color: var(--h-bone); font-weight: 500; }
.h-hamlet p:not(.h-hamlet__title) { color: var(--h-dim); }

/* Special rules */
.h-rules { display: flex; flex-direction: column; gap: 1rem; margin-top: 1.5rem; }
.h-rule {
  display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr);
  background: var(--h-surface); border: 1px solid var(--h-line); border-radius: 10px; padding: 1rem;
}
.h-rule h3 { font-family: var(--h-gothic); font-weight: 700; font-size: 1.6rem; line-height: 1.05; margin-bottom: 0.5rem; }
.h-rule__text { display: flex; flex-direction: column; gap: 0.6rem; max-width: 68ch; }
.h-rule__symbol { display: flex; gap: 0.6rem; align-items: flex-start; }
.h-rule__symbol > img { width: 2rem; height: 2rem; object-fit: contain; flex: none; }
.h-rule strong { color: var(--h-torch); font-weight: 700; }
@media (min-width: 900px) {
  .h-rule:has(.h-cardimg) { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
}

/* Lightbox */
.h-lightbox { background: transparent; border: 0; padding: 0; max-width: 100vw; max-height: 100vh; margin: auto; }
.h-lightbox::backdrop { background: rgba(10, 7, 5, 0.88); }
.h-lightbox img { max-width: min(94vw, 900px); max-height: 86vh; width: auto; height: auto; border-radius: 8px; cursor: zoom-out; }
.h-lightbox__close {
  display: block; margin: 0.75rem auto 0; font: inherit; color: #e8dcc4;
  background: rgba(44, 32, 24, 0.9); border: 1px solid rgba(232, 220, 196, 0.2); border-radius: 999px; padding: 0.35rem 1.1rem;
}

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

.h-level__cards:not(:has(*)) { display: none; }

/* Phones: levels side by side, swiped */
@media (max-width: 639px) {
  .h-levels {
    display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 0.75rem;
    margin-inline: -1rem; padding: 0 1rem 0.5rem; scroll-padding-inline: 1rem;
  }
  .h-levels > .h-level { flex: 0 0 84%; scroll-snap-align: start; }
  .h-levels--herocards > .h-level { flex-basis: 70%; }
  .h-ability, .h-rule { padding: 0.85rem; }
  .h-ability .h-levels { margin-inline: -0.85rem; padding-inline: 0.85rem; scroll-padding-inline: 0.85rem; }
}

/* A hero card level with two faces (Abomination: human / beast) takes two columns. */
.h-levels--herocards .h-level:has(.h-cardimg + .h-cardimg) { grid-column: span 2; }
