/* Header — smartphone
--------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgb(247 243 236 / 97%);
  border-top: 0.2rem solid var(--color-red);
  border-bottom: 1px solid rgb(36 36 36 / 12%);
  backdrop-filter: blur(12px);
}

.admin-bar .site-header {
  top: 46px;
}

.site-header__inner {
  position: relative;
  display: flex;
  min-height: var(--header-height);
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
}

/* Brand
--------------------------------------------- */

.site-brand {
  display: flex;
  min-width: 0;
  flex: 1 1 0;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
}

.site-brand__monogram {
  display: grid;
  width: 2.6rem;
  flex: 0 0 2.6rem;
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid var(--color-red);
  color: var(--color-red);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.95rem;
  line-height: 1;
  letter-spacing: 0.05em;
}

.site-brand__text {
  display: grid;
  min-width: 0;
  gap: 0.05rem;
}

.site-brand__name {
  display: block;
  overflow: visible;
  color: var(--color-text);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.95rem;
  line-height: 1.15;
  text-overflow: clip;
  white-space: normal;
}

.site-brand__tagline {
  display: none;
  color: rgb(36 36 36 / 70%);
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Menu toggle
--------------------------------------------- */

.menu-toggle {
  display: flex;
  width: 2.75rem;
  height: 2.75rem;
  flex: 0 0 2.75rem;
  padding: 0.7rem;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  background: transparent;
  border: 1px solid var(--color-green);
  border-radius: var(--radius-control);
  color: var(--color-green);
  cursor: pointer;
}

.menu-toggle__line {
  display: block;
  width: 100%;
  height: 1px;
  background: currentcolor;
  transition:
    transform 180ms ease,
    opacity 180ms ease;
}

.menu-toggle[aria-expanded="true"] .menu-toggle__line--top {
  transform: translateY(0.4rem) rotate(45deg);
}

.menu-toggle[aria-expanded="true"] .menu-toggle__line--middle {
  opacity: 0;
}

.menu-toggle[aria-expanded="true"] .menu-toggle__line--bottom {
  transform: translateY(-0.4rem) rotate(-45deg);
}

/* Mobile navigation panel
--------------------------------------------- */

.site-header__panel {
  position: absolute;
  top: 100%;
  left: 50%;
  display: none;
  width: 100vw;
  max-height: calc(100dvh - var(--header-height));
  padding: 1rem;
  overflow-y: auto;
  background: var(--color-ivory);
  border-top: 1px solid rgb(36 36 36 / 10%);
  border-bottom: 1px solid rgb(36 36 36 / 14%);
  box-shadow: 0 1.25rem 2rem rgb(36 36 36 / 12%);
  transform: translateX(-50%);
}

.site-header__panel.is-open {
  display: block;
}

.primary-navigation__list,
.primary-navigation ul {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.primary-navigation li {
  border-bottom: 1px solid rgb(36 36 36 / 10%);
}

.primary-navigation li:last-child {
  border-bottom: 0;
}

.primary-navigation a {
  display: flex;
  min-height: 3.5rem;
  padding-inline: 0.25rem;
  align-items: center;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
}

.primary-navigation a:hover,
.primary-navigation a:focus-visible {
  color: var(--color-red);
}

/* Header CTA
--------------------------------------------- */

.site-header__actions {
  margin-top: 1rem;
}

.header-cta {
  display: inline-flex;
  width: 100%;
  min-height: 3.25rem;
  padding: 0.75rem 1rem;
  align-items: center;
  justify-content: center;
  background: var(--color-green);
  border: 1px solid var(--color-green);
  border-radius: var(--radius-control);
  color: var(--color-white);
  font-size: 0.9rem;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    transform 180ms ease;
}

.header-cta:hover,
.header-cta:focus-visible {
  background: var(--color-red);
  border-color: var(--color-red);
}

/* TranslatePress language switcher
--------------------------------------------- */

.site-header__language-switcher {
  --language-switcher-height: 2.75rem;

  display: inline-flex;
  width: auto;
  min-width: 0;
  height: var(--language-switcher-height);
  min-height: var(--language-switcher-height);
  max-height: var(--language-switcher-height);
  flex: 0 0 auto;
  align-self: center;
  align-items: center;
  line-height: 1;
}

/* Compatibilité avec les différentes structures de TranslatePress */

.site-header__language-switcher > *,
.site-header__language-switcher .trp-language-switcher,
.site-header__language-switcher .trp-language-switcher > div,
.site-header__language-switcher .trp-shortcode-switcher,
.site-header__language-switcher .trp-shortcode-switcher__wrapper {
  display: inline-flex !important;
  width: auto !important;
  min-width: 0 !important;
  height: var(--language-switcher-height) !important;
  min-height: var(--language-switcher-height) !important;
  max-height: var(--language-switcher-height) !important;
  margin: 0 !important;
  padding: 0 !important;
  align-self: center !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1 !important;
}

.site-header__language-switcher .trp-language-switcher > div {
  overflow: visible !important;
}

.site-header__language-switcher a {
  display: inline-flex !important;
  width: auto !important;
  min-width: 0 !important;
  height: var(--language-switcher-height) !important;
  min-height: var(--language-switcher-height) !important;
  max-height: var(--language-switcher-height) !important;
  margin: 0 !important;
  padding: 0.55rem 0.75rem !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.4rem;
  color: var(--color-green-dark);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1 !important;
  white-space: nowrap;
  text-decoration: none;
  box-sizing: border-box;
}

.site-header__language-switcher img {
  width: 1.05rem !important;
  max-width: 1.05rem !important;
  height: auto !important;
  margin: 0 !important;
}

/* Very small smartphones
--------------------------------------------- */

@media screen and (max-width: 23rem) {
  .site-header__inner {
    gap: 0.45rem;
  }

  .site-brand {
    gap: 0.5rem;
  }

  .site-brand__monogram {
    width: 2.35rem;
    flex-basis: 2.35rem;
    font-size: 0.85rem;
  }

  .site-brand__name {
    font-size: 0.85rem;
    line-height: 1.1;
  }

  .menu-toggle {
    width: 2.55rem;
    height: 2.55rem;
    flex-basis: 2.55rem;
    padding: 0.65rem;
  }

  .site-header__language-switcher .trp-language-switcher > div,
  .site-header__language-switcher .trp-language-switcher a {
    min-height: 2.55rem !important;
  }

  .site-header__language-switcher .trp-language-switcher a {
    padding-inline: 0.55rem !important;
    font-size: 0.72rem;
  }
}

/* Tablet
--------------------------------------------- */

@media screen and (min-width: 48rem) {
  :root {
    --header-height: 5rem;
  }

  .site-header__inner {
    gap: 0.85rem;
  }

  .site-brand {
    flex: 1 1 auto;
  }

  .site-brand__monogram {
    width: 2.85rem;
    flex-basis: 2.85rem;
  }

  .site-brand__text {
    max-width: 14rem;
  }

  .site-brand__name {
    font-size: 1.05rem;
  }

  .site-brand__tagline {
    display: block;
  }

  .site-header__panel {
    right: 0;
    left: auto;
    width: min(28rem, 100vw);
    padding: 1.5rem 2rem;
    transform: none;
  }
}

/* WordPress admin bar — tablet and desktop
--------------------------------------------- */

@media screen and (min-width: 48.9375rem) {
  .admin-bar .site-header {
    top: 32px;
  }
}

/* Desktop
--------------------------------------------- */

@media screen and (min-width: 72rem) {
  :root {
    --header-height: 5.75rem;
  }

  body.menu-open {
    overflow: auto;
  }

  .site-header__inner {
    gap: 0.85rem;
  }

  .site-brand {
    flex: 0 1 auto;
  }

  .site-brand__monogram {
    width: 3rem;
    flex-basis: 3rem;
  }

  .site-brand__text {
    max-width: 13rem;
  }

  .site-brand__name {
    font-size: 1.1rem;
  }

  .menu-toggle {
    display: none;
  }

  .site-header__panel {
    position: static;
    display: flex;
    width: auto;
    min-width: 0;
    max-height: none;
    margin-left: auto;
    padding: 0;
    align-items: center;
    gap: 0.9rem;
    overflow: visible;
    background: transparent;
    border: 0;
    box-shadow: none;
    transform: none;
  }

  .primary-navigation__list,
  .primary-navigation ul {
    display: flex;
    align-items: center;
    gap: 0.8rem;
  }

  .primary-navigation li {
    border: 0;
  }

  .primary-navigation a {
    position: relative;
    display: inline-flex;
    min-height: 3rem;
    padding: 0;
    align-items: center;
    font-size: 0.79rem;
    white-space: nowrap;
    transition:
      color 180ms ease,
      transform 180ms ease;
  }

  .primary-navigation a::after {
    position: absolute;
    right: 0;
    bottom: 0.25rem;
    left: 0;
    height: 1px;
    background: var(--color-red);
    content: "";
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 180ms ease;
  }

  .primary-navigation a:hover::after,
  .primary-navigation a:focus-visible::after,
  .primary-navigation .current-menu-item > a::after {
    transform: scaleX(1);
    transform-origin: left;
  }

  .site-header__actions {
    margin-top: 0;
  }

  .header-cta {
    width: auto;
    min-width: max-content;
    min-height: 3rem;
    padding-inline: 0.9rem;
    font-size: 0.83rem;
    white-space: nowrap;
  }

  .site-header__language-switcher {
    --language-switcher-height: 3rem;
  }

  .site-header__language-switcher .trp-language-switcher a {
    padding-inline: 0.75rem !important;
  }
}

/* Large desktop
--------------------------------------------- */

@media screen and (min-width: 82rem) {
  .site-brand__text {
    max-width: none;
  }

  .site-header__panel {
    gap: 1.25rem;
  }

  .primary-navigation__list,
  .primary-navigation ul {
    gap: 1.1rem;
  }

  .primary-navigation a {
    font-size: 0.83rem;
  }

  .header-cta {
    padding-inline: 1.15rem;
  }
}

/* Desktop hover effects
--------------------------------------------- */

@media screen and (min-width: 72rem) and (hover: hover) and (pointer: fine) {
  .primary-navigation a:hover,
  .primary-navigation a:focus-visible {
    color: var(--color-red);
    transform: translateY(-0.12rem);
  }

  .header-cta:hover,
  .header-cta:focus-visible {
    transform: translateY(-0.12rem);
  }

  .site-header__language-switcher .trp-language-switcher a:hover,
  .site-header__language-switcher .trp-language-switcher a:focus-visible {
    color: var(--color-red);
  }
}
