/* P2 global chrome — header, drawer, footer, trust, disclosure, callouts, cookie, age gate */

:root {
  --bex-header-h: 72px;
  --bex-header-h-mobile: 60px;
  --bex-topbar-h: 36px;
  --bex-shadow-card: var(
    --wp--custom--shadow--card,
    0 1px 2px rgba(15, 23, 42, 0.06),
    0 4px 16px rgba(15, 23, 42, 0.06)
  );
  --bex-radius-card: var(--wp--custom--radius--card, 12px);
  --bex-radius-button: var(--wp--custom--radius--button, 8px);
  --bex-radius-chip: var(--wp--custom--radius--chip, 999px);
}

/* —— Top bar (age / responsible-use notice; off unless body.bex-age-gate-on) —— */
.bex-topbar {
  display: none;
  min-height: var(--bex-topbar-h);
  background: var(--wp--preset--color--brand-dark, #0c3b48);
  color: var(--wp--preset--color--white, #fff);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.35rem 1rem;
  text-align: center;
}
body.bex-age-gate-on .bex-topbar {
  display: flex;
}
.bex-topbar a {
  color: inherit;
  text-decoration: underline;
}

/* —— Sticky header —— */
.bex-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: var(--bex-header-h);
  background: var(--wp--preset--color--white, #fff);
  border-bottom: 1px solid var(--wp--preset--color--line, #e2e8f0);
  transition: height 0.2s ease, box-shadow 0.2s ease;
}
.bex-header.is-shrunk {
  height: 56px;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.06);
}
.bex-header__inner {
  max-width: 1200px;
  margin: 0 auto;
  height: 100%;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
}
.bex-header__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: var(--wp--preset--color--brand, #0f4c5c);
  flex-shrink: 0;
}
.bex-header__logo,
header .bex-header__logo,
.bex-header img.bex-header__logo {
  height: 40px !important;
  width: 40px !important;
  max-width: 40px !important;
  max-height: 40px !important;
  object-fit: contain !important;
  display: block !important;
  flex-shrink: 0;
}
.bex-header.is-shrunk .bex-header__logo {
  height: 32px;
}
.bex-header__name {
  font-family: var(--wp--preset--font-family--heading, Georgia, serif);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--wp--preset--color--brand, #0f4c5c);
  white-space: nowrap;
}
.bex-header__nav {
  display: none;
  flex: 1;
  justify-content: center;
  gap: 1.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.bex-header__nav a {
  text-decoration: none;
  color: var(--wp--preset--color--ink, #0f172a);
  font-weight: 600;
  font-size: 0.95rem;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
}
.bex-header__nav a:hover {
  color: var(--wp--preset--color--brand, #0f4c5c);
}
.bex-header__actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.bex-icon-btn {
  appearance: none;
  border: 0;
  background: transparent;
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--bex-radius-button);
  color: var(--wp--preset--color--ink, #0f172a);
  cursor: pointer;
}
.bex-icon-btn:hover,
.bex-icon-btn:focus-visible {
  background: var(--wp--preset--color--surface, #f8fafc);
  outline: 2px solid var(--wp--preset--color--brand, #0f4c5c);
  outline-offset: 2px;
}
.bex-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 1.15rem;
  border-radius: var(--bex-radius-button);
  font-weight: 600;
  text-decoration: none;
  border: 2px solid transparent;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
}
.bex-btn--primary {
  background: var(--wp--preset--color--brand, #0f4c5c);
  color: var(--wp--preset--color--white, #fff) !important;
}
.bex-btn--primary:hover {
  background: var(--wp--preset--color--brand-dark, #0c3b48);
}
.bex-btn--secondary {
  background: transparent;
  color: var(--wp--preset--color--brand, #0f4c5c) !important;
  border-color: var(--wp--preset--color--brand, #0f4c5c);
}
.bex-btn--ghost {
  background: transparent;
  color: var(--wp--preset--color--ink, #0f172a) !important;
  border-color: var(--wp--preset--color--line, #e2e8f0);
}
.bex-header__cta {
  display: none;
}
.bex-header__menu-toggle {
  display: inline-flex;
}

@media (min-width: 960px) {
  .bex-header__nav {
    display: flex;
  }
  .bex-header__cta {
    display: inline-flex;
  }
  .bex-header__menu-toggle {
    display: none;
  }
}

@media (max-width: 959px) {
  .bex-header {
    height: var(--bex-header-h-mobile);
  }
  .bex-header__name {
    font-size: 1.05rem;
  }
}

/* —— Mobile drawer —— */
.bex-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 1100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.bex-drawer-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}
.bex-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(100%, 360px);
  height: 100%;
  background: var(--wp--preset--color--white, #fff);
  z-index: 1101;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  display: flex;
  flex-direction: column;
  padding: 1rem 1.25rem 1.5rem;
  box-shadow: -8px 0 24px rgba(15, 23, 42, 0.12);
}
.bex-drawer.is-open {
  transform: translateX(0);
}
.bex-drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.bex-drawer__nav {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.bex-drawer__nav a {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 0 0.5rem;
  text-decoration: none;
  color: var(--wp--preset--color--ink, #0f172a);
  font-weight: 600;
  font-size: 1.05rem;
  border-radius: var(--bex-radius-button);
}
.bex-drawer__nav a:hover,
.bex-drawer__nav a:focus-visible {
  background: var(--wp--preset--color--brand-tint, #eef2f4);
}
.bex-drawer__cta {
  margin: 1rem 0;
}
.bex-drawer__policies {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--wp--preset--color--line, #e2e8f0);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.bex-drawer__policies a {
  min-height: 44px;
  display: flex;
  align-items: center;
  color: var(--wp--preset--color--muted, #64748b);
  text-decoration: none;
  font-size: 0.9rem;
}
body.bex-drawer-open {
  overflow: hidden;
}

/* —— Breadcrumbs —— */
.bex-breadcrumbs {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.75rem 1rem 0;
  font-size: 0.875rem;
  color: var(--wp--preset--color--muted, #64748b);
}
.bex-breadcrumbs ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}
.bex-breadcrumbs li:not(:last-child)::after {
  content: "/";
  margin-left: 0.35rem;
  opacity: 0.6;
}
.bex-breadcrumbs a {
  color: inherit;
  text-decoration: none;
}
.bex-breadcrumbs a:hover {
  color: var(--wp--preset--color--brand, #0f4c5c);
  text-decoration: underline;
}

/* —— Disclosure bar —— */
.bex-disclosure {
  max-width: 1200px;
  margin: 0.75rem auto 0;
  padding: 0.65rem 1rem;
  background: var(--wp--preset--color--info-bg, #eff6ff);
  color: var(--wp--preset--color--info, #1d4ed8);
  border: 1px solid color-mix(in srgb, var(--wp--preset--color--info, #1d4ed8) 22%, transparent);
  border-radius: var(--bex-radius-button);
  font-size: 0.9rem;
  line-height: 1.45;
}
.bex-disclosure a {
  color: inherit;
  font-weight: 600;
}

/* —— Trust row (byline) —— */
.bex-trust-row,
.bex-trust-row--compact {
  max-width: 720px;
  margin: 1rem auto 0;
  padding: 0 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.85rem;
  font-size: 0.875rem;
  color: var(--wp--preset--color--muted, #64748b);
  line-height: 1.35;
}
.bex-trust-row__author {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
}
.bex-trust-row__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--wp--preset--color--brand-tint, #eef2f4);
  border: 1px solid var(--wp--preset--color--line, #e2e8f0);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--wp--preset--color--brand, #0f4c5c);
  flex-shrink: 0;
}
.bex-trust-row__avatar--placeholder {
  text-transform: uppercase;
}
.bex-trust-row__by,
.bex-trust-row__updated,
.bex-trust-row__reviewed {
  display: inline;
}
.bex-trust-row strong {
  color: var(--wp--preset--color--ink, #0f172a);
  font-weight: 600;
}
.bex-trust-row__meta {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: center;
}
.bex-trust-row a,
.bex-trust-row__policy {
  color: var(--wp--preset--color--brand, #0f4c5c);
  font-weight: 600;
  text-decoration: none;
}
/* Never show builder placeholder labels on the live site. */
.bex-placeholder-label {
  display: none !important;
}

/* Header search panel */
.bex-search-panel {
  border-top: 1px solid var(--wp--preset--color--line, #e2e8f0);
  background: var(--wp--preset--color--white, #fff);
  padding: 0.75rem 1rem 1rem;
}
.bex-search-panel[hidden] {
  display: none !important;
}
.bex-search-panel__form {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.bex-search-panel__input {
  flex: 1;
  min-height: 44px;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--wp--preset--color--line, #e2e8f0);
  border-radius: var(--bex-radius-button);
  font: inherit;
}
.bex-search-page-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin: 0 0 1.5rem;
  max-width: 40rem;
}
.bex-search-page-form input[type="search"] {
  flex: 1;
  min-height: 44px;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--wp--preset--color--line, #e2e8f0);
  border-radius: var(--bex-radius-button);
  font: inherit;
}
.bex-search-empty {
  padding: 1.5rem 0 2rem;
}
.bex-search-empty__title {
  margin: 0 0 0.35rem;
  font-family: var(--wp--preset--font-family--heading, Georgia, serif);
  font-size: 1.35rem;
  color: var(--wp--preset--color--ink, #0f172a);
}
.bex-search-empty__hint,
.bex-search-empty__links {
  margin: 0.35rem 0 0;
  color: var(--wp--preset--color--muted, #64748b);
}
.screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* —— Author box —— */
.bex-author-box {
  max-width: 720px;
  margin: 2.5rem auto;
  padding: 1.25rem;
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 1rem 1.25rem;
  background: var(--wp--preset--color--surface, #f8fafc);
  border: 1px solid var(--wp--preset--color--line, #e2e8f0);
  border-radius: var(--bex-radius-card);
}
.bex-author-box__photo {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--wp--preset--color--brand-tint, #eef2f4);
}
.bex-author-box__photo,
.bex-author-box__photo--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  text-align: center;
  padding: 0.5rem;
  color: var(--wp--preset--color--brand, #0f4c5c);
  line-height: 1.2;
}
/* Hide leftover placeholder author boxes still in old post content. */
.bex-author-box:has(.bex-placeholder-label),
.bex-author-box:has(.bex-author-box__photo--placeholder),
.bex-trust-row:has(.bex-placeholder-label) {
  display: none !important;
}
.bex-author-box__name {
  margin: 0;
  font-family: var(--wp--preset--font-family--heading, Georgia, serif);
  font-size: 1.15rem;
  color: var(--wp--preset--color--ink, #0f172a);
}
.bex-author-box__role {
  margin: 0.15rem 0 0.5rem;
  color: var(--wp--preset--color--muted, #64748b);
  font-size: 0.9rem;
}
.bex-author-box__bio {
  margin: 0;
  font-size: 0.95rem;
}
.bex-author-box__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.75rem;
}
.bex-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 0.65rem;
  border-radius: var(--bex-radius-chip);
  background: var(--wp--preset--color--brand-tint, #eef2f4);
  color: var(--wp--preset--color--brand, #0f4c5c);
  font-size: 0.75rem;
  font-weight: 600;
}
@media (max-width: 640px) {
  .bex-author-box {
    grid-template-columns: 1fr;
    justify-items: start;
  }
}

/* —— Callout block styles —— */
.wp-block-group.is-style-bex-takeaways,
.bex-callout--takeaways {
  background: var(--wp--preset--color--brand-tint, #eef2f4);
  border-radius: var(--bex-radius-card);
  padding: 1.25rem 1.35rem;
  border-left: 4px solid var(--wp--preset--color--brand, #0f4c5c);
}
.wp-block-group.is-style-bex-tip,
.bex-callout--tip {
  background: var(--wp--preset--color--surface, #f8fafc);
  border-radius: var(--bex-radius-card);
  padding: 1.25rem 1.35rem;
  border: 1px solid var(--wp--preset--color--line, #e2e8f0);
}
.wp-block-group.is-style-bex-warning,
.bex-callout--warning {
  background: var(--wp--preset--color--warn-bg, #fffbeb);
  color: var(--wp--preset--color--warn, #b45309);
  border-radius: var(--bex-radius-card);
  padding: 1.25rem 1.35rem;
  border-left: 4px solid var(--wp--preset--color--warn, #b45309);
}
.wp-block-group.is-style-bex-safety,
.bex-callout--safety {
  background: var(--wp--preset--color--info-bg, #eff6ff);
  color: var(--wp--preset--color--info, #1d4ed8);
  border-radius: var(--bex-radius-card);
  padding: 1.25rem 1.35rem;
  border-left: 4px solid var(--wp--preset--color--info, #1d4ed8);
}
.wp-block-group.is-style-bex-note,
.bex-callout--note {
  background: var(--wp--preset--color--white, #fff);
  border-radius: var(--bex-radius-card);
  padding: 1.15rem 1.25rem;
  border: 1px dashed var(--wp--preset--color--line, #e2e8f0);
  color: var(--wp--preset--color--text, #334155);
}
.bex-callout__label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

/* —— Footer —— */
.bex-footer {
  background: var(--wp--preset--color--ink, #0f172a);
  color: #e2e8f0;
  margin-top: 3rem;
  padding: 3rem 1rem 1.5rem;
}
.bex-footer a {
  color: #e2e8f0;
  text-decoration: none;
}
.bex-footer a:hover {
  text-decoration: underline;
}
.bex-footer__grid {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}
@media (min-width: 960px) {
  .bex-footer__grid {
    grid-template-columns: 1.4fr 1fr 1fr 1fr;
  }
}
.bex-footer__logo,
footer .bex-footer__logo,
.bex-footer img.bex-footer__logo {
  height: 40px !important;
  width: 40px !important;
  max-width: 40px !important;
  max-height: 40px !important;
  object-fit: contain !important;
  /* Dark-ready asset — do not invert (that turns cream lockups into blank boxes). */
  filter: none;
  margin-bottom: 0.75rem;
  display: block !important;
}
.bex-footer__brand-name {
  font-family: var(--wp--preset--font-family--heading, Georgia, serif);
  font-weight: 700;
  font-size: 1.15rem;
  color: #fff;
  margin: 0 0 0.35rem;
}
.bex-footer__tag {
  margin: 0;
  font-size: 0.9rem;
  opacity: 0.85;
  max-width: 28ch;
}
.bex-footer__col h3 {
  color: #fff;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0 0 0.75rem;
}
.bex-footer__col ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.bex-footer__policies {
  max-width: 1200px;
  margin: 2rem auto 0;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(226, 232, 240, 0.18);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-size: 0.85rem;
}
.bex-footer__legal {
  max-width: 1200px;
  margin: 1rem auto 0;
  font-size: 0.8rem;
  opacity: 0.75;
  line-height: 1.5;
}

/* —— Cookie banner + Consent Mode v2 defaults —— */
.bex-footer__cookie-settings {
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  text-decoration: underline;
  cursor: pointer;
}
.bex-operator-block {
  margin: 1.5rem 0;
  padding: 1rem 1.15rem;
  border: 1px solid var(--wp--preset--color--line, #e2e8f0);
  border-radius: 12px;
  background: var(--wp--preset--color--surface, #f8fafc);
}
.bex-operator-block p {
  margin: 0.35rem 0;
}
.bex-score-chip {
  display: inline-flex;
  align-items: center;
  margin: 0 1.15rem 0.35rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--wp--preset--color--brand-tint, #eef2f4);
  color: var(--wp--preset--color--brand, #0f4c5c);
}
.bex-cookie {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1200;
  background: var(--wp--preset--color--white, #fff);
  border-top: 1px solid var(--wp--preset--color--line, #e2e8f0);
  box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.08);
  padding: 1rem;
  transform: translateY(110%);
  transition: transform 0.25s ease;
}
.bex-cookie.is-visible {
  transform: translateY(0);
}
.bex-cookie__inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
}
.bex-cookie__copy {
  flex: 1 1 280px;
  margin: 0;
  font-size: 0.95rem;
  color: var(--wp--preset--color--text, #334155);
}
.bex-cookie__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.bex-cookie__actions .bex-btn {
  flex: 1 1 auto;
  min-width: 7.5rem;
}
.bex-cookie-settings {
  display: none;
  max-width: 1200px;
  margin: 0.75rem auto 0;
  padding-top: 0.75rem;
  border-top: 1px solid var(--wp--preset--color--line, #e2e8f0);
  width: 100%;
}
.bex-cookie-settings.is-open {
  display: block;
}
.bex-cookie-settings label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  font-size: 0.9rem;
}

/* —— Age gate overlay (hook; hidden unless body.bex-age-gate-on) —— */
.bex-age-gate {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1300;
  background: rgba(15, 23, 42, 0.72);
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
body.bex-age-gate-on .bex-age-gate:not([hidden]) {
  display: flex;
}
.bex-age-gate__card {
  background: var(--wp--preset--color--white, #fff);
  border-radius: var(--bex-radius-card);
  padding: 1.75rem;
  max-width: 420px;
  width: 100%;
  box-shadow: var(--bex-shadow-card);
  text-align: center;
}
.bex-age-gate__card h2 {
  margin: 0 0 0.5rem;
  font-family: var(--wp--preset--font-family--heading, Georgia, serif);
  color: var(--wp--preset--color--ink, #0f172a);
}
.bex-age-gate__actions {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}
