/* Brand art (logo, race portraits, background and rebirth emblems), the source banner and the
   Character tab's choice cards and race browser. Loaded after app.css and views.css.
   Images come from tools/build-art.mjs; every one is optional (text always stays). */

/* The site's text face: Inter, a variable sans for screens (OFL, assets/fonts/OFL-Inter.txt), Latin, weights 100-900;
   app.css --font. The site's name keeps its own face, Fraunces, a variable serif (OFL, assets/fonts/OFL.txt); everything
   else, the headings and the big numbers too, is Inter, the clearest to read. */
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../fonts/inter-latin-wght.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
    U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Fraunces"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../fonts/fraunces-latin-wght.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
    U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --font-display: var(--font);
  --font-brand: "Fraunces", var(--font);
  --brand-gold: #e9b13b; --brand-indigo: #272059;
  --src-bg: #eef0f8; --src-border: #d9dcef; --src-text: #3c4360;
  --pic-ring: rgba(39, 32, 89, .18);
  --lift: 0 8px 18px -8px rgba(39, 32, 89, .4);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --src-bg: #171b2c; --src-border: #262b44; --src-text: #b9bfd8; --pic-ring: rgba(233, 177, 59, .22); --lift: 0 8px 20px -8px rgba(0, 0, 0, .75); }
}
:root[data-theme="dark"] { --src-bg: #171b2c; --src-border: #262b44; --src-text: #b9bfd8; --pic-ring: rgba(233, 177, 59, .22); --lift: 0 8px 20px -8px rgba(0, 0, 0, .75); }

/* ---- logo and site name ---------------------------------------------------------------------- */
.logo-img { width: 32px; height: 32px; flex: none; display: block; }
.boot .logo-img { width: 40px; height: 40px; }
.brand.brand-box { gap: 9px; }
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.brand-title { margin: 0; font-family: var(--font-brand); font-size: 17px; font-weight: 680; letter-spacing: .005em; white-space: nowrap; }
/* card and dialog headings in the display face (the numbers and controls in them stay system-ui) */
h2 { font-family: var(--font-display); font-weight: 650; letter-spacing: -.01em; }
h2 :is(.muted, .badge, .cnt, .btn, input, select) { font-family: var(--font); letter-spacing: normal; }
h2.lbl { font-family: var(--font); }   /* the summary's small capitals labels ("TOTAL EXP") stay labels */
.sx-name { font-family: var(--font-display); font-weight: 700; letter-spacing: 0; }
.sx-big { font-family: var(--font-display); font-weight: 750; letter-spacing: -.01em; font-variant-numeric: lining-nums tabular-nums; }
/* the boot screen asks for the face too, so it is there when the page draws */
.boot-title { font-family: var(--font-brand); }
/* the indigo outline disappears on the dark surface: a soft gold glow keeps the ring's shape */
:root[data-theme="dark"] .logo-img { filter: drop-shadow(0 0 1px rgba(233, 177, 59, .35)); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .logo-img { filter: drop-shadow(0 0 1px rgba(233, 177, 59, .35)); } }

/* ---- source banner (design.md "Credit to the original") -------------------------------------- */
.srcbar { display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline; column-gap: 0; row-gap: 1px;
  padding: 3px 16px; background: var(--src-bg); color: var(--src-text); border-top: 1px solid var(--src-border);
  font-size: 12.5px; line-height: 1.45; text-align: center; }
.srcbar b { color: var(--text); font-weight: 700; }
.srcbar a { color: var(--accent); text-underline-offset: 2px; white-space: nowrap; }
.srcbar-sep { white-space: pre; color: var(--faint); }
.srcbar-a, .srcbar-b { white-space: nowrap; }
.srcbar-credit { flex: 1 1 auto; display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline; }
@media (max-width: 599px) {
  /* two lines on phones: "Powered by … · Open the original ↗" / "guild, race and help info from bat.org ↗" */
  .srcbar { padding: 4px 10px; font-size: 12px; }
  .srcbar-br { display: none; }
  .srcbar-b { flex-basis: 100%; }
  /* the site name shares its row with Save and More; the credit link is in More (design.md) */
  .brand.brand-box { order: -1; flex: 1 1 auto; }
  .brand-box .brand-title { font-size: 15px; }
  .logo-img { width: 26px; height: 26px; }
}

/* ---- race portraits ---------------------------------------------------------------------------- */
.race-pic { flex: none; display: inline-block; border-radius: 50%; object-fit: cover; vertical-align: middle; }
.race-init { display: inline-grid; place-items: center; background: var(--brand-indigo); color: var(--brand-gold);
  font-weight: 800; letter-spacing: .02em; box-shadow: inset 0 0 0 2px var(--brand-gold); text-transform: none; }
.race-pick { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 6px 10px; }
.race-pick .race-pic { grid-row: span 2; }
.race-pick select { width: 100%; min-width: 0; }
.race-pick .btn { justify-self: start; }
/* the race values stay on one line ("71 → 44") */
.racestats .numc { white-space: nowrap; }
.race-pick .race-pic { box-shadow: 0 0 0 3px var(--pic-ring); }
.racecard-head { flex-wrap: wrap; }
.racecard-head .race-pic-lg { margin-right: 4px; }

/* race browser dialog */
.dlg.race-dlg { width: min(880px, calc(100vw - 24px)); }
.race-tools { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin-bottom: 12px; font-size: 14px; }
.race-tools label { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); }
.race-tools .search input { min-width: 170px; }
.race-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.race-tile { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 10px 8px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text);
  font: inherit; font-size: 13px; text-align: center; cursor: pointer; transition: transform .16s ease-out, box-shadow .16s ease-out; }
