/* ============================================================
   Erbila — masthead (shared)
   The fixed top bar with wordmark + optional nav + lang switch.
   Loaded by every public page so the chrome stays in lockstep —
   change this one file to update headers everywhere.

   Depends on tokens defined at :root by the page's own stylesheet:
     --bg-deep, --ink, --ink-2, --rule, --rule-2,
     --accent, --accent-2, --display, --mono,
     --gutter, --max-wide, --radius-sm, --pill-r, --masthead-h.
   ============================================================ */

.masthead {
  position: fixed;
  top: 0; inset-inline: 0;
  z-index: 30;
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: background 240ms ease, backdrop-filter 240ms ease, border-color 240ms ease;
}
.masthead.is-scrolled,
.masthead--solid {
  background: color-mix(in srgb, var(--bg-deep) 55%, transparent);
  backdrop-filter: saturate(150%) blur(14px);
  -webkit-backdrop-filter: saturate(150%) blur(14px);
  border-bottom-color: rgba(255,255,255,0.08);
}
.masthead__inner {
  max-width: var(--max-wide);
  margin: 0 auto;
  padding: 1rem var(--gutter);
  display: flex; align-items: center; justify-content: space-between;
  gap: 2rem;
}

/* ---------- Wordmark (mark + Erbila) ---------- */
.wordmark {
  display: inline-flex; align-items: center; gap: 0.65rem;
  color: var(--ink);
}
.wordmark__mark {
  display: grid; place-items: center;
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--bg-deep);
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.06),
    0 10px 24px -8px var(--accent),
    0 4px 10px rgba(0,0,0,0.28);
  flex-shrink: 0;
}
.wordmark__mark svg { width: 22px; height: 22px; }
.wordmark__en {
  font-family: var(--display);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-shadow: 0 2px 6px rgba(0,0,0,0.38);
}
.wordmark__i {
  font-style: normal;
  color: var(--accent);
  display: inline-block;
}
.wordmark__ku {
  font-family: var(--arab, "Amiri", "Noto Naskh Arabic", serif);
  font-size: 0.95rem;
  color: var(--ink-2);
  margin-inline-start: 0.1rem;
  transform: translateY(-0.05em);
}

/* ---------- In-page anchor nav ---------- */
.nav {
  display: flex; align-items: center; gap: 1.5rem;
  font-size: 0.95rem;
}
.nav > a:not(.nav__cta) {
  color: var(--ink);
  position: relative;
  padding: 0.4rem 0;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.86rem;
  font-weight: 500;
  opacity: 0.9;
  text-shadow: 0 2px 6px rgba(0,0,0,0.35);
  transition: opacity 180ms ease;
}
.nav > a:not(.nav__cta):hover { opacity: 1; }

/* Demoted to a quiet, secondary pill. The loud, conversion-driving CTA
   lives in the hero (.pill--accent.pill--lg with the pulsing dot); this
   nav variant is the sticky shortcut once the hero has scrolled away. */
.nav__cta {
  display: inline-flex; align-items: center; gap: 0.55rem;
  padding: 0.5rem 0.95rem;
  border: 1px solid var(--rule);
  border-radius: var(--pill-r);
  background: rgba(255,255,255,0.06);
  color: var(--ink);
  font-weight: 500;
  font-size: 0.85rem;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 14px -8px rgba(0,0,0,0.35);
  transition: all 200ms ease;
}
.nav__cta:hover {
  background: rgba(255,255,255,0.14);
  border-color: var(--rule-2);
}

/* ---------- Language switcher ---------- */
.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.1rem;
  padding: 0.25rem;
  background: rgba(255,255,255,0.12);
  border: 1px solid var(--rule-2);
  border-radius: var(--pill-r);
  font-family: var(--mono);
  font-size: 0.84rem;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow:
    0 8px 22px -8px rgba(0,0,0,0.45),
    inset 0 1px 0 rgba(255,255,255,0.08);
}
.lang-switch__btn {
  display: inline-flex;
  align-items: center;
  padding: 0.32rem 0.7rem;
  border-radius: var(--pill-r);
  color: var(--ink-2);
  letter-spacing: 0.04em;
  white-space: nowrap;
  transition: all 180ms ease;
}
.lang-switch__btn:hover { color: var(--ink); }
.lang-switch__btn.is-active {
  background: var(--ink);
  color: var(--bg-deep);
  font-weight: 500;
}

