/* Header, nav, logo, language switch, mobile menu, footer */

/* ---------- Header ---------- */
.site-header {
  position: fixed;
  inset: 0 0 auto;
  height: var(--header-h);
  z-index: var(--z-header);
  background: var(--color-bg);
  color: var(--color-text);
  transition:
    background-color var(--dur) var(--ease),
    color var(--dur) var(--ease),
    height var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease);
}

.site-header.is-scrolled {
  height: var(--header-h-scrolled);
  box-shadow: 0 1px 0 var(--color-border);
}

.site-header--transparent:not(.is-scrolled):not(.is-menu-open) {
  background: transparent;
  color: var(--color-white);
}

.site-header--transparent:not(.is-scrolled):not(.is-menu-open) :focus-visible {
  outline-color: var(--color-white);
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 100%;
  margin-inline: auto;
}

.site-nav {
  display: contents;
}

.site-nav__group {
  display: flex;
  align-items: center;
}

.site-nav__group--left {
  display: none;
}

.site-nav__group--right {
  order: 2;
  margin-left: auto;
}

.site-nav__link {
  display: none;
  position: relative;
  font-family: var(--font-head);
  font-weight: 500;
  font-size: var(--fs-nav);
  letter-spacing: var(--ls-nav);
  text-transform: uppercase;
  white-space: nowrap;
  transition: opacity var(--dur-fast) var(--ease);
}

@media (hover: hover) {
  .site-nav__link:hover {
    opacity: 0.6;
  }
}

.site-nav__link.is-active {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 6px;
  text-decoration-color: var(--color-accent);
}

/* Over the hero photo the accent line has too little contrast, so it follows the white text */
.site-header--transparent:not(.is-scrolled):not(.is-menu-open) .site-nav__link.is-active {
  text-decoration-color: currentColor;
}

/* ---------- Logo ---------- */
.site-logo {
  display: inline-flex;
  align-items: center;
  order: 1;
  min-width: 0;
  min-height: 44px;
}

/* The logo gives up space before the header controls do */
.site-logo__text {
  overflow: hidden;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: 0.01em;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.site-logo__img {
  height: 36px;
  width: auto;
}

/* ---------- Language switch ---------- */
.lang-switch {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-head);
  font-weight: 500;
  font-size: var(--fs-nav);
  letter-spacing: 0.12em;
}

.lang-switch__btn {
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: uppercase;
  cursor: pointer;
  /* 0.75 keeps the inactive label readable on the solid header: #373737 on white gives 5.5:1 */
  opacity: 0.75;
  transition: opacity var(--dur-fast) var(--ease);
}

.lang-switch__btn[aria-pressed="true"] {
  opacity: 1;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 6px;
}

/* Over the hero, dimmed white text falls below 4.5:1, so only the underline marks the active language */
.site-header--transparent:not(.is-scrolled):not(.is-menu-open) .lang-switch__btn {
  opacity: 1;
}

@media (hover: hover) {
  .lang-switch__btn:hover {
    opacity: 1;
  }
}

.lang-switch__sep {
  opacity: 0.5;
}

/* ---------- Hamburger ---------- */
.nav-toggle {
  order: 3;
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-right: -10px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
}

.nav-toggle svg {
  display: block;
}

/* ---------- Mobile menu ---------- */
.mobile-menu {
  position: fixed;
  inset: var(--header-h) 0 0 0;
  z-index: var(--z-menu);
  display: flex;
  flex-direction: column;
  align-items: center;
  /* Auto margins on the children center the content; unlike
     justify-content: center, they keep overflow scrollable from the top */
  justify-content: flex-start;
  gap: 48px;
  padding: var(--space-6) var(--gutter);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--color-bg);
  color: var(--color-text);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(8px);
  transition:
    opacity 300ms var(--ease),
    transform 300ms var(--ease),
    visibility 0s linear 300ms;
}

.mobile-menu.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: none;
  transition:
    opacity 300ms var(--ease),
    transform 300ms var(--ease),
    visibility 0s;
}

.mobile-menu > :first-child {
  margin-top: auto;
}

.mobile-menu > :last-child {
  margin-bottom: auto;
}

