/* =====================================================================
   tenant-theme.css — per-tenant color overrides
   =====================================================================
   Sits ABOVE the existing gold styling. When tenant-theme.js paints the
   --tenant-primary / --tenant-primary-soft / --tenant-primary-border /
   --tenant-primary-bright / --tenant-primary-glow / --tenant-accent
   variables onto :root, this stylesheet routes the portal's primary
   accents through those variables.

   When the variables are unset (e.g. on auth pages where the script
   doesn't run), the rules below resolve to their gold fallbacks — so
   the visual cascade stays identical to today's gold/P1 look.

   Scoped narrowly: only the elements that "feel" like brand accents
   get switched. Page backgrounds, dark cards, body text, etc. are left
   alone so a primary swap doesn't risk illegible contrast.
   ===================================================================== */

:root {
  /* Gold fallbacks — preserve today's P1 look when no tenant override is
     paint-ed in. tenant-theme.js will overwrite these on the same :root
     element when /api/tenant/current returns a primary_color. */
  --tenant-primary:        #c9a227;
  --tenant-primary-soft:   #e7c45d;
  --tenant-primary-bright: #f0c862;
  --tenant-primary-border: rgba(201, 162, 39, 0.42);
  --tenant-primary-glow:   rgba(201, 162, 39, 0.55);
  --tenant-secondary:      #a27e13;
  --tenant-accent:         #e7c45d;
}

/* ---------------------------------------------------------------------
   Hero gold tray — !important is REQUIRED because every page defines
   .hero in its own inline <style> block (which loads after this external
   stylesheet and would otherwise win the cascade). The same-specificity
   page rule used to override us — !important here makes us win.
   --------------------------------------------------------------------- */
/* CarPlay navy hero — flat slate panel with a soft tenant-colored glow at the
   top (P1 = gold whisper; other tenants = their color whisper). Navy fallbacks
   keep it valid on pages that haven't yet adopted the --panel tokens. */
.hero {
  background:
    radial-gradient(130% 92% at 50% -14%, color-mix(in srgb, var(--tenant-primary) 22%, transparent) 0%, transparent 60%),
    linear-gradient(150deg, var(--panel-2, #323d63) 0%, var(--panel, #2a3352) 100%) !important;
  box-shadow:
    0 0 0 1px var(--line2, rgba(170, 190, 230, 0.34)),
    0 18px 44px -20px rgba(0, 0, 0, 0.85),
    inset 0 1px 0 rgba(255, 255, 255, 0.06) !important;
}

/* ---------------------------------------------------------------------
   Action tray on Coach / Parent / Board HQs — same navy treatment.
   --------------------------------------------------------------------- */
.action-tray,
.action-stack,
.toolbar {
  background:
    radial-gradient(130% 92% at 50% -14%, color-mix(in srgb, var(--tenant-primary) 18%, transparent) 0%, transparent 60%),
    linear-gradient(150deg, var(--panel-2, #323d63) 0%, var(--panel, #2a3352) 100%) !important;
  box-shadow:
    0 0 0 1px var(--line2, rgba(170, 190, 230, 0.34)),
    0 12px 34px -18px rgba(0, 0, 0, 0.8),
    inset 0 1px 0 rgba(255, 255, 255, 0.06) !important;
}

/* ---------------------------------------------------------------------
   Eyebrow pills — small uppercase chips above hero titles.
   --------------------------------------------------------------------- */
.hero-eyebrow,
.hero-eye,
.command-center-eyebrow {
  border-color: var(--tenant-primary-border);
  background: color-mix(in srgb, var(--tenant-primary) 10%, transparent);
}

/* ---------------------------------------------------------------------
   Tile icon halos on .btn-action / .btn-action-icon — gold ring around
   the SVG inside each action button.
   --------------------------------------------------------------------- */
.btn-action-icon {
  border-color: var(--tenant-primary-border);
  color: var(--tenant-primary-bright);
}
.btn-action:hover {
  border-color: var(--tenant-primary-border);
}

/* ---------------------------------------------------------------------
   Hero logo helper — slots in via the `.js-tenant-logo` hook on heroes.
   tenant-theme.js sets the src and removes [hidden] when logo_url is
   present.
   --------------------------------------------------------------------- */
.js-tenant-logo {
  display: block;
  margin: 14px auto 8px;
  max-width: 180px;
  width: 60%;
  height: auto;
  /* Dark areas of the logo blend with the dark hero inset, light areas
     stay visible. Same trick we used for the TC Pop Warner mark. */
  mix-blend-mode: screen;
}
.js-tenant-logo[hidden] { display: none !important; }
@media (max-width: 480px) {
  .js-tenant-logo { max-width: 140px; }
}

/* ---------------------------------------------------------------------
   Command-center divider — gradient bar between the eyebrow chip and
   the heading.
   --------------------------------------------------------------------- */
.command-center-rule {
  background: linear-gradient(90deg,
    var(--tenant-primary-bright) 0%,
    var(--tenant-primary-soft)   50%,
    var(--tenant-primary)        100%);
  filter: drop-shadow(0 0 6px var(--tenant-primary-glow));
}

/* ---------------------------------------------------------------------
   Active category / filter / view tab pills — the "selected" gold pill
   pattern used across coach pages.
   --------------------------------------------------------------------- */
.cat-pill.is-active,
.view-tab.is-active,
.lift-tab.is-active,
.filter-pill.is-active,
.subcat-pill.is-active {
  background: linear-gradient(180deg, var(--tenant-primary-bright), var(--tenant-primary)) !important;
}

/* ---------------------------------------------------------------------
   Primary gold-gradient action buttons — coach + parent pages share
   this pattern for "Save" / "Build" / "Generate" calls-to-action.
   --------------------------------------------------------------------- */
.btn-gold,
.btn-primary.btn-gold,
.btn.btn-gold {
  background: linear-gradient(180deg,
    var(--tenant-primary-bright) 0%,
    var(--tenant-primary)        60%,
    var(--tenant-secondary)      100%) !important;
}

/* ---------------------------------------------------------------------
   Coach-tab "is-active" gold pill — used on admin-results / admin-stats
   and any page with the coach-tabs nav.
   --------------------------------------------------------------------- */
.coach-tabs {
  background:
    radial-gradient(140% 80% at 50% 0%, var(--tenant-primary-glow) 0%, transparent 55%),
    linear-gradient(180deg,
      var(--tenant-primary-bright) 0%,
      var(--tenant-primary)        55%,
      var(--tenant-secondary)      100%) !important;
}

/* Paper look (Nov 8): outside Pop Warner, heroes, trays and toolbars are white
   cards on the cream app with a hairline, and the tenant color stays the accent. */
body:not(.pw-theme):not(.keep-dark) .hero,
body:not(.pw-theme):not(.keep-dark) .action-tray,
body:not(.pw-theme):not(.keep-dark) .action-stack,
body:not(.pw-theme):not(.keep-dark) .toolbar {
  background: #fff !important; color: #141414;
  border: 1px solid #e6e1d6; box-shadow: none !important;
}
body:not(.pw-theme):not(.keep-dark) .hero::before, body:not(.pw-theme):not(.keep-dark) .hero::after { opacity: 0; }
