:root {
  --sanad-header-height: 64px;
  --sanad-header-counter-zoom: 1;
}
@media (min-width: 861px) and (max-width: 1023px) {
  :root { --sanad-header-counter-zoom: calc(1 / .9); }
}
@media (min-width: 1024px) and (max-width: 1599px) {
  :root { --sanad-header-counter-zoom: calc(1 / .92); }
}
@media (min-width: 961px) {
  :root { --sanad-header-height: 76px; }
}

html body > header.top.sanad-site-header:has(#mnav[hidden]) {
  position: sticky;
  inset: env(safe-area-inset-top, 0px) 0 auto;
  z-index: 90;
  zoom: var(--sanad-header-counter-zoom);
  color: white;
  background: #302119 !important;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: 0;
}
html body.sanad-home > header.top.sanad-site-header:has(#mnav[hidden]) {
  position: fixed;
  zoom: 1;
}
html body > header.top.sanad-site-header > .wrap {
  display: flex;
  box-sizing: border-box;
  width: 100%;
  max-width: 1480px;
  height: var(--sanad-header-height);
  min-height: var(--sanad-header-height);
  padding: 0 clamp(14px, 2.1vw, 28px);
  margin-inline: auto;
  align-items: center;
  justify-content: space-between;
  gap: clamp(8px, 1.1vw, 18px);
}
html body > header.top.sanad-site-header > .wrap > .brand {
  display: inline-flex;
  flex: none;
  align-items: center;
  direction: ltr;
  gap: 7px;
  margin: 0;
  order: 0;
}
html body > header.top.sanad-site-header .brand svg {
  display: block;
  width: 28px;
  height: auto;
  flex: none;
}
html body > header.top.sanad-site-header .brand .wm {
  font: 400 12px/1 Figtree, sans-serif !important;
  letter-spacing: .28em !important;
  margin: 0;
}
html body > header.top.sanad-site-header > .wrap > .hdr-r {
  display: flex !important;
  align-items: center;
  flex: none;
  order: 2;
  gap: 2px;
  margin: 0;
}
html body > header.top.sanad-site-header .hdr-r > button:not(.fl-saved-open) {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  padding: 0;
  margin: 0;
  border: 0 !important;
  box-shadow: none;
}
html body > header.top.sanad-site-header .hdr-r > #srchbtn { order: 1; }
html body > header.top.sanad-site-header .hdr-r > #lang { order: 3; }
html body > header.top.sanad-site-header .hdr-r > #menubtn { order: 4; }
.sanad-site-header #srchbtn svg { width: 21px; height: 21px; }
.sanad-site-header #menubtn span { width: 20px; height: 1.5px; }
.sanad-site-header :is(button, a, input):focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

html body > header.top.sanad-site-header > .hsrch {
  position: absolute;
  inset: 100% 0 auto;
  color: #302119;
  background: #fbf9f6;
  border: 0;
  border-bottom: 1px solid #d6cfc4;
  padding: 12px 0;
}
html body > header.top.sanad-site-header .hsrch .wrap {
  width: 100%;
  max-width: 960px;
  padding: 0 clamp(14px, 2.1vw, 28px);
  margin-inline: auto;
}
.sanad-site-header #hs-in { min-height: 44px; font-size: 16px; }
.sanad-site-header .hs-list {
  max-height: min(55dvh, 440px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

@media (max-width: 960px) {
  html body > header.top.sanad-site-header :is(nav.menu, .hdr-r > a, .hdr-r > .fl-saved-open) {
    display: none !important;
  }
}
@media (min-width: 961px) {
  html body > header.top.sanad-site-header .brand { gap: 10px; }
  html body > header.top.sanad-site-header .brand svg { width: 34px; }
  html body > header.top.sanad-site-header .brand .wm {
    font: 400 23px/1 Jost, sans-serif !important;
    letter-spacing: 4px !important;
  }
  html body > header.top.sanad-site-header .hdr-r > #menubtn { display: none; }
  html body > header.top.sanad-site-header .hdr-r > #srchbtn {
    border: 1px solid rgb(255 255 255 / .35) !important;
    border-radius: 0;
  }
  html body > header.top.sanad-site-header > .wrap > .hdr-r { gap: clamp(10px, 1vw, 16px); }
  html body > header.top.sanad-site-header .hdr-r > a { order: 2; gap: 6px; }
  .sanad-site-header .hdr-r > a svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.5; }
  html body > header.top.sanad-site-header nav.menu {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: clamp(10px, 1.3vw, 22px);
  }
  html body > header.top.sanad-site-header :is(nav.menu a, .hdr-r > a) {
    font: 500 12px/1.4 Figtree, Almarai, sans-serif !important;
    letter-spacing: normal !important;
    text-transform: uppercase;
    white-space: nowrap;
    padding: 0 !important;
    margin: 0;
    min-width: 0;
    min-height: 44px;
    height: auto;
    display: inline-flex;
    align-items: center;
    border: 0;
    text-decoration: none;
  }
  html[lang=ar] body > header.top.sanad-site-header :is(nav.menu a, .hdr-r > a) {
    font-family: Almarai, sans-serif !important;
  }
  .sanad-site-header nav.menu a:is(:hover, [aria-current=page]) {
    text-decoration: underline !important;
    text-underline-offset: 5px;
  }
}

