/* Desktop (>= 1100 px). The game screen stays on the left as the brand anchor; the frame now fills the window and the
   docked page gets desktop room: a wider centred content column, a desktop type step, a 24-32 px gutter and one
   section rhythm. Every rule sits inside the media query, so the phone and tablet layouts are untouched.

   Widths a page can design for (the pane body is the named 'pane' container):
     1440 x 900   pane ~ 930 px wide, content column ~ 870 px
     1920 x 1080  pane ~ 1410 px wide, content column capped at --bfc-page-max (1280 px)
   Section CSS adds its desktop steps with @container pane (min-width: 900px / 1200px). */

:root {
  --bfc-page-max: 1280px;   /* the content column inside the dock */
  --bfc-prose-max: 72ch;    /* paragraph-level text never runs wider than this */
  --bfc-section-gap: 32px;  /* space above a section heading on desktop */
}

@media (min-width: 1100px) {
  /* ------------------------------------------------------------ frame: the whole window, not a fixed 1320 x 940 box */
  .bfc-app:not(.is-bare) {
    width: calc(100% - 32px);
    max-width: 2400px;
    height: calc(100dvh - 32px);
  }

  /* ------------------------------------------------------------ desktop type and spacing step, docked page only */
  .bfc-pane {
    --bfc-fs-xs: 12px;
    --bfc-fs-s: 14px;
    --bfc-fs-m: 15.5px;
    --bfc-fs-l: 18px;
    --bfc-fs-xl: 22px;
    --bfc-fs-2xl: 28px;
    --bfc-fs-kicker: 11.5px;
    --bfc-fs-label: 13px;
    --bfc-fs-value: 17px;
    --bfc-fs-value-l: 22px;
    --bfc-fs-title: 16.5px;
    --bfc-fs-h: 20px;
    --bfc-gutter: 28px;
    --bfc-panel-pad: 16px;
    --bfc-tile-pad: 10px 14px;
    --bfc-tile-gap: 8px;
    --bfc-lh: 1.5;
  }

  /* the page: centred column with a real gutter and air at the end */
  .bfc-pane__body > .bfc-pad {
    box-sizing: border-box;
    width: 100%;
    max-width: calc(var(--bfc-page-max) + 2 * var(--bfc-gutter));
    margin-inline: auto;
    padding: 24px var(--bfc-gutter) 56px;
  }

  /* title bar: the page title reads as the top of the hierarchy */
  .bfc-titlebar h1 { font-size: 24px; }

  /* ------------------------------------------------------------ section rhythm: one gap above every section heading */
  .bfc-pane .bfc-ribbon { margin: var(--bfc-section-gap) 2px 14px; gap: 14px; }
  .bfc-pane .bfc-ribbon:first-child { margin-top: 8px; }

  /* ------------------------------------------------------------ the Hall clerk: one calm line, no empty band */
  .bfc-pane .bfc-navi { padding: 8px 16px 10px; align-items: center; }
  .bfc-pane .bfc-navi__say { max-width: var(--bfc-prose-max); line-height: 1.5; }
  .bfc-pane .bfc-navi__who { font-size: 12px; }

  /* ------------------------------------------------------------ prose never runs the full width */
  .bfc-pane .bfc-prose, .bfc-pane .bfc-note, .bfc-pane .bfc-hint { max-width: var(--bfc-prose-max); }

  /* ------------------------------------------------------------ list rows and cards: a bit more room */
  .bfc-pane .bfc-rows { gap: 10px; }
  .bfc-pane .bfc-row { min-height: 60px; }
}

/* the public profile (an open page) gets a desktop width of its own; sign-in keeps the 520 px bare frame */
@media (min-width: 1100px) {
  .bfc-app.is-bare.is-wide-bare { width: min(100% - 64px, 1100px); }
}

/* ---------------------------------------------------------------- the game screen on the left fits the frame height
   The hub is the game's Home scene: HUD, bar, QUEST crest, squad, the squad verdict ("Missing: ... / Advisor") and the
   clerk's first line. On a phone it scrolls; beside the dock it should read as one screen. Only the QUEST crest gives
   up height (it keeps its 450:296 shape), sized from the window height (col = --bfc-screen-two):
     hub height        = 100dvh - 32 (frame) - HUD (col x .2484) - ticker 30 - footer 97
     under the crest   = bar 68 + 4 + caption 29 + squad with verdict (90 + (col - 12) x .547) + 6 slack
                         + page dots 28 + the clerk's first line 100 (when there is room for it)
   1920 x 1080 keeps the full crest and shows everything down to the clerk's line; at 1440 x 900 the crest floors at
   150 px tall and the squad verdict ends the first screen (the clerk is one scroll down). Short windows (< 860 px) drop
   the page dots; under 800 px the news ticker goes and the column takes its narrow width, so the verdict still fits. */
