/* =========================================================
   SRF Mega Menu — desktop panels + mobile drawer
   Breakpoint: 991px
   ========================================================= */

:root {
  --srf-navy: #004990;          /* mega panel background */
  --srf-navy-dark: #002952;     /* drawer utility card */
  --srf-yellow: #FEC916;        /* panel headings / carets */
  --srf-orange: #F5853F;        /* CTA buttons */
  --srf-white: #ffffff;
  --srf-divider: rgba(255, 255, 255, 0.35);
  --srf-nav-height: 44px;
}

/* ---------- Shared button ---------- */
.srf-btn {
  display: inline-block;
  background: var(--srf-orange);
  color: var(--srf-white) !important;
  font-weight: 700;
  font-family: 'Segma';
  font-size: 18px;
  line-height: 1;
  padding: 14px 26px;
  border-radius: 999px;
  text-decoration: none;
  transition: background-color 0.2s ease, transform 0.15s ease;
}
.srf-btn:hover {
  background: #e06f14;
  transform: translateY(-1px);
}

/* =========================================================
   DESKTOP NAV (> 991px)
   ========================================================= */
.srf-nav {
  position: relative;
}

.srf-nav__list {
  display: flex;
  align-items: stretch;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
  justify-content: flex-end;
}

.srf-nav__item {
  position: static; /* mega panel spans the full nav width */
}

.srf-nav__link {
  display: flex;
  align-items: center;
  gap: 7px;
  height: var(--srf-nav-height);
  padding: 0 16px;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
  color: #000000;
  text-decoration: none;
  font-family: 'Segma';
}

/* caret: right-pointing triangle, rotates down when open */
.srf-nav__caret {
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 6px solid #004990;
  transition: transform 0.2s ease;
}

.srf-nav__item.is-open .srf-nav__link {
  background: var(--srf-navy);
  color: var(--srf-white);
}
.srf-nav__item.is-open .srf-nav__caret {
  border-left-color: var(--srf-yellow);
  transform: rotate(90deg);
}

/* ---------- Mega panel ---------- */
.srf-mega {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 999;
  background: var(--srf-navy);
  color: var(--srf-white);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.25);
}
.srf-mega[hidden] {
  display: none;
}

.srf-mega__inner {
  position: relative;
  max-width: 1399px;
  margin: 0 auto;
  padding: 6.5rem 2.5rem 4rem;
}

.srf-mega__close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 30px;
  height: 30px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.6);
  color: var(--srf-white);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.srf-mega__close:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* ---------- Column grid ----------
   First column slightly wider (1.4fr), separated by vertical rules. */
.srf-mega__grid {
  display: grid;
  gap: 0;
  /* fallback for column counts other than 4/5: equal columns */
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
}
.srf-mega__grid--cols-4 {
  grid-template-columns: 1.4fr 1fr 1fr 1.15fr;
}
.srf-mega__grid--cols-5 {
  grid-template-columns: 1.4fr 1fr 1fr 1fr 1fr;
}

.srf-mega__col {
  padding: 0 24px;
  border-left: 1px solid var(--srf-divider);
  min-width: 0;
}
.srf-mega__col--intro {
  border-left: 0;
  padding-left: 0;
  padding-right: 40px;
}
.srf-mega__col--image {
  display: flex;
  align-items: flex-start;
}
.srf-mega__col--image img {
  width: 100%;
  height: auto;
  display: block;
}

.srf-mega__title {
  color: var(--srf-yellow);
  font-weight: 700;
  margin: 0 0 20px;
  line-height: 1.2;
}
.srf-mega__subtitle {
  color: var(--srf-white);
  font-family: 'Segma';
  font-size: 18px;
  font-weight: 700;
  line-height: 1.25;
  margin: 0 0 20px;
}
.srf-mega__desc {
  font-size: 18px;
  line-height: 1.6;
  margin: 0 0 22px;
  color: var(--srf-white);
}

.srf-mega__col-heading {
  color: var(--srf-white);
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 14px;
  line-height: 1.25;
}
.srf-mega__col-text {
  font-size: 16px;
  line-height: 1.7;
  margin: 0;
}
.srf-mega__col-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.srf-mega__col-heading,
.srf-mega__col-heading > a {
  color: var(--srf-white);
  text-decoration: none;
}
/* .srf-mega__col-heading:hover {
  text-decoration: underline;
  color: var(--srf-yellow);
}
 */
.srf-mega__col-heading.current-menu-item {
    color: var(--srf-yellow);
}
.srf-mega__col-heading.current-menu-item > a {
    color: var(--srf-yellow);
}
/* Hover and keyboard focus. */
.srf-mega__col-heading > a:hover,
.srf-mega__col-heading > a:focus-visible {
    color: var(--srf-yellow);
    text-decoration: underline;
}

