/* =========================================================================
   Release 2 theme: fonts, colors and the page frame (header, bottom bar).
   The same colors are in Theme/AppTheme.cs for MudBlazor. Shared building
   blocks (cards, rows, buttons...) are in ui.css. Fonts ship with the app.
   ========================================================================= */

@font-face { font-family: 'Atkinson Hyperlegible'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/atkinson-hyperlegible-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Atkinson Hyperlegible'; font-style: normal; font-weight: 700; font-display: swap; src: url('../fonts/atkinson-hyperlegible-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-style: normal; font-weight: 600; font-display: swap; src: url('../fonts/barlow-condensed-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-style: normal; font-weight: 700; font-display: swap; src: url('../fonts/barlow-condensed-latin-700-normal.woff2') format('woff2'); }

:root {
    --bm-navy: #0F2747;
    --bm-orange: #C2410C;
    --bm-amber: #F59E0B;
    --bm-page: #F4F5F7;
    --bm-surface: #FFFFFF;
    --bm-ink: #14171C;
    --bm-ink-2: #2B313B;
    --bm-muted: #4A5260;
    --bm-line: #E1E4EA;
    --bm-line-strong: #C9CED6;
    --bm-orange-tint: #FFF4EC;
    --bm-navy-tint: #E3E9F3;
    --bm-red: #B91C1C;
    --bm-green: #15803D;
    --bm-font-body: 'Atkinson Hyperlegible', system-ui, 'Segoe UI', sans-serif;
    --bm-font-head: 'Barlow Condensed', 'Arial Narrow', sans-serif;
    --bm-wide: 900px; /* at and above this width: top navigation; below: bottom navigation */
}

html, body {
    font-family: var(--bm-font-body);
    background-color: var(--bm-page);
    color: var(--bm-ink);
}

a { color: var(--bm-navy); }
a:hover { color: var(--bm-orange); }

/* Keyboard focus must always be visible. */
:focus-visible { outline: 3px solid var(--bm-amber); outline-offset: 2px; }

/* ---------- Page frame ---------- */
.bm-shell { min-height: 100vh; display: flex; flex-direction: column; background: var(--bm-page); }

.bm-header { background: var(--bm-navy); color: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.25); position: sticky; top: 0; z-index: 1100; }
.bm-header-bar { display: flex; align-items: center; gap: 12px; max-width: 1240px; margin: 0 auto; padding: 8px 16px; min-height: 60px; }
.bm-brand { font-family: var(--bm-font-head); font-weight: 700; font-size: 28px; letter-spacing: .5px; text-transform: uppercase; color: #fff; text-decoration: none; white-space: nowrap; }
.bm-brand:hover { color: #fff; }
.bm-spacer { flex: 1; }

.bm-topnav { display: none; gap: 4px; font-size: 17px; margin-left: 8px; }
.bm-topnav a { white-space: nowrap; color: #fff; padding: 10px 14px; border-radius: 8px; text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
.bm-topnav a:hover { background: rgba(255,255,255,.12); color: #fff; }
.bm-topnav a.active { background: #fff; color: var(--bm-navy); font-weight: 700; }

.bm-header-link { color: #fff; font-size: 16px; text-decoration: none; border: 1px solid rgba(255,255,255,.55); border-radius: 8px; padding: 8px 14px; min-height: 44px; display: inline-flex; align-items: center; background: transparent; font-family: inherit; cursor: pointer; }
.bm-header-link:hover { background: rgba(255,255,255,.12); color: #fff; }
.bm-header-hello { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 170px; min-width: 0; }
.bm-header-link { white-space: nowrap; flex-shrink: 0; }

.bm-menu-button { min-width: 48px; min-height: 48px; border-radius: 8px; border: 1px solid rgba(255,255,255,.55); background: transparent; color: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.bm-menu-button:hover { background: rgba(255,255,255,.12); }

/* One page-width rule: every page is as wide as the header and centered. MainLayout adds bm-article--wide
   for big grids (What If, admin), which then use the full screen. */
.bm-article { width: 100%; max-width: 1240px; margin-left: auto; margin-right: auto; }
.bm-article--wide { max-width: none; }
.bm-main { flex: 1; min-width: 0; padding-bottom: calc(80px + env(safe-area-inset-bottom)); }

/* Bottom bar (phones) */
.bm-bottomnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1100; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: #fff; border-top: 1px solid #D5D9E0; padding-bottom: env(safe-area-inset-bottom); }
.bm-bottomnav a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 8px 0 10px; text-decoration: none; color: var(--bm-ink-2); font-size: 14px; min-height: 60px; box-sizing: border-box; }
.bm-bottomnav a.active { color: var(--bm-orange); font-weight: 700; }
.bm-bottomnav .bm-live-dot { position: absolute; top: 8px; left: calc(50% + 8px); }

/* Pool tabs inside the navy header (phones) */
.bm-pooltabs { display: flex; max-width: 1240px; margin: 0 auto; }
.bm-pooltabs button { flex: 1; min-height: 48px; border: none; border-bottom: 3px solid transparent; background: transparent; color: rgba(255,255,255,.85); font-size: 17px; font-family: inherit; cursor: pointer; padding: 0 8px; }
.bm-pooltabs button[aria-pressed="true"] { border-bottom-color: var(--bm-amber); color: #fff; font-weight: 700; }

/* Live marker */
.bm-live-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--bm-red); display: inline-block; animation: bm-pulse 2s infinite; }
@keyframes bm-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .bm-live-dot { animation: none; } }

/* ---------- Wide screens: top navigation ---------- */
@media (min-width: 900px) {
    .bm-topnav { display: flex; }
    .bm-bottomnav { display: none; }
    .bm-main { padding-bottom: 0; }
    .bm-only-phone { display: none !important; }
}
@media (max-width: 899.98px) {
    .bm-only-wide { display: none !important; }
}
/* The top bar must stay on one line: tighter links below 1100 px, and the "Hello, name" greeting
   only where there is room (a long email address would otherwise push the links onto two lines). */
@media (min-width: 900px) and (max-width: 1099.98px) {
    .bm-brand { font-size: 24px; }
    .bm-topnav { gap: 0; margin-left: 4px; font-size: 16px; }
    .bm-topnav a { padding: 10px 9px; }
}
/* Just over 900 px a signed-in admin has eight links plus Log out: closer links still fit on one line. */
@media (min-width: 900px) and (max-width: 999.98px) {
    .bm-brand { font-size: 22px; }
    .bm-topnav a { padding: 10px 5px; }
}
@media (min-width: 900px) and (max-width: 1259.98px) {
    .bm-header-hello { display: none !important; }
}

/* Phone menu items: big tap targets */
.mud-menu-item, .mud-list-item { min-height: 48px; }

/* ---------- Print: the new frame never prints ---------- */
@media print {
    .bm-header, .bm-bottomnav, .bm-pooltabs { display: none !important; }
    .bm-main { padding-bottom: 0 !important; }
    .bm-article { max-width: none !important; }
}
