/* =========================================================
   COMPONENTS.CSS
   Reusable UI components — works across all pages.
   ========================================================= */

/* =========================================================
   SITE HEADER
   ========================================================= */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: var(--header-height);
  transition: background-color var(--transition);
}

/* Transparent variant — sits over a hero photo */
.site-header[data-theme="dark"] {
  background: transparent;
  color: var(--color-white);
}

/* Solid variant — use on inner pages where there's no hero */
.site-header[data-theme="solid"] {
  background: var(--color-white);
  color: var(--color-navy);
  box-shadow: var(--shadow-md);
}

/* Scrolled state — applied via JS when page is scrolled */
.site-header.site-header--scrolled {
  background: var(--color-navy);
  color: var(--color-white);
  box-shadow: 0 2px 16px rgba(4, 51, 108, 0.4);
}

.site-header__inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--gutter);
  max-width: var(--container-max);
  margin: 0 auto;
}

/* -------- LOGO -------- */
.site-logo {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.site-logo img {
  height: 52px;
  width: auto;
  max-width: none;
  transition: filter 0.3s ease;
}

/* On solid (white) header, turn the white SVG logo navy */
.site-header[data-theme="solid"]:not(.site-header--scrolled) .site-logo img {
  filter: brightness(0) saturate(100%) invert(14%) sepia(55%) saturate(1400%) hue-rotate(189deg) brightness(90%) contrast(105%);
}

/* =========================================================
   PRIMARY NAV
   ========================================================= */
.site-nav__list {
  display: flex;
  gap: var(--space-2xl);
}

.site-nav__list a {
  position: relative;
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-sm);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: var(--space-xs) 0;
  transition: color var(--transition);
}

.site-nav__list a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 2px;
  background: var(--color-red);
  transition: width var(--transition);
}

.site-nav__list a:hover::after,
.site-nav__list a:focus-visible::after {
  width: 100%;
}

/* =========================================================
   MOBILE MENU TOGGLE (hamburger)
   Sized to the 44px standard tap target — large enough to hit
   comfortably, small enough to feel refined in the header.
   ========================================================= */
.menu-toggle {
  display: none;        /* visible only below breakpoint */
  width: 44px;
  height: 44px;
  background: var(--color-red);
  border-radius: var(--radius-md);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: background var(--transition);
  flex-shrink: 0;
}

.menu-toggle:hover,
.menu-toggle:focus-visible {
  background: var(--color-deep-carmine);
}

.menu-toggle__bar {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--color-white);
  transition: transform var(--transition), opacity var(--transition);
  transform-origin: center;
}

/* Animated X when open. Translate = gap (4) + bar height (2) = 6px */
.menu-toggle[aria-expanded="true"] .menu-toggle__bar:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}
.menu-toggle[aria-expanded="true"] .menu-toggle__bar:nth-child(2) {
  opacity: 0;
}
.menu-toggle[aria-expanded="true"] .menu-toggle__bar:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* =========================================================
   NAV DROPDOWN
   ========================================================= */
.nav-has-dropdown {
  position: relative;
}

/* Wrapper holding label link + chevron button side-by-side */
.nav-dropdown__group {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

/* The navigating link part */
.nav-dropdown__label {
  position: relative;
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-sm);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: var(--space-xs) 0;
  transition: color var(--transition);
}

.nav-dropdown__label::after {
  content: '';
  position: absolute;
  left: 0; bottom: 0;
  width: 0; height: 2px;
  background: var(--color-red);
  transition: width var(--transition);
}

.nav-dropdown__label:hover::after,
.nav-has-dropdown[data-open="true"] .nav-dropdown__label::after {
  width: 100%;
}

/* Chevron-only toggle button */
.nav-dropdown__btn {
  display: inline-flex;
  align-items: center;
  padding: 4px 3px;
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  transition: color var(--transition);
}

.nav-dropdown__chevron {
  flex-shrink: 0;
  transition: transform 0.2s;
}

.nav-has-dropdown[data-open="true"] .nav-dropdown__chevron {
  transform: rotate(180deg);
}

.nav-dropdown__menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-navy);
  min-width: 210px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.3);
  border-top: 3px solid var(--color-red);
  z-index: 200;
  list-style: none;
  padding: 4px 0;
}