.srf-mega__col-item {
  margin: 0 0 15px;
  line-height: 1.3;
}
.srf-mega__col-item:last-of-type {
  margin-bottom: 0;
}
.srf-mega__col-item a {
  color: var(--srf-white);
  font-family: 'Segma';
  font-size: 16px;
  line-height: 1.25;
  text-decoration: none;
}
.srf-mega__col-item a:hover {
  text-decoration: underline;
  color: var(--srf-yellow);
}
.srf-mega__col-item.current-menu-item a {
  color: var(--srf-yellow);
}

.srf-mega__col-item.nav-heading {
  margin: 20px 0 14px;
}
.srf-mega__col-item.nav-heading a {
  font-size: 24px;
  margin: 0 0 14px;
  line-height: 1.25;
}
.srf-mega__col-item.nav-heading-small a {
  font-size: 20px;
  line-height: 1.25;
  margin: 0 0 14px;
}
.srf-mega__col-item.nav-heading a,
.srf-mega__col-item.nav-heading-small a {
  color: var(--srf-white);
  font-weight: 700;
  text-decoration: none;
  /* cursor: default; */
}
.srf-mega__col-item.nav-heading a:hover,
.srf-mega__col-item.nav-heading-small a:hover {
  text-decoration: underline;
  color: var(--srf-yellow);
}
.srf-mega__col-item.current-menu-item.nav-heading a,
.srf-mega__col-item.current-menu-item.nav-heading-small a {
  color: var(--srf-yellow);
}
.srf-mega__col-item.extra-padd {
  padding-top: 11px;
}

/* ---------- Hamburger (hidden on desktop) ---------- */
.srf-nav__hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 10px;
  background: transparent;
  border: 0;
  cursor: pointer;
}
.srf-nav__hamburger span {
  display: block;
  height: 3px;
  border-radius: 2px;
  background: var(--srf-navy);
}

/* Drawer hidden on desktop */
.srf-drawer,
.srf-drawer__backdrop {
  display: none;
}

@media (min-width: 992px) {
  .srf-mega__col-item:not(.nav-heading, .nav-heading-small) {
    margin: 0 0 10px;
    line-height: 1.1;
  }
}

/* =========================================================
   MOBILE (<= 991px)
   ========================================================= */
@media (max-width: 991.98px) {
  .srf-header-row {
    position: absolute !important;
	top: 18px !important;
    right: 20px !important;
    left: inherit !important;
    width: auto !important;
    min-width: auto !important;
    max-width: 50px !important;
    z-index: 9 !important;
	padding-bottom: 0 !important;
  }
  .srf-nav__desktop {
    display: none;
  }
  .srf-nav__hamburger {
    display: flex;
  }

  .srf-drawer__backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 9998;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }
  .srf-drawer__backdrop.is-visible {
    opacity: 1;
    pointer-events: auto;
  }

  .srf-drawer {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    width: 100vw;
    max-width: none;
    inset: 0;
    background: var(--srf-navy);
    color: var(--srf-white);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    overflow: hidden;
  }
  .srf-drawer.is-open {
    transform: translateX(0);
  }

  .srf-drawer__inner {
    position: relative;
    height: 100%;
  }

  .srf-drawer__close {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 3;
    width: 30px;
    height: 30px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.6);
    color: var(--srf-white);
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
  }

  /* ---------- Panels (main list + drill-down sub-panels) ---------- */
  .srf-drawer__panel--main {
    height: 100%;
    display: grid;
    padding: 50px 20px 20px;
    overflow-y: auto;
    transition: transform 0.3s ease;
  }

  .srf-drawer__list {
    list-style: none;
    margin: 0;
    padding: 0;
    align-self: center;
    display: grid;
    gap: 4vh;
  }
  .srf-drawer__item {
    margin: 0;
  }

  .srf-drawer__link {
    display: flex;
    align-items: center;
    gap: 25px;
    width: 100%;
    padding: 18px 8px;
    background: transparent;
    border: 0;
    color: var(--srf-white);
    font-size: 22px;
    font-weight: 700;
    line-height: 1.25;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    font-family: inherit;
  }

  /* yellow arrow + vertical rule before each label */
  .srf-drawer__arrow {
    flex: none;
    width: 0;
    height: 0;
    border-top: 7px solid transparent;
    border-bottom: 7px solid transparent;
    border-left: 9px solid var(--srf-yellow);
    position: relative;
    margin-right: 4px;
  }
  .srf-drawer__link .srf-drawer__arrow::after {
    content: "";
    position: absolute;
    left: 12px;
    top: -25px;
    height: 50px;
    border-left: 2px solid var(--srf-white);
  }
  .srf-drawer__arrow--back {
    display: block;
    width: 0;
    height: 0;
    border-left: 0;
    border-top: 11px solid transparent;
    border-bottom: 11px solid transparent;
    border-right: 10px solid var(--srf-yellow);
    position: relative;
  }

  /* Utility card at the bottom of the main panel */
  .srf-drawer__utility {
    background: var(--srf-navy-dark);
    border-radius: 14px;
    padding: 18px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    align-self: end;
    gap: 12px;
    margin-top: 0;
  }
  .srf-drawer__utility-list {
    list-style: none;
    margin: 0;
    padding: 0;
  }
  .srf-drawer__utility-list li {
    margin: 0 0 10px;
  }
  .srf-drawer__utility-list li:last-of-type {
    margin: 0;
  }
  .srf-drawer__utility-list a {
    color: var(--srf-white);
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
  }
  .srf-btn--donate {
    flex: none;
    padding: 12px 20px;
    font-size: 16px;
  }

  /* ---------- Drill-down sub-panels ---------- */
  .srf-drawer__panel--sub {
    position: absolute;
    inset: 0;
    z-index: 2;
    background: var(--srf-navy);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    padding: 56px 0 0;
  }
  .srf-drawer__panel--sub[hidden] {
    display: none;
  }
  .srf-drawer__panel--sub.is-active {
    transform: translateX(0);
  }

  .srf-drawer__back {
    position: absolute;
    top: 58px;
    left: 4px;
    z-index: 3;
    background: transparent;
    border: 0;
    padding: 8px;
    cursor: pointer;
  }

  /* Columns stacked + scrollable */
  .srf-drawer__scroll {
    flex: 1;
    overflow-y: scroll;
    -webkit-overflow-scrolling: touch;
    padding: 0 24px 32px 40px;
  }

  .srf-drawer__scroll .srf-mega__col {
    border-left: 2px solid var(--srf-divider);
    padding: 4px 0 4px 18px;
    margin: 0 0 30px;
  }
  .srf-drawer__scroll .srf-mega__col--intro {
    padding-left: 18px;
    margin-bottom: 60px;
  }
  .srf-drawer__scroll .srf-mega__col--image {
    border-left: 0;
    padding-left: 0;
    margin: 0 0 30px;
  }

  .srf-drawer__scroll .srf-mega__title {
    font-size: 28px;
  }
  .srf-drawer__scroll .srf-mega__col-heading {
    font-size: 20px;
  }
  .srf-drawer__scroll .srf-mega__col-item a,
  .srf-drawer__scroll .srf-mega__col-text,
  .srf-drawer__scroll .srf-mega__desc {
    font-size: 16px;
  }
  .srf-mega__col-item.nav-heading a {
    font-size: 20px !important;
  }
  .srf-mega__col-item.nav-heading-small a {
    font-size: 18px !important;
  }
}

