/* ==========================================================================
   Al-Hadbaa Core: shared UI (tokens, scoped reset, type roles, buttons,
   crescent edge, mouse effect, reveal, chips, search, lightbox).
   Ported from site/css/tokens.css, base.css and components.css. Every block
   depends on this file, so blocks keep their look after a theme change.
   Values read the theme's presets first and fall back to the brand values.
   ========================================================================== */
:root {
  --navy-900: var(--wp--preset--color--navy-900, #08131F);
  --navy-800: var(--wp--preset--color--navy-800, #0B1A2C);
  --navy-700: var(--wp--preset--color--navy-700, #132A42);
  --cyan: var(--wp--preset--color--cyan, #1EC8E8);
  --cyan-soft: var(--wp--preset--color--cyan-soft, #6FDDF2);
  --cyan-tint: var(--wp--preset--color--cyan-tint, #E3F8FC);
  --cyan-text: var(--wp--preset--color--cyan-text, #0A7A92);
  --cyan-ink: var(--wp--preset--color--cyan-ink, #0B87A1);
  --deep-teal: #0E4A64;
  --mist: var(--wp--preset--color--mist, #F3F7FA);
  --silver: var(--wp--preset--color--silver, #D9DEE4);
  --white: var(--wp--preset--color--white, #FFFFFF);
  --error: var(--error);
  --error-ring: var(--error-ring);

  --text-muted-dark: rgb(217 222 228 / .78);
  --text-muted-light: rgb(19 42 66 / .82);
  --text-faint-dark: var(--text-faint-dark);
  --line-dark: rgb(255 255 255 / .12);
  --line-dark-soft: rgb(255 255 255 / .08);
  --line-light: rgb(11 26 44 / .14);
  --line-light-soft: rgb(11 26 44 / .08);
  --line-light-strong: var(--line-light-strong);
  --outline-word-dark: rgb(111 221 242 / .16);
  --outline-word-light: rgb(11 26 44 / .10);
  --cyan-a12: rgb(30 200 232 / .12);
  --cyan-a25: rgb(30 200 232 / .25);
  --cyan-a35: rgb(30 200 232 / .35);
  --navy-scrim: rgb(11 26 44 / .78);

  --shadow-sm: 0 1px 2px var(--line-light-soft), 0 6px 16px -6px var(--line-light-soft);
  --shadow-lg: 0 4px 10px var(--line-light-soft), 0 32px 64px -28px rgb(11 26 44 / .28);
  --shadow-deep: 0 30px 60px -30px rgb(8 19 31 / .7);
  --glow-cyan: 0 12px 28px -12px rgb(30 200 232 / .6);
  --glow-cyan-hover: 0 16px 34px -10px rgb(30 200 232 / .7);
  --highlight-top: inset 0 1px 0 rgb(255 255 255 / .4);

  --font-head: var(--wp--preset--font-family--heading, "Sora", "Sora Fallback", ui-sans-serif, system-ui, sans-serif);
  --font-body: var(--wp--preset--font-family--body, "Manrope", "Manrope Fallback", ui-sans-serif, system-ui, sans-serif);
  /* Arabic: Cairo covers Arabic code points only, so Latin runs keep the
     Latin family next in the stack (Manrope in text, Sora in headings). */
  --font-ar: var(--wp--preset--font-family--arabic, "Cairo", "Manrope", Tahoma, sans-serif);
  --font-ar-head: "Cairo", var(--font-head);
  --lh-ar-body: 1.8;
  --lh-ar-head: 1.35;
  --lh-ar-display: 1.3;

  --radius-sm: 14px;
  --radius-md: 20px;
  --radius-device: 40px;
  --radius-pill: 999px;

  --container: 1240px;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --nav-h: 76px;
  --section: clamp(5rem, 10vw, 8rem);
  --section-tall: clamp(6rem, 12vw, 10rem);
  --edge: clamp(56px, 8vw, 130px);

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --dur-press: 160ms;
  --dur-hover: 200ms;
  --dur-reveal: 900ms;
  --dur-menu: 500ms;
  --dur-slide: 1200ms;
  --dur-draw: 1400ms;
  --dur-settle: 7s;
  --dur-kenburns: 20s;
  --dur-pulse: 2.4s;
  --dur-fade-reduced: 400ms;
  --reveal-rise: 18px;
  --stagger: 90ms;
  --hover-lift: -6px;

  /* Buttons (QA round 3: ~12% less padding, one font step down; never under 44px) */
  --btn-min-h: 44px;
  --btn-pad: .84rem 1.4rem;
  --btn-font: .88rem;
  --btn-pad-sm: .5rem 1rem;
  --btn-font-sm: .8rem;
  --btn-pad-lg: .9rem 1.7rem;
  --btn-font-lg: .95rem;

  --z-content: 2;
  --z-edge: 3;
  --z-menu: 70;
  --z-nav: 80;
  --z-float: 85;
  --z-skip: 120;
}
/* The header bar fits the logo (96 / 80 / 64px, site-header/style.css) with 8px above and below */
:root { --nav-h: 112px; }
@media (max-width: 1024px) { :root { --nav-h: 96px; } }
@media (max-width: 767px) { :root { --nav-h: 76px; } }

/* Metric-matched fallbacks, so the web-font swap shifts nothing */
@font-face { font-family: "Sora Fallback"; src: local("Arial"); size-adjust: 114.8%; ascent-override: 84.5%; descent-override: 25.3%; line-gap-override: 0%; }
@font-face { font-family: "Manrope Fallback"; src: local("Arial"); size-adjust: 103.6%; ascent-override: 102.9%; descent-override: 29%; line-gap-override: 0%; }

/* --- Page-level defaults ---------------------------------------------------- */
html { scroll-padding-block-start: calc(var(--nav-h) + 12px); -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body { -webkit-font-smoothing: antialiased; overflow-x: clip; }
body.menu-open, html:has(body.menu-open) { overflow: hidden; }
[hidden] { display: none !important; }
:lang(ar) { font-family: var(--font-ar); }
/* Components that set the Latin families get Cairo for their Arabic letters (its unicode-range is Arabic only, so Latin keeps Sora / Manrope). */
:lang(ar) {
  --font-head: "Cairo", var(--wp--preset--font-family--heading, "Sora", "Sora Fallback", ui-sans-serif, system-ui, sans-serif);
  --font-body: "Cairo", var(--wp--preset--font-family--body, "Manrope", "Manrope Fallback", ui-sans-serif, system-ui, sans-serif);
}
/* Arabic never takes tracking, capitals or slanted type (brand rules) */
:lang(ar) { letter-spacing: 0 !important; text-transform: none !important; font-style: normal !important; }
:lang(ar) :where(p, li, dd, dt, blockquote, figcaption, label, input, textarea, select, td, th, address, summary) { line-height: var(--lh-ar-body); }

/* --- Reset, scoped to the plugin's blocks (zero specificity) ----------------- */
.alh, .alh *, .alh *::before, .alh *::after { box-sizing: border-box; }
:where(.alh) :where(img, svg, canvas) { display: block; max-inline-size: 100%; }
:where(.alh) :where(img) { block-size: auto; }
:where(.alh) :where(a) { color: inherit; text-decoration: none; }
:where(.alh) :where(button) { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
/* .alh (not :where) so theme.json's global heading styles never reach blocks */
.alh :where(h1, h2, h3, h4), :where(h1, h2, h3, h4).alh { font-family: var(--font-head); color: var(--fg); font-size: revert; margin: 0; line-height: 1.1; letter-spacing: -0.03em; font-weight: 600; text-wrap: balance; }
.alh :where(h1, h2, h3, h4):lang(ar) { font-family: var(--font-ar-head); line-height: var(--lh-ar-head); }
:where(.alh) :where(p, figure, blockquote) { margin: 0; }
:where(.alh) :where(p, li) { text-wrap: pretty; }
:where(.alh) :where(ul, ol) { margin: 0; padding: 0; list-style: none; }
section.alh, .alh section { position: relative; overflow-x: clip; }

/* --- Theme scopes: every section is .dark or .light ------------------------ */
.light {
  --fg: var(--navy-800);
  --fg-2: var(--navy-700);
  --muted: var(--text-muted-light);
  --focus: var(--navy-800);
  --outline: var(--outline-word-light);
  background: var(--white);
  color: var(--fg-2);
}
.dark {
  --fg: var(--white);
  --fg-2: var(--silver);
  --muted: var(--text-muted-dark);
  --focus: var(--cyan);
  --outline: var(--outline-word-dark);
  background: var(--navy-900);
  color: var(--fg-2);
}
.mist { background: var(--mist); }
.tint { background: color-mix(in oklch, var(--cyan-tint) 55%, var(--white)); }

/* --- Editor overrides (block supports and "presets + Custom" controls) ------
   render.php sets these custom properties on the block's wrapper. */
.has-alh-accent { --cyan: var(--alh-accent); --cyan-soft: var(--alh-accent); --cyan-text: var(--alh-accent); --cyan-ink: var(--alh-accent); }
/* The "Cyan highlight" text format (the hero's cyan line, highlighted words) */
:where(.alh) mark.hl { background: none; color: var(--cyan); font-style: normal; }
:where(.alh .light, .alh.light) mark.hl { color: var(--cyan-text); }
.has-alh-heading-color { --fg: var(--alh-heading-color); }
.has-alh-text-color { --fg-2: var(--alh-text-color); --muted: var(--alh-text-color); }
.has-alh-heading-size .alh-heading { font-size: var(--alh-heading-size) !important; }
.has-alh-gap .alh-gap { gap: var(--alh-gap) !important; }
.has-text-color { --fg: currentColor; --fg-2: currentColor; --muted: currentColor; }

/* --- Focus, screen-reader text, skip link ------------------------------------ */
:focus-visible { outline: 2px solid var(--focus, var(--navy-800)); outline-offset: 3px; border-radius: 8px; }
.sr { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip {
  position: fixed; inset-block-start: 12px; inset-inline-start: 12px; z-index: var(--z-skip);
  padding: .7rem 1.1rem; border-radius: var(--radius-pill);
  background: var(--cyan); color: var(--navy-900); font-weight: 700;
  transform: translateY(-160%);
  transition: transform var(--dur-hover) var(--ease-out);
}
.skip:focus-visible { transform: none; --focus: var(--navy-900); }

/* --- Layout ------------------------------------------------------------------ */
.container {
  inline-size: min(100% - 2 * max(var(--gutter), env(safe-area-inset-left), env(safe-area-inset-right)), var(--container));
  margin-inline: auto;
}

/* --- Shared type roles ------------------------------------------------------- */
.eyebrow {
  display: inline-flex; align-items: center; gap: .6rem;
  margin-block-end: 1.2rem;
  font-family: var(--font-head); font-size: .84rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .12em;
  color: var(--muted);
}
.eyebrow::before { content: ""; flex: none; inline-size: 8px; block-size: 8px; background: var(--cyan); transform: rotate(45deg); }
.eyebrow:lang(ar) { font-size: .9rem; font-family: var(--font-ar-head); }
.h2 { font-size: clamp(2rem, 1.2rem + 2.4vw, 2.9rem); }
.lead { font-size: 1.08rem; color: var(--muted); max-inline-size: 56ch; }
.text-link { display: inline-flex; align-items: center; gap: .4rem; font-weight: 700; color: var(--cyan-text); }
.dark .text-link { color: var(--cyan-soft); }
.text-link svg { inline-size: 1.1em; block-size: 1.1em; transition: transform var(--dur-hover) var(--ease-out); }
[dir="rtl"] .text-link svg.flip { transform: scaleX(-1); }
@media (hover: hover) and (pointer: fine) {
  .text-link:hover svg:not(.flip) { transform: translateX(3px); }
  [dir="rtl"] .text-link:hover svg:not(.flip) { transform: translateX(-3px); }
}

/* --- Buttons: one primary, one secondary, one size scale --------------------- */
.btn {
  --pad: var(--btn-pad);
  display: inline-flex; align-items: center; justify-content: center; gap: .6rem;
  min-block-size: var(--btn-min-h);
  padding: var(--pad); border-radius: var(--radius-pill);
  white-space: nowrap; text-decoration: none;
  font-family: var(--font-head); font-weight: 600; font-size: var(--btn-font); line-height: 1.2;
  transition:
    transform var(--dur-press) var(--ease-out),
    background-color var(--dur-hover) ease,
    color var(--dur-hover) ease,
    border-color var(--dur-hover) ease,
    box-shadow var(--dur-hover) ease;
}
.btn:lang(ar) { font-family: var(--font-ar-head); }
.btn:active { transform: scale(.97); }
.btn svg { inline-size: 1.2em; block-size: 1.2em; flex: none; }
[dir="rtl"] .btn__arrow { transform: scaleX(-1); }
.btn--sm { --pad: var(--btn-pad-sm); font-size: var(--btn-font-sm); }
.btn--lg { --pad: var(--btn-pad-lg); font-size: var(--btn-font-lg); }
/* Two buttons side by side share one width, the wider one's: equal grid
   columns on a shrink-to-fit grid resolve to the widest button */
.btn-pair:has(> .btn + .btn) {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  inline-size: max-content; max-inline-size: 100%;
}
/* Phones: section CTAs run full width (hero CTAs stay auto, see hero) */
@media (max-width: 767px) {
  main .btn--cyan:not(.btn--sm), main .btn--lg, main .btn-pair > .btn { inline-size: 100%; }
  main .btn-pair:has(> .btn + .btn) { grid-auto-flow: row; inline-size: 100%; }
}
.btn--cyan { background: var(--cyan); color: var(--navy-900); box-shadow: var(--highlight-top), var(--glow-cyan); }
.btn--ghost { color: var(--fg); border: 1.5px solid currentColor; }
@media (hover: hover) and (pointer: fine) {
  .btn--cyan:hover { background: var(--cyan-soft); box-shadow: var(--highlight-top), var(--glow-cyan-hover); }
  .dark .btn--ghost:hover { color: var(--cyan-soft); }
  .light .btn--ghost:hover { background: var(--navy-800); border-color: var(--navy-800); color: var(--white); }
}
/* Disabled (decision 10): silver fill, faded text, no glow, no hover or press */
.btn:disabled, .btn[aria-disabled="true"] {
  background: var(--silver); color: rgb(19 42 66 / .6); box-shadow: none; cursor: not-allowed; transform: none;
}
.btn--ghost:disabled, .btn--ghost[aria-disabled="true"] { background: transparent; color: var(--fg); border-color: color-mix(in oklch, currentColor 40%, transparent); opacity: .6; }
@media (hover: hover) and (pointer: fine) {
  .btn--cyan:disabled:hover, .btn--cyan[aria-disabled="true"]:hover { background: var(--silver); box-shadow: none; }
  .light .btn--ghost:disabled:hover, .dark .btn--ghost:disabled:hover { background: transparent; color: var(--fg); }
}

/* --- Crescent Edge ----------------------------------------------------------- */
.edge {
  position: absolute; inset-inline: 0; z-index: var(--z-edge);
  inline-size: 100%; block-size: var(--edge);
  pointer-events: none;
}
.edge--bottom { inset-block-end: -1px; }
.edge--top { inset-block-start: -1px; }
.edge__fill { fill: var(--edge-fill, var(--white)); }
.edge__rim { fill: url(#g-rim) var(--cyan); }
.edge-fill--white { --edge-fill: var(--white); }
.edge-fill--navy { --edge-fill: var(--navy-900); }
.edge-fill--mist { --edge-fill: var(--mist); }
.edge-fill--tint { --edge-fill: color-mix(in oklch, var(--cyan-tint) 55%, var(--white)); }

/* --- Hero mouse effect (spotlight.js + hero-net.js) -------------------------- */
[data-spotlight] {
  --spot-x: -100vmax; --spot-y: -100vmax; --spot-in: 1;
  --spot-mask: radial-gradient(circle 200px at var(--spot-x) var(--spot-y), rgb(0 0 0 / var(--spot-in)) 0%, #000 100%);
}
.spot-shade { -webkit-mask-image: var(--spot-mask); mask-image: var(--spot-mask); }
.fx-net {
  --net-line: var(--cyan);
  --net-line-alpha: .32;
  --net-dot: var(--cyan-soft);
  position: absolute; inset: 0; inline-size: 100%; block-size: 100%; pointer-events: none;
}

/* --- Reveal, once per element ------------------------------------------------ */
.js [data-reveal] {
  opacity: 0;
  transition: opacity var(--dur-reveal) var(--ease-out), transform var(--dur-reveal) var(--ease-out), clip-path var(--dur-reveal) var(--ease-in-out);
  transition-delay: calc(var(--i, 0) * var(--stagger));
}
.js [data-reveal="up"] { transform: translateY(32px); }
.js [data-reveal="left"] { transform: translateX(-48px); }
.js [data-reveal="right"] { transform: translateX(48px); }
.js[dir="rtl"] [data-reveal="left"] { transform: translateX(48px); }
.js[dir="rtl"] [data-reveal="right"] { transform: translateX(-48px); }
.js [data-reveal="scale"] { transform: scale(.92); }
.js [data-reveal="wipe"] { opacity: 1; clip-path: inset(0 100% 0 0); }
.js[dir="rtl"] [data-reveal="wipe"] { clip-path: inset(0 0 0 100%); }
.js [data-reveal].is-in { opacity: 1; transform: none; }
.js [data-reveal="wipe"].is-in { clip-path: inset(0 0 0 0); }

/* --- Sections ---------------------------------------------------------------- */
.sec { padding-block: var(--section); }
.has-edge { padding-block-end: calc(var(--section) + var(--edge) * .6); }
.sec__head { max-inline-size: 640px; margin-block-end: clamp(2.25rem, 5vw, 3.25rem); }
.sec__head .lead { margin-block-start: 1rem; }

/* --- Inner hero entrance and breadcrumb -------------------------------------- */
.crumbs { margin-block-end: 1.5rem; font-size: .88rem; }
.crumbs ol { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.crumbs li + li::before { content: "/"; margin-inline-end: .5rem; color: var(--muted); }
.crumbs a { color: var(--muted); transition: color var(--dur-hover) ease; }
.crumbs [aria-current] { color: var(--white); font-weight: 600; }
@media (hover: hover) and (pointer: fine) { .crumbs a:hover { color: var(--cyan-soft); } }
.js .c-in { opacity: 0; transform: translateY(var(--reveal-rise)); }
.is-ready .c-in {
  opacity: 1; transform: none;
  transition: opacity var(--dur-reveal) var(--ease-out), transform var(--dur-reveal) var(--ease-out);
  transition-delay: calc(var(--i, 0) * var(--stagger) + 100ms);
}

/* --- Chips, the "Exclusive agent" badge, the active-filter chip -------------- */
.chip {
  display: inline-flex; align-items: center; gap: .4rem; padding: .22rem .7rem; border-radius: var(--radius-pill);
  background: var(--cyan-tint); border: 1px solid var(--cyan-a35);
  font-size: .76rem; font-weight: 700; color: var(--navy-800); white-space: nowrap;
}
.dark .chip { background: var(--cyan-a12); color: var(--cyan-soft); }
.badge-ex {
  display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .75rem; border-radius: var(--radius-pill);
  background: var(--cyan); color: var(--navy-900); font-size: .76rem; font-weight: 800; letter-spacing: .02em; white-space: nowrap;
  box-shadow: var(--glow-cyan);
}
.badge-ex svg { inline-size: 13px; block-size: 13px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.fchip {
  display: inline-flex; align-items: center; gap: .45rem; min-block-size: 32px; padding: .25rem .4rem .25rem .8rem; border-radius: var(--radius-pill);
  background: var(--navy-800); color: var(--white); font-size: .82rem; font-weight: 700;
}
.fchip svg { inline-size: 18px; block-size: 18px; padding: 3px; border-radius: 50%; background: var(--line-dark); }
@media (hover: hover) and (pointer: fine) { .fchip:hover svg { background: var(--cyan); color: var(--navy-900); } }
@media (pointer: coarse) { .fchip { min-block-size: 44px; } }

/* --- Search field (scoped: WordPress puts .search on <body> on search results) */
.alh .search { position: relative; }
.alh .search svg {
  position: absolute; inset-block-start: 50%; inset-inline-start: 1rem; translate: 0 -50%;
  inline-size: 18px; block-size: 18px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; pointer-events: none;
}
.alh .search input {
  inline-size: 100%; min-block-size: 46px; padding: .6rem 1rem; padding-inline-start: 2.7rem;
  border-radius: var(--radius-pill); border: 1.5px solid var(--line-light); background: var(--white);
  font: inherit; font-size: .95rem; color: var(--navy-800);
  transition: border-color var(--dur-hover) ease, box-shadow var(--dur-hover) ease;
}
.alh .search input::placeholder { color: var(--muted); opacity: .85; }
.alh .search input:focus-visible { outline: none; border-color: var(--navy-800); box-shadow: 0 0 0 3px var(--cyan-a35); }

/* --- Round buttons and the lightbox ------------------------------------------ */
.round-btn {
  display: grid; place-items: center; inline-size: 48px; block-size: 48px; border-radius: 50%;
  border: 1px solid var(--line-dark); color: var(--white); background: var(--navy-scrim); --focus: var(--cyan);
  transition: background-color var(--dur-hover) ease, color var(--dur-hover) ease, border-color var(--dur-hover) ease;
}
.round-btn svg { inline-size: 20px; block-size: 20px; }
.round-btn--prev svg, [dir="rtl"] .round-btn--next svg { transform: scaleX(-1); }
[dir="rtl"] .round-btn--prev svg { transform: none; }
@media (hover: hover) and (pointer: fine) { .round-btn:hover { background: var(--cyan); border-color: var(--cyan); color: var(--navy-900); } }
.lightbox { padding: 0; border: 0; background: transparent; max-inline-size: 100vw; max-block-size: 100vh; inline-size: 100%; block-size: 100%; color: var(--white); }
.lightbox::backdrop { background: color-mix(in oklch, var(--navy-900) 94%, transparent); }
.lightbox__inner { display: grid; place-items: center; block-size: 100%; padding: 4.5rem 4.5rem 3rem; }
.lightbox figure { display: grid; justify-items: center; gap: 1rem; margin: 0; }
.lightbox img { max-inline-size: min(1200px, 100%); max-block-size: calc(100vh - 10rem); border-radius: var(--radius-sm); object-fit: contain; }
.lightbox figcaption { font-size: .92rem; color: var(--silver); }
.lightbox .round-btn { position: absolute; }
.lightbox__close { inset-block-start: 1rem; inset-inline-end: 1rem; }
.lightbox .round-btn--prev { inset-inline-start: 1rem; inset-block-start: 50%; translate: 0 -50%; }
.lightbox .round-btn--next { inset-inline-end: 1rem; inset-block-start: 50%; translate: 0 -50%; }
@media (max-width: 479px) {
  .lightbox__inner { padding: 4.5rem 1rem 6rem; }
  .lightbox .round-btn--prev, .lightbox .round-btn--next { inset-block-start: auto; inset-block-end: 1.25rem; translate: none; }
}

/* --- Placeholder images (MISSING-ASSETS.md): a quiet label in the editor ----- */
.alh-ph-note { display: none; }

/* --- Reduced motion ---------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .js [data-reveal] { transform: none !important; clip-path: none !important; transition: opacity var(--dur-fade-reduced) ease; }
  .btn, .skip, .text-link svg { transition: none; }
  .spot-shade { -webkit-mask-image: none; mask-image: none; }
  .js .c-in { opacity: 1; transform: none; transition: none; }
  .crumbs a, .alh .search input, .round-btn { transition: none !important; }
}
/* Swipe rows run to the screen edge but start on the container line */
.bleed { --bleed: max(var(--gutter), (100% - var(--container)) / 2); }
