/**
 * CC Global Header
 *
 * All styles for the unified header. Single file. No framework deps.
 * BEM naming under the .cc-gh root namespace to avoid collision with
 * theme/plugin styles.
 *
 * Mobile-first: base styles target the small viewport, media queries
 * scale up to the desktop layout at 768px+.
 *
 * Color tokens at the top — adjust there to retheme without touching
 * component rules.
 */

/* -----------------------------------------------------------------------------
   Tokens
   -------------------------------------------------------------------------- */

.cc-gh {
  /* Colors */
  --cc-gh-black: #0a0a0a;
  --cc-gh-red: #c0392b;
  --cc-gh-red-hover: rgba(0, 0, 0, 0.18);
  --cc-gh-gray-bg: #f2f2f2;
  --cc-gh-text: #1a1a1a;
  --cc-gh-text-muted: #555;
  --cc-gh-text-light: #777;
  --cc-gh-border: #e0e0e0;
  --cc-gh-border-input: #ccc;

  /* Status colors */
  --cc-gh-green: #2a7a3a;
  --cc-gh-green-bg: #e8f7eb;
  --cc-gh-green-border: #b9e4c0;
  --cc-gh-green-fg-dark: #5cd384;

  --cc-gh-amber: #a86b00;
  --cc-gh-amber-bg: #fff5e0;
  --cc-gh-amber-border: #f3d28e;
  --cc-gh-amber-cta: #f5a623;
  --cc-gh-amber-fg-dark: #ffc266;

  /* Typography */
  --cc-gh-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* Layout */
  --cc-gh-z-drawer: 9999;
  --cc-gh-z-overlay: 9998;

  font-family: var(--cc-gh-font);
  color: var(--cc-gh-text);
  line-height: 1.5;
  box-sizing: border-box;
}

.cc-gh *,
.cc-gh *::before,
.cc-gh *::after {
  box-sizing: inherit;
}

.cc-gh a {
  text-decoration: none;
  color: inherit;
}

.cc-gh button {
  font-family: inherit;
  cursor: pointer;
  border: 0;
  background: transparent;
  padding: 0;
  color: inherit;
}

/* -----------------------------------------------------------------------------
   Top bar (black)
   -------------------------------------------------------------------------- */

.cc-gh__top {
  background: var(--cc-gh-black);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #fff;
}

/* Hamburger — mobile only */
.cc-gh__hamburger {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  color: #fff;
}

.cc-gh__hamburger:hover,
.cc-gh__hamburger:focus-visible {
  background: rgba(255, 255, 255, 0.14);
}

.cc-gh__hamburger-icon {
  position: relative;
  width: 20px;
  height: 2px;
  background: currentColor;
  display: block;
}

.cc-gh__hamburger-icon::before,
.cc-gh__hamburger-icon::after {
  content: "";
  position: absolute;
  left: 0;
  width: 20px;
  height: 2px;
  background: currentColor;
}

.cc-gh__hamburger-icon::before { top: -6px; }
.cc-gh__hamburger-icon::after  { top: 6px; }

/* Mobile logo (in top bar on mobile only) */
.cc-gh__mobile-logo {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: #fff;
}

.cc-gh__mobile-logo-red {
  color: var(--cc-gh-red);
}

/* Top-bar nav (desktop) */
.cc-gh__nav {
  display: none;
  gap: 2px;
  align-items: center;
}

.cc-gh__nav-item {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  transition: background 0.12s;
}

.cc-gh__nav-item:hover,
.cc-gh__nav-item:focus-visible {
  background: rgba(255, 255, 255, 0.14);
}

.cc-gh__nav-item.is-active {
  background: var(--cc-gh-red);
}

/* Top-bar utility cluster (right side) */
.cc-gh__utility {
  display: flex;
  gap: 4px;
  align-items: center;
}

.cc-gh__user {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border-radius: 4px;
  color: #fff;
  transition: background 0.12s;
}

.cc-gh__user:hover,
.cc-gh__user:focus-visible {
  background: rgba(255, 255, 255, 0.14);
}

.cc-gh__greeting {
  font-size: 12px;
  /* Hidden on mobile to save space; visible on desktop. */
  display: none;
}

.cc-gh__cart {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: 4px;
  color: #fff;
  transition: background 0.12s;
}

.cc-gh__cart:hover,
.cc-gh__cart:focus-visible {
  background: rgba(255, 255, 255, 0.14);
}

