/* Home hub: the Home scene. Loaded with js/sections/home.js. */

.bfc-home { padding-bottom: 18px; container-type: inline-size; }

/* bar under the HUD: Menu pill hangs off the left edge, What next? mail pill off the right, the name between */
/* overflow-x: clip: the What next? pill runs off the right edge like the game's mail pill; clip (not hidden) keeps it from
   making the hub scroll sideways when something is scrolled into view or focused */
.bfc-homebar { position: relative; display: flex; align-items: flex-start; justify-content: space-between; height: 72px; padding-top: 4px; overflow-x: clip; overflow-y: visible; }
.bfc-pill { position: relative; display: block; flex: none; border: 0; padding: 0; cursor: pointer; background: center / contain no-repeat; transition: transform var(--bfc-dur-fast) var(--bfc-ease-out), filter .15s; }
.bfc-pill--menu { width: 112px; height: 48px; margin-left: -16px; background-image: url(../../assets/ui/pill-menu-1.png); }
.bfc-pill--menu:active { background-image: url(../../assets/ui/pill-menu-2.png); }
.bfc-pill--mail { width: 110px; height: 44px; margin-right: -14px; background-image: url(../../assets/ui/pill-mail-1.png); background-size: 110px 40px; background-position: 50% 0; }   /* 44 px tall to tap; the art stays 40 */
.bfc-pill--mail:active { background-image: url(../../assets/ui/pill-mail-2.png); }
.bfc-pill:hover { filter: brightness(1.15); }
.bfc-pill__cap { position: absolute; left: 0; right: 0; bottom: -17px; text-align: center; font: 800 12px/1 var(--bfc-font-game); }
.bfc-pill--menu .bfc-pill__cap { padding-left: 16px; }
.bfc-pill--mail .bfc-pill__cap { padding-right: 14px; bottom: -14px; }
.bfc-pill__badge { position: absolute; left: 2px; top: -6px; display: grid; place-items: center; width: 34px; height: 21px; background: url(../../assets/ui/badge.png) center / contain no-repeat; font-size: 13px; }
.bfc-pill__badge[hidden] { display: none; }
@media (prefers-reduced-motion: no-preference) { .bfc-pill__badge { animation: bfc-bob 1.6s ease-in-out infinite; } }
.bfc-homebar .bfc-nameplate { margin-top: 6px; min-width: 120px; flex: 0 1 auto; padding: 0; gap: 6px; }
/* a narrow phone gives the whole plate to the name: the small "Summoner" tag says nothing the page does not */
@media (max-width: 379.98px) { .bfc-homebar .bfc-nameplate small { display: none; } }