/* ---------- Mobile breakpoints ---------- */
@media (max-width: 760px) {
  .masthead__inner { padding: 0.7rem 1rem; gap: 0.55rem; }
  .nav { gap: 0.5rem; }
  .nav > a:not(.nav__cta) { display: none; }
  .wordmark__ku { display: none; }
  .lang-switch { font-size: 0.7rem; padding: 0.15rem; }
  .lang-switch__btn { padding: 0.25rem 0.45rem; }
}
@media (max-width: 520px) {
  .masthead__inner { padding: 0.6rem 0.85rem; gap: 0.4rem; }
  .wordmark__mark { width: 26px; height: 26px; }
  .wordmark__mark svg { width: 16px; height: 16px; }
  .wordmark__en { font-size: 0.95rem; }
  .lang-switch { font-size: 0.68rem; padding: 0.12rem; gap: 0.05rem; }
  .lang-switch__btn { padding: 0.22rem 0.42rem; }
  .nav__cta { display: none; }
}
@media (max-width: 360px) {
  .masthead__inner { padding: 0.55rem 0.7rem; }
  .lang-switch__btn { padding: 0.2rem 0.35rem; font-size: 0.62rem; }
}

/* ============================================================
   Mobile bottom tab bar — iOS / Material 3 style.
   Hidden on desktop. Full-width translucent blurred strip hugging
   the bottom edge, equal-width tabs (icon + tiny mono label),
   stroked outline glyphs. Active state is colored, not chipped.
   ============================================================ */
.mobile-dock {
  display: none;
  position: fixed;
  z-index: 25;
  bottom: 0;
  inset-inline: 0;
  padding: 0.3rem 0.2rem calc(env(safe-area-inset-bottom, 0px) + 0.3rem);
  background: color-mix(in srgb, var(--bg-deep) 80%, transparent);
  border-top: 1px solid var(--rule);
  backdrop-filter: saturate(160%) blur(20px);
  -webkit-backdrop-filter: saturate(160%) blur(20px);
}
@media (max-width: 760px) {
  .mobile-dock { display: flex; align-items: stretch; }
}

.mobile-dock__item {
  flex: 1 1 0;
  min-width: 0;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  padding: 0.3rem 0.3rem 0.25rem;
  color: var(--ink-2);
  text-align: center;
  -webkit-tap-highlight-color: transparent;
  transition: color 120ms ease, opacity 120ms ease;
}
.mobile-dock__item:active {
  color: var(--accent);
  opacity: 0.65;
}

.mobile-dock__icon {
  display: inline-flex;
  width: 22px; height: 22px;
}
.mobile-dock__icon svg {
  width: 22px; height: 22px;
  display: block;
}

.mobile-dock__label {
  font-family: var(--mono);
  font-size: 0.56rem;
  letter-spacing: 0.04em;
  white-space: nowrap;
  text-transform: lowercase;
  opacity: 0.78;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 360px) {
  .mobile-dock__icon, .mobile-dock__icon svg { width: 20px; height: 20px; }
  .mobile-dock__label { font-size: 0.52rem; }
}

/* ---------- Reserve space so the bar never covers content ----------
   --mobile-dock-h is the total vertical space the bar occupies (incl.
   safe-area). Layouts read this var to push their content up. */
@media (max-width: 760px) {
  body:has(.mobile-dock) {
    --mobile-dock-h: calc(env(safe-area-inset-bottom, 0px) + 3.5rem);
    padding-bottom: var(--mobile-dock-h);
  }

  /* Snap-scroll landing: each 100vh panel needs internal bottom padding
     so its content shifts up clear of the bar's footprint. Body padding
     alone doesn't work because snap targets are locked to viewport size. */
  body:has(.mobile-dock) .view3__panel {
    padding-bottom: calc(clamp(3rem, 8vh, 6rem) + var(--mobile-dock-h));
  }
  body:has(.mobile-dock) .hero__overlay {
    padding-bottom: calc(clamp(2rem, 5vh, 5.5rem) + var(--mobile-dock-h));
  }

  /* Chat launcher (bottom-right) needs to sit ABOVE the bar. */
  body:has(.mobile-dock) .cw-launcher {
    bottom: calc(var(--mobile-dock-h) + 0.85rem);
  }
}
