/* Part 11. Google Fonts EB Garamond, served locally with its OFL license.
   The digit-only faces also cover mixed labels (COMPRAR 1 / FASE 1).
   Font selection happens in the browser: no text wrappers or update observers. */
@font-face {
  font-family: 'EB Garamond';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('assets/fonts/ebgaramond-latin.woff2') format('woff2');
}
/* Digits inside Optimus Princeps labels come from EB Garamond. One digit face per weight range of the real faces
   (100-500 regular, 600-900 semibold): Chrome segments a family by identical descriptors, so mismatched ranges would
   leave the letters without the Optimus face. */
@font-face {
  font-family: 'Optimus Princeps';
  font-style: normal;
  font-weight: 100 500;
  font-display: swap;
  src: url('assets/fonts/ebgaramond-latin.woff2') format('woff2');
  unicode-range: U+0025, U+002B-0039, U+00D7, U+2030, U+2212;
}
@font-face {
  font-family: 'Optimus Princeps';
  font-style: normal;
  font-weight: 600 900;
  font-display: swap;
  src: url('assets/fonts/ebgaramond-latin.woff2') format('woff2');
  unicode-range: U+0025, U+002B-0039, U+00D7, U+2030, U+2212;
}
:root {
  --font-body: 'EB Garamond', serif;
  --ui: var(--font-body);
  --body-copy-color: #e5d6c0;
}

/* Reset the earlier all-UI-font rule, including dynamically inserted content. */
body, body * {
  font-family: var(--font-body) !important;
  font-variant-numeric: lining-nums tabular-nums !important;
}
body :is(#appFrame, #authScreen, #hudBackdrop, #dialogBackdrop, #toastStack) * {
  font-family: var(--font-body) !important;
}

