/* ==========================================================================
   BridgeWell V2 — SITEWIDE design system (official brand).
   Loaded globally by base.html AFTER bridgewell.css + bridgewell-polish.css so
   it wins. The ENTIRE retheme is gated behind body.bw-v2-theme: brand tokens
   are redefined on that class (NOT :root), so removing the one body class (or
   this stylesheet link) is a complete, instant rollback. base.html's skeleton,
   SEO, consent, pixels, messages, cookie handling, and member mobile nav are
   untouched.

   Official palette (brand identity sheet):
     Deep Navy #001B4D · Bridge Blue #24A8F5 · Aqua Teal #19D2C5 ·
     Cool Gray #6E8192 · White. Type: Montserrat.
   Interactive/text blue is darkened (--bw-blue-ink #0C74C6) for WCAG-AA.
   ========================================================================== */

/* ── Brand tokens (scoped to the V2 body class — override bridgewell.css) ── */
body.bw-v2-theme {
  --bw-navy:        #001B4D;   /* Deep Navy */
  --bw-navy-mid:    #0b2a63;
  --bw-blue:        #24A8F5;   /* Bridge Blue — accents/emphasis */
  --bw-blue-dark:   #1487d4;
  --bw-blue-light:  #e4f3fe;
  --bw-blue-ink:    #0C74C6;   /* accessible blue for links/small text */
  --bw-sky:         #37b0f7;
  --bw-teal:        #19D2C5;   /* Aqua Teal */
  --bw-teal-ink:    #0a857a;   /* accessible teal for small text */
  --bw-teal-light:  #d7f6f2;
  --bw-navy-text:   #001B4D;
  --bw-slate:       #33415c;
  --bw-muted:       #6E8192;   /* Cool Gray */
  --bw-surface:     #f3f7fb;
  --bw-surface-d:   #e9eff6;
  --bw-white:       #ffffff;
  --bw-border:      #dbe3ee;
  --bw-font:        'Montserrat','Inter',system-ui,-apple-system,'Segoe UI',sans-serif;
  --bw-radius:      0.9rem;
  --bw-radius-sm:   0.5rem;
  --bw-radius-pill: 999px;
  --bw-shadow:      0 1px 2px rgba(0,27,77,.06), 0 2px 8px rgba(0,27,77,.06);
  --bw-shadow-md:   0 4px 14px rgba(0,27,77,.08), 0 18px 36px rgba(0,27,77,.10);
  --bw-shadow-lg:   0 10px 28px rgba(0,27,77,.12), 0 36px 70px rgba(0,27,77,.16);
}

/* Body/base type → Montserrat everywhere under the V2 theme. */
body.bw-v2-theme { font-family: var(--bw-font); }
body.bw-v2-theme h1, body.bw-v2-theme h2, body.bw-v2-theme h3,
body.bw-v2-theme h4, body.bw-v2-theme h5, body.bw-v2-theme h6 {
  font-family: var(--bw-font);
  color: var(--bw-navy);
  letter-spacing: -.018em;
}

/* Accessible link color (bright Bridge Blue fails AA on white for text). */
body.bw-v2-theme a { color: var(--bw-blue-ink); }
body.bw-v2-theme a:hover { color: var(--bw-navy); }