.nav-has-dropdown:hover .nav-dropdown__menu,
.nav-has-dropdown[data-open="true"] .nav-dropdown__menu {
  display: block;
}

.nav-dropdown__menu li { padding: 0; }

.nav-dropdown__menu a {
  display: block;
  padding: 11px 20px;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-white) !important;
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  transition: background var(--transition), padding-left var(--transition);
}

.nav-dropdown__menu li:last-child a { border-bottom: none; }
.nav-dropdown__menu a::after { display: none !important; }

.nav-dropdown__menu a:hover {
  background: rgba(255,255,255,0.12);
  padding-left: 26px;
}

/* Scroll-lock when mobile nav is open */
body.nav-open { overflow: hidden; }

@media (max-width: 1023px) {
  /* Shrink header on mobile */
  .site-header { height: var(--header-height-mobile); }

  /* Show hamburger button */
  .menu-toggle { display: flex; }

  /* Mobile nav — drawer overlay below header, scrollable when long */
  .site-nav {
    position: fixed;
    inset: 0;
    top: var(--header-height-mobile);
    background: var(--color-navy);
    z-index: 99;
    display: block;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
  }

  .site-nav[data-open="true"] {
    opacity: 1;
    pointer-events: auto;
  }

  /* Stack nav links vertically, left-aligned with hairline dividers.
     1.25rem top padding gives the first item a clear breathing buffer so
     it never feels jammed against the header divider. */
  .site-nav__list {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 1.25rem 0 3rem;
    list-style: none;
    width: 100%;
  }

  .site-nav__list > li {
    width: 100%;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  }

  .site-nav__list a {
    font-size: 0.9375rem;          /* 15px — compact, readable, fits 10+ items comfortably */
    font-weight: 600;              /* semibold — less visual heft than 700 in caps */
    color: var(--color-white);
    letter-spacing: 0.08em;
    display: block;
    padding: 0.8rem 1.25rem;        /* keeps row height ~44px tap target */
  }

  .site-nav__list a::after { display: none; }

  /* Dropdown rows in mobile: parent link + separate chevron tap area */
  .nav-has-dropdown {
    width: 100%;
    text-align: left;
  }

  .nav-dropdown__group {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    width: 100%;
    gap: 0;
  }

  .nav-dropdown__label {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--color-white);
    letter-spacing: 0.08em;
    padding: 0.8rem 1.25rem;
    flex: 1;                       /* label takes the row, chevron sits at the end */
  }

  .nav-dropdown__label::after { display: none; }

  .nav-dropdown__btn {
    color: var(--color-white);
    padding: 0 1.1rem;
    width: 48px;                   /* compact chevron tap area */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-left: 1px solid rgba(255, 255, 255, 0.07);
  }

  .nav-dropdown__chevron {
    width: 16px;
    height: 16px;
  }

  /* Dropdown sub-items — indented under the parent, slightly dimmer */
  .nav-dropdown__menu {
    position: static;
    transform: none;
    box-shadow: none;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(0, 0, 0, 0.18);
    min-width: 0;
    padding: 0.25rem 0;
  }

  .nav-has-dropdown:hover .nav-dropdown__menu { display: none; }
  .nav-has-dropdown[data-open="true"] .nav-dropdown__menu { display: block; }

  .nav-dropdown__menu a {
    font-size: 0.8125rem;          /* 13px — clearly child-level vs the 15px parents */
    font-weight: 500;
    color: rgba(255, 255, 255, 0.75) !important;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    padding: 0.55rem 1.25rem 0.55rem 2.5rem;
    letter-spacing: 0.1em;
  }

  .nav-dropdown__menu li:last-child a { border-bottom: none; }

  .nav-dropdown__menu a:hover {
    padding-left: 2.5rem;
    color: var(--color-white) !important;
    background: rgba(255, 255, 255, 0.04);
  }
}

/* =========================================================
   BUTTONS
   ========================================================= */
.btn {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-sm);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: var(--space-md) var(--space-xl);
  border: 2px solid transparent;
  transition: background var(--transition), color var(--transition),
              border-color var(--transition), transform var(--transition);
  cursor: pointer;
  text-align: center;
  line-height: 1.2;
  min-width: 160px;
}

