/* header · a quiet Night bar that stays. Every rule is scoped to [data-part="header"]. */
[data-part="header"] { position: sticky; top: 0; z-index: 50; padding-block: 0; background: var(--night); color: var(--sand); }
[data-part="header"] .hd { height: var(--hd); border-bottom: 1px solid transparent; transition: border-color .3s ease; }
[data-part="header"].hd-scrolled .hd { border-bottom-color: var(--wire); }
[data-part="header"] .hd-row { height: 100%; display: flex; align-items: center; gap: clamp(12px, 2vw, 28px); }
[data-part="header"] .hd-logo { padding-block: 10px; }
/* the lockup is set left to right inside, so its own inline margins point the wrong way in Arabic: use the page's */
html[dir="rtl"] [data-part="header"] .hd-logo { margin-left: auto; }
html[dir="ltr"] [data-part="header"] .hd-logo { margin-right: auto; }

/* The logo's pixel answers when you point at the lockup: a crouch, a quarter-turn hop, a landing. */
[data-part="header"] .hd-logo .px { transform-box: fill-box; transform-origin: 50% 50%; }
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  [data-part="header"] .hd-logo:hover .px, [data-part="header"] .hd-logo:focus-visible .px { animation: hd-hop .56s linear both; }
}
@keyframes hd-hop {
  0% { transform: none; animation-timing-function: cubic-bezier(.3, 0, .6, 1); }
  16% { transform: translateY(12%) scale(1.26, .72); animation-timing-function: cubic-bezier(.2, .7, .4, 1); }
  27% { transform: translateY(-40%) rotate(14deg) scale(.84, 1.2); animation-timing-function: cubic-bezier(.3, .6, .5, 1); }
  48% { transform: translateY(-78%) rotate(48deg) scale(1); animation-timing-function: cubic-bezier(.55, 0, .8, .45); }
  70% { transform: translateY(0) rotate(90deg) scale(.88, 1.14); animation-timing-function: ease-out; }
  78% { transform: translateY(14%) rotate(90deg) scale(1.3, .7); animation-timing-function: ease-out; }
  90% { transform: translateY(-2%) rotate(90deg) scale(.96, 1.05); }
  100% { transform: rotate(90deg); }
}

/* Links, with a Dune marker that hops to the section you're reading */
[data-part="header"] .hd-nav { position: relative; }
[data-part="header"] .hd-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: clamp(18px, 2.2vw, 32px); font-size: 15px; line-height: 1.2; }
[data-part="header"] .hd-nav a { display: block; padding: 12px 0; text-decoration: none; color: var(--ink-2); transition: color .2s ease; white-space: nowrap; }
[data-part="header"] .hd-nav a:hover, [data-part="header"] .hd-nav a[aria-current] { color: var(--sand); }
[data-part="header"] .hd-mark { position: absolute; left: 0; bottom: 4px; width: 6px; height: 6px; margin-left: -3px; pointer-events: none; opacity: 0; }
[data-part="header"] .hd-mark > i { display: block; width: 100%; height: 100%; background: var(--dune); border-radius: 18.5%; transform-origin: 50% 100%; }
[data-part="header"] .hd-mark.on { opacity: 1; }

[data-part="header"] .hd-lang, [data-part="header"] .hd-lang2 { background: none; border: 0; padding: 12px 2px; cursor: pointer; font-size: 15px; line-height: 1.2; color: var(--sand); }
[data-part="header"] .hd-lang .en, [data-part="header"] .hd-lang2 .en { font-family: var(--f-ar); }
[data-part="header"] .hd-lang .ar, [data-part="header"] .hd-lang2 .ar { font-family: var(--f-en); }
[data-part="header"] .hd-ask { min-height: 40px; padding: 0 18px; font-size: 15px; white-space: nowrap; }

/* The compact menu (phones and small tablets): a <details>, so it opens without JavaScript too */
[data-part="header"] .hd-more { display: none; }
[data-part="header"] .hd-more > summary { list-style: none; display: grid; place-items: center; width: 44px; height: 44px; margin-inline-end: -10px; cursor: pointer; border-radius: 10px; }
[data-part="header"] .hd-more > summary::-webkit-details-marker { display: none; }
[data-part="header"] .hd-vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[data-part="header"] .hd-burger { position: relative; width: 20px; height: 14px; }
[data-part="header"] .hd-burger i { position: absolute; inset-inline-start: 0; height: 2px; border-radius: 1px; background: var(--sand); transition: transform .32s var(--ease), width .32s var(--ease), top .32s var(--ease); }
[data-part="header"] .hd-burger i:first-child { top: 2px; width: 20px; }
[data-part="header"] .hd-burger i:last-child { top: 10px; width: 13px; }
[data-part="header"] .hd-more[open] .hd-burger i:first-child { top: 6px; transform: rotate(45deg); }
[data-part="header"] .hd-more[open] .hd-burger i:last-child { top: 6px; width: 20px; transform: rotate(-45deg); }
[data-part="header"] .hd-sheet { position: absolute; inset-inline: 0; top: 100%; background: var(--night); border-bottom: 1px solid var(--wire); padding-block: 8px 28px; max-height: calc(100svh - var(--hd)); overflow-y: auto; }
[data-part="header"] .hd-sheet ul { list-style: none; margin: 0; padding: 0; display: grid; }
[data-part="header"] .hd-sheet li + li { border-top: 1px solid var(--wire); }
[data-part="header"] .hd-sheet a { display: flex; align-items: center; gap: 12px; min-height: 60px; text-decoration: none; font: 600 24px/1.3 var(--f-ar); color: var(--sand); }
html[lang="en"] [data-part="header"] .hd-sheet a { font: 600 24px/1.2 var(--f-en); letter-spacing: -.02em; }
[data-part="header"] .hd-sheet a[aria-current]::after { content: ""; width: 7px; height: 7px; border-radius: 18.5%; background: var(--dune); }
[data-part="header"] .hd-sheet .hd-lang2 { margin-top: 14px; font-size: 17px; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .3em; }
@media (prefers-reduced-motion: no-preference) {
  [data-part="header"] .hd-more[open] .hd-sheet { animation: hd-sheet .24s var(--ease) both; }
}
@keyframes hd-sheet { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }

@media (max-width: 999px) {
  [data-part="header"] .hd-nav { display: none; }
  [data-part="header"] .hd-more { display: block; }
}
@media (max-width: 599px) {
  [data-part="header"] .lockup { font-size: 21px; }
  [data-part="header"] .hd-row { gap: 10px; }
  [data-part="header"] .hd-ask { min-height: 40px; padding: 0 15px; font-size: 14px; }
}
@media (max-width: 419px) {
  [data-part="header"] .hd-lang { display: none; }
}
@media (max-width: 349px) {
  [data-part="header"] .lockup { font-size: 19px; }
  [data-part="header"] .hd-ask { padding: 0 12px; font-size: 13px; }
}