@media (min-width: 1100px) {
  .bfc-app:not(.is-bare) .bfc-hub .bfc-homebar { height: 68px; }
  .bfc-app:not(.is-bare) .bfc-hub .bfc-crests { margin-top: 4px; }
  .bfc-app:not(.is-bare) .bfc-hub .bfc-crest__art { --bfc-crest-h: calc(100vh - 477px - var(--bfc-screen-two) * .795); width: min(100%, max(228px, var(--bfc-crest-h) * 450 / 296)); }
  @supports (height: 100dvh) { .bfc-app:not(.is-bare) .bfc-hub .bfc-crest__art { --bfc-crest-h: calc(100dvh - 477px - var(--bfc-screen-two) * .795); } }
  /* the clerk's line under the squad: one compact speech box, the face a touch smaller */
  .bfc-app:not(.is-bare) .bfc-hub .bfc-clerk { margin-top: 10px; }
  .bfc-app:not(.is-bare) .bfc-hub .bfc-clerk > .bfc-navi { grid-template-columns: 46px minmax(0, 1fr); gap: 10px; align-items: center; padding: 4px 8px 6px; }
  .bfc-app:not(.is-bare) .bfc-hub .bfc-clerk > .bfc-navi .bfc-navi__face { width: 46px; height: 46px; }
  .bfc-app:not(.is-bare) .bfc-hub .bfc-clerk > .bfc-navi .bfc-navi__who { margin: 0 0 3px; }
  .bfc-app:not(.is-bare) .bfc-hub .bfc-clerk > .bfc-navi .bfc-navi__say { font-size: 14px; line-height: 1.35; }
}
@media (min-width: 1100px) and (max-height: 859.98px) {
  .bfc-app:not(.is-bare) .bfc-hub .bfc-crests__dots { display: none; }
  .bfc-app:not(.is-bare) .bfc-hub .bfc-crest__art { --bfc-crest-h: calc(100vh - 349px - var(--bfc-screen-two) * .795); width: min(100%, max(150px, var(--bfc-crest-h) * 450 / 296)); }
  @supports (height: 100dvh) { .bfc-app:not(.is-bare) .bfc-hub .bfc-crest__art { --bfc-crest-h: calc(100dvh - 349px - var(--bfc-screen-two) * .795); } }
}
@media (min-width: 1100px) and (max-height: 799.98px) {
  .bfc-app:not(.is-bare) { --bfc-screen-two: 420px; }
  .bfc-app:not(.is-bare) .bfc-ticker { display: none; }
  .bfc-app:not(.is-bare) .bfc-hub .bfc-crest__art { --bfc-crest-h: calc(100vh - 319px - var(--bfc-screen-two) * .795); }
  @supports (height: 100dvh) { .bfc-app:not(.is-bare) .bfc-hub .bfc-crest__art { --bfc-crest-h: calc(100dvh - 319px - var(--bfc-screen-two) * .795); } }
}

/* ---------------------------------------------------------------- shared parts on a desktop page
   Every rule sits behind the 1100 px query or the pane container query, so the phone keeps its own sizes. */