.btn--primary {
  background: var(--color-red);
  color: var(--color-white);
}
.btn--primary:hover,
.btn--primary:focus-visible {
  background: var(--color-deep-carmine);
  transform: translateY(-1px);
}

.btn--secondary {
  background: transparent;
  color: var(--color-white);
  border-color: var(--color-white);
}
.btn--secondary:hover,
.btn--secondary:focus-visible {
  background: var(--color-white);
  color: var(--color-navy);
}

.btn--navy {
  background: var(--color-navy);
  color: var(--color-white);
}
.btn--navy:hover,
.btn--navy:focus-visible {
  background: var(--color-lapis);
}

/* Inline text link to the staff roster (people and teams).
   Inherits the surrounding text colour so it works on light
   and navy sections alike. */
/* A link inside a paragraph. base.css strips underlines and colour from
   every <a> on the site, which is right for nav items, cards, and buttons
   but leaves a link in running text looking exactly like the words around
   it. Anything in prose needs one of these classes to be visible as a link
   at all.

   .prose-link is the one to reach for. .staff-link is the same rule under
   an older name, kept because pages already use it for links to /team/. */
.prose-link,
.staff-link {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: color var(--transition);
}

.prose-link:hover,
.prose-link:focus-visible,
.staff-link:hover,
.staff-link:focus-visible {
  color: var(--color-red);
}

/* =========================================================
   CAROUSEL
   ========================================================= */
.carousel {
  position: relative;
  display: flex;
  align-items: stretch;
  background: var(--color-navy);
}

.carousel__viewport {
  flex: 1;
  overflow: hidden;
  min-width: 0;            /* prevent flex overflow */
}

.carousel__track {
  display: flex;
  transition: transform 0.5s var(--ease-smooth);
  will-change: transform;
}

.carousel__btn {
  flex-shrink: 0;
  width: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-white);
  transition: background var(--transition);
}

.carousel__btn svg {
  width: 28px;
  height: 28px;
}

.carousel__btn--prev {
  background: var(--color-beige);
}
.carousel__btn--prev:hover:not(:disabled) {
  background: #a6918c;
}

.carousel__btn--next {
  background: var(--color-red);
}
.carousel__btn--next:hover:not(:disabled) {
  background: var(--color-deep-carmine);
}

.carousel__btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* =========================================================
   CLASS CARD (inside carousel)
   ========================================================= */
.class-card {
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.class-card__link {
  display: block;
  position: relative;
  width: 100%;
  height: 100%;
  color: var(--color-white);
  outline-offset: -3px;
}

.class-card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) brightness(0.85);
  transition: transform 0.5s var(--ease-smooth),
              filter 0.4s var(--ease-smooth);
}

.class-card__link:hover .class-card__img,
.class-card__link:focus-visible .class-card__img {
  transform: scale(1.06);
  filter: grayscale(0) brightness(1);
}

.class-card__link::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top,
    rgba(4, 51, 108, 0.8) 0%,
    rgba(4, 51, 108, 0.2) 50%,
    rgba(4, 51, 108, 0) 100%);
  transition: opacity var(--transition);
}

.class-card__link:hover::after {
  opacity: 0.75;
}

.class-card__label {
  position: absolute;
  bottom: var(--space-md);
  left: var(--space-md);
  right: var(--space-md);
  z-index: 2;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-base);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

/* =========================================================
   SITE FOOTER
   ========================================================= */
.site-footer {
  background: var(--color-navy);
  color: var(--color-white);
}

.site-footer__body {
  display: grid;
  grid-template-columns: 2fr 3fr;
  max-width: var(--container-max);
  margin: 0 auto;
  width: 100%;
}

/* ---- Left panel ---- */
.site-footer__left {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-xl);
  padding: var(--space-2xl) var(--space-2xl);
  border-right: 1px solid rgba(255, 255, 255, 0.15);
  min-width: 0;
}

/* ---- Right panel ---- */

.site-footer__logo {
  display: block;
  width: 180px;
  max-width: 100%;
}

.site-footer__logo img {
  width: 100%;
  height: auto;
}

.footer-newsletter__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--fs-sm);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: var(--space-md);
}