/* The UI face (Optimus Princeps) is reserved for short labels, navigation and actions. */
body :is(#appFrame, #authScreen, #hudBackdrop, #dialogBackdrop, #toastStack)
:is(button, button *, label, kbd, dt, .eyebrow, .brand-eyebrow,
    .resource-pill small, .profile-copy small, .hud-panel-heading small,
    .stat-tile small, .quantity-control small, .equip-slot small,
    .zone-index, .zone-requirement, .event-ribbon, .event-instruction,
    .relic-caption, .relic-caption *, .secondary-label, .live-indicator,
    .hero-level-line > span:last-child, .hero-health-line > span,
    .hero-health-footer > span:first-child, .upgrade-rank > span:first-child,
    #announcementKicker, #stageNumber, #stageKills) {
  font-family: var(--font-ui) !important;
  text-transform: uppercase;
  letter-spacing: .06em;
}

/* All data containers, including prices, HP, XP, levels and floating damage.
   Labels containing digits use the EB Garamond unicode-range face above. */
body :is(#appFrame, #authScreen, #hudBackdrop, #dialogBackdrop, #toastStack)
:is(.resource-pill strong, .resource-gain, .stat-tile strong, .attribute-row > b,
    .attribute-row > button, .attribute-total, .attribute-total *,
    .upgrade-rank strong, .journey-row strong, .intel-chance strong,
    .ascension-gain strong, .offline-loot strong, .event-clock, .event-clock *,
    .combat-number, .float-damage, .hero-damage-number, .relic-badge,
    input, select, option, time, .mob-rank, .hp-numbers,
    #levelValue, #heroHPText, #heroRegeneration, #xpLabel,
    #mobLevel, #mobHPText, #bossHUDLevel, #bossHUDValue,
    #inventoryCount, #quickPotionCount, #announcementCounter,
    #respawnCountdown, #runKills, #runGold, #rebirths) {
  font-family: var(--font-body) !important;
  font-variant-numeric: lining-nums tabular-nums !important;
  letter-spacing: normal;
}

/* Prose and secondary messages are readable sentences in every view.
   Descendants are explicit because previous sheets force fonts on each node. */
body :is(#appFrame, #authScreen, #hudBackdrop, #dialogBackdrop, #toastStack)
:is(p, p *, .upgrade-description, .upgrade-description *,
    .attribute-row small, .attribute-quantity > span,
    .upgrade-rank > span:last-child, .stat-tile > span:not(.painted-icon),
    .resource-tooltip, .resource-tooltip *, .toast, .toast *,
    .dialog-copy, .dialog-copy *, .hud-feedback, .hw-note,
    .item-stats, .item-stats *, .item-origin, .item-card .rarity,
    .arsenal-actions > span, .inventory-sale small, .inventory-buff,
    .empty-state, .empty-state strong, .zone-boss-note,
    .node-copy, .node-copy *, .skill-path-header small, .ascension-note,
    .mini-tip, .intel-block span, .intel-chance > span,
    .shortcut-list dd, .screen-effects-control,
    .souls-outcome-copy, .souls-outcome-copy *, .souls-outcome-footer,
    .souls-outcome-footer *, .boss-intro-banner small,
    .log-footer, .battle-instruction, #returnNow) {
  font-family: var(--font-body) !important;
  font-variant: normal !important;
  font-variant-numeric: lining-nums tabular-nums !important;
  text-transform: none !important;
  font-size: max(15px, .9375rem) !important;
  line-height: 1.4 !important;
  letter-spacing: normal !important;
  color: var(--body-copy-color);
  white-space: normal;
  overflow-wrap: anywhere;
}

/* Keep large display headings in the title face (Optimus Princeps); item names use body text. */
body :is(#appFrame, #authScreen, #hudBackdrop, #dialogBackdrop, #toastStack)
:is(h1, h2, .brand-name, .souls-area-announcement strong,
    .souls-boss-heading strong, .boss-intro-banner strong,
    .souls-outcome-title, #dialogTitle, #hudPanelTitle) {
  font-family: var(--font-title) !important;
}
body :is(#appFrame, #authScreen, #hudBackdrop, #dialogBackdrop)
:is(#profileName, #playerHeroName, #combatHeroName, #mobName, .event-title,
    .item-name, .item-top h3, .equip-slot strong) {
  font-family: var(--font-body) !important;
  text-transform: none;
  letter-spacing: normal;
}

/* Prose must not be clipped by old two-line notification limits. */
body #toastStack .toast {
  display: block;
  max-height: none;
  -webkit-line-clamp: unset;
  overflow: visible;
  background-color: #170f13;
}
body #appFrame .resource-tooltip { width: min(19rem, calc(100vw - 1.5rem)); }
body #appFrame .souls-outcome-copy { opacity: 1; }
body #hudBackdrop :is(.upgrade-description, .attribute-row small, .node-copy span,
    .node-copy em, .inventory-sale small, .item-origin) { color: var(--body-copy-color); }
body #hudBackdrop .upgrade-rank { flex-wrap: wrap; gap: .3rem .75rem; }
/* Disabled skill descriptions still need full contrast to explain requirements. */
body #hudBackdrop .skill-node:disabled { opacity: 1; }
body #hudBackdrop :is(.item-card .rarity, .item-stats, .upgrade-description) {
  height: auto;
  max-height: none;
  overflow: visible;
}
/* A single tooltip lives outside scrolling/clipped panels. */
#gameTextTooltip {
  position: fixed;
  z-index: 200;
  width: max-content;
  max-width: min(22rem, calc(100vw - 1rem));
  padding: .6rem .75rem;
  border: 1px solid #98754e;
  background: #180f15;
  color: #e5d6c0;
  font-family: var(--font-body) !important;
  font-size: max(15px, .9375rem);
  line-height: 1.4;
  font-variant: normal;
  font-variant-numeric: lining-nums tabular-nums;
  letter-spacing: normal;
  text-transform: none;
  white-space: normal;
  overflow-wrap: anywhere;
  pointer-events: none;
}