.race-tile:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent-soft) 50%, var(--surface)); }
.race-tile:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
/* a tile lifts under the hand (and with the keyboard) */
.race-tile:hover, .race-tile:focus-visible { transform: translateY(-2px); box-shadow: var(--lift); }
.race-tile.cur { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-soft); }
.race-tile .race-pic { margin-bottom: 3px; }
.race-tile-name { font-weight: 700; font-size: 14.5px; }
.race-tile-sub { color: var(--muted); font-size: 12px; }
.race-tile-tier { font-size: 12px; color: var(--muted); }
@media (max-width: 599px) { .race-grid { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); } .race-tile-sub { font-size: 11.5px; } }

/* ---- choice cards (rebirth, background) ------------------------------------------------------- */
/* balanced rows: 2 across, or all in one row when the card is wide enough (4 rebirths, 5 backgrounds) */
.cols-char > .card { container-type: inline-size; }
.choices { display: grid; gap: 6px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@container (min-width: 540px) { .choices-rebirth { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@container (min-width: 760px) { .choices-bg { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.choice { position: relative; display: flex; align-items: center; gap: 8px; padding: 6px 9px 6px 6px; min-height: 48px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer;
  transition: box-shadow .18s ease-out, border-color .18s ease-out; }
.choice input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: pointer; }
.choice:hover:not(.dis) { border-color: var(--accent); }
/* the chosen card: indigo edge with a gold hairline inside (character.js stamps it when it becomes the choice) */
.choice.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--gold); }
.choice:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 1px; }
/* under the hand or the keyboard: a soft gold glow, the emblem a size up (transform only: nothing moves around it) */
.choice:not(.dis):is(:hover, :has(input:focus-visible)) { box-shadow: var(--glow-gold); }
.choice.on:not(.dis):is(:hover, :has(input:focus-visible)) { box-shadow: inset 0 0 0 1px var(--gold), var(--glow-gold); }
.choice .emblem { transition: transform .18s ease-out; }
.choice:not(.dis):is(:hover, :has(input:focus-visible)) .emblem { transform: scale(1.08); }
.choice.dis { cursor: not-allowed; background: var(--surface-2); color: var(--faint); }
.choice.dis input { cursor: not-allowed; }
.choice.dis .emblem { opacity: .4; filter: grayscale(.7); }
.choice .emblem { flex: none; width: 36px; height: 36px; }
.choice-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.choice-text b { font-size: 14px; }
.choice-sub { font-size: 12px; color: var(--muted); }
.choice.on .choice-sub { color: var(--text); }
.choice.dis .choice-sub { color: var(--faint); }
@media (prefers-reduced-motion: reduce) {
  .choice, .choice .emblem, .race-tile { transition: none; }
  .choice:not(.dis):is(:hover, :has(input:focus-visible)) .emblem, .race-tile:hover, .race-tile:focus-visible { transform: none; }
}

.subh { font-size: 14px; margin: 16px 0 6px; padding-top: 12px; border-top: 1px solid var(--border); }
.subh .muted { font-weight: 400; font-size: 13px; }

/* ---- My plans: find box ------------------------------------------------------------------------ */
.plans-find { display: flex; align-items: center; gap: 10px; margin: 4px 0 10px; }
.plans-find .search { flex: 1 1 auto; }
.plans-find .search input { width: 100%; min-width: 0; padding: 7px 8px 7px 0; }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--focus) 35%, transparent); }