.footer-newsletter__body {
  font-size: var(--fs-sm);
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.75);
  margin-bottom: var(--space-lg);
  max-width: none;
}

.btn--newsletter {
  display: block;
  width: 100%;
  background: var(--color-red);
  color: var(--color-white);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--fs-sm);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-align: center;
  padding: var(--space-md) var(--space-lg);
  border: none;
  transition: background var(--transition);
}

.btn--newsletter:hover,
.btn--newsletter:focus-visible {
  background: var(--color-deep-carmine);
}

.footer-social {
  margin-top: auto;
  padding-top: var(--space-xl);
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  flex-wrap: wrap;
}

.footer-social__handle {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.footer-social__links {
  display: flex;
  gap: var(--space-sm);
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: var(--color-white);
  transition: border-color var(--transition), background var(--transition);
}

.social-link:hover,
.social-link:focus-visible {
  border-color: var(--color-white);
  background: rgba(255, 255, 255, 0.08);
}

/* ---- Right panel ---- */
.site-footer__right {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xl);
  padding: var(--space-2xl) var(--space-2xl);
  min-width: 0;
}

.footer-programmes__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-xs);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
  margin-bottom: var(--space-lg);
}

.footer-programmes__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md) var(--space-lg);
}

.footer-prog {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--color-white);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-sm);
  letter-spacing: 0.03em;
  transition: color var(--transition);
}

.footer-prog:hover,
.footer-prog:focus-visible {
  color: var(--color-sea-pink);
}

.footer-prog img {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
}

/* ---- Footer bottom links ---- */
.footer-links {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-xl);
  padding-top: var(--space-xl);
  border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.footer-links__heading {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-xs);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
  margin-bottom: var(--space-md);
}

.footer-links__col ul li + li {
  margin-top: var(--space-xs);
}

.footer-links__col ul li a {
  font-size: var(--fs-sm);
  color: rgba(255, 255, 255, 0.8);
  transition: color var(--transition);
}

.footer-links__col ul li a:hover,
.footer-links__col ul li a:focus-visible {
  color: var(--color-white);
}

/* ---- Copyright bar ---- */
.site-footer__bar {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: var(--space-md) var(--space-2xl);
  max-width: var(--container-max);
  margin: 0 auto;
  width: 100%;
}

.site-footer__copy {
  font-size: var(--fs-xs);
  color: rgba(255, 255, 255, 0.4);
  max-width: none;
}

/* ---- Footer responsive ---- */
@media (max-width: 900px) {
  .site-footer__body {
    grid-template-columns: 1fr;
  }

  .site-footer__left {
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    padding-bottom: var(--space-2xl);
  }

  .footer-programmes__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 560px) {
  .site-footer__left,
  .site-footer__right {
    padding: var(--space-xl) var(--space-md);
  }

  .footer-programmes__grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-sm);
  }

  .footer-links {
    grid-template-columns: 1fr;
    gap: var(--space-lg);
  }

  .site-footer__bar {
    padding: var(--space-md);
  }
}

/* =========================================================
   ELITE PATHWAY
   ========================================================= */
.pathway {
  padding: var(--space-4xl) var(--gutter);
  background: var(--color-white);
}

.pathway__inner {
  max-width: var(--container-max);
  margin: 0 auto;
}

.pathway__header {
  max-width: 72ch;
  margin-bottom: var(--space-3xl);
}

.pathway__eyebrow {
  font-family: var(--font-display);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--color-red);
  margin-bottom: var(--space-md);
}

.pathway__title {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 4vw, 3rem);
  font-weight: 900;
  text-transform: uppercase;
  color: var(--color-navy);
  line-height: 1.05;
  margin-bottom: var(--space-lg);
}

.pathway__intro {
  font-size: var(--fs-md);
  color: var(--color-text);
  line-height: 1.7;
  max-width: 66ch;
}

.pathway__steps {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-3xl);
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-xl);
  counter-reset: pathway-step 2;
}

.pathway__step {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  padding: var(--space-xl);
  background: var(--color-off-white);
  border-top: 4px solid var(--color-navy);
  position: relative;
  counter-increment: pathway-step;
}