.cc-gh__cart-badge {
  position: absolute;
  top: 0;
  right: 0;
  background: var(--cc-gh-red);
  color: #fff;
  border-radius: 50%;
  min-width: 16px;
  height: 16px;
  font-size: 10px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* GN CTA variants */
.cc-gh__gn {
  display: none; /* Hidden on mobile; surfaced inside drawer instead. */
  align-items: center;
  gap: 5px;
  padding: 7px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  margin-left: 4px;
  border: 1px solid transparent;
}

.cc-gh__gn--cta {
  background: var(--cc-gh-red);
  color: #fff;
}

.cc-gh__gn--cta:hover {
  background: #a13325;
}

.cc-gh__gn--active {
  background: rgba(50, 180, 90, 0.18);
  color: var(--cc-gh-green-fg-dark);
  border-color: rgba(50, 180, 90, 0.4);
}

.cc-gh__gn--lapsed {
  background: rgba(255, 180, 40, 0.18);
  color: var(--cc-gh-amber-fg-dark);
  border-color: rgba(255, 180, 40, 0.5);
}

.cc-gh__gn--lapsed:hover {
  background: rgba(255, 180, 40, 0.28);
}

/* -----------------------------------------------------------------------------
   Brand row (gray, mobile = search-only)
   -------------------------------------------------------------------------- */

.cc-gh__brand {
  background: var(--cc-gh-gray-bg);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.cc-gh__brand-cell {
  display: flex;
  align-items: center;
  min-width: 0;
}

.cc-gh__brand-cell--left,
.cc-gh__brand-cell--right {
  display: none; /* Mobile: only search renders. */
}

.cc-gh__brand-cell--center {
  flex: 1;
  justify-content: stretch;
}

.cc-gh__logo {
  display: inline-flex;
  align-items: center;
}

.cc-gh__logo-img {
  display: block;
  max-height: 44px;
  width: auto;
  max-width: 320px;
  height: auto;
}

.cc-gh__mobile-logo-img {
  display: block;
  max-height: 28px;
  width: auto;
  max-width: 160px;
}

.cc-gh__logo-text {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: var(--cc-gh-text);
}

.cc-gh__logo-red {
  color: var(--cc-gh-red);
}

.cc-gh__logo-tld {
  font-size: 10px;
  color: #666;
  vertical-align: 4px;
  margin-left: 2px;
  font-weight: 400;
}

/* Search form */
.cc-gh__search {
  display: flex;
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--cc-gh-border-input);
}

/* SearchWP form variant: SearchWP renders its own markup, so we just
   constrain width and let its internal styles handle the rest.
   The wrapper keeps the form aligned within the brand-row center cell. */
.cc-gh__search--searchwp {
  display: block;
  width: 100%;
  max-width: 380px;
  border: 0;
  background: transparent;
  overflow: visible;
}

.cc-gh__search--searchwp form,
.cc-gh__search--searchwp .searchwp-form {
  width: 100%;
}

.cc-gh__search-filter {
  padding: 7px 8px;
  border: 0;
  border-right: 1px solid var(--cc-gh-border-input);
  background: #fff;
  font-size: 12px;
  font-family: inherit;
  outline: none;
  flex-shrink: 0;
}

.cc-gh__search-input {
  flex: 1;
  padding: 8px 11px;
  border: 0;
  font-size: 13px;
  font-family: inherit;
  min-width: 0;
  outline: none;
  background: #fff;
}

.cc-gh__search-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  background: var(--cc-gh-gray-bg);
  border-left: 1px solid var(--cc-gh-border-input);
  color: var(--cc-gh-text-muted);
}

.cc-gh__search-submit:hover {
  background: #e5e5e5;
}

/* Banner ad slot */
.cc-gh__ad {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.cc-gh__ad img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* -----------------------------------------------------------------------------
   Red bar (contextual section nav)
   Hidden on mobile — categories surface inside the drawer instead.
   -------------------------------------------------------------------------- */

.cc-gh__redbar {
  display: none;
  background: var(--cc-gh-red);
  color: #fff;
}

.cc-gh__redbar-inner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
  padding: 8px 14px;
}

.cc-gh__redbar-item {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 3px;
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  transition: background 0.12s;
}

.cc-gh__redbar-item:hover,
.cc-gh__redbar-item:focus-visible {
  background: var(--cc-gh-red-hover);
}

.cc-gh__redbar-item.is-active {
  background: rgba(0, 0, 0, 0.32);
}

/* -----------------------------------------------------------------------------
   Mobile drawer
   -------------------------------------------------------------------------- */

.cc-gh__drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(86vw, 380px);
  background: #fff;
  z-index: var(--cc-gh-z-drawer);
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  display: flex;
  flex-direction: column;
  box-shadow: 2px 0 20px rgba(0, 0, 0, 0.15);
  overflow: hidden;
}

.cc-gh__drawer[hidden] { display: flex; } /* keep markup, override default hidden */
.cc-gh__drawer.is-open { transform: translateX(0); }

