/*
 * siteHeader.css
 * Site-wide header: government bar, red NOTICE ribbon, and navy navigation
 * bar. Markup is generated by js/siteHeader.js on every page; ribbon movement
 * is driven by js/noticeTicker.js.
 *
 * Look ported from the Webflow home page (gray government bar with the
 * "Here's how you know" panel; navy bar, Montserrat links, Generation /
 * Transmission / Dams & Reservoirs dropdowns, Energy Czar logo left, P3 logo
 * right). Below 992px the links move into a slide-in drawer opened by a
 * hamburger button.
 *
 * Heights are fixed: the dashboard pages size their content to "viewport minus
 * header" through a flex-column body, so a content-driven header height would
 * shift the charts after fonts load.
 *
 * All classes are namespaced site-* so neither the Webflow remote stylesheet
 * (home/search/policy pages) nor Tabler (dashboard pages) restyles them.
 */

/* ================= HEADER SHELL ================= */

.site-header {
  --site-navy: #001f3f;
  --site-ribbon-red: #c41230;
  --site-ribbon-border: #173145;
  --site-gold: #ffc629;
  --site-link-hover: #509b94;
  --site-sublink-hover: #cadfe6;
  --site-gov-gray: #394447;
  --site-gov-height: 20px;
  --site-ribbon-height: 40px;
  --site-nav-height: 80px;

  position: relative;
  z-index: 1000;          /* above dashboard banners (z:20) and cells (z:10) */
  flex: none;             /* dashboard pages are flex-column bodies */
  width: 100%;
  margin: 0;
  padding: 0;
  font-family: Montserrat, "Segoe UI", Arial, sans-serif;
  box-sizing: border-box;
}
.site-header *,
.site-header *::before,
.site-header *::after {
  box-sizing: border-box;
}

/* ================= GOVERNMENT BAR ================= */

.site-govbar {
  position: relative;
  background: var(--site-gov-gray);
  color: #fff;
  z-index: 20; /* panel overlays the ribbon and nav below */
}
.site-govbar-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: var(--site-gov-height);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 500;
  line-height: 14px;
}
.site-govbar-icon {
  display: block;
  width: 20px;
  height: 20px;
}
.site-govbar-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0;
  background: none;
  border: 0;
  color: inherit;
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}
.site-govbar-toggle:focus-visible {
  outline: 2px solid var(--site-gold);
  outline-offset: 2px;
}
.site-govbar-caret {
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-top: -3px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.2s;
}
.site-govbar.is-open .site-govbar-caret {
  transform: rotate(225deg);
  margin-top: 3px;
}

/* Explanation panel: overlays the page instead of pushing it down so the
   fixed-viewport dashboard pages keep their layout while it is open. */