@media print { .srcbar { display: block; border: 0; background: none; } }
.nw { white-space: nowrap; }

/* ---- boot screen (index.html, ui/boot.js rotates the quips) ------------------------------------ */
.boot.boot-load { flex-direction: column; gap: 6px; text-align: center; min-height: 70vh; animation: boot-appear .3s ease-out backwards;
  transition: opacity .25s ease-in; }
.boot.boot-load.boot-out { opacity: 0; }
.boot-art { width: 168px; height: 168px; animation: boot-bob 2.8s ease-in-out infinite; filter: drop-shadow(0 6px 14px rgba(39, 32, 89, .25)); }
.boot-title { display: flex; align-items: center; gap: 8px; margin: 10px 0 0; font-weight: 600; color: var(--text); }
.boot-title .logo-img { width: 28px; height: 28px; animation: boot-spin 6s linear infinite; }
.boot-quip { margin: 0; min-height: 1.5em; font-size: 15px; font-style: italic; color: var(--muted); max-width: 32ch; }
.boot-quip { transition: opacity .2s ease, transform .2s ease; }
.boot-quip.out { opacity: 0; transform: translateY(3px); }
.boot-bar { width: min(220px, 60vw); height: 3px; border-radius: 2px; background: var(--surface-3); overflow: hidden; margin-top: 8px; }
.boot-bar i { display: block; width: 40%; height: 100%; border-radius: 2px; background: linear-gradient(90deg, transparent, var(--brand-gold), transparent);
  animation: boot-shimmer 1.4s ease-in-out infinite; }
