/* v152: the existing page-language links now live in the white main header.
   Real links and per-page fragment handling are unchanged; no new JavaScript. */
@media screen {
  .site-header {
    flex-wrap: wrap;
    container-type: inline-size;
    container-name: language-header;
    column-gap: clamp(12px, 1.2vw, 22px);
    row-gap: 10px;
  }
  body[data-page] .site-header > .header-language-switch {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    flex-wrap: nowrap;
    gap: 2px;
    margin: 0;
    padding: 3px;
    position: static;
    z-index: auto;
    border: 1px solid #dacbe3;
    border-radius: 999px;
    background: #f3edf7;
  }
  body[data-page] .site-header > .header-language-switch a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 44px;
    margin: 0;
    padding: 7px 11px;
    border: 0;
    border-radius: 999px;
    font: 500 .875rem/1.35 'DM Sans', sans-serif;
    letter-spacing: normal;
    white-space: nowrap;
    text-decoration: none;
    color: #4e177f;
    background: transparent;
    box-shadow: none;
    transition: background-color .16s ease, color .16s ease;
  }
  body[data-page] .site-header > .header-language-switch a[aria-current="page"] {
    color: #fffefa;
    background: #4e177f;
    box-shadow: 0 1px 3px #2c123f1a;
  }
  body[data-page] .site-header > .header-language-switch a:not([aria-current="page"]):hover {
    color: #2c123f;
    background: #e7d9ef;
  }
  body[data-page] .site-header > .header-language-switch a:focus-visible {
    outline: 2px solid #4e177f;
    outline-offset: 3px;
  }
  .site-header .header-actions { gap: clamp(10px, 1vw, 18px); margin-inline-start: auto; }
}
/* Protect the main navigation at laptop widths: the existing download and
   search controls stay accessible as labelled icons rather than crowded text. */
@media screen and (min-width: 1601px) and (max-width: 2050px) {
  .site-header .header-vcard span,
  .site-header .header-search kbd { display: none; }
  .site-header .desktop-nav { gap: 16px; }

}
@media screen and (min-width: 1601px) and (max-width: 1799px) {
  .site-header .header-phone { display: none; }
}
@media screen and (min-width: 1800px) and (max-width: 2050px) {
  .site-header .header-search > span { display: none; }
}
/* At narrow widths the language selector gets a short second row, still inside
   the fixed white header. The first row's familiar search/menu controls stay put. */
@media screen and (max-width: 900px) {
  .site-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 7px 10px;
    padding-block: 10px;
  }
  .site-header > div:first-child { grid-column: 1; grid-row: 1; }
  .site-header .brand { max-inline-size: 100%; }
  .site-header .brand-name { min-inline-size: 0; overflow-wrap: anywhere; }
  .site-header .header-actions { grid-column: 2; grid-row: 1; margin-inline-start: 0; }
  body[data-page] .site-header > .header-language-switch {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: end;
    margin: 0;
  }
  body[data-page] .site-header > .header-language-switch a {
    min-height: 44px;
    padding-inline: 13px;
  }
}
@media screen and (max-width: 650px) {
  body[data-page] .site-header > .header-language-switch { justify-self: center; }
}
/* In a high-zoom/narrow layout, allow the text to wrap instead of clipping
   either language. The measured-header observer keeps all offsets accurate. */
@media screen and (max-width: 380px) {
  body[data-page] .site-header > .header-language-switch {
    max-width: 100%;
  }
  body[data-page] .site-header > .header-language-switch a { padding-inline: 10px; }
}
/* A text-relative query gives the brand its full line only when very large
   text would otherwise squeeze it beside the action icons. */
@media screen and (max-width: 900px) {
  @container language-header (max-width: 12em) {
    .site-header > div:first-child { grid-column: 1 / -1; grid-row: 1; }
    .site-header .brand-sub { max-width: none; }
    .site-header .header-actions { grid-column: 2; grid-row: 2; justify-self: end; }
    body[data-page] .site-header > .header-language-switch { grid-row: 3; }
  }
}
@media (prefers-reduced-motion: reduce) {
  body[data-page] .site-header > .header-language-switch a { transition: none; }
}
.motion-paused body[data-page] .site-header > .header-language-switch a { transition: none; }
@media (forced-colors: active) {
  body[data-page] .site-header > .header-language-switch a[aria-current="page"] {
    outline: 2px solid Highlight;
    outline-offset: -2px;
  }
}
@media print { .header-language-switch { display: none !important; } }