.pathway__step::before {
  content: "0" counter(pathway-step);
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 900;
  color: var(--color-navy-25);
  line-height: 1;
  position: absolute;
  top: var(--space-md);
  right: var(--space-lg);
}

.pathway__step-icon {
  color: var(--color-navy);
}

.pathway__step-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  flex: 1;
}

.pathway__step-title {
  font-family: var(--font-display);
  font-size: var(--fs-md);
  font-weight: 800;
  color: var(--color-navy);
  text-transform: uppercase;
  letter-spacing: -0.01em;
}

.pathway__step-body {
  font-size: var(--fs-sm);
  color: var(--color-text);
  line-height: 1.65;
  max-width: none;
}

.pathway__cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-xl);
  padding: var(--space-xl) var(--space-2xl);
  background: var(--color-navy);
  flex-wrap: wrap;
}

.pathway__cta-text {
  font-size: var(--fs-md);
  color: rgba(255, 255, 255, 0.85);
  max-width: 52ch;
}

.pathway__cta-actions {
  display: flex;
  gap: var(--space-md);
  flex-shrink: 0;
  flex-wrap: wrap;
}

@media (max-width: 900px) {
  .pathway__steps {
    grid-template-columns: repeat(2, 1fr);
  }

  .pathway__cta {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 640px) {
  .pathway {
    padding: var(--space-3xl) var(--gutter-mobile);
  }

  .pathway__steps {
    grid-template-columns: 1fr;
  }

  .pathway__cta {
    padding: var(--space-xl) var(--gutter-mobile);
  }

  .pathway__cta-actions {
    width: 100%;
  }

  .pathway__cta-actions .btn {
    flex: 1;
    text-align: center;
    min-width: 120px;
  }
}

/* =========================================================
   GALLERY EXPAND  (shared/js/gallery-expand.js)
   The "See all" control on every carousel, and the full
   gallery overlay it opens.
   ========================================================= */

.squad-gallery__expand {
  position: absolute;
  right: 60px;
  bottom: 12px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: none;
  cursor: pointer;
  background: rgba(4, 51, 108, 0.86);
  color: var(--color-white);
  font-family: var(--font-display);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  line-height: 1;
  transition: background 0.2s;
}

.squad-gallery__expand:hover,
.squad-gallery__expand:focus-visible {
  background: var(--color-red);
}

/* display:inline-flex above would otherwise beat the hidden attribute, and
   the control would show on a gallery whose CSV turned out to be empty. */
.squad-gallery__expand[hidden] { display: none; }

/* The photos themselves open the gallery, so say so on hover. */
.squad-gallery[data-expandable="true"] .squad-gallery__slide { cursor: pointer; }

/* ---------- the overlay ---------- */
.gallery-expand {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  background: var(--color-navy);
  color: var(--color-white);
  line-height: normal;
}

/* Same trap as the control above: display:flex would beat the hidden
   attribute and leave the overlay covering the page on load. */
.gallery-expand[hidden] { display: none !important; }

body.gallery-expand-open { overflow: hidden; }

.gallery-expand__bar {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--gutter);
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
  flex: 0 0 auto;
}

.gallery-expand__title {
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gallery-expand__count {
  margin: 0;
  font-size: var(--fs-xs);
  color: rgba(255, 255, 255, 0.72);
  flex: 0 0 auto;
}

.gallery-expand__close,
.gallery-expand__back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  color: var(--color-white);
  cursor: pointer;
  padding: 8px;
  flex: 0 0 auto;
}

.gallery-expand__back {
  font-family: var(--font-display);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.gallery-expand__close:hover,
.gallery-expand__back:hover,
.gallery-expand__close:focus-visible,
.gallery-expand__back:focus-visible { color: var(--color-red-50); }

/* ---------- the same two menus, inside the full gallery ---------- */
.gallery-expand__filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  padding: var(--space-md) var(--gutter) 0;
  flex: 0 0 auto;
}

.gallery-expand__field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.gallery-expand__field span {
  font-family: var(--font-display);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
  white-space: nowrap;
}

.gallery-expand__field select {
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  color: var(--color-navy);
  background: var(--color-white);
  border: 2px solid transparent;
  padding: 8px 12px;
  min-width: 190px;
  max-width: 100%;
  cursor: pointer;
}

