/* ============================================================
   Public design system — app frame + scaffold
   (topbar, nav, ticker, mobile tab bar, page container,
   lower-third header, footer). Requires tokens.css.
   All rules scoped under body.pub-scope so this file can never
   affect admin pages even if class names look generic.
   ============================================================ */

.pub-scope .topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(7,9,12,.94); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line-1);
}
.pub-scope .topbar-inner {
  display: flex; align-items: center; gap: var(--s-4);
  height: 58px; padding: 0 var(--s-4); max-width: 1240px; margin: 0 auto;
}
.pub-scope .brand {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-cond); font-weight: 700; font-size: 19px;
  letter-spacing: .06em; text-transform: uppercase; font-style: italic;
}
.pub-scope .brand img.brand-mark { height: 26px; width: auto; flex: none; }
.pub-scope .brand .flag {
  width: 26px; height: 26px; flex: none;
  background: var(--signal); clip-path: polygon(0 0, 100% 0, 100% 70%, 50% 100%, 0 70%);
  display: grid; place-items: center; color: var(--signal-ink);
  font-size: 13px; font-style: normal; font-weight: 800; font-family: var(--font-ui);
}
.pub-scope .brand em { color: var(--signal); font-style: italic; }
.pub-scope .topnav { display: none; }
@media (min-width: 1100px) {
  .pub-scope .topnav { display: flex; gap: 2px; margin-left: var(--s-6); }
  .pub-scope .topnav a {
    padding: 8px 16px; font-family: var(--font-cond); font-weight: 600;
    font-size: 16px; letter-spacing: .08em; text-transform: uppercase; color: var(--grey-1);
    border-bottom: 2px solid transparent;
    transition: color var(--speed) ease;
  }
  .pub-scope .topnav a:hover { color: var(--white); }
  .pub-scope .topnav a.is-active { color: var(--signal); border-bottom-color: var(--signal); }
}
.pub-scope .topbar-user { margin-left: auto; display: flex; align-items: center; gap: 10px; position: relative; }
@media (max-width: 767px) {
  .pub-scope .topbar-user .who { display: none; }
  .pub-scope .brand { font-size: 16px; }
}
.pub-scope .topbar-user .who { text-align: right; font-size: 11px; color: var(--grey-2); line-height: 1.3; }
.pub-scope .topbar-user .who b { display: block; color: var(--grey-1); font-size: 12.5px; }
.pub-scope .tv-avatar {
  width: 34px; height: 34px; flex: none; clip-path: var(--cut);
  background: var(--carbon-3); border: 1px solid var(--line-2);
  display: grid; place-items: center; font-weight: 700; font-size: 13px; color: var(--signal);
  overflow: hidden;
}
.pub-scope .tv-avatar img { width: 100%; height: 100%; object-fit: cover; }
.pub-scope .tv-avatar-btn { background: none; border: 0; padding: 0; }
.pub-scope .tv-avatar--row { width: 38px; height: 38px; font-size: 14px; }

/* account/overflow menu — anchored to the topbar avatar button */
.pub-scope .account-menu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 50;
  width: 240px; padding: var(--s-2);
  background: rgba(13,16,21,.98); border: 1px solid var(--line-2);
  border-top: 3px solid var(--signal); border-radius: var(--r-md);
  box-shadow: 0 20px 60px rgba(0,0,0,.55);
}
.pub-scope .account-menu[hidden] { display: none; }
.pub-scope .account-menu a, .pub-scope .account-menu button {
  display: block; width: 100%; text-align: left;
  padding: 10px 12px; border-radius: var(--r-sm); background: none; border: 0;
  color: var(--grey-1); font-size: 13.5px; font-weight: 600;
  min-height: var(--tapmin);
}
.pub-scope .account-menu a:hover, .pub-scope .account-menu button:hover {
  background: var(--carbon-3); color: var(--white);
}
.pub-scope .account-menu .divider { height: 1px; background: var(--line-1); margin: var(--s-1) 4px; }

/* Live-leaderboard ticker styling lives in css/public/dashboard.css,
   scoped to the dashboard page only (it is the only template that
   populates {% block ticker %}). */

/* mobile tab bar */
.pub-scope .tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; background: rgba(10,12,17,.97); backdrop-filter: blur(14px);
  border-top: 1px solid var(--line-1);
  padding: 6px 2px calc(8px + env(safe-area-inset-bottom));
}
.pub-scope .tabbar a, .pub-scope .tabbar button {
  flex: 1; min-height: var(--tapmin);
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding-top: 5px;
  color: var(--grey-2); font-family: var(--font-cond); font-size: 11.5px;
  letter-spacing: .08em; text-transform: uppercase; font-weight: 600;
  transition: color var(--speed) ease; background: none; border: 0;
}
.pub-scope .tabbar a svg, .pub-scope .tabbar button svg { width: 22px; height: 22px; }
.pub-scope .tabbar a.is-active { color: var(--signal); }
.pub-scope .tabbar a[aria-disabled="true"] { opacity: .4; pointer-events: none; }
@media (min-width: 1100px) { .pub-scope .tabbar { display: none; } }

/* ============ SCAFFOLD ============ */
.pub-scope .page { max-width: 680px; margin: 0 auto; padding: var(--s-4); }
@media (min-width: 768px)  { .pub-scope .page { max-width: 820px; padding: var(--s-6); } }
@media (min-width: 1100px) { .pub-scope .page { max-width: 1240px; padding: var(--s-8); } }

/* lower-third page header */
.pub-scope .lower-third { margin: var(--s-3) 0 var(--s-6); }
.pub-scope .lt-tag {
  display: inline-block; background: var(--signal); color: var(--signal-ink);
  font-family: var(--font-cond); font-weight: 700; font-size: 13px;
  letter-spacing: .18em; text-transform: uppercase;
  padding: 3px 10px; clip-path: var(--cut);
}
.pub-scope .lt-title {
  font-family: var(--font-cond); font-weight: 700; font-style: italic;
  text-transform: uppercase; letter-spacing: .02em;
  font-size: 34px; line-height: 1.04; margin: 10px 0 0;
}
.pub-scope .lt-sub {
  color: var(--grey-1); font-size: 13px; margin-top: 8px;
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  min-width: 0; overflow-wrap: anywhere;
}
@media (min-width: 1100px) { .pub-scope .lt-title { font-size: 52px; } .pub-scope .lower-third { margin-bottom: var(--s-8); } }

body.pub-scope.dialog-open { overflow: hidden; }

/* footer */
.pub-scope .pub-footer {
  max-width: 1240px; margin: var(--s-10) auto 0; padding: var(--s-6) var(--s-4);
  color: var(--grey-2); font-size: 12px; text-align: center;
  border-top: 1px solid var(--line-1);
}
.pub-scope .pub-footer a { color: var(--grey-1); font-weight: 600; }
.pub-scope .pub-footer a:hover { color: var(--signal); }
