/* Hammerborn theme — self-sufficient. MADS CDN provides utility classes we don't rely on for layout.
   Version 0.5 — post-diagnostic clean. */

:root {
  /* Palette */
  --forge-red:   #8B0000;
  --ember:       #c94a00;
  --ember-hi:    #ffb347;
  --ember-lo:    #ff9433;
  --ash:         #f5f5f0;
  --ash-dim:     #a8a8a0;
  --soot:        #050303;
  --soot-mid:    #1a0f0f;
  --soot-hi:     #2a1a1a;
  --angelwork:   #5a8a55;

  /* Fonts */
  --font-display: 'EB Garamond', Georgia, 'Times New Roman', serif;
  --font-body:    'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, 'SF Mono', monospace;

  /* Override MADS variables so any cx-* class we DO opt in uses forge palette */
  --cx-bg-void:       var(--soot);
  --cx-bg-deep:       #0a0505;
  --cx-bg-base:       #0f0808;
  --cx-bg-surface:    var(--soot-mid);
  --cx-bg-raised:     var(--soot-hi);
  --cx-accent:        var(--ember);
  --cx-accent-glow:   var(--ember-hi);
  --cx-purple-500:    var(--ember);
  --cx-purple-700:    var(--forge-red);
  --cx-danger:        var(--forge-red);
  --cx-ash:           var(--ash);
  --cx-ash-dim:       var(--ash-dim);
  --cx-forge-500:     var(--ember);
  --cx-forge-700:     var(--forge-red);
  --cx-angelwork:     var(--angelwork);
  --cx-font-display:  var(--font-display);
  --cx-font-body:     var(--font-body);
  --cx-font-mono:     var(--font-mono);
}

/* ============================================================
   Global reset + body
   ============================================================ */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  padding: 0;
  background: var(--soot);
  color: var(--ash);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}
::selection { background: var(--forge-red); color: var(--ash); }

h1, h2, h3, h4 {
  font-family: var(--font-display) !important;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ember);
  margin: 0 0 0.5em;
}
/* MADS injects `h1 { font-size: 1.25rem !important }` globally — neutralize it. */
h1 { font-size: 2.5rem !important; }
h2 { font-size: 2rem !important; }
h3 { font-size: 1.5rem !important; }
h4 { font-size: 1.2rem !important; }

.hb-home-hero .hb-title { font-size: clamp(38px, 13vw, 160px) !important; color: var(--ember) !important; overflow-wrap: anywhere; word-break: break-word; max-width: 100%; padding-inline: 4px; }
@media (max-width: 480px) {
  .hb-home-hero { padding: 60px 12px 40px !important; }
  .hb-home-hero .hb-title {
    font-size: clamp(24px, 9vw, 44px) !important;
    letter-spacing: -0.02em !important;
    line-height: 1.05 !important;
    max-width: 100% !important;
  }
  .hb-home-hero .hb-tagline { font-size: 15px !important; }
}
@media (max-width: 380px) {
  .hb-home-hero .hb-title { font-size: 30px !important; }
}
.hb-page-header h1 { font-size: clamp(36px, 6vw, 64px) !important; color: var(--ember) !important; }

a { color: var(--ember); }
a:hover { color: var(--ember-hi); }

/* ============================================================
   Skip-link (WCAG)
   ============================================================ */
.hb-skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  padding: 12px 20px;
  background: var(--ember);
  color: var(--soot);
  font-weight: 600;
  text-decoration: none;
  border-radius: 0 0 6px 0;
}
.hb-skip:focus { left: 0; outline: 3px solid var(--ember-hi); }

/* ============================================================
   Nav
   ============================================================ */
.hb-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(5, 3, 3, 0.94);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--forge-red);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.hb-nav .brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--ember);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
}
.hb-nav .brand::before {
  content: '';
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--forge-red);
  box-shadow: 0 0 10px var(--ember);
  animation: hb-pulse 2s ease-in-out infinite;
}
@keyframes hb-pulse {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50%      { opacity: 1;   transform: scale(1.2); }
}
.hb-nav-links { display: flex; gap: 4px; flex-wrap: wrap; }
.hb-nav-links a {
  color: var(--ash);
  text-decoration: none;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 3px;
  transition: all 0.15s;
  border: 1px solid transparent;
}
.hb-nav-links a:hover {
  color: var(--ember);
  background: rgba(139, 0, 0, 0.15);
}
.hb-nav-links a.active {
  color: var(--ember);
  background: rgba(139, 0, 0, 0.28);
  border-color: var(--forge-red);
}
.hb-nav-links a:focus-visible {
  outline: 2px solid var(--ember);
  outline-offset: 2px;
}
.hb-nav-badge {
  margin-left: auto;
  padding: 4px 10px;
  background: var(--forge-red);
  color: var(--ash);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  border-radius: 3px;
}

