/* ==========================================================================
   STG signature layer: the small touches that make STG feel like STG
   (on top of the shared V3 design system in app.css).
   ========================================================================== */


/* Drawer logo: full-color on light, navy→white variant on dark */
.drawer-logo-dark { display: none; }
:root[data-theme="dark"] .drawer-logo { background: none; padding: 0; border-radius: 0; }
:root[data-theme="dark"] .drawer-logo-light { display: none; }
:root[data-theme="dark"] .drawer-logo-dark { display: block; }

/* Large titles use the Fraunces serif (echoes the STG wordmark); tighten the optical size */
.pg-title, .hero-title, h1 { font-variation-settings: "opsz" 96; letter-spacing: -.015em; }
h2, h3 { font-variation-settings: "opsz" 40; }


/* BOOST accent chip (BOOST + Team are blended; BOOST items carry a small gold tag) */
.boost-tag { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 8px; border-radius: 999px;
  background: var(--gold-soft); color: #8A5A00; font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
:root[data-theme="dark"] .boost-tag { color: var(--gold); }

/* Fraunces is heavy at 800: STG headlines sit at 650 for a crisper, editorial look */
h1, .pg-title { font-weight: 650; }
h2, h3 { font-weight: 640; }

/* Stat card preview (core statcard.js) */
.statcard-preview img { width: 100%; border-radius: 18px; box-shadow: var(--shadow-2); -webkit-touch-callout: default; -webkit-user-select: auto; user-select: auto; }

/* ==========================================================================
   STG SIGNATURE SHELL: docked edge-to-edge tab bar with a full-cell gradient
   indicator, themed drawer, left-aligned headers with a ridge overline,
   tone-aware header buttons, squarer geometry. (Page transitions: app.css.)
   ========================================================================== */
:root {
  --r-hero: 22px; --r-card: 16px; --r-group: 14px; --r-input: 12px; --r-sm: 9px;
  --tabbar-h: 66px;
  --tabbar-space: calc(var(--tabbar-h) + var(--sab) + 14px);
  --dur: 380ms;
  /* fixed hex (not var(--teal)) so the brand gradient is identical in both themes and white text stays AA on it */
  --grad-brand: linear-gradient(135deg, #1B2159 0%, #2E3A8C 55%, #4A4FC0 100%);
}

/* ---- Docked tab bar: the whole active cell lights up (Dulles behaviour), STG gradient ---- */
#tabbar {
  left: 0; right: 0; bottom: 0; transform: none; width: 100%; height: calc(var(--tabbar-h) + var(--sab));
  padding: 6px max(8px, var(--sar)) var(--sab) max(8px, var(--sal)); border-radius: 22px 22px 0 0;
  align-items: start;
  background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none;
  border: 0; border-top: 1px solid var(--line); box-shadow: 0 -10px 30px -18px rgba(27, 33, 89, .35);
}
:root[data-theme="dark"] #tabbar { box-shadow: 0 -12px 30px -16px rgba(3, 6, 20, .7); }
#tabbar.hide { transform: translateY(calc(100% + 10px)); }
#tabbar .tab-ind {
  top: 6px; bottom: auto; height: calc(var(--tabbar-h) - 12px); left: max(8px, var(--sal));
  width: calc((100% - max(8px, var(--sal)) - max(8px, var(--sar))) / 5);
  background: none; border-radius: 0;
}
#tabbar .tab-ind::before {
  content: ""; position: absolute; inset: 0 4px; border-radius: 16px;
  background: var(--grad-brand); box-shadow: 0 10px 20px -10px rgba(27, 33, 89, .75), inset 0 1px 0 rgba(255,255,255,.18);
}
:root[data-theme="dark"] #tabbar .tab-ind { background: none; }
:root[data-theme="dark"] #tabbar .tab-ind::before { box-shadow: 0 10px 22px -10px rgba(142, 156, 255, .45), inset 0 1px 0 rgba(255,255,255,.14); }
#tabbar a {
  height: calc(var(--tabbar-h) - 12px); justify-content: center; padding: 0; gap: 3px; border-radius: 16px;
  font-size: 10.5px; letter-spacing: .02em;
}
#tabbar a .ico { width: 22px; height: 22px; }
#tabbar a.active, :root[data-theme="dark"] #tabbar a.active { color: #fff; }
#tabbar a.active .ico { color: #fff; transform: translateY(-1px); }
#tabbar .tab-badge { top: 4px; left: calc(50% + 8px); box-shadow: 0 0 0 2px var(--surface); }
#tabbar a.active .tab-badge { box-shadow: 0 0 0 2px rgba(255,255,255,.9); }