.gallery-expand__field select:focus-visible {
  border-color: var(--color-red);
  outline: none;
}

/* ---------- grid of every photo ---------- */
.gallery-expand__grid {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: var(--space-lg) var(--gutter) var(--space-3xl);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--space-md);
  align-content: start;
}

.gallery-expand__thumb {
  position: relative;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  display: block;
  overflow: hidden;
}

.gallery-expand__thumb img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.gallery-expand__thumb:hover img,
.gallery-expand__thumb:focus-visible img { transform: scale(1.04); }

.gallery-expand__thumb-cap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 8px 12px;
  background: rgba(4, 51, 108, 0.82);
  color: var(--color-white);
  font-size: var(--fs-xs);
  line-height: 1.4;
  text-align: left;
}

/* ---------- one photo, large ---------- */
.gallery-expand__stage {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  padding: var(--space-lg) var(--gutter) var(--space-3xl);
  position: relative;
}

.gallery-expand__figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  min-width: 0;
  max-height: 100%;
}

.gallery-expand__figure img {
  max-width: 100%;
  max-height: 72vh;
  object-fit: contain;
  display: block;
}

.gallery-expand__figure figcaption {
  font-size: var(--fs-sm);
  color: rgba(255, 255, 255, 0.82);
  text-align: center;
  max-width: 70ch;
}

/* Hub carousel slides link through to a squad page. Opening the photo
   would swallow that, so the link is offered here instead. */
.gallery-expand__link {
  font-family: var(--font-display);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-white);
  background: var(--color-red);
  padding: 10px 18px;
  text-decoration: none;
}

.gallery-expand__link:hover,
.gallery-expand__link:focus-visible { background: #c01020; }

.gallery-expand__nav {
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: var(--color-white);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.gallery-expand__nav:hover,
.gallery-expand__nav:focus-visible { background: var(--color-red); }

.gallery-expand__pos {
  position: absolute;
  left: 0;
  right: 0;
  bottom: var(--space-md);
  margin: 0;
  text-align: center;
  font-size: var(--fs-xs);
  color: rgba(255, 255, 255, 0.72);
}

.gallery-expand [hidden] { display: none !important; }

.gallery-expand[data-reduce-motion="true"] .gallery-expand__thumb img { transition: none; }
.gallery-expand[data-reduce-motion="true"] .gallery-expand__thumb:hover img { transform: none; }

@media (max-width: 640px) {
  /* Clear of the carousel's own 44px arrows, and a 44px tap target itself. */
  .squad-gallery__expand { right: 48px; bottom: 8px; padding: 13px; }
  .squad-gallery__expand span { display: none; }

  .gallery-expand__bar   { padding: var(--space-sm) var(--gutter-mobile); gap: var(--space-sm); }
  .gallery-expand__title { font-size: var(--fs-md); }
  .gallery-expand__count { display: none; }

  .gallery-expand__grid {
    padding: var(--space-sm) var(--gutter-mobile) var(--space-2xl);
    gap: 6px;
    grid-template-columns: repeat(2, 1fr);
  }
  .gallery-expand__thumb img { height: 140px; }
  .gallery-expand__thumb-cap { padding: 5px 8px; }

  /* The arrows come off the flow and sit over the photo, so the picture
     gets the full width of the screen instead of sharing it with them. */
  .gallery-expand__stage {
    padding: var(--space-sm) var(--gutter-mobile) var(--space-2xl);
    gap: 0;
  }
  .gallery-expand__figure { width: 100%; }
  .gallery-expand__figure img { max-height: 62vh; }
  .gallery-expand__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    background: rgba(4, 51, 108, 0.72);
    z-index: 2;
  }
  .gallery-expand__nav--prev { left: 4px; }
  .gallery-expand__nav--next { right: 4px; }

  /* Inside the full gallery, label above menu, both full width. */
  .gallery-expand__filters {
    padding: var(--space-sm) var(--gutter-mobile) 0;
    gap: var(--space-sm);
  }
  .gallery-expand__field {
    flex: 1 1 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }
  .gallery-expand__field select { min-width: 0; width: 100%; padding: 10px 12px; }

}