/* ============================================================
   Home hero
   ============================================================ */
.hb-home-hero {
  position: relative;
  min-height: 82vh;
  padding: 80px 24px 60px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background:
    radial-gradient(ellipse at bottom, rgba(201, 74, 0, 0.22) 0%, transparent 70%),
    linear-gradient(180deg, var(--soot) 0%, var(--soot-mid) 100%);
  overflow: hidden;
  isolation: isolate;
}
.hb-home-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url('/art/T7_hammerborn_v2.jpg') center/cover;
  opacity: 0.25;
  filter: blur(1px) brightness(0.75);
  z-index: -1;
}
.hb-home-hero .hb-title {
  font-family: var(--font-display);
  font-size: clamp(38px, 13vw, 160px);
  font-weight: 700;
  color: var(--ember);
  line-height: 0.95;
  margin: 0 0 20px;
  letter-spacing: 0.02em;
  text-shadow:
    0 0 20px rgba(201, 74, 0, 0.6),
    0 0 60px rgba(139, 0, 0, 0.4);
  animation: hb-title-glow 4s ease-in-out infinite;
}
@keyframes hb-title-glow {
  0%, 100% { text-shadow: 0 0 20px rgba(201, 74, 0, 0.6), 0 0 60px rgba(139, 0, 0, 0.4); }
  50%      { text-shadow: 0 0 30px rgba(201, 74, 0, 0.8), 0 0 80px rgba(255, 179, 71, 0.5); }
}
.hb-home-hero .hb-tagline {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(20px, 2.6vw, 30px);
  color: var(--ash);
  max-width: 720px;
  margin: 0 0 36px;
  line-height: 1.4;
  opacity: 0.94;
}
.hb-home-hero .hb-badges {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 720px;
  margin-bottom: 48px;
}
.hb-home-hero .hb-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 20px;
  max-width: 1100px;
  width: 100%;
  margin-bottom: 40px;
}
.hb-home-hero .hb-stat {
  background: rgba(26, 15, 15, 0.7);
  border: 1px solid var(--soot-hi);
  border-radius: 8px;
  padding: 20px 12px;
  text-align: center;
  transition: border-color 0.15s, transform 0.15s;
  backdrop-filter: blur(6px);
}
.hb-home-hero .hb-stat:hover {
  border-color: var(--ember);
  transform: translateY(-2px);
}
.hb-home-hero .hb-stat .n {
  display: block;
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 700;
  color: var(--ember);
  line-height: 1;
  margin-bottom: 6px;
}
.hb-home-hero .hb-stat .l {
  display: block;
  font-size: 11px;
  color: var(--ash-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.hb-home-hero .hb-cta-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

/* ============================================================
   Pills (badges)
   ============================================================ */
.hb-pill {
  display: inline-block;
  padding: 6px 14px;
  background: rgba(139, 0, 0, 0.2);
  border: 1px solid var(--ember);
  border-radius: 20px;
  font-size: 12px;
  color: var(--ember);
  letter-spacing: 0.03em;
}

.hb-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 3px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}
.hb-badge-companion   { background: var(--forge-red); color: var(--ash); }
.hb-badge-protagonist { background: var(--ember); color: var(--soot); }
.hb-badge-antagonist  { background: var(--soot); color: var(--forge-red); border: 1px solid var(--forge-red); }
.hb-badge-romance     { background: var(--angelwork); color: var(--soot); }
.hb-badge-role        { background: var(--soot-hi); color: var(--ash-dim); }
.hb-badge-formal      { background: var(--soot-hi); color: var(--ash-dim); }
.hb-badge-folk        { background: var(--forge-red); color: var(--ash); }
.hb-badge-priestly    { background: var(--ember); color: var(--soot); }
.hb-badge-children    { background: var(--angelwork); color: var(--soot); }
.hb-badge-guild       { background: var(--ash-dim); color: var(--soot); }
.hb-badge-authorrule  { background: rgba(139, 0, 0, 0.4); color: var(--ember-hi); border: 1px solid var(--ember-hi); }

/* ============================================================
   CTAs
   ============================================================ */
.hb-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: var(--ember);
  color: var(--soot);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  border-radius: 6px;
  border: 1px solid var(--ember);
  transition: all 0.15s;
}
.hb-cta:hover {
  background: var(--forge-red);
  color: var(--ash);
  border-color: var(--ember-hi);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(201, 74, 0, 0.35);
}
.hb-cta-ghost {
  background: transparent;
  color: var(--ember);
}
.hb-cta-ghost:hover { background: rgba(201, 74, 0, 0.12); color: var(--ember-hi); }

