/* The hero header scrolls with the scene. Its surface appears only once fixed;
   blur and the shadow are decorative, while all text uses semantic tokens. */
html { scroll-padding-top: 7rem; }
.site-header { position: absolute; z-index: 20; top: max(1.2rem,env(safe-area-inset-top)); left: 50%; translate: -50% 0; display: flex; align-items: center; gap: 2rem; width: min(calc(100% - 3rem),76rem); min-height: 4.4rem; padding: .65rem .8rem .65rem 1.4rem; border: 1px solid transparent; border-radius: 5rem; background: transparent; }
.site-header.is-fixed { position: fixed; border-color: var(--line); background: color-mix(in srgb,var(--surface) 88%,transparent); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); box-shadow: 0 8px 30px #08091f0c; }
.site-header:not(.is-fixed) :is(.header-links a,.brand-accent) { color: var(--ink); }
.header-brand { display: inline-flex; align-items: center; gap: .65rem; flex-shrink: 0; color: var(--ink); font-size: 1.18rem; font-weight: 700; letter-spacing: -.055rem; white-space: nowrap; }
.header-brand-icon { display: block; width: 2.75rem; height: 2.75rem; flex-shrink: 0; object-fit: contain; }
.header-links { display: flex; align-items: center; justify-content: center; gap: clamp(1.2rem,3vw,2.5rem); margin-inline: auto; }
.header-links a { display: inline-flex; align-items: center; min-height: 2.75rem; color: var(--ink-2); font-size: .75rem; white-space: nowrap; }
.header-links a:hover { color: var(--ink); }
.header-controls { display: flex; align-items: center; gap: .45rem; flex-shrink: 0; }
.site-header .theme-toggle { min-width: 5.6rem; min-height: 2.9rem; padding: .65rem .85rem; }
.nav-menu-toggle { display: grid; place-items: center; width: 2.8rem; height: 2.8rem; border: 1px solid var(--line); border-radius: 50%; background: var(--surface-raised); color: var(--ink); }
.nav-menu-toggle svg { width: 1.25rem; height: 1.25rem; }
.nav-menu-toggle .menu-close,.nav-menu-toggle[aria-expanded="true"] .menu-bars { display: none; }
.nav-menu-toggle[aria-expanded="true"] .menu-close { display: block; }
.nav-menu-toggle[hidden],.header-links[hidden] { display: none; }
@media (max-width: 54em) {
  html { scroll-padding-top: 6rem; }
  .site-header { top: max(.75rem,env(safe-area-inset-top)); width: calc(100% - 1.5rem); min-height: 3.8rem; padding: .4rem .45rem .4rem 1rem; gap: .75rem; }
  .header-brand { font-size: 1.05rem; gap: .45rem; }
  .header-brand-icon { width: 2.25rem; height: 2.25rem; }
  .header-controls { margin-left: auto; }
  .site-header .theme-toggle { min-width: 2.8rem; min-height: 2.8rem; padding: .65rem; }
  .site-header .sound-toggle { width: 2.8rem; height: 2.8rem; }
  .site-header .theme-toggle-label { display: none; }
  .header-links { position: absolute; top: calc(100% + .6rem); left: 0; right: 0; flex-direction: column; align-items: stretch; gap: .1rem; padding: .6rem; border: 1px solid var(--line); border-radius: 1.3rem; background: var(--surface-raised); box-shadow: 0 12px 30px #08091f16; }
  .header-links a { min-height: 3.2rem; padding-inline: 1rem; border-radius: .75rem; font-size: .85rem; }
  .header-links a:hover { background: var(--surface-soft); }
  /* Without JavaScript, keep the links available in compact rows. */
  .site-header:not([data-menu-ready]) { flex-wrap: wrap; gap: 0; }
  .site-header:not([data-menu-ready]) .header-links { position: static; width: 100%; flex-direction: row; flex-wrap: wrap; justify-content: flex-start; gap: 0 1rem; padding: 0; border: 0; box-shadow: none; background: none; }
  .site-header:not([data-menu-ready]) .header-links a { min-height: 2.5rem; padding: 0; font-size: .65rem; }
  .site-header:not([data-menu-ready]) .header-controls { display: none; }
}
/* Five links in Spanish, French or Portuguese are wider than in English, and the bar now
   carries a language control too. Below a wide desktop both pills drop their labels, as
   they do on a phone, so the row never outgrows the bar. */
@media (min-width: 54.01em) and (max-width: 72em) {
  .site-header { gap: 1rem; }
  .header-links { gap: clamp(.7rem,1.7vw,1.5rem); }
  .site-header :is(.theme-toggle,.language-toggle) { min-width: 2.8rem; padding: .65rem; }
  .site-header :is(.theme-toggle-label,.language-toggle-label) { display: none; }
}
/* Four round controls (language, theme, sound, menu) beside the wordmark: a little tighter
   on small phones, so a 375px screen keeps them inside the bar. */
@media (max-width: 24em) {
  .header-controls { gap: .25rem; }
  .site-header :is(.theme-toggle,.language-toggle,.sound-toggle,.nav-menu-toggle) { width: 2.6rem; min-width: 2.6rem; height: 2.6rem; min-height: 2.6rem; padding: .55rem; }
}
/* On the narrowest phones four controls leave no room for the wordmark: Topi alone links
   home, and the link's aria-label still names it. */
@media (max-width: 22.5em) {
  .site-header { padding-left: .75rem; gap: .4rem; }
  .header-controls { gap: .3rem; }
  .site-header :is(.theme-toggle,.language-toggle,.sound-toggle,.nav-menu-toggle) { width: 2.5rem; min-width: 2.5rem; height: 2.5rem; min-height: 2.5rem; padding: .5rem; }
  .header-brand > span { display: none; }
}
@media (max-height: 30em) and (min-width: 54.01em) {
  .site-header { top: .65rem; min-height: 3.8rem; padding-block: .35rem; }
}
