/* =========================================================
   Briefly V36 — Major UX Foundation
   Loaded last across the app.
   ========================================================= */

/* ---------- App canvas / viewport ---------- */
html{
  min-height:100%;
  overflow-x:hidden;
  -webkit-text-size-adjust:100%;
  text-size-adjust:100%;
  scroll-behavior:smooth;
}

body{
  min-height:100dvh;
  overflow-x:hidden;
  overscroll-behavior-y:auto;
  padding-bottom:calc(var(--ui-bottom-nav-height) + env(safe-area-inset-bottom) + 14px)!important;
}

/* Prevent accidental horizontal overflow from old components */
body > *,
main,section,article,header,footer,nav,div{
  max-width:100%;
}

/* ---------- Typography scale ---------- */
body{
  font-size:var(--ui-font-md)!important;
  line-height:var(--ui-line-normal)!important;
}

p,li,dd,dt,.description,.subtitle,.hint,.muted{
  font-size:var(--ui-font-md)!important;
  line-height:var(--ui-line-relaxed)!important;
}

small,time,.meta,
.v10Date,.v32-game-date small,.v32-game-score small,
.v32-game-teams span,.v32-team-grid small{
  font-size:var(--ui-font-sm)!important;
  line-height:1.35!important;
}

.v25Hint,.v25Rows span,.v26TeamCard em,
.v10LeadBody p,.v10TopCard p,.v10Feed p,
.v11DiscoverCard p,.v32-story p,.v32-empty{
  font-size:var(--ui-font-md)!important;
  line-height:var(--ui-line-relaxed)!important;
}

.storyBody,.storyBody p,
.briefingBody,.briefingBody p,
.aiSummary,.aiSummary p,
.threePoints,.threePoints li,
.whyImportant,.whyImportant p,
[class*="point"] p,
[class*="summary"] p,
[class*="context"] p,
[class*="reason"] p{
  font-size:clamp(17px,2.35vw,19px)!important;
  line-height:1.58!important;
}

h1{line-height:1.02!important}
h2{line-height:1.08!important}
h3{line-height:1.16!important}

.kicker,.eyebrow,.cat,.live,
.v10Kicker,.v25PanelHead small,.v32-kicker,
.v32-section-head>div>span{
  font-size:13px!important;
  line-height:1.1!important;
  letter-spacing:1.25px!important;
}

/* ---------- Cards ---------- */
.v25Panel,.savedCard,.alertCard,.v11DiscoverCard,
.v32-story,.v32-games-list,.v32-table-wrap,
.v32-teamdesk article,.v32-team-grid a,
.v32-stats article,.v31HomeHub,
.v10Lead,.v10TopCard,.v10FeedCard{
  border-radius:var(--ui-radius-lg)!important;
  box-shadow:var(--b35-shadow)!important;
}

/* ---------- Buttons / interaction ---------- */
button,
a.button,a.btn,
[role="button"],
input[type="submit"]{
  min-height:var(--ui-touch-min);
  touch-action:manipulation;
  -webkit-tap-highlight-color:transparent;
  transition:transform var(--ui-transition),opacity var(--ui-transition),box-shadow var(--ui-transition);
}

button:active,
a.button:active,a.btn:active,
[role="button"]:active{
  transform:scale(.985);
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible{
  outline:3px solid rgba(var(--briefly-accent-rgb),.42)!important;
  outline-offset:2px!important;
}

/* All selectable cards need a minimum touch target */
.v27Accent,.v26Appearance button,
.v25TopicGrid label,.v26TeamCard,
.v25Segment label,.v11TopicGrid label,
.v11Modes label{
  min-height:var(--ui-touch-min)!important;
  touch-action:manipulation!important;
}

/* ---------- Inputs ---------- */
input[type="text"],input[type="search"],input[type="email"],
input[type="time"],select,textarea{
  min-height:48px!important;
  font-size:16px!important; /* prevents iOS input zoom */
  border-radius:var(--ui-radius-md)!important;
  padding-left:14px!important;
  padding-right:14px!important;
}

/* ---------- Images ---------- */
img{
  max-width:100%;
  height:auto;
}

.v10LeadImage img,
.v10TopCard img,
.v11DiscoverCard img,
.storyImage img,
.v32-story img{
  display:block;
  width:100%;
  object-fit:cover;
  background:var(--b35-bg-soft);
}

/* Broken images shouldn't collapse layout */
img[data-briefly-broken="1"]{
  min-height:180px;
  object-fit:contain;
  opacity:.35;
}

/* ---------- GLOBAL BOTTOM NAV — fully locked ---------- */
#briefly-global-nav{
  position:fixed!important;
  inset:auto 0 0 0!important;
  z-index:2147483640!important;
  width:100vw!important;
  max-width:none!important;
  height:calc(var(--ui-bottom-nav-height) + env(safe-area-inset-bottom))!important;
  min-height:calc(var(--ui-bottom-nav-height) + env(safe-area-inset-bottom))!important;
  max-height:calc(var(--ui-bottom-nav-height) + env(safe-area-inset-bottom))!important;

  display:grid!important;
  grid-template-columns:repeat(5,minmax(0,1fr))!important;
  align-items:start!important;
  justify-items:stretch!important;

  margin:0!important;
  padding:8px 8px max(env(safe-area-inset-bottom),8px)!important;
  border-radius:0!important;
  transform:none!important;
  zoom:1!important;

  font-size:16px!important;
  line-height:1!important;

  box-sizing:border-box!important;
  overflow:hidden!important;
  isolation:isolate!important;
  contain:layout paint style!important;
  -webkit-backdrop-filter:blur(22px) saturate(160%)!important;
  backdrop-filter:blur(22px) saturate(160%)!important;
}