/* ============================================================
   Page header (non-home pages)
   ============================================================ */
.hb-page-header {
  padding: 60px 24px 40px;
  max-width: 1280px;
  margin: 0 auto;
  border-bottom: 1px solid var(--soot-hi);
}
.hb-page-header h1 {
  font-size: clamp(36px, 6vw, 64px);
  color: var(--ember);
  margin: 0 0 12px;
  text-shadow: 0 0 40px rgba(201, 74, 0, 0.4);
}
.hb-page-header .lede {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 20px;
  color: var(--ash-dim);
  max-width: 720px;
  line-height: 1.4;
  margin: 0;
}
.hb-page {
  padding: 40px 24px 80px;
  max-width: 1280px;
  margin: 0 auto;
}
.hb-page > h2 {
  font-size: clamp(28px, 4vw, 40px);
  color: var(--ember);
  margin: 60px 0 16px;
}
.hb-page > h2:first-child { margin-top: 0; }

/* ============================================================
   Grids
   ============================================================ */
.hb-grid { display: grid; gap: 20px; }
.hb-grid-240 { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.hb-grid-280 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.hb-grid-300 { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.hb-grid-320 { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }

/* ============================================================
   Card base
   ============================================================ */
.hb-card {
  background: var(--soot-mid);
  border: 1px solid var(--soot-hi);
  border-radius: 8px;
  padding: 20px;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.hb-card:hover {
  border-color: var(--ember);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(201, 74, 0, 0.18);
}

/* ============================================================
   Character cards
   ============================================================ */
.hb-char {
  background: var(--soot-mid);
  border: 1px solid var(--soot-hi);
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
}
.hb-char:hover {
  border-color: var(--ember);
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(201, 74, 0, 0.25);
}
.hb-char .portrait-btn {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  display: block;
  width: 100%;
}
.hb-char .portrait-btn:focus-visible {
  outline: 3px solid var(--ember);
  outline-offset: -3px;
}
.hb-char .portrait {
  aspect-ratio: 2 / 3;
  width: 100%;
  object-fit: cover;
  display: block;
  background: var(--soot-hi);
}
.hb-char .portrait.no-img {
  aspect-ratio: 2 / 3;
  background: linear-gradient(135deg, var(--soot-mid), var(--soot-hi));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--forge-red);
  font-family: var(--font-display);
  font-size: 56px;
}
.hb-char .body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}
.hb-char h3 {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--ember);
  margin: 0;
  line-height: 1.2;
}
.hb-char .meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.hb-char .summary {
  font-size: 13px;
  color: var(--ash-dim);
  line-height: 1.5;
  margin: 4px 0 0;
}
.hb-char details { margin-top: 8px; }
.hb-char details summary {
  cursor: pointer;
  color: var(--ember-lo);
  font-size: 12px;
  padding: 6px 0;
  border-top: 1px solid var(--soot-hi);
}
.hb-char details summary:hover { color: var(--ember-hi); }
.hb-char details .detail {
  padding: 12px 0 0;
  font-size: 12px;
  color: var(--ash);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.hb-char details .detail b { color: var(--ember); }
.hb-char .secret {
  color: var(--forge-red);
  font-style: italic;
  border-top: 1px dashed var(--forge-red);
  padding-top: 8px;
  margin-top: 8px;
}

/* ============================================================
   Title cards
   ============================================================ */
.hb-title-card {
  background: var(--soot-mid);
  border: 1px solid var(--soot-hi);
  border-left: 4px solid var(--ember);
  border-radius: 6px;
  padding: 22px;
  transition: transform 0.15s, box-shadow 0.15s;
}
.hb-title-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(201, 74, 0, 0.22);
}
.hb-title-card .num {
  font-family: var(--font-display);
  font-size: 56px;
  color: var(--forge-red);
  opacity: 0.65;
  line-height: 0.85;
  margin-bottom: 8px;
}
.hb-title-card h3 {
  color: var(--ember);
  font-size: 22px;
  margin: 0 0 6px;
}
.hb-title-card .fmt {
  font-size: 12px;
  color: var(--angelwork);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 12px;
}
.hb-title-card p {
  font-size: 13px;
  color: var(--ash-dim);
  margin: 4px 0;
}
.hb-title-card p b { color: var(--ember); }
.hb-title-card .status {
  display: inline-block;
  margin-top: 12px;
  padding: 3px 10px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border-radius: 3px;
  background: var(--soot-hi);
  color: var(--ash-dim);
}
.hb-title-card .status.in-dev { background: var(--ember); color: var(--soot); }