@keyframes boot-bob { 0%, 100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-6px) scale(1.02); } }
@keyframes boot-spin { to { transform: rotate(360deg); } }
@keyframes boot-appear { from { opacity: 0; } to { opacity: 1; } }
/* the app after the boot screen (app.js adds the class for the first render only) */
#app.app-enter { animation: app-enter .35s ease-out both; }
@keyframes app-enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes boot-shimmer { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
@keyframes app-enter-still { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .boot-art, .boot-title .logo-img { animation: none; }
  .boot-quip, .boot-quip.out { transform: none; }
  #app.app-enter { animation-name: app-enter-still; }
  .boot-bar i { animation: none; width: 100%; opacity: .5; }
}

/* a smaller loader inside the page (Reference tab, lazy loads) */
.quip-loader { display: flex; align-items: center; gap: 12px; padding: 12px 0; color: var(--muted); }
.quip-loader img { width: 56px; height: 56px; flex: none; animation: boot-bob 2.8s ease-in-out infinite; }
.quip-loader .quip { font-style: italic; }
@media (prefers-reduced-motion: reduce) { .quip-loader img { animation: none; } }
/* In-app requests share Chronicle's surfaces and rhythm; no moving ancestor
   transforms, so sticky controls and the summary retain their positions. */
.card:has(> .chronicle-loading) { padding: 0; border: 0; background: none; box-shadow: none; }
.view-loader.chronicle-loading { display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; box-sizing: border-box; min-height: clamp(260px, 45svh, 420px); padding: 28px 20px;
  border: 1px solid var(--border); border-top: 3px solid var(--gold); border-radius: var(--radius);
  background: linear-gradient(135deg, var(--surface), var(--accent-soft)); color: var(--text); text-align: center;
  animation: panel-in .16s ease-out both; }
.chronicle-loading .boot-art { width: 80px; height: 80px; animation: none; }
.chronicle-loading .eyebrow { color: var(--gold-ink); font-size: 11px; letter-spacing: .12em; }
.chronicle-loading .view-loader-title { margin: 0; font-size: clamp(17px, 2vw, 21px); font-weight: 650; }
.chronicle-loading .boot-quip { max-width: 42ch; min-height: 3em; font-size: 13px; line-height: 1.5; transition: opacity .16s ease; }
.chronicle-loading .boot-quip.fading { opacity: 0; }
.chronicle-loading .boot-bar { width: min(240px, 65vw); margin: 0; }
.quip-loader.sm img { width: 28px; height: 28px; animation: none; }
@media (max-width: 599px) {
  .view-loader.chronicle-loading { min-height: 280px; padding: 24px 16px; }
  .chronicle-loading .boot-art { width: 64px; height: 64px; }
}
@media (prefers-reduced-motion: reduce) {
  .view-loader.chronicle-loading { animation: none; }
  .chronicle-loading .boot-quip { transition: none; }
}

/* ---- notices in the change strip (appbar.js ChangeStrip; they cover nothing) -------------------- */
.strip-note { display: flex; align-items: center; gap: 6px; font-weight: 500; }
.strip-note > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.strip-note.full > span { white-space: normal; }
.strip-note .ico { flex: none; }
.strip-note.ok { color: var(--ok); } .strip-note.warn { color: var(--warn); } .strip-note.err { color: var(--err); }
@media (max-width: 599px) {
  .strip-note { display: flex; }
  .strip-note > span { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; white-space: normal; }
}
/* buttons that stay focusable while they cannot act (saving, already saved) */
.btn[aria-disabled="true"] { opacity: .55; cursor: default; }
.btn.primary[aria-disabled="true"]:hover { background: var(--accent); border-color: var(--accent); }

/* ---- phones: a slimmer top (the app bar and banner scroll away; only the change strip stays) ---- */
@media (max-width: 599px) {
  .appbar { gap: 4px 8px; padding: 5px 10px 6px; }
  .bar-acts { gap: 4px; flex-wrap: nowrap; }
  .bar-acts .btn.icon { min-width: 40px; min-height: 38px; justify-content: center; }
  .bar-acts .btn.primary { padding: 3px 12px; min-height: 38px; }
}
@media (max-width: 380px) {
  /* keep the banner at two lines on the narrowest phones */
  .srcbar { font-size: 11px; padding: 4px 6px; }
  .bar-acts .btn.primary { padding: 3px 8px; }
}

/* ---- print: always light ink on white paper, and the summary in full -----------------------------
   A printed page is 700-800 CSS px wide, so the bottom-sheet rule (below 1200px) would hide the
   summary's body; and the dark theme's light text would print nearly invisible. Last in the last
   stylesheet, with :root:root:root to beat both dark-theme blocks. */
@media print {
  .summary .sum-body { display: grid !important; }
  :root:root:root {
    color-scheme: light;
    --bg: #ffffff; --surface: #ffffff; --surface-2: #f0f3f7; --surface-3: #e4e9f0;
    --border: #d9dfe7; --border-strong: #b8c1ce; --field-border: #7d8898;
    --text: #19212d; --muted: #586474; --faint: #6b7685;
    --accent: #3d3497; --accent-hover: #2f2878; --accent-soft: #ecebfa; --on-accent: #ffffff;
    --gold: #e9b13b; --gold-ink: #94650a; --on-gold: #1d1640;
    --ok: #18733f; --ok-soft: #e2f3e9; --warn: #9a5b00; --warn-soft: #fcf0d9; --err: #bf3328; --err-soft: #fbe7e5; --on-err: #ffffff;
    --info: #335f96; --info-soft: #e8f0fa;
    --lit: #fbe3a6; --chip-up: #e9b13b; --chip-text: #1d1640; --chip-down: #3d3497; --chip-down-text: #ffffff; --focus: #3d3497;
    --wash: none; --hilite: 0 0 0 transparent;
    --g-rebirth: #6b7584; --g-race: #5c6b80; --g-free: #e4e9f0;
    --src-bg: #ffffff; --src-border: #d9dcef; --src-text: #3c4360; --pic-ring: rgba(39, 32, 89, .18);
    --sx-levels: #3d3497; --sx-ascension: #8e44ad; --sx-skills: #1f8a7a; --sx-spells: #2f7fd1; --sx-other: #c9900f; --sx-quests: #8994a3;
    --sx-hp: #d14343; --sx-sp: #2f74c9; --sx-ep: #18804a; --sx-race: #3d3497; --sx-more: #d9a21b;
    --sx-grad: linear-gradient(90deg, #272059 0%, #4a3fb3 50%, #a8740a 100%);
    --sx-hero: linear-gradient(135deg, color-mix(in srgb, #272059 9%, #ffffff) 0%, color-mix(in srgb, #e9b13b 13%, #ffffff) 100%);
    --sx-gold-tile: color-mix(in srgb, #e9b13b 16%, #f0f3f7); --sx-gold-ink: #94650a;
  }
}

/* ---- foldable sections (ui/fold.js; common.js FoldHead builds on it, views.css fits it into cards) --- */
.fold-head { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; }
.fold-head > :not(.fold-h) { margin-left: auto; }
.fold-h { margin: 0; font-size: inherit; }
h2.fold-h { font-size: 1.15em; } h3.fold-h { font-size: 1.02em; } h4.fold-h, h5.fold-h { font-size: .95em; }
.fold-btn { all: unset; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-weight: 700; color: inherit;
  border-radius: 4px; padding: 2px 4px 2px 0; }
.fold-btn:hover { color: var(--accent); }
.fold-btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.fold-chev { flex: none; transition: transform .15s ease; transform: rotate(90deg); color: var(--muted); }
.fold.is-folded .fold-chev { transform: rotate(0deg); }
.fold-sum { margin: 2px 0 0 22px; font-size: 13px; color: var(--muted); }
.fold.is-open > .fold-body { margin-top: 6px; }
@media (prefers-reduced-motion: reduce) { .fold-chev { transition: none; } }
@media print { .fold-chev { display: none; } }
/* Character tab: common.js FoldHead with its summary beside the heading */
.fold-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
.fold-line .fold-h { font-size: 15px; }
.fold-line .fold-sum { margin: 0; }
.cfold:not(.is-folded) > .fold-body { margin-top: 8px; }


/* ---- BatMUD site links (appbar.js SiteLinks): the banner's right end; on phones in the More menu ---- */
.srcbar-links { flex: none; font-size: 11.5px; white-space: nowrap; color: var(--faint); padding-left: 16px; }
.srcbar-links a { color: var(--muted); text-decoration: none; }
.srcbar-links a:hover, .srcbar-links a:focus-visible { color: var(--accent); text-decoration: underline; }
.srcbar-links .sl-sep { white-space: pre; }
@media (max-width: 599px) { .srcbar-links { display: none; } }