/* ---------------------------------------------------------------- crest carousel */
.bfc-crests { position: relative; margin-top: 8px; }
.bfc-crests__track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; padding: 0 12%; scroll-padding: 0 12%; }
.bfc-crests__track::-webkit-scrollbar { display: none; }
.bfc-crest {
  position: relative; flex: 0 0 100%; scroll-snap-align: center; display: flex; flex-direction: column; align-items: center; padding: 0 4px;
  text-decoration: none; color: inherit; transform: scale(.84); filter: brightness(.7) saturate(.8);
  transition: transform var(--bfc-dur-slow) var(--bfc-ease-out), filter var(--bfc-dur-slow);
}
.bfc-crest.is-on { transform: none; filter: none; }
/* a neighbour's caption pill peeked in at the screen edge as a clipped "Sc..." chip: only the centred crest shows one */
.bfc-crest:not(.is-on) .bfc-crest__cap { opacity: 0; transition: opacity var(--bfc-dur-fast); }
.bfc-crest__art { position: relative; width: 100%; aspect-ratio: 450 / 296; }
.bfc-crest__emb { position: absolute; left: 0; right: 0; bottom: 21%; width: 100%; height: auto; aspect-ratio: 450 / 205; object-fit: contain; object-position: 50% 100%; filter: drop-shadow(0 6px 6px rgba(0, 0, 0, .55)); }
.bfc-crest__full { position: absolute; left: 0; top: -2%; width: 100%; height: auto; aspect-ratio: 450 / 316; filter: drop-shadow(0 6px 6px rgba(0, 0, 0, .55)); }
.bfc-crest__crop { position: absolute; left: 0; right: 0; bottom: 21%; aspect-ratio: 450 / 205; overflow: hidden; filter: drop-shadow(0 6px 6px rgba(0, 0, 0, .55)); }
.bfc-crest__crop img { display: block; width: 100%; height: auto; aspect-ratio: 450 / 316; }
.bfc-crest__crop img.is-missing { visibility: hidden; }
.bfc-crest__title { position: absolute; left: -2%; right: -2%; bottom: 0; width: 104%; height: auto; overflow: visible; }
.bfc-crest__cap { margin-top: 2px; padding: 4px 12px; border-radius: 12px; font-size: 12.5px; text-align: center; background: linear-gradient(rgba(5, 11, 30, .86), rgba(5, 11, 30, .7)); box-shadow: 0 0 0 1px rgba(214, 164, 62, .6); }
.bfc-crest__cap b { font-family: var(--bfc-font-game); }
.bfc-crest:focus-visible { box-shadow: none; outline: none; }
.bfc-crest:focus-visible .bfc-crest__art { filter: drop-shadow(0 0 10px #ffe066); }
.bfc-crest:focus-visible .bfc-crest__cap { box-shadow: var(--bfc-focus); }
.bfc-crests__feed { position: absolute; top: 32%; z-index: 2; width: var(--bfc-tap); height: 64px; border: 0; padding: 0; cursor: pointer; background: center / 30px 60px no-repeat; transition: transform var(--bfc-dur-fast); }
.bfc-crests__feed--l { left: 0; background-image: url(../../assets/ui/arrow-l.png); }
.bfc-crests__feed--r { right: 0; background-image: url(../../assets/ui/arrow-r.png); }
.bfc-crests__feed:hover { filter: brightness(1.2); }
.bfc-crests__dots { display: flex; justify-content: center; gap: 0; margin-top: 2px; }
.bfc-crests__dots button { display: grid; place-items: center; width: 44px; height: 44px; margin: -8px 0; border: 0; padding: 0; cursor: pointer; background: none; }
.bfc-crests__dots button::before { content: ""; width: 16px; height: 16px; background: url(../../assets/ui/page-dots.png) 100% 0 / 32px 16px no-repeat; }
.bfc-crests__dots button[aria-current="true"]::before { background-position: 0 0; }

/* ---------------------------------------------------------------- the squad in home_character_frame */
.bfc-party { position: relative; display: block; margin: 10px 6px 0; text-decoration: none; color: inherit; }
/* the squad's name on the game's tab plate (grand_tab1_on without its baked words, _tools/build_tab_assets.py), a
   9-slice as wide as the name; its dark bottom edge sits on the frame's top rail. The cost plate sits on the rail too. */
.bfc-party__head { position: relative; z-index: 2; display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; margin: 0 1.6% -1px; }
.bfc-party__tab {
  --h: 34px; flex: 0 1 auto; display: grid; place-items: center; box-sizing: border-box; min-width: 0; height: var(--h);
  padding: 6px 4px 0 0; border-style: solid; border-color: transparent;
  border-width: 0 calc(var(--h) * 28 / 43) 0 calc(var(--h) * 32 / 43);
  border-image: url(../../assets/ui/tab-plate.png) 0 28 0 32 fill / 0 calc(var(--h) * 28 / 43) 0 calc(var(--h) * 32 / 43) stretch;
  font: 800 15px/1 var(--bfc-font-game); color: #fff; text-shadow: var(--bfc-outline); white-space: nowrap;
}
.bfc-party__tab > span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; padding: 0 2px; }
.bfc-party__cost { flex: none; display: flex; padding-bottom: 2px; }
.bfc-party__cost .bfc-cost { --h: 30px; }
.bfc-party__hint { flex: none; padding: 3px 10px; border-radius: 999px; font: 800 11.5px/1.2 var(--bfc-font-game); color: var(--bfc-ink-dark); background: linear-gradient(#fff3c4, #e2b450); box-shadow: 0 0 0 1px #000; }
.bfc-party__frame { position: relative; display: block; aspect-ratio: 640 / 350; }
/* the slots form their own layer under the frame overlay: the art inside (z-index 1, scaled) must never draw over the
   frame's rounded window corners */
.bfc-party__slots { position: absolute; inset: 0; z-index: 0; }
/* each slot covers one window of char-frame.webp exactly (measured on the 640x350 art: windows 112 px wide on a 128 px
   pitch from x 9, rows y 22-325); the frame's rails hide the slot's square corners */
.bfc-party__slot {
  position: absolute; top: 6.3%; height: 86.6%; width: 17.6%; overflow: hidden;
  background: radial-gradient(ellipse at 50% 30%, var(--glow, #3a4a8a), #0a0f22 75%);
}
.bfc-party__slot::before { content: ""; position: absolute; inset: 0; z-index: 0; background: radial-gradient(ellipse at 50% 30%, var(--glow, #3a4a8a), #0a0f22 75%); opacity: .82; }
/* the party slices are tight 160x437 strips: shown a touch larger than the window, anchored near the face, so the
   unit fills its card edge to edge instead of sitting small inside it */
.bfc-party__bust { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; object-fit: cover; object-position: 50% 18%; transform: scale(1.1); transform-origin: 50% 22%; transition: opacity .3s; }
.bfc-party__bust.is-missing { opacity: 0; }
/* no party slice (no crop data or no full art): the bust stand-in shows its top, a square thumb sits whole at the top */
.bfc-party__bust[data-step="1"] { object-position: 50% 0; transform: none; }
.bfc-party__bust[data-step="2"] { inset: 12% 4% auto; width: 92%; height: auto; aspect-ratio: 1; object-fit: contain; transform: none; }
/* no art at all: the game's "?" unit frame (common/secret) high in the slot, and the unit's name on the game's name
   plate (handle_name_frame, ends shrunk to the slot) under it, so the slot still says who stands there */
.bfc-party__bust[data-last] { inset: 15% 9% auto; width: 82%; height: auto; aspect-ratio: 1; object-fit: contain; transform: none; }
.bfc-party__nameless {
  display: none; z-index: 2; position: absolute; left: 1px; right: 1px; top: 46%; box-sizing: border-box; min-height: 26px;
  align-items: center; justify-content: center; padding: 3px 0; border-style: solid; border-color: transparent; border-width: 0 8px;
  border-image: url(../../assets/ui/name-frame.png) 0 56 fill / 0 8px stretch; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .6));
  text-align: center; overflow-wrap: anywhere; font: 800 10.5px/1.15 var(--bfc-font-game); color: #fff; text-shadow: var(--bfc-outline-thin);
}
.bfc-party__bust[data-last] ~ .bfc-party__nameless { display: flex; }
.bfc-party__slot:nth-child(1) { left: 1.3%; } .bfc-party__slot:nth-child(2) { left: 21.3%; } .bfc-party__slot:nth-child(3) { left: 41.3%; }
.bfc-party__slot:nth-child(4) { left: 61.3%; } .bfc-party__slot:nth-child(5) { left: 81.3%; }
.bfc-party__slot .bfc-el { z-index: 2; position: absolute; left: 6%; top: 2.5%; width: clamp(18px, 28%, 24px); height: auto; aspect-ratio: 1; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .7)); }
.bfc-party__slot.is-empty { background: linear-gradient(#141c3a, #070b1a); }
.bfc-party__lead { z-index: 2; position: absolute; left: 0; right: 0; bottom: 7%; text-align: center; font: 800 11px/1 var(--bfc-font-game); }
.bfc-party__over { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; pointer-events: none; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .6)); }
/* no motion under the pointer (owner, 11-13): pressing or focusing the banner only rings it in gold */
.bfc-party:focus-visible { box-shadow: none; outline: none; }
.bfc-party:focus-visible .bfc-party__frame, .bfc-party:active .bfc-party__frame { outline: 2px solid #ffe066; outline-offset: 1px; border-radius: 6px; }
.bfc-party:focus-visible .bfc-party__verdict { box-shadow: var(--bfc-focus); }
.bfc-party__verdict {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; min-height: 44px; margin: -4px 4px 0; padding: 8px 10px; border-radius: 0 0 10px 10px;
  background: linear-gradient(rgba(5, 11, 30, .94), rgba(5, 11, 30, .82)); box-shadow: 0 0 0 1px rgba(214, 164, 62, .6);
  font-size: 13px;
}
.bfc-party__say { flex: 1 1 160px; font-weight: 800; line-height: 1.35; text-shadow: var(--bfc-outline-thin); }
/* the Home strip shows the verdict's first two lines (it ran under the news ticker); the Advisor has it all */
.bfc-party__say { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
.bfc-party__verdict.is-critical { box-shadow: 0 0 0 1px #000, 0 0 0 2px #e0503c; }
.bfc-party__verdict.is-critical .bfc-party__lack { color: var(--bfc-ink-bad); }
.bfc-party__line { font-weight: 700; }

/* ---------------------------------------------------------------- today */
.bfc-home__ribbon { margin: 18px 12px 8px; }
.bfc-today { display: grid; gap: 8px; margin: 0 10px; }
/* your goals (parts-goals/card.js homeGoals): only when goals are set; lined up with the Today cards */
.bfc-home__goals { margin: 10px 10px 0; }
/* History > "Your week" (parts-history/home-link.js): one link line, no request */
.bfc-home__recap { margin: 10px 10px 0; }
.bfc-today__slot { display: grid; min-height: 92px; }
.bfc-today__slot > * { min-width: 0; }
@container (min-width: 640px) { .bfc-today { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.bfc-card__bust { width: 100%; height: 100%; object-fit: cover; object-position: 50% 10%; }

/* ---------------------------------------------------------------- the clerk's lines */
.bfc-clerk { display: grid; gap: 6px; margin: 14px 10px 0; }
.bfc-clerk__more { display: grid; gap: 6px; }
.bfc-home__new { margin: 14px 16px 0; text-align: center; color: var(--bfc-ink-soft); text-shadow: var(--bfc-outline-thin); }

/* short phones: the quest crest gives up height so the whole squad strip (cards and Leader label) sits above the ticker.
   What stays fixed under the crest scales with the width: HUD 24.8vw, squad frame 54.7vw, footer ~22vw, plus ~204 px
   of bar, caption, dots, squad tab and ticker. The crest keeps its 450:296 shape and never drops under 170 px wide. */
@media (max-width: 1099.98px) {
  .bfc-crest__art { width: min(100%, max(170px, calc((100vh - 101.5vw - 204px) * 450 / 296))); }
  @supports (height: 100dvh) {
    .bfc-crest__art { width: min(100%, max(170px, calc((100dvh - 101.5vw - 204px) * 450 / 296))); }
  }
}