.site-govbar-panel {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 10px 40px;
  background: #f3f3f3;
  color: #000;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}
.site-govbar-panel[hidden] { display: none; }
.site-govbar-card {
  display: flex;
  align-items: center;
  border-left: 3px solid #000;
  border-radius: 6px;
  padding-left: 10px;
}
.site-govbar-flags {
  display: inline-flex;
  flex: none;
  gap: 4px;
  margin: 0 10px;
}
.site-govbar-flags img {
  display: block;
  width: 24px;
  height: auto;
}
.site-govbar-lock {
  display: block;
  flex: none;
  width: 25px;
  height: 25px;
  margin: 0 10px;
}
.site-govbar-card p {
  margin: 0;
  padding: 10px 0 10px 10px;
  font-size: 12px;
  font-weight: 400;
  line-height: 20px;
}
.site-govbar-lock-glyph { vertical-align: -1px; }

/* ================= RED NOTICE RIBBON ================= */

.site-ribbon {
  display: flex;
  align-items: center;
  height: var(--site-ribbon-height);
  background: var(--site-ribbon-red);
  border-top: 1px solid var(--site-ribbon-border);
  border-bottom: 1px solid var(--site-ribbon-border);
}

/* Scrolling message. js/noticeTicker.js drives the movement with the Web
   Animations API; the CSS keyframes below run only when JS is unavailable. */
.notice-ticker {
  overflow: hidden;
  width: 100%;
}
.notice-ticker-track {
  display: flex;
  width: max-content;
  will-change: transform;
  animation: notice-ticker-scroll 10s linear infinite;
}
.notice-ticker:hover .notice-ticker-track {
  animation-play-state: paused;
}
.notice-ticker-text {
  white-space: nowrap;
  padding-right: 8em;    /* fallback gap before noticeTicker.js builds the copies */
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.01em;
  color: #fff;
}
/* Gold delimiters bracketing each message pass (created by noticeTicker.js) */
.notice-ticker-cap {
  color: var(--site-gold);
  font-size: 0.72em;
  letter-spacing: 0.15em;
  margin: 0 1.4em;
  vertical-align: 0.08em;
}
@keyframes notice-ticker-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* ================= NAVIGATION BAR ================= */

.site-nav {
  display: flex;
  align-items: center;
  height: var(--site-nav-height);
  padding: 0 12px;
  background: var(--site-navy);
  color: #fff;
}

/* Bar logos: pinned to the edges by auto margins */
.site-nav-logo {
  display: block;
  flex: none;
  line-height: 0;
}
.site-nav-logo--left  { margin-right: auto; }
.site-nav-logo--right { margin-left: auto; }
.site-nav-logo img {
  display: block;
  height: 80px;
  width: auto;
  max-width: none;
}
/* The P3 mark is a dense near-square; at the full 80px it reads much heavier
   than the coat of arms, so 60px balances the two visually. */
.site-nav-logo--right img { height: 60px; }

/* Hamburger button: hidden on desktop, shown in the drawer layout */
.site-nav-burger {
  display: none;
  flex: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 0 10px;
  margin: 0;
  background: none;
  border: 0;
  border-radius: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.site-nav-burger span {
  display: block;
  width: 24px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: transform 0.3s, opacity 0.3s;
}
.site-header.is-open .site-nav-burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.site-header.is-open .site-nav-burger span:nth-child(2) { opacity: 0; }
.site-header.is-open .site-nav-burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Menu: on desktop a centered row of links; on phone/tablet a drawer */
.site-nav-menu {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 auto;
}

/* In-drawer logo copies: only exist visually in the drawer layout */
.site-nav-menu-logo { display: none; }

/* Top-level link */
.site-nav-link,
.site-nav-toggle {
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 20px 5px;
  background: none;
  border: 0;
  border-radius: 0;
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  text-transform: capitalize;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.15s;
}
.site-nav-link:hover,
.site-nav-link:focus-visible,
.site-nav-toggle:hover,
.site-nav-toggle:focus-visible {
  color: var(--site-link-hover);
  text-decoration: none;
}
.site-nav-link:focus-visible,
.site-nav-toggle:focus-visible,
.site-nav-sublink:focus-visible,
.site-nav-burger:focus-visible {
  outline: 2px solid var(--site-gold);
  outline-offset: -2px;
}
/* Current page: bold white, matching Webflow's w--current */
.site-nav-link.is-current,
.site-nav-toggle.is-current {
  font-weight: 700;
}

/* Dropdown group */
.site-nav-group {
  position: relative;
  display: flex;
}
.site-nav-toggle {
  gap: 8px;
  padding: 20px 10px;
}
/* Chevron caret after the label */
.site-nav-caret {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin: -4px 0 0 2px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.2s;
}

/* Submenu: opens below the toggle on hover, keyboard focus, or click */
.site-nav-sub {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 100%;
  flex-direction: column;
  padding: 0;
  margin: 0;
  background: var(--site-navy);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
  z-index: 10;
}
.site-nav-sublink {
  display: block;
  padding: 10px 30px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s;
}
.site-nav-sublink:hover,
.site-nav-sublink:focus-visible {
  color: var(--site-sublink-hover);
  text-decoration: none;
}
.site-nav-sublink.is-current {
  color: var(--site-gold);
  font-weight: 700;
}

/* Backdrop behind the drawer (phone/tablet only) */
.site-nav-backdrop { display: none; }

/* ================= DESKTOP (≥992px) ================= */

@media (min-width: 992px) {
  /* Menu sits centered between the logos */
  .site-nav-menu { margin: 0 auto; }

  /* Hover / keyboard focus opens a dropdown */
  .site-nav-group:hover .site-nav-sub,
  .site-nav-group:focus-within .site-nav-sub,
  .site-nav-group.is-open .site-nav-sub {
    display: flex;
  }
  .site-nav-group:hover .site-nav-toggle,
  .site-nav-group.is-open .site-nav-toggle {
    color: var(--site-link-hover);
  }
  .site-nav-group:hover .site-nav-toggle.is-current,
  .site-nav-group.is-open .site-nav-toggle.is-current {
    color: var(--site-link-hover);
  }
}

@media (min-width: 1280px) {
  .site-nav-toggle { padding-left: 15px; padding-right: 15px; }
}

/* ================= PHONE / TABLET (≤991px): drawer ================= */

/* Keep in sync with DRAWER_MAX_WIDTH in js/siteHeader.js. */
@media (max-width: 991px) {
  .site-header { --site-nav-height: 60px; }

  .site-nav { padding: 0 10px 0 4px; }

  /* Bar logos leave the bar; they reappear inside the drawer */
  .site-nav-logo { display: none; }

  .site-nav-burger { display: flex; }

  /* Drawer: slides in from the left over the page. position:fixed lets it
     escape the dashboard pages' overflow:hidden body. */
  .site-nav-menu {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    height: 100vh;
    height: 100dvh;
    width: 300px;
    max-width: 86vw;
    margin: 0;
    padding: 12px 0 16px;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    overflow-y: auto;
    background: var(--site-navy);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.4);
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform 0.4s ease, visibility 0s linear 0.4s;
    z-index: 1002;
  }
  .site-header.is-open .site-nav-menu {
    transform: none;
    visibility: visible;
    transition: transform 0.4s ease;
  }

  .site-nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0s linear 0.3s;
    z-index: 1001;
  }
  .site-header.is-open .site-nav-backdrop {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s;
  }

  /* Logos inside the drawer: Energy Czar at the top, P3 at the bottom */
  .site-nav-menu-logo {
    display: block;
    padding: 14px 20px;
    line-height: 0;
  }
  .site-nav-menu-logo img {
    display: block;
    width: auto;
    max-width: 230px;
    height: 64px;
    object-fit: contain;
    object-position: left center;
  }
  .site-nav-menu-logo--p3 { margin-top: auto; }
  .site-nav-menu-logo--p3 img { height: 52px; }

  /* Full-width rows */
  .site-nav-link,
  .site-nav-toggle {
    display: flex;
    width: 100%;
    padding: 14px 20px;
    font-size: 15px;
    text-align: left;
  }
  .site-nav-group {
    display: block;
    position: static;
  }
  .site-nav-toggle {
    justify-content: space-between;
    gap: 12px;
  }
  .site-nav-caret {
    width: 8px;
    height: 8px;
    margin: 0 4px 0 0;
  }
  .site-nav-group.is-open .site-nav-caret { transform: rotate(225deg); margin-top: 4px; }

  /* Sub-links expand in place under their toggle (accordion), no hover */
  .site-nav-sub {
    position: static;
    min-width: 0;
    box-shadow: none;
    background: rgba(255, 255, 255, 0.04);
  }
  .site-nav-group.is-open .site-nav-sub { display: flex; }
  .site-nav-sublink {
    padding: 11px 20px 11px 36px;
    font-size: 14px;
  }
}

@media (max-width: 767px) {
  /* Government bar wraps onto two lines: text row, then the toggle */
  .site-govbar-bar {
    flex-wrap: wrap;
    row-gap: 4px;
    padding: 4px 10px;
  }
  .site-govbar-toggle { flex-basis: 100%; justify-content: center; }
  .site-govbar-panel {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 10px;
  }
  .site-govbar-card p { font-size: 11px; line-height: 17px; }
}