@media (min-width: 1100px) {
  /* title bar: Back and the plate on one centre line, the plate a touch taller for the 24 px title */
  .bfc-app:not(.is-bare) .bfc-titlebar { min-height: 60px; padding: 6px 14px 6px 10px; gap: 10px; }
  .bfc-app:not(.is-bare) .bfc-titlebar__plate { height: 46px; }
  .bfc-app:not(.is-bare) .bfc-titlebar__extra { font-size: 16px; gap: 8px; }
  .bfc-app:not(.is-bare) .bfc-titlebar__extra .bfc-num { font-size: 18px; }

  /* the clerk standing beside her box: the box takes the width its words need (never a wide empty band), she stands
     right next to it, and she overhangs the box instead of making the row taller than it */
  .bfc-pane .bfc-navi-stand { grid-template-columns: minmax(0, max-content) 150px; justify-content: start; align-items: center; }
  .bfc-pane .bfc-navi-stand > .bfc-navi { min-width: min(100%, 520px); max-width: 880px; margin-right: -24px; }
  .bfc-pane .bfc-navi-stand__art { width: 150px; height: 150px; margin: -24px 0 -14px -8px; }

  /* windows and section headings */
  .bfc-pane .bfc-window { padding: 8px 12px 10px; }
  .bfc-pane .bfc-window__title { margin-bottom: 12px; }

  /* list rows: the title / sub pair reads as a pair, the sub never runs wider than a line can be read */
  .bfc-pane .bfc-row { gap: 14px; padding: 10px 16px; }
  .bfc-pane .bfc-row__sub { margin-top: 3px; max-width: var(--bfc-prose-max); }
  .bfc-pane .bfc-card { gap: 16px; padding: 10px 16px 10px 10px; }
  .bfc-pane .bfc-card__sub { max-width: var(--bfc-prose-max); }

  /* buttons: one height per size (small 44, normal 48, big 56) and desktop lettering */
  .bfc-pane .bfc-btn { min-height: 48px; font-size: 15.5px; }
  .bfc-pane .bfc-btn--small { min-height: 44px; font-size: 14px; }
  .bfc-pane .bfc-btn--big { min-height: 56px; font-size: 18px; }
  /* a full-width button never becomes a page-wide bar: it stops at a comfortable button width */
  .bfc-pane .bfc-btn--wide { max-width: 440px; }

  /* tabs: one plate size, wide enough that short words do not make stubby tabs (132 px once the page is 900 px wide;
     a narrower page, a 1100-1300 px window, keeps 96 px so five tabs still fit) */
  .bfc-pane .bfc-tab { min-width: 96px; height: 48px; font-size: 16px; }
  @container pane (min-width: 900px) { .bfc-pane .bfc-tab { min-width: 132px; } }
  @container pane (max-width: 899.98px) { .bfc-pane .bfc-tab { font-size: 15px; } }
  .bfc-pane .bfc-seg button { min-height: 44px; padding: 0 16px; font-size: 14.5px; }
  .bfc-pane .bfc-chip { font-size: 14px; padding: 0 16px; }

  /* small lettering never under 12 px on desktop */
  .bfc-pane .bfc-role--s { font-size: 12px; height: 22px; }
  .bfc-pane .bfc-pw { font-size: 12px; }
  .bfc-pane .bfc-dlist thead th { font-size: 12px; }
  .bfc-pane .bfc-utile__lvl { font-size: 11px; }
  .bfc-pane .bfc-utile__name, .bfc-pane .bfc-itile__name { font-size: 12.5px; }
  .bfc-pane .bfc-pwsum__k, .bfc-pane .bfc-pwsum__note { font-size: 12.5px; }
  .bfc-pane .bfc-pwsum__n { font-size: 16px; }

  /* data list: a desktop row height */
  .bfc-pane .bfc-dlist { border-spacing: 0 8px; }
  .bfc-pane .bfc-dlist tbody th, .bfc-pane .bfc-dlist tbody td { padding: 12px 14px; }

  /* disclosures: every <summary> in a page shows it can be pressed */
  .bfc-pane summary { cursor: pointer; }
  .bfc-pane summary:hover { filter: brightness(1.18); }

  /* empty / error / coming-next states: room to breathe in a wide pane */
  .bfc-pane .bfc-state { padding: 48px 24px; gap: 16px; }
  .bfc-pane .bfc-state__text { max-width: 52ch; }
  .bfc-pane .bfc-soon { max-width: 760px; margin-inline: auto; }

  /* dialogs and sheets: a desktop width */
  .bfc-dialog { max-width: 460px; }
  .bfc-dialog--sheet { max-width: 600px; }
}

