.tc-site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--tc-shell-header-border);
  background: var(--tc-shell-header-background);
  box-shadow: 0 5px 20px rgb(15 23 42 / 10%);
  color: var(--tc-shell-header-foreground);
}

.admin-bar .tc-site-header { top: 32px; }

.tc-site-header__main {
  position: relative;
  display: flex;
  width: 100%;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  padding-inline: clamp(2rem, 2.3vw, 2.75rem);
  box-sizing: border-box;
}

.tc-site-header__left,
.tc-site-header__right {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
}

.tc-site-header__left { gap: clamp(0.62rem, 0.8vw, 0.82rem); }
.tc-site-header__right { gap: clamp(1rem, 1.4vw, 1.5rem); }

.tc-brand {
  display: flex;
  width: 174px;
  height: 46px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  padding: 0.34rem 0.48rem;
  margin-right: clamp(0.9rem, 1.15vw, 1.35rem);
  border-radius: 11px;
  background: var(--tc-color-surface);
}

.tc-brand img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.tc-icon-button {
  display: inline-grid;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--tc-color-border);
  border-radius: 50%;
  background: var(--tc-shell-control-background);
  box-shadow: var(--tc-shadow-small);
  color: var(--tc-shell-control-foreground);
  cursor: pointer;
}

.tc-icon-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 2;
}

.tc-site-header__menu {
  width: 36px;
  height: 36px;
  flex-basis: 36px;
  border-color: var(--tc-shell-header-border);
  box-shadow: none;
}

.tc-site-header__menu svg {
  width: 17px;
  height: 17px;
}

.tc-universe-nav {
  display: flex;
  align-items: center;
  gap: var(--tc-space-1);
  padding: 0.2rem;
  border: 1px solid var(--tc-shell-header-border);
  border-radius: var(--tc-radius-pill);
  background: color-mix(in srgb, var(--tc-shell-header-foreground) 6%, transparent);
  white-space: nowrap;
}

.tc-universe-nav a {
  min-height: 30px;
  padding: 0.32rem 0.68rem;
  border-radius: var(--tc-radius-pill);
  color: var(--tc-shell-header-foreground);
  font-size: var(--tc-type-micro);
  font-weight: 750;
  text-decoration: none;
}

.tc-universe-nav a[aria-current="page"] {
  background: var(--tc-shell-active-background);
  color: var(--tc-shell-active-foreground);
}

.tc-header-search {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 3;
  display: grid;
  width: clamp(330px, 30vw, 450px);
  max-width: 450px;
  height: 42px;
  grid-template-columns: 27px minmax(0, 1fr) 32px;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.32rem 0.2rem 0.72rem;
  border: 1px solid var(--tc-color-border);
  border-radius: var(--tc-radius-pill);
  background: var(--tc-shell-control-background);
  box-shadow: var(--tc-shadow-small);
  color: var(--tc-shell-control-foreground);
  transform: translate(-50%, -50%);
}

.tc-header-search__toggle,
.tc-header-search__submit {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--tc-universe-accent);
  cursor: pointer;
}

.tc-header-search__toggle {
  width: 27px;
  height: 27px;
}

.tc-header-search__toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.tc-header-search__submit {
  background: color-mix(in srgb, var(--tc-universe-accent) 13%, var(--tc-color-surface));
  font-size: 1.15rem;
  font-weight: 800;
}

.tc-header-search input {
  min-width: 0;
  height: 34px;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
}

.tc-primary-nav__list {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(0.85rem, 1.2vw, 1.25rem);
  padding: 0;
  margin: 0;
  list-style: none;
}