/* ---- Headers: left-aligned compact title, ridge overline on large titles ---- */
.pg-bar .bar-title { text-align: left; padding-left: 6px; }
.pg-title { font-stretch: 100%; }
.pg-hero .pg-title::before {
  content: ""; display: block; width: 30px; height: 4px; border-radius: 2px; margin: 0 0 12px;
  background: var(--grad-brand);
}

/* ---- Header buttons: glass back pill, tone-aware over dark heroes ----
   .page.hero-dark is set by core/router.js (auto-detected, or ctx.setHeaderTone('light')).
   It only applies while the page is at the top; once scrolled the glass header takes over. */
.back-btn {
  height: 40px; margin-left: 2px; padding: 0 12px 0 5px; gap: 1px; border-radius: 20px;
  color: var(--text); background: rgba(255,255,255,.62);
  box-shadow: inset 0 0 0 1px rgba(27,33,89,.08), 0 1px 2px rgba(27,33,89,.06);
  -webkit-backdrop-filter: saturate(170%) blur(14px); backdrop-filter: saturate(170%) blur(14px);
  transition: background .2s, color .2s, box-shadow .2s, transform .15s;
}
.back-btn .ico { width: 24px; height: 24px; color: var(--teal-strong); transition: color .2s; }
.back-btn:active { transform: scale(.95); background: var(--surface-3); }
.page.is-scrolled .back-btn { background: transparent; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
:root[data-theme="dark"] .back-btn { color: #fff; background: rgba(255,255,255,.08); box-shadow: inset 0 0 0 1px rgba(255,255,255,.1); }
:root[data-theme="dark"] .back-btn .ico, :root[data-theme="dark"] .pg-head .icon-btn { color: #fff; }
:root[data-theme="dark"] .page.is-scrolled .back-btn { background: transparent; box-shadow: none; }
.pg-head .icon-btn { transition: background .2s, color .2s, transform .15s; }

.page.hero-dark:not(.is-scrolled) .pg-head .back-btn,
.page.hero-dark:not(.is-scrolled) .pg-head .back-btn .ico,
.page.hero-dark:not(.is-scrolled) .pg-head .icon-btn { color: #fff; }
.page.hero-dark:not(.is-scrolled) .pg-head .back-btn {
  background: rgba(255,255,255,.14); box-shadow: inset 0 0 0 1px rgba(255,255,255,.2), 0 4px 14px -6px rgba(5,8,24,.4);
}
.page.hero-dark:not(.is-scrolled) .pg-head .icon-btn {
  background: rgba(255,255,255,.12); box-shadow: inset 0 0 0 1px rgba(255,255,255,.16);
  -webkit-backdrop-filter: saturate(170%) blur(14px); backdrop-filter: saturate(170%) blur(14px);
  width: 40px; height: 40px; margin: 2px;
}
.page.hero-dark:not(.is-scrolled) .pg-head .icon-btn .dot { box-shadow: 0 0 0 2px rgba(255,255,255,.85); }
.page.hero-dark:not(.is-scrolled) .pg-bar .bar-title { color: #fff; }

/* ---- Drawer: follows the theme. Light = clean surface + full-color logo; dark = STG navy + white logo ---- */
#drawer .drawer-panel {
  background:
    radial-gradient(120% 40% at 0% 0%, rgba(27, 33, 89,.10) 0%, transparent 60%),
    radial-gradient(90% 30% at 100% 100%, rgba(74,79,192,.08) 0%, transparent 70%),
    var(--surface);
  color: var(--text); border-radius: 0 26px 26px 0; width: min(84vw, 350px);
  border-right: 1px solid var(--line);
}
:root[data-theme="dark"] #drawer .drawer-panel {
  background: radial-gradient(130% 60% at 0% 0%, #1E3B5C 0%, #1B2159 45%, #131A45 100%);
  color: #E9ECF8; border-right-color: rgba(255,255,255,.06);
}
.drawer-logo { width: 176px; margin: 18px 22px 8px; }
.drawer-user { box-shadow: 0 12px 26px -16px rgba(27,33,89,.6); }
:root[data-theme="dark"] .drawer-user { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.1); box-shadow: none; }
.drawer-section { color: var(--teal-strong); letter-spacing: .08em; text-transform: uppercase; font-size: 11px; font-weight: 800; padding-top: 18px; }
:root[data-theme="dark"] .drawer-section { color: #7FD3B0; }
.drawer-link { border-radius: 14px; margin: 1px 10px; padding: 11px 12px; max-width: calc(100% - 20px); }
button.drawer-link { width: calc(100% - 20px); }
.drawer-link:active { background: var(--surface-3); }
.drawer-link .ico { color: var(--teal-strong); }
.drawer-link-feature {
  background: linear-gradient(100deg, rgba(27, 33, 89,.14), rgba(74,79,192,.08) 70%, transparent);
  box-shadow: inset 0 0 0 1px rgba(27, 33, 89,.14);
}
.drawer-link-feature .ico { color: var(--teal-strong); }
:root[data-theme="dark"] .drawer-link { color: #EEF1FA; }
:root[data-theme="dark"] .drawer-link:active { background: rgba(255,255,255,.07); }
:root[data-theme="dark"] .drawer-link .ico { color: #7FD3B0; }
:root[data-theme="dark"] .drawer-link .dl-sub { color: rgba(233,236,248,.62); }
:root[data-theme="dark"] .drawer-link .ext { color: rgba(233,236,248,.45); }
:root[data-theme="dark"] .drawer-link-feature { background: linear-gradient(100deg, rgba(142, 156, 255,.2), rgba(154,157,242,.08) 70%, transparent); box-shadow: inset 0 0 0 1px rgba(127,211,176,.14); }
:root[data-theme="dark"] .drawer-foot { color: rgba(233,236,248,.58); border-top-color: rgba(255,255,255,.1); }
:root[data-theme="dark"] .drawer-foot strong { color: #fff; }
.drawer-foot { margin-top: 10px; }

/* ---- Buttons: rounded-rect geometry, emerald primary ---- */
.btn-lg { border-radius: 16px; }
.btn-sm { border-radius: 11px; }
.btn-ink { background: var(--ink); color: #fff; }
:root[data-theme="dark"] .btn-ink { background: #EEF1FA; color: #17224A; }
.btn-brand { background: var(--grad-brand); color: #fff; box-shadow: 0 10px 22px -12px rgba(27, 33, 89, .8); }

/* ==========================================================================
   3.0.3 native-feel layer
   ========================================================================== */
/* Dark glass header: deep navy glass with crisp text (was milky) */
:root[data-theme="dark"] .pg-head::before {
  background: rgba(16, 26, 61, .82);
  -webkit-backdrop-filter: saturate(150%) blur(20px); backdrop-filter: saturate(150%) blur(20px);
  border-bottom-color: rgba(255, 255, 255, .07);
}
:root[data-theme="dark"] .page.is-scrolled .pg-bar .bar-title { color: #F4F6FD; }

/* Decorative line art is gone everywhere (owner: no wavy/ridge/zigzag lines). Safety net for old markup. */
.ac-ridge, .ad-ridge, .fn-ridge, .fn-hero-ridge, .ec-ridge, .boot-ribbon, .pa-ridge, .wn-ridge { display: none !important; }

/* No springy "website" pops on content that re-renders (badges, dots, empty icons). Presses stay subtle. */
.tm-badge, .cl-chat-dot, .empty .e-icon, .tab-badge, .icon-btn .dot { animation: none !important; }
#tabbar a.active .ico { transform: none; }

/* Native horizontal strips: contain sideways overscroll so a swipe never rubber-bands the page (iOS WKWebView) */
.scroller, .chips, .tm-track, .hm-slider-track, .tk-ackscroll, .rs-table-scroll, .prose table, [data-hscroll] {
  overscroll-behavior-x: contain; touch-action: pan-x pan-y; -webkit-overflow-scrolling: touch;
}