/* ============================================================
   Art tiles
   ============================================================ */
.hb-art-tile {
  aspect-ratio: 4 / 3;
  background: var(--soot-mid);
  border: 1px solid var(--soot-hi);
  border-radius: 6px;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
  position: relative;
  overflow: hidden;
  padding: 0;
  display: block;
}
.hb-art-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.hb-art-tile:hover, .hb-art-tile:focus-visible {
  border-color: var(--ember);
  transform: scale(1.02);
  outline: none;
}
.hb-art-tile:focus-visible { box-shadow: 0 0 0 3px rgba(201, 74, 0, 0.35); }
.hb-art-tile .caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 10px 14px;
  background: linear-gradient(0deg, rgba(5,3,3,0.92), transparent);
  font-size: 12px;
  color: var(--ash);
  opacity: 0;
  transition: opacity 0.15s;
  text-align: left;
}
.hb-art-tile:hover .caption,
.hb-art-tile:focus-visible .caption { opacity: 1; }

/* ============================================================
   Quest cards
   ============================================================ */
.hb-quest-card {
  background: var(--soot-mid);
  border: 1px solid var(--soot-hi);
  border-left: 3px solid var(--ember);
  border-radius: 6px;
  padding: 20px;
}
.hb-quest-card h4 {
  color: var(--ember);
  font-size: 18px;
  margin: 0 0 4px;
}
.hb-quest-card .qmeta {
  font-size: 11px;
  color: var(--angelwork);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 12px;
}
.hb-quest-card .qsummary {
  font-size: 14px;
  color: var(--ash);
  margin: 0 0 14px;
  line-height: 1.5;
}
.hb-quest-card .qres {
  font-size: 12px;
  color: var(--ash-dim);
  padding: 6px 0;
  border-top: 1px dashed var(--soot-hi);
}
.hb-quest-card .qres::before {
  content: '▸ ';
  color: var(--ember);
}

/* ============================================================
   Item cards
   ============================================================ */
.hb-item-card {
  background: var(--soot-mid);
  border: 1px solid var(--soot-hi);
  border-left: 3px solid var(--forge-red);
  border-radius: 6px;
  padding: 16px 18px;
}
.hb-item-card .iname {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--ember);
  margin-bottom: 4px;
}
.hb-item-card .itier {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 10px;
}
.hb-item-card .itier.angelwork    { color: var(--angelwork); }
.hb-item-card .itier.dread-machine{ color: var(--ember); }
.hb-item-card .ispec {
  font-size: 13px;
  color: var(--ash);
  margin-bottom: 6px;
}
.hb-item-card .ilore {
  font-size: 11px;
  color: var(--ash-dim);
  font-style: italic;
}

/* ============================================================
   Glossary
   ============================================================ */