@supports (backdrop-filter: blur(10px)) or (-webkit-backdrop-filter: blur(10px)) {
  html body > header.top.sanad-site-header.is-scrolled:has(#mnav[hidden]) {
    background: rgb(48 33 25 / .83) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }
}
html body:has(.sanad-home-hero, #tpl .monthly-cover) > header.top.sanad-site-header:not(.is-scrolled):has(#mnav[hidden]) {
  background: transparent !important;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
html body:has(.sanad-home-hero, #tpl .monthly-cover) > header.top.sanad-site-header:not(.is-scrolled):has(#mnav[hidden])::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(rgb(26 19 15 / .68), rgb(26 19 15 / .25));
  pointer-events: none;
}

/* Slide the existing full-bleed photo behind the shared header and keep the ask bar in view. */
body:has(#tpl .monthly-cover) > header.top.sanad-site-header {
  margin-block-end: calc(-1 * var(--sanad-header-height));
}
html body:has(> .sanad-site-header) #tpl .tpl-hero.monthly-cover {
  height: calc(100svh - env(safe-area-inset-top, 0px) - var(--askbar-h, 74px));
  height: calc(100dvh - env(safe-area-inset-top, 0px) - var(--askbar-h, 74px));
}
html body:has(> .sanad-site-header) #tpl .monthly-cover .save-bookmark {
  inset-block-start: calc(var(--sanad-header-height) + 12px);
}

@media (prefers-reduced-transparency: reduce) {
  html body > header.top.sanad-site-header.is-scrolled:has(#mnav[hidden]),
  html body:has(.sanad-home-hero, #tpl .monthly-cover) > header.top.sanad-site-header:not(.is-scrolled):has(#mnav[hidden]) {
    background: #302119 !important;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  html body > header.top.sanad-site-header::before { display: none; }
}

html:has(.sanad-mobile-menu[open]),body:has(.sanad-mobile-menu[open]) {overflow:hidden}
dialog.sanad-mobile-menu {
  position:fixed;inset-block:0;inset-inline-start:auto;inset-inline-end:0;margin:0;
  box-sizing:border-box;inline-size:clamp(min(215px, 68vw), 50vw, 420px);block-size:100dvh;
  max-inline-size:none;max-block-size:none;border:0;padding:0;background:var(--sanad-white,#fff);color:var(--sanad-text,#2a1e18);
  font-family:inherit;
}
.sanad-mobile-menu[open] {display:grid;grid-template-rows:auto minmax(0,1fr);overflow:hidden}
.sanad-mobile-menu::backdrop {background:rgb(20 15 12 / .32)}
dialog.sanad-mobile-menu header {display:flex;align-items:center;justify-content:flex-end;padding-inline:12px;box-sizing:border-box;height:var(--sanad-header-height);background:white}
.sanad-mobile-menu .menu-actions {display:flex;align-items:center;flex:none}
.sanad-mobile-menu button {border:0;background:transparent;font:inherit;color:inherit;padding:0;cursor:pointer}
.sanad-mobile-menu header button {width:44px;height:44px;display:grid;place-items:center}
.sanad-mobile-menu .menu-search svg {width:21px;height:21px;fill:none;stroke:currentColor;stroke-width:1.8}
dialog.sanad-mobile-menu .menu-close {position:relative;background:none}
.sanad-mobile-menu .menu-close::before,.sanad-mobile-menu .menu-close::after {content:"";position:absolute;grid-area:1/1;width:20px;height:2px;background:currentColor;rotate:45deg}
.sanad-mobile-menu .menu-close::after {rotate:-45deg}
.sanad-mobile-menu nav {min-block-size:0;overflow-y:auto;overscroll-behavior:contain;padding:calc(20px + clamp(12px,4vh,34px)) 0 calc(12px + env(safe-area-inset-bottom))}
.sanad-mobile-menu nav a {display:flex;align-items:center;justify-content:center;box-sizing:border-box;min-block-size:44px;padding:8px clamp(14px,5vw,24px);text-align:center;text-transform:none;font:600 clamp(16px,4vw,19px)/1.4 Figtree,sans-serif;letter-spacing:normal;color:var(--sanad-text,#2a1e18);text-decoration:none}
.sanad-mobile-menu nav a:active {color:var(--sanad-amber,#7d5a31)}
.sanad-mobile-menu .menu-languages {display:flex;justify-content:center;padding-inline:clamp(14px,5vw,24px);font:400 14px/1.4 Figtree,sans-serif}
.sanad-mobile-menu .menu-languages > div {display:flex;align-items:center;gap:4px}
.sanad-mobile-menu .menu-languages button {min-width:44px;min-height:44px;color:inherit;font:inherit}
.sanad-mobile-menu .menu-languages button[aria-pressed=true] {font-weight:800;color:var(--sanad-amber,#7d5a31)}
html[lang=ar] .sanad-mobile-menu nav a {font-family:Almarai,"Noto Sans Arabic","Geeza Pro",Tahoma,sans-serif;font-weight:700}
@media(prefers-reduced-motion:no-preference){
  .sanad-mobile-menu[open]{--menu-slide-start:100%;animation:sanad-menu-arrive .26s ease-out}
  html[dir=rtl] .sanad-mobile-menu[open]{--menu-slide-start:-100%}
  @keyframes sanad-menu-arrive{from{translate:var(--menu-slide-start) 0}to{translate:0 0}}
}

@supports (backdrop-filter: blur(18px)) or (-webkit-backdrop-filter: blur(18px)) {
  dialog.sanad-mobile-menu {
    background:rgb(252 248 241 / .82);
    -webkit-backdrop-filter:blur(18px);
    backdrop-filter:blur(18px);
  }
  dialog.sanad-mobile-menu header {background:transparent}
  .sanad-mobile-menu .menu-languages button[aria-pressed=true] {
    color:color-mix(in srgb,var(--sanad-amber,#7d5a31) 85%,var(--sanad-text,#2a1e18));
  }
}

@media (prefers-reduced-transparency: reduce) {
  dialog.sanad-mobile-menu {
    background:var(--sanad-white,#fff);
    -webkit-backdrop-filter:none;
    backdrop-filter:none;
  }
}