/* 44px tall links with a 10px gap keep the 54px rhythm of 26px text + 28px gap */
.mobile-menu__links {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.mobile-menu__link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-family: var(--font-head);
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  transition: opacity var(--dur-fast) var(--ease);
}

@media (hover: hover) {
  .mobile-menu__link:hover {
    opacity: 0.6;
  }
}

.mobile-menu__link.is-active {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 6px;
}

.mobile-menu__social {
  display: flex;
  gap: 16px;
}

.mobile-menu__social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  transition: opacity var(--dur-fast) var(--ease);
}

@media (hover: hover) {
  .mobile-menu__social-link:hover {
    opacity: 0.6;
  }
}

/* Short landscape screens: less space around the menu content */
@media (max-height: 480px) {
  .mobile-menu {
    gap: 24px;
    padding-block: 16px;
  }
}

@media (min-width: 480px) {
  .site-logo__text {
    font-size: 22px;
  }
}

/* ---------- Desktop header ---------- */
/* Logo on the left (its DOM position), all links grouped on the right */
@media (min-width: 1024px) {
  .site-header__inner {
    column-gap: clamp(18px, 2.2vw, 32px);
  }

  .site-logo {
    order: 0;
    margin-right: auto;
  }

  .site-logo__text {
    font-size: 24px;
  }

  .site-nav__group--left {
    display: flex;
    order: 1;
    gap: clamp(18px, 2.2vw, 32px);
  }

  .site-nav__group--right {
    order: 2;
    margin-left: 0;
    gap: clamp(18px, 2.2vw, 32px);
  }

  .site-nav__link {
    display: inline-block;
  }

  .lang-switch {
    padding-left: 24px;
    border-left: 1px solid color-mix(in srgb, currentColor 40%, transparent);
  }

  .nav-toggle,
  .mobile-menu {
    display: none;
  }
}

/* ---------- Footer ---------- */
/* Sand band closes every page; --color-muted keeps 4.9:1 on it */
.site-footer {
  padding: 56px 0 40px;
  background: var(--color-panel);
}

.site-footer__row {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-5);
}

.site-footer__nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px 24px;
}

.site-footer__link {
  font-family: var(--font-head);
  font-weight: 500;
  font-size: var(--fs-nav);
  letter-spacing: 0.25em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: opacity var(--dur-fast) var(--ease);
}

@media (hover: hover) {
  .site-footer__link:hover {
    opacity: 0.6;
  }
}

.site-footer__link.is-active {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 6px;
  text-decoration-color: var(--color-accent);
}

.site-footer__meta {
  margin-top: 32px;
  text-align: center;
  font-family: var(--font-body);
  font-size: var(--fs-small);
  line-height: 2;
  color: var(--color-muted);
}

.site-footer__line {
  margin: 0;
}

.site-footer__line a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

/* Below 768px: 3 links on the first row, the rest centered on the second */
@media (max-width: 767px) {
  .site-footer__nav::after {
    content: "";
    flex-basis: 100%;
    order: 1;
  }

  .site-footer__link:nth-child(n + 4) {
    order: 2;
  }
}

/* Keep the 3-link footer nav row inside the gutter on 320-359px screens */
@media (max-width: 359px) {
  .site-footer__nav {
    column-gap: 12px;
  }
}

@media (min-width: 768px) {
  .site-footer__nav {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 40px;
  }
}

/* Touch targets of 44px below the desktop layout */
@media (max-width: 1023px) {
  .site-footer__nav {
    row-gap: 0;
  }

  .site-footer__link,
  .site-footer__line a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }
}

@media (min-width: 1024px) {
  .site-footer__row {
    display: block;
    padding-inline: 64px;
  }

  .site-footer__nav {
    justify-content: center;
  }

}

/* ---------- Print ---------- */
/* A fixed header repeats on every printed page and covers its first lines */
@media print {
  .site-header {
    position: absolute;
  }

  .nav-toggle,
  .lang-switch,
  .mobile-menu,
  .float-top {
    display: none;
  }
}

.float-top {
  position: fixed;
  right: var(--gutter);
  bottom: 24px;
  z-index: var(--z-header);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  background: var(--color-bg);
  color: var(--color-text);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease), visibility var(--dur-fast);
}

.float-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: none;
}

@media (hover: hover) {
  .float-top:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
  }
}
