/* Public site header + footer (.sh-* / .sf-*), ASAS look: white blurred bar, hairline border, orange CTA with ink text (never white on orange).
   Tokens: --asas-* (public/css/brand-tokens.css) with inline fallbacks. Logical properties only, so the same rules serve LTR and RTL. */
html { scroll-padding-top: 88px; }
.sh-header, .sf-footer {
  --c-orange: var(--asas-orange, #F97316);
  --c-orange-press: var(--asas-orange-press, #EA580C);
  --c-orange-text: var(--asas-orange-text, #C2410C);
  --c-ink: var(--asas-ink, #0F172A);
  --c-surface: var(--asas-white, #fff);
  --c-surface-2: var(--asas-slate-50, #F8FAFC);
  --c-surface-3: var(--asas-slate-100, #F1F5F9);
  --c-line: var(--asas-border, #E2E8F0);
  --c-line-strong: var(--asas-border-strong, #CBD5E1);
  --c-text-2: var(--asas-text-2, #475569);
  --c-text-3: var(--asas-text-3, #64748B);
  font-family: var(--asas-font, "IBM Plex Sans", "IBM Plex Sans Arabic", system-ui, sans-serif);
}
html[data-theme="dark"] .sh-header, html[data-theme="dark"] .sf-footer {
  --c-surface: #0F172A; --c-surface-2: #111C33; --c-surface-3: #1E293B; --c-line: #243247; --c-line-strong: #334155;
  --c-ink: #F8FAFC; --c-text-2: #CBD5E1; --c-text-3: #94A3B8; --c-orange-text: #FDBA74;
}

/* ---------- header ---------- */
.sh-header {
  position: fixed; inset-block-start: 0; inset-inline: 0; z-index: 1040;
  background: color-mix(in srgb, var(--c-surface) 92%, transparent); border-block-end: 1px solid var(--c-surface-3);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.sh-header.is-open { background: var(--c-surface); }
.sh-inner {
  position: relative; display: flex; align-items: center; gap: 16px;
  max-width: 80rem; margin-inline: auto; padding: 0 16px; min-height: 72px; box-sizing: border-box;
}
.sh-header *, .sh-header *::before, .sh-header *::after { box-sizing: border-box; }
.sh-header a { text-decoration: none; }

.sh-brand { display: inline-flex; align-items: center; gap: 10px; min-width: 0; color: var(--c-ink); order: 1; }
/* Logo only: natural aspect ratio (never cropped or stretched), 40px tall. */
.sh-logo { flex: 0 0 auto; display: inline-flex; align-items: center; height: 40px; min-width: 40px; max-width: min(190px, 46vw); border-radius: 8px; overflow: hidden; }
.sh-logo img { display: block; height: 100%; width: auto; max-width: 100%; object-fit: contain; }
html[data-theme="dark"] .sh-logo { background: #fff; padding-inline: 6px; }

.sh-actions { display: flex; align-items: center; gap: 8px; margin-inline-start: auto; order: 3; }
.sh-header .sh-iconbtn.mq-theme-toggle,
.sh-menu-btn {
  position: static; inset: auto; z-index: auto; width: 40px; height: 40px; min-height: 40px; padding: 0; border-radius: 8px; box-shadow: none; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  background: transparent; color: var(--c-ink); border: 1px solid var(--c-line);
}
.sh-menu-btn { min-height: 44px; width: 44px; height: 44px; }
.sh-header .sh-iconbtn.mq-theme-toggle:hover, .sh-menu-btn:hover { background: var(--c-surface-2); transform: none; }
.sh-menu-btn .sh-ic-close { display: none; }
.sh-header.is-open .sh-menu-btn .sh-ic-open { display: none; }
.sh-header.is-open .sh-menu-btn .sh-ic-close { display: block; }

.sh-lang { display: inline-flex; align-items: center; height: 40px; padding: 3px; border: 1px solid var(--c-line); border-radius: 8px; }
.sh-lang a {
  display: inline-flex; align-items: center; justify-content: center; min-width: 36px; height: 32px; padding-inline: 8px; border-radius: 6px;
  font-size: 12px; font-weight: 600; color: var(--c-text-2);
}
.sh-lang a:hover { color: var(--c-ink); }
.sh-lang a.is-active { background: var(--c-ink); color: var(--c-surface); }

.sh-lang.sh-lang-switch {
  min-width: 44px; height: 40px; padding: 0 12px; justify-content: center; border-radius: 8px;
  font-size: 12px; font-weight: 600; color: var(--c-text-2);
  transition: background-color .2s ease;
}
.sh-lang-switch:hover { background: var(--c-surface-2); color: var(--c-ink); }

.sh-panel { display: none; }
.sh-links { display: flex; flex-direction: column; gap: 2px; }
.sh-link { display: block; padding: 12px 8px; font-size: 15px; font-weight: 500; color: var(--c-text-2); border-radius: 8px; transition: color .2s ease, background-color .2s ease; }
.sh-link:hover { color: var(--c-orange-text); background: var(--asas-orange-tint, #FFF7ED); }
.sh-link[aria-current="page"] { color: var(--c-orange-text); font-weight: 700; }
.sf-links a[aria-current="page"] { color: var(--c-orange-text); font-weight: 700; }
html[data-theme="dark"] .sh-link:hover { background: #2A1A0D; }
.sh-auth { display: flex; flex-direction: column; gap: 10px; margin-block-start: 10px; padding-block-start: 14px; border-block-start: 1px solid var(--c-line); }
.sh-btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 20px; border-radius: 12px; border: 1px solid transparent;
  font-size: 14px; font-weight: 600; line-height: 1.2; text-align: center; cursor: pointer;
  transition: background-color .2s ease, border-color .2s ease, color .2s ease;
}
.sh-btn-ghost { background: transparent; color: var(--c-text-2); border-color: transparent; }
.sh-btn-ghost:hover { color: var(--c-ink); background: var(--c-surface-2); }
.sh-btn-primary { background: var(--c-orange); color: #0F172A; }
.sh-btn-primary:hover { background: var(--c-orange-press); color: #000; }

.sh-header :is(a, button):focus-visible { outline: 2px solid var(--c-orange); outline-offset: 2px; }

/* phone / tablet: the links and the pills live in a dropdown panel under the bar */
.sh-header.is-open .sh-panel {
  display: block; position: absolute; inset-inline: 0; inset-block-start: 100%;
  max-height: calc(100vh - 72px); overflow-y: auto; padding: 8px 16px 20px;
  background: var(--c-surface); border-block-end: 1px solid var(--c-line); box-shadow: 0 4px 12px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
}

@media (max-width: 399.98px) {
  .sh-inner { padding-inline: 12px; gap: 8px; }
  .sh-actions { gap: 6px; }
  .sh-logo { height: 36px; min-width: 36px; max-width: min(140px, 38vw); }
}

@media (min-width: 768px) {
  .sh-inner { min-height: 80px; padding-inline: 24px; }
}

@media (min-width: 1080px) {
  .sh-inner { padding-inline: 32px; gap: 24px; }
  .sh-menu-btn { display: none; }
  .sh-actions { margin-inline-start: 0; }
  .sh-panel, .sh-header.is-open .sh-panel { display: contents; position: static; max-height: none; padding: 0; background: none; border: 0; box-shadow: none; overflow: visible; }
  .sh-links { order: 2; flex: 1 1 auto; flex-direction: row; justify-content: flex-start; gap: 4px; }
  .sh-link { padding: 8px 16px; font-size: 14px; }
  .sh-auth { order: 4; flex-direction: row; align-items: center; gap: 12px; margin: 0; padding: 0; border: 0; }
  .sh-btn { min-height: 44px; }
}

/* ---------- footer ---------- */
.sf-footer { background: var(--c-surface); border-block-start: 1px solid var(--c-line); padding: 40px 0 32px; color: var(--c-text-2); }
.sf-footer *, .sf-footer *::before, .sf-footer *::after { box-sizing: border-box; }
.sf-inner { max-width: 80rem; margin-inline: auto; padding-inline: 24px; }
.sf-row { display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 24px; padding-block-end: 32px; border-block-end: 1px solid var(--c-surface-3); }
.sf-brand { display: inline-flex; align-items: center; color: var(--c-ink); text-decoration: none; flex: 0 0 auto; }
.sf-logo { display: inline-flex; align-items: center; height: 36px; max-width: 200px; }
.sf-logo img { display: block; height: 100%; width: auto; max-width: 100%; object-fit: contain; }
html[data-theme="dark"] .sf-logo { background: #fff; border-radius: 8px; padding-inline: 6px; }
.sf-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 24px; }
.sf-links a { font-size: 14px; font-weight: 500; color: var(--c-text-2); text-decoration: none; padding-block: 4px; transition: color .2s ease; }
.sf-links a:hover { color: var(--c-orange-text); }
.sf-footer :is(a):focus-visible { outline: 2px solid var(--c-orange); outline-offset: 2px; border-radius: 4px; }
.sf-copy { margin: 24px 0 0; text-align: center; font-size: 12px; color: var(--c-text-3); }

@media (min-width: 1024px) {
  .sf-row { flex-direction: row; }
  .sf-links { justify-content: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto !important; }
  .sh-link, .sh-btn, .sh-lang-switch, .sf-links a { transition: none; }
}
@media print { .sh-header { position: static; } }