#briefly-global-nav a{
  width:100%!important;
  min-width:0!important;
  max-width:none!important;
  height:72px!important;
  min-height:72px!important;
  max-height:72px!important;

  display:grid!important;
  grid-template-rows:34px 18px!important;
  place-items:center!important;
  align-content:start!important;
  gap:5px!important;

  margin:0!important;
  padding:2px 1px 0!important;

  border:0!important;
  border-radius:0!important;
  background:transparent!important;
  box-shadow:none!important;

  font-size:var(--ui-bottom-nav-label)!important;
  line-height:1!important;
  font-weight:500!important;
  letter-spacing:0!important;

  transform:none!important;
  scale:1!important;
  zoom:1!important;
  opacity:1!important;

  text-decoration:none!important;
  -webkit-text-size-adjust:100%!important;
  text-size-adjust:100%!important;
}

#briefly-global-nav .b34-nav-icon{
  width:34px!important;
  height:34px!important;
  min-width:34px!important;
  min-height:34px!important;
  max-width:34px!important;
  max-height:34px!important;

  display:grid!important;
  place-items:center!important;

  margin:0!important;
  padding:0!important;

  font-size:var(--ui-bottom-nav-icon)!important;
  line-height:34px!important;
  font-weight:400!important;

  transform:none!important;
  scale:1!important;
  zoom:1!important;
}

#briefly-global-nav .b34-nav-label{
  display:block!important;
  width:100%!important;
  height:18px!important;
  margin:0!important;
  padding:0!important;

  font-size:var(--ui-bottom-nav-label)!important;
  line-height:18px!important;
  font-weight:500!important;
  text-align:center!important;
  white-space:nowrap!important;

  transform:none!important;
  scale:1!important;
  zoom:1!important;
}

/* No page-level CSS can hide or reposition the final nav */
body #briefly-global-nav{
  visibility:visible!important;
  opacity:1!important;
  pointer-events:auto!important;
}

/* ---------- Header touch targets ---------- */
.v10HeaderActions a,.v10HeaderActions button,
.v32-back,.v32-follow,
.settingsTop .back,.pageTop .back{
  min-width:44px!important;
  min-height:44px!important;
}

/* ---------- Better pills / metadata ---------- */
.v10Trust,.v10MiniSignal,
.pill,.badge,
.v32-story-bottom span,
.v32-game-date small{
  font-size:var(--ui-font-sm)!important;
}

/* ---------- Empty / error states ---------- */
.briefly-empty,
.briefly-error,
.v32-empty,.empty{
  border-radius:var(--ui-radius-lg)!important;
  padding:20px!important;
}

/* ---------- Offline banner ---------- */
#briefly-network-status{
  position:fixed;
  left:50%;
  top:calc(10px + env(safe-area-inset-top));
  transform:translateX(-50%);
  z-index:2147483641;
  max-width:calc(100vw - 32px);
  padding:9px 14px;
  border-radius:var(--ui-radius-pill);
  background:var(--b35-dark-action);
  color:#fff;
  font-size:13px;
  font-weight:700;
  box-shadow:0 10px 28px rgba(0,0,0,.18);
  pointer-events:none;
}

/* ---------- Reduce motion ---------- */
@media(prefers-reduced-motion:reduce){
  *,*::before,*::after{
    scroll-behavior:auto!important;
    animation-duration:.001ms!important;
    animation-iteration-count:1!important;
    transition-duration:.001ms!important;
  }
}

/* ---------- iPhone / narrow viewport ---------- */
@media(max-width:420px){
  body{
    font-size:16px!important;
  }

  .v10LeadBody p,.v10TopCard p,.v10Feed p,
  .v11DiscoverCard p,.v32-story p{
    font-size:16px!important;
  }

  small,time,.meta,
  .v10Date,.v32-game-date small,
  .v32-game-score small,.v32-game-teams span{
    font-size:13px!important;
  }
}