.cc-gh__drawer-header {
  background: var(--cc-gh-black);
  color: #fff;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.cc-gh__drawer-close {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  color: #fff;
}

.cc-gh__drawer-close:hover,
.cc-gh__drawer-close:focus-visible {
  background: rgba(255, 255, 255, 0.14);
}

.cc-gh__drawer-logo {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: #fff;
}

.cc-gh__drawer-spacer { width: 36px; }

.cc-gh__drawer-body {
  padding: 14px;
  overflow-y: auto;
  flex: 1;
}

.cc-gh__drawer-body .cc-gh__search {
  margin-bottom: 14px;
  max-width: none;
}

/* Drawer overlay (click-to-dismiss) */
.cc-gh__drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: var(--cc-gh-z-overlay);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.cc-gh__drawer-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}

/* Drawer user block */
.cc-gh__user-block {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 6px;
  margin-bottom: 12px;
  border: 1px solid transparent;
  text-decoration: none;
  color: var(--cc-gh-text);
}

.cc-gh__user-block--loggedin {
  background: #f7f7f7;
}

.cc-gh__user-block--active {
  background: var(--cc-gh-green-bg);
  border-color: var(--cc-gh-green-border);
}

.cc-gh__user-block--lapsed {
  background: var(--cc-gh-amber-bg);
  border-color: var(--cc-gh-amber-border);
}

.cc-gh__user-block-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--cc-gh-red);
  color: #fff;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}

.cc-gh__user-block-text {
  display: flex;
  flex-direction: column;
}

.cc-gh__user-block-name {
  font-size: 13px;
  font-weight: 500;
}

.cc-gh__user-block-status {
  font-size: 11px;
  font-weight: 500;
  margin-top: 2px;
}

.cc-gh__user-block--loggedin .cc-gh__user-block-status { color: var(--cc-gh-text-light); }
.cc-gh__user-block--active   .cc-gh__user-block-status { color: var(--cc-gh-green); }
.cc-gh__user-block--lapsed   .cc-gh__user-block-status { color: var(--cc-gh-amber); }

/* Drawer categories */
.cc-gh__drawer-categories {
  border-top: 1px solid var(--cc-gh-border);
}

/* Subsite items group (e.g., on a state subsite, the state-specific links
   shown at the top of the drawer body — separate group, no accordion).
   Specificity bumped via .cc-gh wrapper to defeat theme link styles. */
.cc-gh__drawer-subsite-items {
  margin-bottom: 16px;
  border-top: 1px solid var(--cc-gh-border);
  border-bottom: 1px solid var(--cc-gh-border);
}

.cc-gh .cc-gh__drawer-subsite-item {
  display: block;
  padding: 12px 4px;
  font-size: 14px;
  font-weight: 500;
  color: var(--cc-gh-text);
  text-decoration: none;
  border-bottom: 1px solid var(--cc-gh-border);
  transition: background 0.1s;
}

.cc-gh .cc-gh__drawer-subsite-item:last-child {
  border-bottom: 0;
}

.cc-gh .cc-gh__drawer-subsite-item:hover,
.cc-gh .cc-gh__drawer-subsite-item:focus-visible {
  background: #f7f7f7;
}

/* Section divider (label) inside the drawer (used on subsites to mark
   the transition from subsite-specific items to main-site links). */
.cc-gh__drawer-section-divider {
  padding: 14px 4px 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--cc-gh-text-light);
  font-weight: 600;
  border-top: 1px solid var(--cc-gh-border);
  margin-top: 4px;
}

/* Flat-link rows used in the drawer on subsites for main-site categories
   (no accordion, just navigate). */
.cc-gh .cc-gh__drawer-flat-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 13px 4px;
  border-bottom: 1px solid var(--cc-gh-border);
  font-size: 14px;
  font-weight: 500;
  color: var(--cc-gh-text);
  text-decoration: none;
  transition: background 0.1s;
}

.cc-gh .cc-gh__drawer-flat-link:hover,
.cc-gh .cc-gh__drawer-flat-link:focus-visible {
  background: #f7f7f7;
}

.cc-gh__drawer-category {
  border-bottom: 1px solid var(--cc-gh-border);
}

.cc-gh__drawer-category-row {
  width: 100%;
  padding: 13px 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-align: left;
  background: transparent;
  transition: background 0.1s;
}

.cc-gh__drawer-category-row:hover,
.cc-gh__drawer-category-row:focus-visible {
  background: #f7f7f7;
}

.cc-gh__drawer-category[data-expanded="true"] .cc-gh__drawer-category-row {
  background: #f7f7f7;
}

.cc-gh__drawer-category-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--cc-gh-text);
}

.cc-gh__drawer-subitems {
  background: #f7f7f7;
}

