/* =========================================================
   Header Xander
   ========================================================= */
.header {
  --brand-h: 120px;           /* top row SVGs */
  --small-h: 50px;            /* solo roundel in thin state */
  --t: .4s ease-in;           /* all appear/disappear transitions */
}

.header__img { display: block; height: var(--brand-h); width: auto; max-width: 100%; }
.logo-group, .logo-group .logo, .freedom-southwark a,
.header__user-nav { display: flex; align-items: center; }

.top-bar { background-color: var(--white); border-bottom: 1px solid #D9D9D9; padding: .2rem 0; }

/* =========================================================
   Desktop
   ========================================================= */
@media (min-width: 992px) {

  /* ---------- Top row: 3 SVGs centred, 2rem above and below ---------- */
  .header__top__left { margin: 0 !important; padding-block: .7rem; }
  .header__top__left .logo-group { justify-content: center; gap: 1.5rem; }
  .header__top__left .logo { gap: .75rem; }

  .header__container-wrapper--header__top {
    transition: opacity var(--t), visibility var(--t);
  }
  :is(.small-header .header, .header.small-header) .header__container-wrapper--header__top {
    opacity: 0; visibility: hidden; pointer-events: none;
  }

  /* ---------- Hover: roundel + strap together, shield alone, solo roundel ---------- */
  .header__top__left .logo,
  .freedom-southwark a,
  .small__logo a {
    display: flex;
    line-height: 0;
    transition: transform var(--t);
  }
  .header__top__left .logo:hover,
  .freedom-southwark a:hover,
  .small__logo a:hover { transform: scale(1.1); }
  .small__logo a { transform-origin: left center; }

  /* ---------- Menu container: constant .5rem padding top and bottom ---------- */
  .header .header__container-wrapper--header__main {
    padding-block: .5rem;
  }

  /* ---------- Sticky bar: 3-column grid keeps the menu truly centred ----------
     Layout is identical in every state. Only the roundel's opacity changes
     on scroll, so the menu never shifts and search stays at the right edge. */
  .header__main {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
  }

  /* roundel: space always reserved, faded in on small-header */
  .header__main__left {
    grid-column: 1; justify-self: start;
    display: flex; align-items: center;
    opacity: 0; visibility: hidden;
    transition: opacity var(--t), visibility var(--t);
  }
  .small__logo a { gap: .5rem; }          /* it's already display:flex in the desktop block */
  .small__logo .header__img { height: var(--small-h); width: auto; }

  /* menu: top level only, dropdowns untouched */
  .header__main__middle { grid-column: 2; flex: none; width: auto; }
  .header__main__middle .region-we-mega-menu,
  .header__main__middle .navbar,
  .header__main__middle .container-fluid { width: auto; padding: 0; }
  .header__main__middle .we-mega-menu-ul { display: flex; justify-content: center; }

  /* search: always at the right edge of the container */
  .header__main_right {
    grid-column: 3;
    justify-self: end;
  }

  /* ---------- Thin state: only the roundel fades in ---------- */
  :is(.small-header .header, .header.small-header) .header__main__left {
    opacity: 1; visibility: visible;
  }
}

/* =========================================================
   Mobile / tablet
   ========================================================= */
@media (max-width: 991.98px) {
  .header { --brand-h: clamp(36px, 11vw, 56px); }
  .header__main { display: flex; align-items: center; justify-content: space-between; padding-block: .5rem; }
  .header__main__left { flex: 0 1 60%; max-width: 60%; min-width: 0; }
  .header__main__left .logo-group { gap: .5rem; }
  .header__main__left .logo { gap: .4rem; }
  .header__user-nav { gap: .75rem; }
}

/* ---- Search icon (moved from frontpage.css) ---- */
.fa-search:before {
    font-family: var(--font-icons);
    content: "\e80b";
    margin-left: 1rem;
    top: -4px;
    position: relative;
    color: var(--color-text);
    transition: all .5s ease-in-out;
}

.fa-search:hover:before {
	color: var(--color-brand-light);
}

/* ===============================
   HAMBURGER
================================= */
.hamburger {
  position: relative;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  transition: transform .35s ease;
}
.header .hamburger:hover { transform: rotate(90deg); }

.hamburger__bar {
  position: absolute;
  left: 15%;
  width: 70%;
  height: 3px;
  margin-top: -1.5px;
  border-radius: 2px;
  background: var(--color-brand);
  transition: transform .35s ease, top .35s ease, opacity .25s ease, background-color .3s ease;
}
.hamburger:hover .hamburger__bar { background: var(--color-brand-dark); }

/* intro: top + bottom enter from the left, middle from the right */
.hamburger__bar:nth-child(1) { top: 28%; animation: bar-in-left  .5s ease .1s backwards; }
.hamburger__bar:nth-child(2) { top: 50%; animation: bar-in-right .5s ease .2s backwards; }
.hamburger__bar:nth-child(3) { top: 72%; animation: bar-in-left  .5s ease .3s backwards; }

@keyframes bar-in-left  { from { transform: translateX(-150%); opacity: 0; } }
@keyframes bar-in-right { from { transform: translateX(150%);  opacity: 0; } }