.hb-gloss-search {
  padding: 12px 16px;
  width: 100%;
  max-width: 480px;
  background: var(--soot-mid);
  border: 1px solid var(--forge-red);
  color: var(--ash);
  border-radius: 6px;
  font-size: 15px;
  margin-bottom: 20px;
  font-family: var(--font-body);
}
.hb-gloss-search:focus {
  outline: none;
  border-color: var(--ember);
  box-shadow: 0 0 0 3px rgba(201, 74, 0, 0.2);
}
.hb-gloss-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.hb-gloss-filters button {
  padding: 6px 14px;
  background: var(--soot-mid);
  border: 1px solid var(--soot-hi);
  color: var(--ash-dim);
  border-radius: 20px;
  cursor: pointer;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: all 0.15s;
  font-family: var(--font-body);
}
.hb-gloss-filters button:hover {
  border-color: var(--ember);
  color: var(--ember);
}
.hb-gloss-filters button.active {
  background: var(--ember);
  color: var(--soot);
  border-color: var(--ember);
}
.hb-gloss-item {
  background: var(--soot-mid);
  border-left: 3px solid var(--forge-red);
  padding: 14px 18px;
  border-radius: 4px;
}
.hb-gloss-item .term {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--ember);
  margin-bottom: 4px;
}
.hb-gloss-item .cat-tags {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ash-dim);
  margin-bottom: 10px;
  display: flex;
  gap: 8px;
  align-items: center;
}
.hb-gloss-item .def {
  font-size: 14px;
  color: var(--ash);
  line-height: 1.6;
}

/* ============================================================
   Timeline
   ============================================================ */
.hb-timeline {
  position: relative;
  padding-left: 32px;
  border-left: 2px solid var(--forge-red);
}
.hb-beat {
  position: relative;
  padding: 14px 0 20px 24px;
}
.hb-beat::before {
  content: '';
  position: absolute;
  left: -39px;
  top: 22px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--ember);
  border: 2px solid var(--soot);
  box-shadow: 0 0 12px var(--ember);
}
.hb-beat.era::before {
  background: var(--angelwork);
  box-shadow: 0 0 12px var(--angelwork);
}
.hb-beat .when {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ash-dim);
  margin-bottom: 4px;
}
.hb-beat .title {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--ember);
  margin-bottom: 4px;
}
.hb-beat .desc {
  font-size: 14px;
  color: var(--ash-dim);
  line-height: 1.5;
}

/* ============================================================
   Scenes + dialogue
   ============================================================ */
.hb-scene {
  background: var(--soot-mid);
  border: 1px solid var(--soot-hi);
  border-left: 4px solid var(--ember);
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 20px;
}
.hb-scene .header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}
.hb-scene h3 {
  font-family: var(--font-display);
  color: var(--ember);
  font-size: 24px;
  margin: 0;
}
.hb-scene .meta {
  font-size: 11px;
  color: var(--ash-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  display: flex;
  gap: 12px;
}
.hb-scene .summary {
  font-size: 14px;
  color: var(--ash);
  margin: 12px 0 20px;
  padding-bottom: 14px;
  border-bottom: 1px dashed var(--soot-hi);
}
.hb-scene .dialogue-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.hb-dialogue {
  padding: 12px 16px;
  background: var(--soot-hi);
  border-radius: 6px;
  border-left: 3px solid var(--forge-red);
}
.hb-dialogue.mood-weary       { border-left-color: var(--ash-dim); }
.hb-dialogue.mood-quiet       { border-left-color: var(--forge-red); }
.hb-dialogue.mood-wary        { border-left-color: var(--ember); }
.hb-dialogue.mood-controlled  { border-left-color: var(--angelwork); }
.hb-dialogue.mood-anxious     { border-left-color: var(--ember-hi); }
.hb-dialogue.mood-formal      { border-left-color: var(--ash); }
.hb-dialogue .speaker {
  font-family: var(--font-display);
  color: var(--ember);
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
}
.hb-dialogue .speaker .mood {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ash-dim);
  margin-left: 8px;
  font-weight: normal;
}
.hb-dialogue .text {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 16px;
  color: var(--ash);
  line-height: 1.5;
}
.hb-dialogue .subtext {
  margin-top: 8px;
  font-size: 11px;
  color: var(--ash-dim);
  border-top: 1px solid rgba(255,255,255,0.05);
  padding-top: 6px;
}
.hb-dialogue .beat-trigger {
  margin-top: 6px;
  font-size: 10px;
  color: var(--angelwork);
  font-family: var(--font-mono);
}

/* ============================================================
   Lore snippets
   ============================================================ */