.cc-gh__drawer-subitem {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 4px 10px 22px;
  font-size: 13px;
  color: #444;
}

.cc-gh__drawer-subitem:hover,
.cc-gh__drawer-subitem:focus-visible {
  background: #ebebeb;
}

.cc-gh__drawer-subitem--all {
  font-weight: 500;
  color: var(--cc-gh-red);
}

/* Drawer GN CTA */
.cc-gh__drawer-cta {
  display: block;
  text-align: center;
  padding: 12px;
  margin-top: 14px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  color: #fff;
}

.cc-gh__drawer-cta--join {
  background: var(--cc-gh-red);
}

.cc-gh__drawer-cta--lapsed {
  background: var(--cc-gh-amber-cta);
}

.cc-gh__drawer-footer-links {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--cc-gh-border);
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 12px;
  color: var(--cc-gh-text-light);
}

.cc-gh__drawer-footer-links a:hover { color: var(--cc-gh-text); }

/* -----------------------------------------------------------------------------
   Icons
   Embedded inline SVGs via background-image — keeps the plugin
   dependency-free (no FontAwesome / Tabler / etc. required).
   -------------------------------------------------------------------------- */

.cc-gh__icon {
  display: inline-block;
  width: 20px;
  height: 20px;
  background-position: center center;
  background-repeat: no-repeat;
  background-size: contain;
}

.cc-gh__icon--user {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='12' cy='7' r='4'/%3E%3C/svg%3E");
}

.cc-gh__icon--cart {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='21' r='1'/%3E%3Ccircle cx='20' cy='21' r='1'/%3E%3Cpath d='M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6'/%3E%3C/svg%3E");
}

.cc-gh__icon--search {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23555555' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
  width: 16px;
  height: 16px;
}

.cc-gh__icon--close {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='18' y1='6' x2='6' y2='18'/%3E%3Cline x1='6' y1='6' x2='18' y2='18'/%3E%3C/svg%3E");
}

.cc-gh__icon--check {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235cd384' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 11.08V12a10 10 0 1 1-5.93-9.14'/%3E%3Cpolyline points='22 4 12 14.01 9 11.01'/%3E%3C/svg%3E");
  width: 14px;
  height: 14px;
}

.cc-gh__icon--warning {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffc266' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z'/%3E%3Cline x1='12' y1='9' x2='12' y2='13'/%3E%3Cline x1='12' y1='17' x2='12.01' y2='17'/%3E%3C/svg%3E");
  width: 14px;
  height: 14px;
}

.cc-gh__icon--chevron-right {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23aaaaaa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='9 18 15 12 9 6'/%3E%3C/svg%3E");
  width: 16px;
  height: 16px;
}

.cc-gh__icon--chevron-down {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  width: 16px;
  height: 16px;
}

/* -----------------------------------------------------------------------------
   Desktop breakpoint (768px+)
   -------------------------------------------------------------------------- */

@media (min-width: 768px) {

  /* Hamburger and mobile logo: hidden */
  .cc-gh__hamburger,
  .cc-gh__mobile-logo {
    display: none;
  }

  /* Top-bar nav: shown inline */
  .cc-gh__nav {
    display: flex;
  }

  /* Top bar: a bit more padding on desktop */
  .cc-gh__top {
    padding: 8px 16px;
  }

  /* Greeting text visible alongside icon for logged-in users */
  .cc-gh__greeting {
    display: inline;
  }

  /* GN CTA appears inline in top bar */
  .cc-gh__gn {
    display: inline-flex;
  }

  /* Brand row: three equal columns */
  .cc-gh__brand {
    padding: 12px 16px;
    gap: 14px;
  }

  .cc-gh__brand-cell {
    flex: 1;
  }

  .cc-gh__brand-cell--left {
    display: flex;
    justify-content: flex-start;
  }

  .cc-gh__brand-cell--center {
    justify-content: center;
  }

  .cc-gh__brand-cell--right {
    display: flex;
    justify-content: flex-end;
  }

  /* Red bar visible on desktop */
  .cc-gh__redbar {
    display: block;
  }

  /* Drawer never opens on desktop, regardless of state */
  .cc-gh__drawer,
  .cc-gh__drawer-overlay {
    display: none !important;
  }
}

/* -----------------------------------------------------------------------------
   wpautop neutralizer
   When the shortcode is dropped inside a content area that runs wpautop,
   the surrounding <p> tags get inserted around our top-level wrapper.
   This rule prevents the rendered <p> from breaking the visual layout.
   -------------------------------------------------------------------------- */

p > .cc-gh,
p:has(> .cc-gh) {
  display: contents;
}

p:has(> .cc-gh) {
  margin: 0;
  padding: 0;
}
