/* ============================================================================
   VEOTH — canonical public header.

   Single source of truth for the top bar on the 14 public pages. Before this
   file the header was copy-pasted into every page, which is how five different
   variants (70/66/64px bars, four different link sets, logo on 6 pages only,
   burger on 4 pages only) came to exist.

   Rules:
   - every header class is namespaced `ph-` under the single `.public-header`
     root, so nothing here can reach page content;
   - `.lang` and its `button[data-lang]` children keep their names because
     assets/i18n.js `setLang()` toggles `.on` through
     `document.querySelectorAll(".lang button")`; they are scoped under
     `.public-header` so other pages' own `.lang` blocks are unaffected;
   - layout is flexbox only, with logical properties, so `dir="rtl"` mirrors the
     bar automatically. No float, no physical left/right offset, no directional
     margin.

   Breakpoint: the desktop row is kept until 1120px. Worst case is French, whose
   seven labels measure about 491px of text at 14.5px Inter 500; plus 6x24px
   gaps (144), brand 137, client CTA 128, language switcher 96, two 28px group
   gaps (56), tools gap 12 and 2x24px padding (48) => about 1112px before the
   items can collide. Below 1120px the links and the CTA move into the burger
   panel. Confirm at 1119/1120/1440 in the browser pass.
   ========================================================================== */

.public-header {
  --ph-accent: var(--orange, #D85A30);
  --ph-bg: rgba(15, 33, 64, .94);
  --ph-panel-bg: var(--navy-deep, #0a1730);
  --ph-hairline: rgba(255, 255, 255, .08);
  --ph-text: rgba(255, 255, 255, .82);

  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--ph-bg);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--ph-hairline);
}

/* ---- bar ---- */
.public-header .ph-bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 28px;
  height: 70px;
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---- brand ---- */
.public-header .ph-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  flex: 0 0 auto;
  text-decoration: none;
}
.public-header .ph-logo {
  display: block;
  width: 38px;
  height: 38px;
  border-radius: 9px;
}
.public-header .ph-word {
  font-family: 'Sora', sans-serif;
  font-weight: 700;
  font-size: 21px;
  line-height: 1;
  color: #fff;
  letter-spacing: .14em;
}

/* ---- links + client CTA (the burger panel on small screens) ---- */
.public-header .ph-panel {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 28px;
  flex: 1 1 auto;
  min-width: 0;
}
.public-header .ph-nav {
  display: flex;
  align-items: center;
  gap: 24px;
}
.public-header .ph-link {
  position: relative;
  color: var(--ph-text);
  font-size: 14.5px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: color .2s;
}
.public-header .ph-link:hover,
.public-header .ph-link:focus-visible {
  color: #fff;
}
.public-header .ph-link.active {
  color: #fff;
}
.public-header .ph-link.active::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  bottom: -7px;
  height: 2px;
  border-radius: 2px;
  background: var(--ph-accent);
}
.public-header .ph-cta {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 9px;
  background: rgba(255, 255, 255, .06);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background .2s, border-color .2s;
}
.public-header .ph-cta:hover,
.public-header .ph-cta:focus-visible {
  background: var(--ph-accent);
  border-color: var(--ph-accent);
}

/* ---- tools: language switcher (always visible) + burger ---- */
.public-header .ph-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
}
.public-header .lang {
  display: flex;
  gap: 2px;
  background: rgba(255, 255, 255, .08);
  border-radius: 8px;
  padding: 3px;
}
.public-header .lang button {
  min-width: 34px;
  min-height: 30px;
  padding: 5px 9px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: rgba(255, 255, 255, .7);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.public-header .lang button.on {
  background: var(--ph-accent);
  color: #fff;
}

.public-header .ph-burger {
  display: none;
  position: relative;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 9px;
  background: none;
  cursor: pointer;
}
.public-header .ph-burger span {
  position: absolute;
  inset-inline-start: 11px;
  width: 22px;
  height: 2px;
  border-radius: 2px;
  background: #fff;
  transition: top .28s, opacity .28s, transform .28s;
}
.public-header .ph-burger span:nth-child(1) { top: 16px; }
.public-header .ph-burger span:nth-child(2) { top: 21px; }
.public-header .ph-burger span:nth-child(3) { top: 26px; }
.public-header .ph-burger[aria-expanded="true"] span:nth-child(1) { top: 21px; transform: rotate(45deg); }
.public-header .ph-burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.public-header .ph-burger[aria-expanded="true"] span:nth-child(3) { top: 21px; transform: rotate(-45deg); }

/* ---- focus visibility ---- */
.public-header a:focus-visible,
.public-header button:focus-visible {
  outline: 2px solid var(--ph-accent);
  outline-offset: 3px;
}

/* ---- Arabic typography, applied by i18n.js via body.ar ---- */
body.ar .public-header .ph-word,
body.ar .public-header .ph-link,
body.ar .public-header .ph-cta {
  font-family: 'Noto Kufi Arabic', 'Inter', sans-serif;
}

/* ============================ RESPONSIVE ============================ */
@media (max-width: 1119px) {
  .public-header .ph-burger { display: block; }
  .public-header .ph-tools { margin-inline-start: auto; }

  .public-header .ph-panel {
    position: absolute;
    top: 100%;
    inset-inline: 0;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 4px;
    max-height: calc(100vh - 70px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 10px 16px 18px;
    background: var(--ph-panel-bg);
    border-bottom: 1px solid var(--ph-hairline);
    box-shadow: 0 18px 40px rgba(0, 0, 0, .35);
    display: none;
  }
  .public-header.ph-open .ph-panel { display: flex; }

  .public-header .ph-nav {
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
  }
  .public-header .ph-link {
    min-height: 48px;
    display: flex;
    align-items: center;
    padding: 0 10px;
    border-radius: 9px;
    font-size: 16px;
    white-space: normal;
  }
  .public-header .ph-link.active {
    background: rgba(255, 255, 255, .07);
  }
  /* The desktop underline would sit outside the tapped row on mobile. */
  .public-header .ph-link.active::after { position: static; display: none; }

  .public-header .ph-cta {
    margin-top: 8px;
    min-height: 48px;
    font-size: 15.5px;
  }
}

@media (max-width: 480px) {
  .public-header .ph-bar { gap: 12px; padding: 0 16px; }
  .public-header .ph-word { font-size: 18px; }
  .public-header .ph-logo { width: 34px; height: 34px; }
  .public-header .lang button { min-width: 30px; padding: 5px 7px; }
}

@media (prefers-reduced-motion: reduce) {
  .public-header .ph-link,
  .public-header .ph-cta,
  .public-header .ph-burger span {
    transition: none;
  }
}