.hb-lore {
  background: var(--soot-mid);
  border: 1px solid var(--soot-hi);
  border-left: 3px solid var(--angelwork);
  border-radius: 6px;
  padding: 20px 22px;
  margin-bottom: 16px;
}
.hb-lore h3 {
  font-family: var(--font-display);
  color: var(--ember);
  font-size: 22px;
  margin: 0 0 6px;
}
.hb-lore .category {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--angelwork);
  margin-bottom: 14px;
}
.hb-lore .text {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 16px;
  color: var(--ash);
  line-height: 1.65;
}
.hb-lore .source {
  margin-top: 14px;
  font-size: 12px;
  color: var(--ash-dim);
  text-align: right;
}
.hb-lore .source::before { content: '— '; }

/* ============================================================
   Lore accordion blocks (world.html)
   ============================================================ */
.hb-lore-block {
  background: var(--soot-mid);
  border: 1px solid var(--soot-hi);
  border-radius: 6px;
  margin-bottom: 12px;
  overflow: hidden;
}
.hb-lore-block > summary {
  padding: 16px 22px;
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--ember);
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.hb-lore-block > summary::after {
  content: '+';
  font-size: 26px;
  color: var(--forge-red);
  transition: transform 0.15s;
}
.hb-lore-block[open] > summary::after { transform: rotate(45deg); }
.hb-lore-block .content {
  padding: 0 22px 22px;
  font-size: 15px;
  line-height: 1.7;
  color: var(--ash);
}
.hb-lore-block .content strong { color: var(--ember); }
.hb-lore-block .content em { color: var(--angelwork); font-style: normal; }

/* ============================================================
   Diagrams
   ============================================================ */
.hb-diagram-card {
  background: var(--soot-mid);
  border: 1px solid var(--soot-hi);
  border-radius: 6px;
  padding: 20px;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
}
.hb-diagram-card:hover {
  border-color: var(--ember);
  transform: translateY(-2px);
}
.hb-diagram-card h4 {
  color: var(--ember);
  font-size: 18px;
  margin: 0 0 6px;
}
.hb-diagram-card p {
  font-size: 13px;
  color: var(--ash-dim);
  margin: 0;
}
.hb-diagram-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(5,3,3,0.98);
  z-index: 1000;
  padding: 20px;
  overflow: auto;
}
.hb-diagram-modal.open { display: block; }
.hb-diagram-modal .content {
  max-width: 1200px;
  margin: 40px auto;
  background: var(--soot-mid);
  border: 1px solid var(--ember);
  border-radius: 8px;
  padding: 30px;
}
.hb-diagram-modal h3 { color: var(--ember); font-family: var(--font-display); margin-bottom: 20px; }
.hb-diagram-modal .close {
  position: fixed;
  top: 20px;
  right: 24px;
  background: none;
  border: none;
  font-size: 32px;
  color: var(--ember);
  cursor: pointer;
  z-index: 1001;
}
.mermaid { background: var(--soot); border-radius: 4px; padding: 20px; }

/* ============================================================
   Lightbox
   ============================================================ */
.hb-modal {
  position: fixed;
  inset: 0;
  background: rgba(5,3,3,0.97);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 40px;
  cursor: pointer;
}
.hb-modal.open { display: flex; }
.hb-modal img {
  max-width: 100%;
  max-height: 100%;
  border: 1px solid var(--ember);
  box-shadow: 0 20px 60px rgba(201, 74, 0, 0.3);
}
.hb-modal .close {
  position: absolute;
  top: 24px;
  right: 28px;
  background: none;
  border: none;
  font-size: 32px;
  color: var(--ember);
  cursor: pointer;
}

/* ============================================================
   Skeleton
   ============================================================ */
.hb-skeleton {
  background: linear-gradient(90deg, var(--soot-mid) 0%, var(--soot-hi) 50%, var(--soot-mid) 100%);
  background-size: 200% 100%;
  animation: hb-shimmer 1.6s ease-in-out infinite;
  border-radius: 4px;
  height: 22px;
  margin-bottom: 10px;
}
@keyframes hb-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ============================================================
   Footer
   ============================================================ */
footer {
  border-top: 1px solid var(--forge-red);
  padding: 40px 24px;
  text-align: center;
  color: var(--ash-dim);
  font-size: 12px;
  background: var(--soot-mid);
}
footer a { color: var(--ember); text-decoration: none; }
footer a:hover { color: var(--ember-hi); }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 768px) {
  .hb-nav {
    flex-direction: column;
    align-items: flex-start;
    padding: 12px 16px;
    gap: 8px;
  }
  .hb-nav-links a { font-size: 12px; padding: 4px 8px; }
  .hb-nav-badge { display: none; }
  .hb-home-hero { padding: 60px 16px 40px; min-height: 70vh; }
  .hb-home-hero .hb-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .hb-page-header, .hb-page { padding-left: 16px; padding-right: 16px; }
}