/* layouts that depend on the page width, not the window: the pane container */
@container pane (min-width: 700px) {
  /* an action row: buttons as wide as their words (never stretched to a third of the page), the same height, wrapping
     as a group; a lone button does not span the row */
  .bfc-actions { display: flex; flex-wrap: wrap; align-items: stretch; gap: 10px 12px; }
  .bfc-actions > .bfc-btn { flex: 0 0 auto; min-width: 168px; }
  .bfc-actions > .bfc-btn--wide { flex: 1 1 100%; }

  /* stat tiles and key/value rows: tiles about 260-360 px wide, so a label never sits a page-width away from its
     value; more tiles share the row instead */
  .bfc-stats { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
  .bfc-stat--wide { grid-column: 1 / -1; }
  .bfc-kv { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
  .bfc-kv > div { padding: 8px 16px; }
}

/* an empty or error state on an open page (a public link that is gone) sits on the busy parchment art: give its words
   a dark plate so they read */
@media (min-width: 1100px) {
  .bfc-app.is-bare .bfc-pane .bfc-state {
    max-width: 640px; margin: 64px auto 0; padding: 32px 40px 36px; border-radius: 12px;
    background: rgba(4, 10, 30, .86); box-shadow: 0 0 0 1px #000, 0 0 0 3px var(--bfc-gold-3), 0 0 0 4px #000, 0 20px 40px rgba(0, 0, 0, .5);
  }
}

/* ---------------------------------------------------------------- one look per shared part on a desktop page
   (section sheets load after this file, so these rules carry a .bfc-app prefix to win over them) */
@media (min-width: 1100px) {
  /* segmented toggles: both halves on one line, the same width, never "Last / week" beside "This week". Not the team
     builder's recipe groups (.bfc-bre__seg): builder.css lays those out as even grid columns in its narrow panel */
  .bfc-app .bfc-pane .bfc-seg:not(.bfc-bre__seg) { width: fit-content; max-width: 100%; }
  .bfc-app .bfc-pane .bfc-seg:not(.bfc-bre__seg) button { flex: 1 1 0; min-width: 120px; white-space: nowrap; }

  /* explanation notes: every note plate runs the full column, text left, so stacked notes share both edges */
  .bfc-app .bfc-pane :is(.bfc-jbasis, .bfc-act__sum, .bfc-week__asof, .bfc-week__sub, .bfc-week__note, .bfc-week__none, .bfc-week__next, .bfc-coll__note, .bfc-wk__range, .bfc-wk__partial, .bfc-wk__lead, .bfc-wk__compare) {
    box-sizing: border-box; justify-self: stretch; width: auto; max-width: none; text-align: left; border-radius: 8px;
  }

  /* share: Download / Copy are buttons, not half-page bars: fit their words, same height as every other button */
  .bfc-app .bfc-pane .bfc-share__actions { display: flex; flex-wrap: wrap; gap: 12px; }
  .bfc-app .bfc-pane .bfc-share__actions > .bfc-btn { flex: 0 0 auto; width: auto; min-width: 168px; min-height: 48px; justify-content: center; }
  /* every normal-size action button in a page: the same 48 px height, words centred */
  .bfc-app .bfc-pane .bfc-btn:not(.bfc-btn--small):not(.bfc-btn--big) { min-height: 48px; justify-content: center; }

  /* the Hall clerk: one look on every page. A box as wide as her words (never a wide empty band), and she stands at
     its right; a page that asks for the plain box gets her figure drawn beside it (the art is decoration only) */
  @container pane (min-width: 700px) {
    .bfc-app .bfc-pane :not(.bfc-navi-stand) > .bfc-navi {
      box-sizing: border-box; justify-self: start; width: fit-content;
      min-width: min(100% - 130px, 520px); max-width: min(880px, 100% - 130px); align-items: center;
    }
    .bfc-app .bfc-pane :not(.bfc-navi-stand) > .bfc-navi::before {
      content: ""; position: absolute; left: calc(100% - 4px); top: 50%; width: 120px; height: 150px; transform: translateY(-55%);
      background: url(../assets/navi/clerk.webp) 0 0 / contain no-repeat; filter: drop-shadow(0 8px 10px rgba(0, 0, 0, .6)); pointer-events: none;
    }
    /* standing clerk boxes keep room above and below for her figure */
    .bfc-app .bfc-pane :not(.bfc-navi-stand) > .bfc-navi, .bfc-app .bfc-pane .bfc-navi-stand { margin-block: 14px 10px; }
  }
}

/* a very wide dock (2560 px windows): the content column grows to 1600 px instead of leaving 600 px of art each side */
@media (min-width: 1100px) {
  @container pane (min-width: 1800px) {
    .bfc-pane__body > .bfc-pad { max-width: calc(1600px + 2 * var(--bfc-gutter)); }
  }
}
