/* Responsive header: phone, tablet, desktop. Loaded after all other CSS. */

/* ---- base (phones first) ---- */
header{
  background:var(--bg);color:var(--fg);
  border-bottom:1px solid var(--line);
  gap:6px;min-height:60px;
  padding-top:8px;padding-bottom:8px;
  padding-inline:max(12px,env(safe-area-inset-left,0px)) max(12px,env(safe-area-inset-right,0px));
}
:root[data-theme=light] header{background:#fff}

header button.ib{color:inherit;border-radius:50%;padding:8px;transition:background .2s,color .2s}
header button.ib:hover,header button.ib:focus-visible{background:var(--hv)}
header .ib svg{width:26px;height:26px}

header .logo{height:auto;min-width:0;flex:0 1 auto;margin-inline:2px auto;direction:ltr;text-decoration:none}
header .logo .lgt{font-size:clamp(18px,5.3vw,28px);margin-inline-end:1.5em}
header .logo .lgt sup{font-size:.42em;top:-.5em;right:-1.7em;letter-spacing:0}

header .ic{gap:2px;margin-inline-end:-6px;flex:0 0 auto}
header #mb{margin-inline-start:-6px;flex:0 0 auto}

/* theme toggle: one icon button on phones, pill on wider screens */
header .tm{margin:0;border-color:currentColor}
header .tm button{color:inherit}
header .tm button:hover{background:var(--hv)}
header .tm button.on{background:var(--fg);color:var(--bg)}
:root[data-theme=light] header .tm button.on{background:#000;color:#fff}

@media(max-width:559px){
  header .tm{border:0;padding:0;gap:0}
  header .tm button,header .tm button.on{width:42px;height:42px;background:none;color:inherit;border-radius:50%}
  header .tm button.on{display:none}
  header .tm button:hover{background:var(--hv)}
  header .tm svg{width:22px;height:22px}
}

/* very narrow phones (iPhone SE, small Androids) */
@media(max-width:440px){
  header{gap:2px;padding-inline:max(8px,env(safe-area-inset-left,0px)) max(8px,env(safe-area-inset-right,0px))}
  header button.ib{padding:6px}
  header .ib svg{width:24px;height:24px}
  header .tm button,header .tm button.on{width:34px;height:34px}
  header .tm svg{width:20px;height:20px}
  header .ic{gap:0;margin-inline-end:-4px}
  header #mb{margin-inline-start:-4px}
  header .logo .lgt{font-size:clamp(15px,4.9vw,20px);margin-inline-end:1.3em}
}

/* ---- tablet ---- */
@media(min-width:560px){
  header{min-height:70px;padding-inline:max(24px,env(safe-area-inset-left,0px)) max(24px,env(safe-area-inset-right,0px))}
  header .logo{margin-inline:14px auto}
  header .logo .lgt{font-size:clamp(28px,4.2vw,36px)}
  header .ic{gap:6px}
  header .ib svg{width:28px;height:28px}
}

/* ---- desktop ---- */
@media(min-width:960px){
  header{min-height:88px;padding:12px var(--gut);border-bottom:1px solid var(--line);
    box-shadow:0 10px 30px rgba(0,0,0,.18)}
  header .logo{height:64px;margin-inline:26px auto}
  header .logo .lgt{font-size:42px}
  header .logo .lgt sup{top:-.3em;right:-1.6em}
  header .ic{gap:10px}
  header button.ib{padding:10px}
}

/* RTL (Hebrew): keep the logo glued to the menu button */
[dir=rtl] header .logo{margin-inline:0 auto}
[dir=rtl] header .logo .lgt{margin-inline-end:0;margin-left:0;margin-right:1.1em}

/* Marquee pause/play button: first button in the menu drawer's top row */
.tg .mqp{position:static;transform:none;inset:auto;width:44px;height:44px;border:1px solid var(--line);background:none;color:var(--fg);z-index:auto}
.tg .mqp:hover{background:none;border-color:var(--o);color:var(--ot)}
.tg .mqp:focus-visible{outline:2px solid var(--o);outline-offset:2px;box-shadow:none}
.tg .mqp svg{width:18px;height:18px}
/* icon follows the button's own state: pause symbol while running, play symbol while paused */
.mqp[aria-pressed=true] .pp1{display:none}
.mqp[aria-pressed=true] .pp2{display:block}