/* ============================================================
   v0.6 — Better art gallery + compact professional pass
   ============================================================ */

/* Compact professional density */
.hb-page { padding: 32px 24px 60px; }
.hb-page-header { padding: 40px 24px 28px; }
.hb-page > h2 { margin: 40px 0 12px; }
section { padding: 60px 24px; }
.hb-grid { gap: 16px; }
.hb-grid-240 { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.hb-grid-280 { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.hb-grid-300 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.hb-grid-320 { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }

/* Tighter title cards */
.hb-title-card { padding: 18px; }
.hb-title-card .num { font-size: 44px !important; margin-bottom: 4px; }
.hb-title-card h3 { font-size: 20px !important; }
.hb-title-card p { font-size: 12px; }
.hb-title-card .status { font-size: 9px; padding: 2px 8px; }

/* Tighter character cards */
.hb-char h3 { font-size: 18px !important; }
.hb-char .body { padding: 12px; gap: 6px; }
.hb-char .summary { font-size: 12px; }

/* Tighter quest / item cards */
.hb-quest-card { padding: 16px; }
.hb-quest-card h4 { font-size: 16px !important; }
.hb-quest-card .qsummary { font-size: 13px; }
.hb-quest-card .qres { font-size: 11px; padding: 5px 0; }
.hb-item-card { padding: 14px 16px; }
.hb-item-card .iname { font-size: 16px !important; }
.hb-item-card .ispec { font-size: 12px; }
.hb-item-card .ilore { font-size: 10px; }

/* Tighter scenes + dialogue */
.hb-scene { padding: 20px; margin-bottom: 16px; }
.hb-scene h3 { font-size: 20px !important; }
.hb-scene .summary { font-size: 13px; margin: 10px 0 16px; padding-bottom: 12px; }
.hb-dialogue { padding: 10px 14px; }
.hb-dialogue .text { font-size: 14px; }
.hb-dialogue .speaker { font-size: 13px; }

/* Tighter lore */
.hb-lore { padding: 16px 18px; margin-bottom: 12px; }
.hb-lore h3 { font-size: 18px !important; }
.hb-lore .text { font-size: 14px; line-height: 1.55; }

/* ============================================================
   BETTER ART GALLERY (v0.6)
   ============================================================ */
.hb-art-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--soot-hi);
}
.hb-art-chip {
  padding: 6px 14px;
  background: var(--soot-mid);
  border: 1px solid var(--soot-hi);
  color: var(--ash-dim);
  border-radius: 20px;
  cursor: pointer;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  transition: all 0.15s;
  font-family: var(--font-body);
}
.hb-art-chip:hover { border-color: var(--ember); color: var(--ember); }
.hb-art-chip.active { background: var(--ember); color: var(--soot); border-color: var(--ember); }
.hb-art-chip .count {
  margin-left: 6px;
  padding: 1px 6px;
  background: rgba(0,0,0,0.25);
  border-radius: 8px;
  font-size: 10px;
}

/* Masonry-flavored art grid — variable heights */
.hb-art-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  grid-auto-rows: 10px;
  gap: 12px;
}
.hb-art-tile {
  aspect-ratio: unset;
  grid-row: span 20;    /* default row-span; overridden per aspect */
  background: var(--soot-mid);
  border: 1px solid var(--soot-hi);
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(.2,.6,.2,1), border-color 0.15s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
  padding: 0;
  display: block;
}
.hb-art-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s cubic-bezier(.2,.6,.2,1);
}
.hb-art-tile.wide  { grid-row: span 16; }  /* T6 landscape 1536x640 */
.hb-art-tile.tall  { grid-row: span 34; }  /* T3 portrait 832x1216 */
.hb-art-tile.square { grid-row: span 26; } /* T2/T5 square 1024x1024 */
.hb-art-tile.action { grid-row: span 18; } /* T7 action 1344x768 */