/* Let the WPBakery header row contain the desktop mega panel */
@media (min-width: 992px) {
    .srf-header-row {
        position: relative;
        overflow: visible;
    }
    .srf-header-row .container,
    .srf-header-row .wpb_wrapper {
        position: static !important;
    }

    .srf-header-row .wpb_raw_code {
        width: 100%;
        max-width: 1399px;
        margin: auto;
        padding: 0 1.1rem;
    }
    /*
      * Remove .srf-nav as the containing block.
      * The mega panel will now position itself relative
      * to .srf-header-row.
      */
    .srf-header-row #srf-nav {
        position: static;
        width: auto;
        max-width: none;
        margin-left: 0;
    }

    /*
      * Stretch the panel across the WPBakery row.
      */
    .srf-header-row .srf-mega {
        position: absolute;
        top: 44px;
        left: 0;
        right: 0;
        width: 100%;
    }
}


/* =========================================================
   Optional desktop row-grid layouts
   Intro on the left; sections arranged on the right.
   ========================================================= */

@media (min-width: 992px) {

    /* Override the original automatic column flow. */
    .srf-mega__grid.srf-mega__grid--rows-2,
    .srf-mega__grid.srf-mega__grid--rows-3,
    .srf-mega__grid.srf-mega__grid--rows-4 {
        display: grid;
        grid-template-columns:
            minmax(0, 1.4fr)
            minmax(0, 3fr);
        grid-auto-flow: row;
        grid-auto-columns: auto;
        align-items: start;
        gap: 0;
    }

    /* Container for the sections to the right of the intro. */
    .srf-mega__grid--rows-2 > .srf-mega__items,
    .srf-mega__grid--rows-3 > .srf-mega__items,
    .srf-mega__grid--rows-4 > .srf-mega__items {
        display: grid;
        grid-auto-flow: row;
        gap: 32px 0;
        min-width: 0;
    }

    /* Two sections per row. */
    .srf-mega__grid--rows-2 > .srf-mega__items {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    /* Three sections per row. */
    .srf-mega__grid--rows-3 > .srf-mega__items {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    /* Four sections per row. */
    .srf-mega__grid--rows-4 > .srf-mega__items {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    /* Each existing section becomes one grid cell. */
    .srf-mega__items > .srf-mega__col {
        min-width: 0;
        margin: 0;
        padding: 0 24px;
        border-left: 1px solid var(--srf-divider);
        overflow-wrap: break-word;
    }
}
