/* ─── Regulatory Ecosystem switcher ─────────────────────────────────────────
   The 2×2 grid trigger left of the brand and the floating mega panel beneath
   the header. Markup ships in every page's <nav>; behavior in ecosystem.js.
   Brand accents are each sibling's shipped wordmark colour (News emerald,
   Events purple, Academy orange, Jobs royal blue from regulatoryjobs.com). */

.eco-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text-light, #687489);
  cursor: pointer;
  /* Wordmark-to-trigger gap matches the header's R-to-wordmark gap (.brand-link gap: 28px). */
  margin-left: 28px;
  transition: background 0.15s ease, color 0.15s ease;
}
.eco-trigger:hover,
.eco-trigger[aria-expanded="true"] {
  background: rgba(177, 89, 27, 0.08);
  color: var(--accent, #b91c1c);
}
.eco-trigger:focus-visible {
  outline: 2px solid var(--accent, #b91c1c);
  outline-offset: 2px;
}
.eco-trigger svg { display: block; }

.eco-panel {
  position: absolute;
  top: calc(100% + 36px);
  left: 0;
  width: min(900px, calc(100vw - 48px));
  padding: 38px;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 22px;
  box-shadow: 0 30px 90px rgba(13, 37, 69, 0.13), 0 4px 16px rgba(13, 37, 69, 0.05);
  z-index: 210;
  opacity: 0;
  transform: translateY(-10px);
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.22s var(--ease-out-expo, cubic-bezier(0.16, 1, 0.3, 1)),
    transform 0.22s var(--ease-out-expo, cubic-bezier(0.16, 1, 0.3, 1)),
    visibility 0s linear 0.22s;
}
.eco-panel.is-open {
  opacity: 1;
  transform: none;
  visibility: visible;
  pointer-events: auto;
  transition:
    opacity 0.22s var(--ease-out-expo, cubic-bezier(0.16, 1, 0.3, 1)),
    transform 0.22s var(--ease-out-expo, cubic-bezier(0.16, 1, 0.3, 1));
}
/* The panel itself receives programmatic focus on open; the ring belongs on the
   cards as the user tabs, not on the container (id beats the global ring rule). */
#eco-panel:focus,
#eco-panel:focus-visible { outline: none; }

/* Ruled title: the divider lines run the full panel width (.eco-titlebar), but
   the red hover sweep covers only the segment directly above and below the
   title text — the pseudos ride the inline-block link, whose box meets the
   bar's borders. Same category-link sweep (2px #ef8b44 at 0.32s); the title
   links to /ecosystem. */
.eco-titlebar {
  border-top: 1px solid var(--border, #e2e8f0);
  border-bottom: 1px solid var(--border, #e2e8f0);
}
.eco-title {
  position: relative;
  display: inline-block;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  line-height: 1.25;
  color: var(--accent, #b91c1c);
  text-decoration: none;
  padding: 13px 0;
}
.eco-title::before,
.eco-title::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: #ef8b44;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}
.eco-title::before { top: -1px; }
.eco-title::after { bottom: -1px; }
.eco-title:hover::before,
.eco-title:hover::after,
.eco-title:focus-visible::before,
.eco-title:focus-visible::after {
  transform: scaleX(1);
}
.eco-sub {
  margin-top: 12px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-muted, #4a5568);
}

.eco-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 26px;
}

.eco-card--news { --eco-a: #0d9f4a; }
.eco-card--events { --eco-a: #781cb9; }
.eco-card--academy { --eco-a: #f76504; }
.eco-card--jobs { --eco-a: #1c4eb9; }
.eco-card--leadership { --eco-a: #b91c1c; }

.eco-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 22px 24px 21px;
  background: #ffffff;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 16px;
  text-decoration: none;
  overflow: hidden;
  transition:
    transform 0.22s var(--ease-out-quint, cubic-bezier(0.22, 1, 0.36, 1)),
    box-shadow 0.22s var(--ease-out-quint, cubic-bezier(0.22, 1, 0.36, 1)),
    border-color 0.22s ease;
}
.eco-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-strong, #cbd5e0);
  box-shadow: 0 14px 34px rgba(13, 37, 69, 0.1);
}
.eco-card:focus-visible {
  outline: 2px solid var(--eco-a);
  outline-offset: 2px;
}
/* The brand accent: a thin line drawn along the card's base on hover/focus. */
.eco-card::after {
  content: "";
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 0;
  height: 2px;
  background: var(--eco-a);
  transform: scaleX(0);
  transform-origin: left;
  opacity: 0;
  transition:
    transform 0.25s var(--ease-out-quint, cubic-bezier(0.22, 1, 0.36, 1)),
    opacity 0.18s ease;
}
.eco-card:hover::after,
.eco-card:focus-visible::after {
  transform: none;
  opacity: 1;
}

.eco-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 52px;
}
/* R-to-wordmark size and spacing mirror the header lockup:
   R = 1.126x the wordmark height, gap = 0.55x (57.6 / 51.15 / 28px in the nav). */
.eco-card-brand {
  display: inline-flex;
  align-items: center;
  gap: 24px;
  min-width: 0;
  transform-origin: left center;
  transition: transform 0.22s var(--ease-out-quint, cubic-bezier(0.22, 1, 0.36, 1));
}
.eco-card-brand img { display: block; width: auto; }
.eco-card-brand .eco-r { height: 50px; border-radius: 21%; }
.eco-card-brand .eco-wordmark { height: 44px; }
.eco-card:hover .eco-card-brand { transform: scale(1.03); }

.eco-arrow {
  flex: none;
  color: var(--text-light, #687489);
  transition:
    transform 0.22s var(--ease-out-quint, cubic-bezier(0.22, 1, 0.36, 1)),
    color 0.15s ease;
}
.eco-card:hover .eco-arrow,
.eco-card:focus-visible .eco-arrow {
  transform: translateX(3px);
  color: var(--eco-a);
}

.eco-card p {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-muted, #4a5568);
}


@media (max-width: 1280px) {
  /* The header collapses .brand-link's gap to 0 in this band; keep a usable minimum. */
  .eco-trigger { margin-left: 8px; }
}

@media (max-width: 980px) and (min-width: 769px) {
  /* Not enough width for two 50px-R cards: single column, narrower panel. */
  .eco-panel { width: min(560px, calc(100vw - 48px)); }
  .eco-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  /* Full-width sheet pinned under the (10px-padded, blur-free) mobile header.
     ecosystem.js sets --eco-top to the nav's live bottom edge on open. */
  .eco-panel {
    position: fixed;
    top: calc(var(--eco-top, 64px) + 10px);
    left: 12px;
    right: 12px;
    width: auto;
    max-height: calc(100dvh - var(--eco-top, 64px) - 26px);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 26px 20px 20px;
    border-radius: 18px;
  }
  /* The brand is the flex row's order-1 item on mobile; the trigger follows it. */
  .eco-trigger { order: 1; margin-left: 4px; }
  .eco-title { font-size: 15.5px; padding: 11px 0; }
  .eco-sub { font-size: 14px; }
  .eco-grid { grid-template-columns: 1fr; gap: 10px; margin-top: 20px; }
  .eco-card { padding: 18px 18px 17px; gap: 10px; }
  .eco-card::after { left: 18px; right: 18px; }
  .eco-card-brand { gap: 18px; }
  .eco-card-brand .eco-r { height: 41px; }
  .eco-card-brand .eco-wordmark { height: 36px; }
}

@media (max-width: 460px) {
  /* The centered wordmark leaves no room for both the R mark and the trigger;
     the trigger takes the R's slot (the wordmark itself still reads REGULATORY).
     This sheet only loads on pages that carry the switcher, so plain scoping is safe. */
  .brand-link .brand-r { display: none; }
}
@media (max-width: 400px) {
  .eco-trigger { width: 40px; margin-right: 2px; }
}

@media (prefers-reduced-motion: reduce) {
  .eco-panel {
    transform: none;
    transition: opacity 0.12s linear, visibility 0s linear 0.12s;
  }
  .eco-panel.is-open { transition: opacity 0.12s linear; }
  .eco-card,
  .eco-card::after,
  .eco-card-brand,
  .eco-arrow,
  .eco-title::before,
  .eco-title::after {
    transition: none;
  }
  .eco-card:hover { transform: none; }
  .eco-card:hover .eco-card-brand { transform: none; }
  .eco-card:hover .eco-arrow,
  .eco-explore:hover svg { transform: none; }
}

@media print {
  .eco-trigger,
  .eco-panel { display: none; }
}