.hb-art-tile:hover,
.hb-art-tile:focus-visible {
  border-color: var(--ember);
  box-shadow: 0 12px 40px rgba(201, 74, 0, 0.35);
  outline: none;
  transform: translateY(-2px);
}
.hb-art-tile:hover img,
.hb-art-tile:focus-visible img { transform: scale(1.05); }

.hb-art-tile .overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(5,3,3,0.92) 100%);
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}
.hb-art-tile:hover .overlay,
.hb-art-tile:focus-visible .overlay { opacity: 1; }

.hb-art-tile .meta {
  position: absolute;
  bottom: 12px;
  left: 12px;
  right: 12px;
  color: var(--ash);
  opacity: 0;
  transform: translateY(6px);
  transition: all 0.2s;
}
.hb-art-tile:hover .meta,
.hb-art-tile:focus-visible .meta {
  opacity: 1;
  transform: translateY(0);
}
.hb-art-tile .meta .title {
  font-family: var(--font-display);
  font-size: 13px;
  color: var(--ember);
  margin-bottom: 2px;
  line-height: 1.2;
}
.hb-art-tile .meta .tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.hb-art-tile .meta .tag {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 6px;
  background: rgba(139, 0, 0, 0.85);
  color: var(--ash);
  border-radius: 3px;
}
.hb-art-tile .meta .tag.key-art { background: var(--ember); color: var(--soot); }
.hb-art-tile .meta .tag.marketing { background: var(--angelwork); color: var(--soot); }

/* MADS utility adoption — non-structural (safe) */
.cx-glass, .cx-glass-1, .cx-glass-2, .cx-glass-3 {
  /* Ensure MADS glass utilities pick up our palette when used sparingly */
  border-color: var(--soot-hi) !important;
}
.cx-glow, .cx-glow-accent {
  /* Recolor glows to forge */
  --cx-accent: var(--ember);
}

/* Timeline compact */
.hb-timeline { padding-left: 26px; }
.hb-beat { padding: 10px 0 14px 20px; }
.hb-beat .title { font-size: 17px !important; }
.hb-beat .desc { font-size: 13px; }
.hb-beat::before { left: -33px; top: 16px; width: 12px; height: 12px; }

/* Glossary compact */
.hb-gloss-item { padding: 12px 16px; }
.hb-gloss-item .term { font-size: 17px !important; }
.hb-gloss-item .def { font-size: 13px; }

/* Nav polish */
.hb-nav { padding: 12px 24px; gap: 16px; }
.hb-nav .brand { font-size: 20px; letter-spacing: 0.1em; }
.hb-nav-links a { font-size: 12px; padding: 5px 10px; }
.hb-nav-badge { padding: 3px 8px; font-size: 10px; }

/* Focus visible everywhere */
*:focus-visible {
  outline: 2px solid var(--ember);
  outline-offset: 2px;
  border-radius: 3px;
}

/* ── Subscribe form ─────────────────────────────────────────── */
.hb-subscribe {
  margin-top: 28px;
  max-width: 560px;
}
.hb-sub-label {
  display: block;
  color: var(--ash);
  font-family: var(--font-display);
  font-style: italic;
  font-size: 15px;
  margin-bottom: 10px;
}
.hb-sub-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.hb-sub-input {
  flex: 1 1 220px;
  min-width: 0;
  padding: 12px 14px;
  background: rgba(20, 14, 10, 0.85);
  border: 1px solid rgba(201, 74, 0, 0.35);
  color: var(--ash);
  font-family: var(--font-mono, monospace);
  font-size: 15px;
  border-radius: 4px;
}
.hb-sub-input:focus {
  outline: none;
  border-color: var(--ember);
  box-shadow: 0 0 0 2px rgba(201, 74, 0, 0.25);
}
.hb-sub-btn {
  padding: 12px 22px;
  font-size: 15px;
  cursor: pointer;
  border: 0;
  white-space: nowrap;
}
.hb-sub-msg {
  min-height: 20px;
  margin: 10px 0 0;
  font-family: var(--font-mono, monospace);
  font-size: 13px;
  color: var(--ash-dim);
}
.hb-sub-msg.hb-sub-ok  { color: #7cc06d; }
.hb-sub-msg.hb-sub-err { color: #d24220; }
.hb-sub-fine {
  margin: 6px 0 0;
  font-size: 12px;
  color: rgba(200, 200, 190, 0.5);
}
@media (max-width: 480px) {
  .hb-sub-btn { width: 100%; }
}