.tc-primary-nav a {
  color: var(--tc-shell-header-foreground);
  font-size: var(--tc-type-small);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.tc-primary-nav a:hover {
  text-decoration: underline;
  text-underline-offset: 0.25rem;
}

.tc-shell-language {
  display: flex;
  align-items: center;
}

.tc-language-switcher {
  position: relative;
  display: inline-flex;
}

.tc-language-switcher__toggle {
  display: inline-flex;
  min-width: 44px;
  height: 36px;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 9px;
  border: 1px solid var(--tc-shell-header-border);
  border-radius: var(--tc-radius-pill);
  background: color-mix(in srgb, var(--tc-shell-header-foreground) 6%, transparent);
  color: var(--tc-shell-header-foreground);
  font: inherit;
  font-size: var(--tc-type-micro);
  font-weight: 850;
  cursor: pointer;
}

.tc-language-switcher__toggle svg {
  width: 11px;
  height: 11px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  transition: transform var(--tc-motion-fast) ease;
}

.tc-language-switcher__toggle[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.tc-language-switcher__list {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 8;
  display: none;
  min-width: 92px;
  gap: 3px;
  padding: 6px;
  margin: 0;
  border: 1px solid var(--tc-color-border);
  border-radius: 13px;
  background: var(--tc-color-surface);
  box-shadow: 0 14px 34px rgb(15 23 42 / 16%);
  list-style: none;
}

.tc-site-header .tc-language-switcher__list[hidden] { display: none; }

.tc-language-switcher.is-open .tc-language-switcher__list { display: grid; }

.tc-language-switcher__list a {
  display: flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  padding: 5px 10px;
  border-radius: 9px;
  color: var(--tc-color-ink);
  font-size: var(--tc-type-micro);
  font-weight: 800;
  text-decoration: none;
}

.tc-language-switcher__list a:hover,
.tc-language-switcher__list a[aria-current="page"] {
  background: var(--tc-shell-active-background);
  color: var(--tc-shell-active-foreground);
}

.tc-language-switcher__toggle:focus-visible,
.tc-language-switcher__list a:focus-visible {
  outline: 3px solid #ffbf47;
  outline-offset: 2px;
}

@media (max-width: 1380px) {
  .tc-site-header__main { padding-inline: clamp(1.25rem, 2vw, 2rem); }
  .tc-primary-nav { display: none; }
  .tc-site-header__right { margin-left: auto; }
}

@media (max-width: 1120px) {
  .tc-header-search { width: clamp(250px, 24vw, 320px); }
  .tc-brand { width: 149px; height: 44px; margin-right: 0.25rem; }
  .tc-site-header__left { gap: 0.4rem; }
  .tc-universe-nav a { padding-inline: 0.5rem; font-size: var(--tc-type-micro); }
}

@media (max-width: 1080px) {
  .tc-site-header__main {
    min-height: 62px;
    justify-content: flex-start;
    gap: 0.45rem;
    padding: 0.4rem 0.625rem;
  }

  .tc-site-header__left {
    min-width: 0;
    gap: 0.4rem;
  }

  .tc-brand {
    width: 130px;
    height: 42px;
    margin-right: 0;
  }

  .tc-universe-nav a {
    min-height: 28px;
    padding-inline: 0.48rem;
    font-size: var(--tc-type-micro);
  }

  .tc-primary-nav { display: none; }

  .tc-header-search {
    position: static;
    width: 40px;
    height: 40px;
    max-width: none;
    margin-left: auto;
    grid-template-columns: 1fr;
    padding: 0;
    transform: none;
  }

  .tc-header-search__toggle {
    width: 40px;
    height: 40px;
    pointer-events: auto;
  }

  .tc-header-search input,
  .tc-header-search__submit { display: none; }

  .tc-header-search.is-open {
    position: absolute;
    top: 0.4rem;
    right: 52px;
    left: 0.625rem;
    z-index: 6;
    width: auto;
    height: 42px;
    grid-template-columns: 40px minmax(0, 1fr) 34px;
    padding-right: var(--tc-space-1);
  }

  .tc-header-search.is-open input,
  .tc-header-search.is-open .tc-header-search__submit { display: grid; }

  .tc-site-header.tc-search-open .tc-site-header__left,
  .tc-site-header.tc-search-open .tc-shell-language {
    opacity: 0;
    pointer-events: none;
  }

  .tc-site-header__right { margin-left: 0; }
}

@media (max-width: 782px) {
  .admin-bar .tc-site-header { top: 46px; }
}

@media (max-width: 760px) {
  .tc-site-header__main {
    display: grid;
    min-height: 60px;
    grid-template-columns: minmax(0, 1fr) 42px 42px 42px;
    grid-template-rows: 1fr;
    gap: 0.3rem;
    padding: 0.35rem max(0.5rem, env(safe-area-inset-right)) 0.35rem max(0.5rem, env(safe-area-inset-left));
  }

  .tc-site-header__left,
  .tc-site-header__right {
    display: contents;
  }

  .tc-brand {
    width: min(130px, 100%);
    height: 44px;
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
    margin: 0;
  }

  .tc-universe-nav,
  .tc-primary-nav {
    display: none;
  }

  .tc-shell-language {
    display: flex;
    min-width: 42px;
    grid-column: 2;
    grid-row: 1;
    justify-self: center;
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
  }

  .tc-language-switcher__toggle {
    width: 42px;
    min-width: 42px;
    height: 42px;
    padding: 0;
    border-radius: 50%;
    background: var(--tc-shell-control-background);
    box-shadow: var(--tc-shadow-small);
    color: var(--tc-shell-control-foreground);
  }

  .tc-language-switcher__toggle svg { display: none; }

  .tc-language-switcher__list {
    top: calc(100% + 7px);
    right: 50%;
    transform: translateX(50%);
  }

  .tc-language-switcher__list a[aria-current="page"] {
    background: var(--tc-universe-accent);
    color: var(--tc-color-surface);
  }

  .tc-header-search {
    width: 42px;
    height: 42px;
    grid-column: 3;
    grid-row: 1;
    justify-self: center;
    margin: 0;
  }

  .tc-header-search__toggle,
  .tc-icon-button.tc-site-header__menu {
    width: 42px;
    height: 42px;
    min-width: 42px;
    min-height: 42px;
  }

  .tc-site-header__menu {
    grid-column: 4;
    grid-row: 1;
    justify-self: end;
  }

  .tc-header-search.is-open {
    position: absolute;
    top: 0.35rem;
    right: max(0.5rem, env(safe-area-inset-right));
    left: max(0.5rem, env(safe-area-inset-left));
    z-index: 7;
    width: auto;
    height: 42px;
    grid-template-columns: 42px minmax(0, 1fr) 36px;
    grid-column: 1 / -1;
    padding: 0 0.25rem 0 0;
    justify-self: stretch;
  }

  .tc-site-header.tc-search-open .tc-brand,
  .tc-site-header.tc-search-open .tc-shell-language,
  .tc-site-header.tc-search-open .tc-site-header__menu {
    opacity: 0;
    pointer-events: none;
  }
}

@media (max-width: 420px) {
  .tc-site-header__main {
    grid-template-columns: minmax(0, 1fr) 40px 40px 40px;
    gap: 0.2rem;
    padding-inline: max(0.375rem, env(safe-area-inset-left)) max(0.375rem, env(safe-area-inset-right));
  }

  .tc-brand {
    width: min(114px, 100%);
    padding-inline: 0.3rem;
  }

  .tc-language-switcher__toggle,
  .tc-header-search,
  .tc-header-search__toggle,
  .tc-icon-button.tc-site-header__menu {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
  }
}

/* 1.3.0-rc2 — Header desktop: the search has its own column, so it can never
 * overlap the brand / universes / menu (≡) block nor the right block.
 * Centered while space allows, it shrinks (max 450px) instead of overlapping.
 * Mobile / tablet rules (≤ 1080px) are unchanged. */
@media (min-width: 1081px) {
  .tc-site-header__main {
    display: grid;
    grid-template-columns: minmax(max-content, 1fr) minmax(0, 450px) minmax(max-content, 1fr);
    column-gap: clamp(0.75rem, 1.4vw, 1.25rem);
  }
  .tc-site-header__left { justify-self: start; }
  .tc-site-header__right { justify-self: end; margin-left: 0; }
  .tc-header-search {
    position: relative;
    top: auto;
    left: auto;
    width: 100%;
    max-width: 450px;
    min-width: 0;
    justify-self: center;
    transform: none;
  }
}

@media (min-width: 1081px) and (max-width: 1180px) {
  .tc-site-header__main { grid-template-columns: max-content minmax(0, 1fr) max-content; }
}

/* Espace du client : le logo est un bouton « Retour à TuCasa » (flèche + cadre + libellé). */
.tc-site-header .tc-brand--back { width: auto; max-width: 100%; justify-content: flex-start; gap: 0.5rem; padding: 0.34rem 0.8rem 0.34rem 0.65rem; border: 1px solid var(--tc-color-border, #dfe4ea); box-shadow: 0 1px 4px rgb(24 36 58 / 10%); cursor: pointer; }
.tc-site-header .tc-brand--back img { width: 118px; height: 100%; flex: 0 0 auto; }
.tc-site-header .tc-brand--back:hover, .tc-site-header .tc-brand--back:focus-visible { border-color: var(--tc-color-ink, #18243a); box-shadow: 0 2px 8px rgb(24 36 58 / 18%); }
.tc-site-header .tc-brand__arrow { font-size: 1.15rem; font-weight: 700; line-height: 1; color: var(--tc-color-ink, #18243a); }
.tc-site-header .tc-brand__back { font-size: 0.78rem; font-weight: 700; color: var(--tc-color-ink, #18243a); white-space: nowrap; }
@media (max-width: 1080px) { .tc-site-header .tc-brand--back { width: auto; max-width: 100%; justify-content: flex-start; } .tc-site-header .tc-brand--back img { width: 92px; } .tc-site-header .tc-brand__back { display: none; } }
@media (max-width: 480px) { .tc-site-header .tc-brand--back { gap: 0.3rem; padding-inline: 0.45rem 0.5rem; } .tc-site-header .tc-brand--back img { width: 76px; } .tc-site-header .tc-brand__arrow { font-size: 1rem; } }
@media (max-width: 360px) { .tc-site-header .tc-brand--back img { width: 66px; } }

/* V48 — téléphone : le bouton du menu (le même, il ouvre le même menu) quitte la rangée d'icônes
   et devient un bouton sombre « ≡ Menu » en bas à droite, au-dessus de la bulle TuCasa.
   Il prend la place de l'onglet « Nouveautés » (désormais dans le menu) : rien n'est ajouté à l'écran. */
.tc-site-header__menu-label { display: none; }
@media (max-width: 760px) {
  .tc-site-header .tc-icon-button.tc-site-header__menu {
    position: fixed;
    right: max(14px, env(safe-area-inset-right));
    bottom: calc(96px + env(safe-area-inset-bottom));
    z-index: 150;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: auto;
    min-width: 0;
    height: 50px;
    min-height: 50px;
    padding: 0 20px 0 16px;
    border: 0;
    border-radius: 999px;
    background: #2b2a24;
    color: #fff;
    box-shadow: 0 8px 22px rgb(30 28 15 / 35%);
  }
  .tc-site-header .tc-site-header__menu svg { width: 20px; height: 20px; stroke: #fff; }
  .tc-site-header .tc-site-header__menu-label { display: inline; font-size: 16px; font-weight: 700; line-height: 1; color: #fff; }
  .tc-site-header .tc-site-header__menu[aria-expanded="true"] { visibility: hidden; }
  /* Espace partenaire : l'application a son propre menu et sa barre d'envoi en bas ; pas de bouton flottant. */
  .tc-partner-surface .tc-site-header .tc-icon-button.tc-site-header__menu { display: none; }
}

/* V49 — téléphone, compte administrateur connecté : sous 600 px la barre noire de WordPress défile avec la page
   (elle n'est plus fixe). L'en-tête restait décalé de 46 px et laissait un vide au-dessus de lui.
   Il colle maintenant tout en haut. Les visiteurs (sans barre noire) ne voient aucune différence. */
@media (max-width: 600px) {
  .admin-bar .tc-site-header,
  .admin-bar.tc-connexion-surface--account .tc-site-header--minimal { top: 0; }
}
