/* ==========================================================================
   Room for Hebrew – site header (same on every page)

   Structure: the logo and title on the left, the call-to-action buttons on
   the right. The header sticks to the top of the window. Once the page is
   scrolled, js/header.js adds .is-scrolled, which adds a shadow.

   Buttons
   - Mobile and tablet: a round WhatsApp button – the visible name is hidden
     but still announced by screen readers – and the menu button.
   - Desktop (1024px and up): the full "WhatsApp us" button.

   The same dark blue in both themes.
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  color: var(--white);
  background-color: var(--night);
  border-bottom: 1px solid rgb(255 255 255 / 0.08);
}

.site-header.is-scrolled {
  box-shadow: 0 0.5rem 1.5rem rgb(0 0 0 / 0.35);
}

.site-header__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-xs);
  height: var(--header-height);
  padding-inline: var(--page-inline-padding);
}

/* Logo and title: one link to the home page */
.brand {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  min-width: 0;
  color: var(--white);
  text-decoration: none;
}

.brand__mark {
  width: 1.75rem;
  height: 1.75rem;
}

/* The title stays on one line while it fits. On a screen too narrow for it
   (about 374px with the language button) it wraps after "for", and keeps its size. */
.brand__name {
  font-family: var(--font-title);
  font-size: var(--font-size-site-title);
  font-weight: 700;
  line-height: 1;
}

/* "for" in the script font, white like the rest of the title */
.brand__script {
  padding-inline: 0.1em;
  font-family: var(--font-title-script);
  font-size: 1.25em;
  font-weight: 400;
  /* so the taller script font doesn't push the title off-centre */
  line-height: 0;
  color: var(--white);
}

/* The buttons never shrink: when the bar is too narrow, the title wraps instead */
.site-header__actions {
  display: flex;
  flex: none;
  align-items: center;
  gap: var(--space-xs);
}

.header-cta {
  min-height: 2.5rem;
  padding: 0;
  width: 2.5rem;
}

.header-cta {
  /* the name is hidden on narrow screens; see below */
  gap: 0;
}

/* Button names on narrow screens: shown to screen readers only */
.header-cta__text {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.header-cta__more {
  display: none;
}

@media (min-width: 30em) {
  .brand__mark {
    width: 2.25rem;
    height: 2.25rem;
  }
}

@media (min-width: 40em) {
  .brand {
    gap: var(--space-s);
  }
}

/* --------------------------------------------------------------------------
   Language switcher (src/components/LanguageSwitcher.astro): a button with
   the current flag that opens a list of languages. Round like the WhatsApp
   button on mobile; from 40em it also shows the language code and an arrow.
   -------------------------------------------------------------------------- */
.lang-switch__button {
  gap: var(--space-xs);
  width: 2.5rem;
  min-height: 2.5rem;
  padding: 0;
}

.lang-switch__flag {
  width: 1.5rem;
  height: 1.125rem;
  border-radius: 0.1875rem;
  /* a thin ring in the text colour, so every flag has an edge on any background */
  box-shadow: 0 0 0 1px color-mix(in srgb, currentColor 30%, transparent);
}

.lang-switch__code,
.lang-switch__chevron {
  display: none;
}

.lang-popup {
  width: auto;
  min-width: 12.5rem;
  padding: var(--space-xs);
}

.lang-list {
  padding: 0;
  margin: 0;
  list-style: none;
}

.lang-list a {
  display: flex;
  align-items: center;
  gap: var(--space-s);
  min-height: 2.75rem;
  padding-inline: var(--space-s);
  color: var(--color-text);
  text-decoration: none;
  border-radius: var(--radius-control);
}

.lang-list a[aria-current="true"] {
  font-weight: 700;
}

.lang-list .icon {
  margin-inline-start: auto;
  color: var(--color-accent);
}

@media (hover: hover) {
  .lang-list a:hover {
    background-color: var(--color-surface);
  }
}

@media (min-width: 40em) {
  .lang-switch__button {
    width: auto;
    min-height: 2.75rem;
    padding-inline: var(--space-s);
  }

  .lang-switch__code,
  .lang-switch__chevron {
    display: inline;
  }

  .lang-switch__chevron {
    width: 1rem;
    height: 1rem;
  }
}

/* --------------------------------------------------------------------------
   Menu links (Courses, About, Contact)
   Mobile: closed behind the menu button, a panel under the bar when open
   (js/header.js sets .menu-open on the header). Without JavaScript the button
   stays hidden, and the footer has the same links.
   Desktop: the links sit in the bar, to the left of the WhatsApp button.
   -------------------------------------------------------------------------- */
.site-nav {
  display: none;
}

.site-header.menu-open .site-nav {
  position: absolute;
  top: 100%;
  right: 0;
  left: 0;
  display: block;
  padding: var(--space-xs) var(--page-inline-padding) var(--space-s);
  background-color: var(--night);
  border-top: 1px solid rgb(255 255 255 / 0.12);
  box-shadow: 0 0.75rem 1.5rem rgb(0 0 0 / 0.35);
}

.site-nav__list {
  padding: 0;
  margin: 0;
  list-style: none;
}

.site-nav a {
  display: flex;
  align-items: center;
  min-height: 2.75rem;
  font-weight: 600;
  color: var(--white);
  text-decoration: none;
}

.site-nav li + li a {
  border-top: 1px solid rgb(255 255 255 / 0.1);
}

/* Menu button: just the hamburger lines (its name is for screen readers) */
.menu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  color: var(--white);
  cursor: pointer;
  background: none;
  border: 0;
}

.menu-toggle[hidden] {
  display: none;
}

.menu-toggle .icon {
  width: 1.75rem;
  height: 1.75rem;
}

.menu-toggle__close,
.menu-toggle[aria-expanded="true"] .menu-toggle__open {
  display: none;
}

.menu-toggle[aria-expanded="true"] .menu-toggle__close {
  display: block;
}

/* Desktop: the links are in the bar, so no menu button */
@media (min-width: 64em) {
  .menu-toggle {
    display: none;
  }

  /* The WhatsApp button grows from round to full only with the desktop layout */
  .header-cta {
    width: auto;
    min-height: 2.75rem;
    padding-inline: 1.125rem;
    gap: var(--space-xs);
  }

  .header-cta__text {
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    overflow: visible;
    clip-path: none;
  }

  .header-cta__more {
    display: inline;
  }

  .site-nav {
    display: block;
    margin-inline-start: auto;
  }

  .site-nav__list {
    display: flex;
    gap: var(--space-xs);
  }

  .site-nav a {
    padding-inline: var(--space-s);
    border-radius: 0.5rem;
  }

  .site-nav li + li a {
    border-top: 0;
  }

  .brand__mark {
    width: 2.5rem;
    height: 2.5rem;
  }
}