/* ── Buttons — V2 pill system ─────────────────────────────────────────── */
body.bw-v2-theme .btn {
  font-family: var(--bw-font);
  font-weight: 700;
  border-radius: var(--bw-radius-pill);
  letter-spacing: -.01em;
  transition: transform .15s ease, background .15s ease, box-shadow .2s ease, color .15s ease;
}
body.bw-v2-theme .btn:hover { transform: translateY(-1px); }
/* Primary = Bridge Blue with Deep-Navy text (AA ~6.5:1), matches the homepage. */
body.bw-v2-theme .btn-primary {
  background: var(--bw-blue); color: var(--bw-navy); border-color: var(--bw-blue);
  box-shadow: var(--bw-shadow);
}
body.bw-v2-theme .btn-primary:hover {
  background: var(--bw-blue-dark); border-color: var(--bw-blue-dark);
  color: var(--bw-navy); box-shadow: var(--bw-shadow-md);
}
body.bw-v2-theme .btn-outline {
  background: transparent; color: var(--bw-blue-ink); border-color: var(--bw-border);
}
body.bw-v2-theme .btn-outline:hover {
  background: var(--bw-blue-light); color: var(--bw-blue-ink); border-color: var(--bw-blue);
}
body.bw-v2-theme .btn-ghost { color: var(--bw-slate); }
body.bw-v2-theme .btn-ghost:hover { background: var(--bw-surface); color: var(--bw-navy); }
body.bw-v2-theme .btn-dark { background: var(--bw-navy); border-color: var(--bw-navy); color: #fff; }
body.bw-v2-theme .btn-dark:hover { background: var(--bw-navy-mid); border-color: var(--bw-navy-mid); }
body.bw-v2-theme .btn-white { background: #fff; color: var(--bw-navy); border-color: #fff; }

/* ── Navbar — V2 sticky, blurred, brand-tokened ───────────────────────── */
body.bw-v2-theme .navbar {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in oklab, #ffffff 84%, transparent);
  backdrop-filter: blur(14px) saturate(1.3);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  border-bottom: 1px solid var(--bw-border);
  box-shadow: 0 1px 0 rgba(0,27,77,.03);
}
body.bw-v2-theme .navbar .container { min-height: 68px; }
body.bw-v2-theme .navbar-nav { gap: .35rem; }
body.bw-v2-theme .navbar-nav a {
  font-weight: 600; color: var(--bw-slate);
  border-radius: var(--bw-radius-pill); padding: .45rem .85rem;
}
body.bw-v2-theme .navbar-nav a:hover { background: var(--bw-blue-light); color: var(--bw-blue-ink); }
body.bw-v2-theme .navbar-logo { height: 34px; }
body.bw-v2-theme .navbar-actions .btn-ghost { color: var(--bw-slate); font-weight: 600; }

/* ── Forms — V2 inputs ────────────────────────────────────────────────── */
body.bw-v2-theme input[type="text"], body.bw-v2-theme input[type="email"],
body.bw-v2-theme input[type="password"], body.bw-v2-theme input[type="tel"],
body.bw-v2-theme input[type="number"], body.bw-v2-theme input[type="date"],
body.bw-v2-theme textarea, body.bw-v2-theme select,
body.bw-v2-theme .form-control {
  border-radius: var(--bw-radius-sm);
  border-color: var(--bw-border);
  font-family: var(--bw-font);
}
body.bw-v2-theme .form-control:focus,
body.bw-v2-theme input:focus, body.bw-v2-theme textarea:focus, body.bw-v2-theme select:focus {
  border-color: var(--bw-blue);
  box-shadow: 0 0 0 3px rgba(36,168,245,.18);
  outline: none;
}
body.bw-v2-theme .form-label { color: var(--bw-navy); }

/* ── Cards — V2 radius/shadow ─────────────────────────────────────────── */
body.bw-v2-theme .card {
  border-radius: var(--bw-radius);
  border-color: var(--bw-border);
  box-shadow: var(--bw-shadow);
}
body.bw-v2-theme .card:hover { box-shadow: var(--bw-shadow-md); }

/* ── Focus visibility (a11y) ──────────────────────────────────────────── */
body.bw-v2-theme :where(a,button,[tabindex],input,select,textarea):focus-visible {
  outline: 3px solid #1299df; outline-offset: 2px; border-radius: 6px;
}

/* ── Footer — already navy (token now #001B4D); V2 polish ─────────────── */
body.bw-v2-theme .footer { background: var(--bw-navy); }
body.bw-v2-theme .footer a:hover { color: #fff; }

/* ── Auth pages — V2 branded split panel (login/signup/reset) ─────────── */
body.bw-v2-theme .bw-auth {
  background: linear-gradient(180deg, #fff, var(--bw-surface));
  padding: clamp(1.5rem, 5vw, 3.5rem) 0;
}
body.bw-v2-theme .bw-auth__grid {
  max-width: 1000px; margin-inline: auto; padding-inline: 1.25rem;
  display: grid; gap: 1.5rem; grid-template-columns: 1fr;
}
@media (min-width: 900px) {
  body.bw-v2-theme .bw-auth__grid { grid-template-columns: 1fr 1fr; align-items: stretch; gap: 2rem; }
}
body.bw-v2-theme .bw-auth__brand {
  display: none; border-radius: var(--bw-radius); overflow: hidden; color: #fff;
  background:
    radial-gradient(600px 300px at 80% -10%, rgba(25,210,197,.20), transparent 60%),
    linear-gradient(160deg, var(--bw-navy), #06285f);
}
@media (min-width: 900px) { body.bw-v2-theme .bw-auth__brand { display: flex; align-items: center; } }
body.bw-v2-theme .bw-auth__brand-inner { padding: 2.5rem; }
body.bw-v2-theme .bw-auth__brand-logo { height: 34px; width: auto; margin-bottom: 1.5rem; }
body.bw-v2-theme .bw-auth__brand-h { color: #fff; font-size: 1.6rem; line-height: 1.15; margin-bottom: .75rem; }
body.bw-v2-theme .bw-auth__brand-p { color: rgba(255,255,255,.82); margin-bottom: 1.25rem; }
body.bw-v2-theme .bw-auth__bullets { display: grid; gap: .6rem; list-style: none; margin: 0; padding: 0; }
body.bw-v2-theme .bw-auth__bullets li { position: relative; padding-left: 1.6rem; color: rgba(255,255,255,.92); }
body.bw-v2-theme .bw-auth__bullets li::before {
  content: ""; position: absolute; left: 0; top: .45em; width: 13px; height: 7px;
  border-left: 2.2px solid var(--bw-teal); border-bottom: 2.2px solid var(--bw-teal);
  transform: rotate(-45deg);
}
body.bw-v2-theme .bw-auth__form-col { display: flex; flex-direction: column; justify-content: center; }
body.bw-v2-theme .bw-auth__card { width: 100%; }
body.bw-v2-theme .bw-auth__h { font-size: 1.5rem; margin-bottom: .35rem; }
body.bw-v2-theme .bw-auth__sub { color: var(--bw-muted); font-size: .92rem; margin-bottom: 1.25rem; }
body.bw-v2-theme .bw-auth__foot { text-align: center; color: var(--bw-muted); font-size: .9rem; margin-top: 1rem; }

/* ── Reduced motion ───────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  body.bw-v2-theme .btn:hover { transform: none; }
}

/* ── Clinician photo module (clinical-care section) ───────────────────────
   Two portrait cards (Dr. Carr / Dr. Tenbrink), each with its baked-in
   credential badge. The panel background matches the images' soft field so
   there is no visible image edge; the panel keeps a light surface in BOTH
   themes because the photos carry a light backdrop (same rationale as the
   white content cards on the dark homepage). Images keep their natural aspect
   ratios (width/height set → no layout shift, no distortion). */
body.bw-v2-theme .bw-clinician-photos {
  display: grid; grid-template-columns: 1fr;
  gap: clamp(1rem, 3vw, 1.75rem);
  max-width: 940px; margin: 2rem auto 0;
  padding: clamp(1rem, 3.5vw, 1.9rem);
  background: #faf9f7;
  border-radius: clamp(1.25rem, 3vw, 2rem);
  box-shadow: 0 24px 60px rgba(0, 61, 160, .12);
}
@media (min-width: 720px) {
  body.bw-v2-theme .bw-clinician-photos { grid-template-columns: 1fr 1fr; align-items: start; }
}
body.bw-v2-theme .bw-clinician-photos__card { margin: 0; }
body.bw-v2-theme .bw-clinician-photos__card img {
  display: block; width: 100%; height: auto;
  border-radius: clamp(1rem, 2.5vw, 1.5rem);
}
/* Screen-reader-only caption (visible credentials are baked into the images). */
body.bw-v2-theme .bw-sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ══════════════════════════════════════════════════════════════════════════
   LIGHT / DARK THEME TOGGLE
   The sitewide controller (base.html) sets html[data-bwv-theme="dark"]. The
   toggle button lives in the shared navbar; icon swaps by theme. Dark tokens
   below re-theme the shared chrome (navbar, mobile menu, logo, auth) so the
   toggle is meaningful sitewide. The homepage (.bw-home-v2) and its FAQ /
   pricing cards carry their own complete dark palette. Default (no attribute)
   is unchanged light — so this whole block is a pure opt-in overlay.
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Theme toggle button ──────────────────────────────────────────────── */
body.bw-v2-theme .bw-theme-toggle {
  display: inline-grid; place-items: center; flex: none;
  width: 40px; height: 40px; padding: 0;
  border-radius: var(--bw-radius-pill);
  border: 1.5px solid var(--bw-border);
  background: #fff; color: var(--bw-slate); cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .15s ease;
}
body.bw-v2-theme .bw-theme-toggle:hover {
  border-color: var(--bw-blue); color: var(--bw-navy); transform: translateY(-1px);
}
body.bw-v2-theme .bw-theme-toggle svg { width: 19px; height: 19px; display: block; }
body.bw-v2-theme .bw-theme-toggle__moon { display: none; }
html[data-bwv-theme="dark"] body.bw-v2-theme .bw-theme-toggle__sun { display: none; }
html[data-bwv-theme="dark"] body.bw-v2-theme .bw-theme-toggle__moon { display: block; }
@media (prefers-reduced-motion: reduce) {
  body.bw-v2-theme .bw-theme-toggle:hover { transform: none; }
}

/* ── Logo swap (navy wordmark ↔ white wordmark) ───────────────────────── */
body.bw-v2-theme .navbar-logo-dark { display: none; }
html[data-bwv-theme="dark"] body.bw-v2-theme .navbar-logo-light { display: none; }
html[data-bwv-theme="dark"] body.bw-v2-theme .navbar-logo-dark { display: block; }

/* ── Dark theme — shared chrome ───────────────────────────────────────────
   Deliberately scoped with explicit colors rather than remapping the global
   --bw-* tokens: those tokens (--bw-surface/--bw-slate/--bw-border/…) are used
   pervasively across the authenticated portal, which was not designed for a
   dark surface. Remapping them would cascade dark-on-dark bugs into un-audited
   portal chrome (e.g. the top-bar identity pill). So dark mode re-themes only
   the shared marketing chrome + auth; the member identity chip stays a light
   chip on the dark bar (readable), and portal body content is untouched. */

/* Navbar */
html[data-bwv-theme="dark"] body.bw-v2-theme .navbar {
  background: color-mix(in oklab, #05132b 82%, transparent);
  border-bottom-color: #21345c;
  box-shadow: 0 1px 0 rgba(0,0,0,.35);
}
html[data-bwv-theme="dark"] body.bw-v2-theme .navbar-nav a { color: #c7d7ee; }
html[data-bwv-theme="dark"] body.bw-v2-theme .navbar-nav a:hover { background: #0f2750; color: #8fd0fb; }
html[data-bwv-theme="dark"] body.bw-v2-theme .navbar-actions .btn-ghost { color: #c7d7ee; }
html[data-bwv-theme="dark"] body.bw-v2-theme .navbar-actions .btn-ghost:hover { background: #0f2750; color: #fff; }
html[data-bwv-theme="dark"] body.bw-v2-theme .navbar-toggle { color: #eaf1fb; }
html[data-bwv-theme="dark"] body.bw-v2-theme .bw-theme-toggle {
  background: #0c2247; border-color: #324670; color: #c7d7ee;
}
html[data-bwv-theme="dark"] body.bw-v2-theme .bw-theme-toggle:hover { border-color: #8fd0fb; color: #fff; }

/* Mobile menu panel */
html[data-bwv-theme="dark"] body.bw-v2-theme .mobile-menu {
  background: #071b3e; border-bottom-color: #21345c;
}
html[data-bwv-theme="dark"] body.bw-v2-theme .mobile-menu a { color: #dbeafe; }
html[data-bwv-theme="dark"] body.bw-v2-theme .mobile-menu a:hover { background: #0f2750; color: #8fd0fb; }

/* ── Dark theme — auth / login split panel ────────────────────────────── */
html[data-bwv-theme="dark"] body.bw-v2-theme .bw-auth {
  background: linear-gradient(180deg, #05132b, #0a1e40);
}
html[data-bwv-theme="dark"] body.bw-v2-theme .bw-auth__h,
html[data-bwv-theme="dark"] body.bw-v2-theme .bw-auth h1,
html[data-bwv-theme="dark"] body.bw-v2-theme .bw-auth h2 { color: #eaf1fb; }
html[data-bwv-theme="dark"] body.bw-v2-theme .bw-auth__sub,
html[data-bwv-theme="dark"] body.bw-v2-theme .bw-auth__foot { color: #aebdd4; }
html[data-bwv-theme="dark"] body.bw-v2-theme .bw-auth .card {
  background: #0c2247; border-color: #21345c;
}
html[data-bwv-theme="dark"] body.bw-v2-theme .bw-auth label,
html[data-bwv-theme="dark"] body.bw-v2-theme .bw-auth .form-label { color: #eaf1fb; }
html[data-bwv-theme="dark"] body.bw-v2-theme .bw-auth input,
html[data-bwv-theme="dark"] body.bw-v2-theme .bw-auth select,
html[data-bwv-theme="dark"] body.bw-v2-theme .bw-auth textarea {
  background: #05132b; border-color: #324670; color: #eaf1fb;
}
html[data-bwv-theme="dark"] body.bw-v2-theme .bw-auth input::placeholder { color: #7488a6; }
