/* SMOrchestra — shared foundation stylesheet
 * -----------------------------------------------------------
 * Loaded FIRST on every page. Page-specific <style> blocks
 * that follow can override any of these rules (cascade order).
 *
 * Contains:
 *   1. Brand design tokens (CSS custom properties)
 *   2. Global resets + base typography
 *   3. Nav primitives (every page has the same nav shell)
 *   4. Footer primitives
 *   5. Layout + utility classes shared site-wide
 *
 * Rules of thumb:
 *   - If a rule is identical across 10+ pages, it belongs here.
 *   - If a page overrides it, keep the page override — don't
 *     fight the cascade, lean on it.
 *   - This file is cached immutably (see netlify.toml headers
 *     on /assets/*). Changing it invalidates every page's
 *     cached bytes — treat as a deliberate design-system move.
 */

/* --- 1. Brand design tokens ------------------------------- */
:root {
  --orange: #ff6b35;
  --cyan: #38bdf8;
  --lime: #bef264;
  --violet: #a78bfa;
  --bg: #000;
  --bg-2: #0a0a0a;
  --card: #141414;
  --card-dark: #141414;
  --rule: #1a1a1a;
  --text: #ffffff;
  --text-body: #cfcfd2;
  --text-muted: #a3a3a3;
  --text-dim: #8a8a8a;
  --text-blue: #b8c4d1;
  --f: "Inter", -apple-system, system-ui, sans-serif;
  --f-ar: "IBM Plex Sans Arabic", "Inter", -apple-system, system-ui, sans-serif;
}

/* --- 2. Global resets + base typography ------------------- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

button {
  font-family: inherit;
}

/* --- 3. Nav primitives ------------------------------------ */
/* Every page uses this shell. Page-specific inline CSS may add
 * decorative tweaks (shadow colors, transforms) but should not
 * override the structural rules below. */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0;
  gap: 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.01em;
}
.brand-mark {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.nav-links {
  display: flex;
  gap: 32px;
  align-items: center;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}
.nav-links a:hover,
.nav-links a.on {
  color: var(--orange);
}
.nav-cta {
  padding: 10px 18px;
  background: var(--orange);
  color: #000;
  font-weight: 700;
  font-size: 13.5px;
  letter-spacing: 0.01em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: 0.15s;
}

/* Mobile nav collapse — the hamburger is injected by /assets/nav.js */
@media (max-width: 880px) {
  .nav-links {
    display: none;
  }
}

/* --- 4. Shared layout primitives -------------------------- */
.wrap {
  max-width: 1170px;
  margin: 0 auto;
  padding: 0 clamp(20px, 4vw, 48px);
}

/* --- 5. Mobile overflow safety net ------------------------ */
/* Belt-and-suspenders against any runaway element on narrow
 * viewports. Homepage applies this inline already for section
 * containers; this is the site-wide baseline. */
@media (max-width: 640px) {
  html,
  body {
    overflow-x: clip;
    max-width: 100vw;
  }
}

/* --- 7. Footer newsletter embed --------------------------- */
/* Inline GHL form in the Brand column of every footer. Iframe
 * is auto-resized by media.smorchestra.com/js/form_embed.js
 * via postMessage; min-height is a pre-load floor to avoid
 * layout shift during the handshake. */
.foot-newsletter {
  margin-top: 18px;
  max-width: 340px;
}
.foot-newsletter-label {
  font-size: 12px;
  color: #a3a3a3;
  margin-bottom: 8px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 600;
}
html[dir="rtl"] .foot-newsletter-label {
  text-transform: none;
  letter-spacing: 0;
}
.foot-newsletter-embed iframe {
  display: block;
  width: 100%;
  min-height: 220px;
  border: none;
  background: transparent;
  border-radius: 4px;
}
@media (max-width: 760px) {
  .foot-newsletter { max-width: 100%; }
}

/* --- 8. Exit-intent popup --------------------------------- */
/* Custom implementation (GHL doesn't ship a usable external-site popup).
 * Rendered by /assets/exit-popup.js on mouseleave from the viewport top.
 * Desktop only (<= 880px bails out). Max 1×/session via sessionStorage. */
#smo-exit-popup {
  position: fixed;
  inset: 0;
  z-index: 99999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
#smo-exit-popup.open {
  opacity: 1;
  pointer-events: auto;
}
.smo-exit-popup-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.smo-exit-popup-card {
  position: relative;
  max-width: 520px;
  width: calc(100% - 48px);
  margin: 12vh auto 0;
  padding: 40px 36px 32px;
  background: #0a0a0a;
  border: 1px solid #1a1a1a;
  border-top: 3px solid #ff6b35;
  box-shadow: 0 24px 72px rgba(0, 0, 0, 0.6);
  color: #f9fafb;
  transform: translateY(12px);
  transition: transform 0.2s ease;
}
#smo-exit-popup.open .smo-exit-popup-card {
  transform: translateY(0);
}
.smo-exit-popup-close {
  position: absolute;
  top: 12px;
  inset-inline-end: 12px;
  width: 32px;
  height: 32px;
  padding: 0;
  background: transparent;
  border: none;
  color: #a3a3a3;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  transition: color 0.15s;
}
.smo-exit-popup-close:hover { color: #fff; }
.smo-exit-popup-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #ff6b35;
  margin-bottom: 16px;
}
html[dir="rtl"] .smo-exit-popup-eyebrow {
  text-transform: none;
  letter-spacing: 0.02em;
}
.smo-exit-popup-h {
  font-size: clamp(22px, 2.4vw, 28px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0 0 14px;
  color: #fff;
}
.smo-exit-popup-body {
  font-size: 15px;
  line-height: 1.6;
  color: #cbd5e1;
  margin: 0 0 24px;
}
.smo-exit-popup-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.smo-exit-popup-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  background: #ff6b35;
  color: #000;
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  transition: filter 0.15s, transform 0.15s;
}
.smo-exit-popup-cta:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}
.smo-exit-popup-dismiss {
  background: transparent;
  border: none;
  color: #a3a3a3;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  padding: 12px 8px;
  transition: color 0.15s;
}
.smo-exit-popup-dismiss:hover { color: #fff; }

/* --- 6. Print hygiene ------------------------------------- */
@media print {
  .nav,
  .nav-cta,
  .nav-toggle,
  footer form,
  [role="region"][aria-label*="chat"] {
    display: none !important;
  }
  a::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #555;
  }
}
