/* public/css/global.css
   Spread Agency design system.
   New brand identity (blue/teal, Kanit/Anton) merged with legacy tokens. */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
::selection { background: #17A4E4; color: #fff; }

:root {
  /* ---- New brand palette (drives the design) ---- */
  --bg: #0C0C0C;
  --fg: #D7E2EA;
  --fg-dim: #7FA0B5;
  --panel: #FFFFFF;
  --panel-fg: #0C0C0C;
  --panel-fg-dim: rgba(12,12,12,.62);
  --panel-border: rgba(12,12,12,.14);
  --card: #101014;
  --card-2: #15151a;
  --card-border: #D7E2EA;
  --hairline: rgba(215,226,234,.16);
  --ghost-hover: rgba(215,226,234,.12);
  --grad-head: linear-gradient(180deg,#7FA0B5 0%,#C8E6EE 100%);
  --glow: radial-gradient(circle at 50% 60%, rgba(23,164,228,.32), rgba(42,215,209,.14) 45%, transparent 70%);
  --chip: rgba(215,226,234,.06);
  --chip-border: rgba(215,226,234,.14);
  --wordmark-filter: none;
  --header: rgba(12,12,12,.72);

  /* ---- Legacy tokens kept for compatibility with old pages ---- */
  --cn: #1565D8;   /* primary  */
  --ct: #2AD7D1;   /* teal     */
  --cb: #17A4E4;   /* blue     */
  --cd: #0C0C0C;   /* dark     */
  --g1: linear-gradient(135deg,#1565D8,#2AD7D1);
  --g2: linear-gradient(135deg,#2AD7D1,#17A4E4 60%,#1565D8);
  --g3: linear-gradient(123deg,#1E2A6E 7%,#1565D8 37%,#17A4E4 72%,#2AD7D1 100%);
}

[data-theme="light"] {
  --bg: #EAF1F8;
  --fg: #16224B;
  --fg-dim: #5E6E8C;
  --panel: #0B1226;
  --panel-fg: #E6EEF7;
  --panel-fg-dim: rgba(230,238,247,.62);
  --panel-border: rgba(230,238,247,.16);
  --card: #FFFFFF;
  --card-2: #DCE7F1;
  --card-border: rgba(22,34,77,.18);
  --hairline: rgba(22,34,77,.12);
  --ghost-hover: rgba(22,34,77,.07);
  --grad-head: linear-gradient(180deg,#1565D8 0%,#17A4E4 100%);
  --glow: radial-gradient(circle at 50% 60%, rgba(23,164,228,.22), rgba(42,215,209,.12) 45%, transparent 70%);
  --chip: rgba(22,34,77,.04);
  --chip-border: rgba(22,34,77,.12);
  --wordmark-filter: brightness(0) saturate(100%) invert(13%) sepia(46%) saturate(1709%) hue-rotate(205deg) brightness(95%) contrast(92%);
  --header: rgba(234,241,248,.78);
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: 'Kanit', sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  transition: background .5s ease, color .5s ease;
}

.acc-grad { background: linear-gradient(123deg,#1E2A6E 7%,#1565D8 37%,#17A4E4 72%,#2AD7D1 100%); }
.ic-moon { display: none; }
[data-theme="light"] .ic-sun { display: none; }
[data-theme="light"] .ic-moon { display: inline-flex; }

@keyframes spGlow  { 0%{opacity:.5;transform:scale(.96)} 50%{opacity:.85;transform:scale(1.05)} 100%{opacity:.5;transform:scale(.96)} }
@keyframes spFloat { 0%{transform:translateY(0)} 50%{transform:translateY(-16px)} 100%{transform:translateY(0)} }
@keyframes spPulse { 0%,100%{box-shadow:0 10px 30px rgba(37,211,102,.45),0 0 0 0 rgba(37,211,102,.5)} 50%{box-shadow:0 10px 30px rgba(37,211,102,.55),0 0 0 14px rgba(37,211,102,0)} }
@keyframes spMarquee { from{transform:translateX(0)} to{transform:translateX(-33.333%)} }

/* fade-on-scroll helper */
.fade { opacity: 0; transform: translateY(30px); transition: transform .9s cubic-bezier(.25,.1,.25,1), opacity .9s cubic-bezier(.25,.1,.25,1); }
.fade.in { opacity: 1; transform: none; }

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

/* ---- Performance: kill heavy blur on mobile (per project rule) ---- */
@media (max-width: 768px) {
  .menu-overlay, .video-play-btn, .glass-blur { backdrop-filter: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* ---- video slider rows ---- */
[data-vslider]::-webkit-scrollbar { display: none; }

/* ---- accessibility: keyboard focus states ---- */
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid #17A4E4;
  outline-offset: 2px;
  border-radius: 6px;
}

/* ---- reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ---- cookie banner ---- */
.cookie-bar { position: fixed; bottom: 0; inset-inline: 0; z-index: 300; background: #0B1226; color: #E6EEF7;
  font-family: 'Tajawal', sans-serif; padding: 14px clamp(16px,4vw,32px); display: flex; align-items: center;
  justify-content: center; gap: 16px; flex-wrap: wrap; box-shadow: 0 -10px 30px rgba(0,0,0,.25); }
.cookie-bar a { color: #2AD7D1; }
.cookie-bar button { background: linear-gradient(123deg,#1565D8,#17A4E4); color:#fff; border:0; border-radius:999px;
  padding:10px 26px; font-weight:800; cursor:pointer; font-family:'Tajawal',sans-serif; }

/* ---- project card: 2 columns on desktop ---- */
@media (min-width: 900px) {
  [data-pgrid] { grid-template-columns: 58% 42% !important; }
}

/* ---- hero nav: mobile switch ---- */
@media (max-width: 899px) {
  [data-desk-nav] { display: none !important; }
  [data-mob-nav]  { display: inline-flex !important; }
  [data-discover] { display: none !important; }
  [data-car-card] { width: clamp(260px, 78vw, 480px) !important; }
}

/* ============================================================
   V2.1 — Mobile UI/UX fixes (no design changes)
   ============================================================ */

/* ---- (1) hard stop for any horizontal overflow / page shift ---- */
html { overflow-x: clip; }
html, body { max-width: 100%; }
body > div { overflow-x: clip; }

/* ---- (1) footer: responsive grid, wrapping text, contained icons ---- */
.ft-grid > * { min-width: 0; }
.ft-grid a, .ft-grid p, .ft-grid span, .ft-grid div { overflow-wrap: anywhere; }
.ft-bar { min-width: 0; }
.ft-bar a, .ft-bar span { overflow-wrap: anywhere; }
@media (max-width: 900px) {
  .ft-grid { grid-template-columns: 1fr 1fr !important; }
}
@media (max-width: 520px) {
  .ft-grid { grid-template-columns: 1fr !important; }
  .ft-bar  { flex-direction: column; align-items: flex-start !important; }
}

/* ---- (2) project cards: always fit the viewport ---- */
[data-pcard] { max-width: 100%; }
[data-pcard] * { min-width: 0; }
@media (max-width: 899px) {
  [data-pcard] { top: 84px !important; }
  [data-pcard] .pimg-box { max-height: 58vh !important; min-height: 220px !important; }
  [data-pcard] h3 { font-size: clamp(1.6rem, 8vw, 2.6rem) !important; overflow-wrap: anywhere; }
}

/* ---- (3) videos: RTL track + native swipe on mobile ---- */
[data-vid-track] { max-width: none; }
[data-vid-track] > * { scroll-snap-align: start; }
[data-vid-track]::-webkit-scrollbar { display: none; }
@media (max-width: 767px) {
  [data-vid-section] { height: auto !important; }
  [data-vid-sticky]  { position: static !important; height: auto !important; padding-bottom: clamp(48px, 8vw, 72px); }
  [data-vid-sticky] > div:last-child { overflow: visible !important; padding-top: 28px; }
  [data-vid-track] {
    transform: none !important;
    overflow-x: auto;
    overscroll-behavior-x: contain;   /* no overscroll past last card */
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    max-width: 100%;
  }
}

/* ---- (4) hero: image on top, text underneath (mobile only) ---- */
@media (max-width: 640px) {
  [data-car-section] { min-height: 660px !important; }
  [data-car-ghost] { top: 0 !important; font-size: clamp(64px, 24vw, 110px) !important; }
  [data-car-card] {
    bottom: auto !important;
    top: 43% !important;
    width: min(88vw, 420px) !important;
  }
  [data-hero-info] {
    left: 20px !important;
    right: 20px !important;
    bottom: 9vh !important;
    max-width: none !important;
    text-align: center;
  }
  [data-hero-info] [data-car-desc] { margin-inline: auto; max-width: 420px; }
  [data-hero-info] .hero-ctrls { justify-content: center; }
}

/* ---- (6)(7) rich HTML content: render admin HTML exactly, theme-safe ---- */
.rich-html { overflow-wrap: anywhere; }
.rich-html * { max-width: 100%; }
.rich-html h1, .rich-html h2, .rich-html h3,
.rich-html h4, .rich-html h5, .rich-html h6 {
  color: var(--fg); font-weight: 800; line-height: 1.35;
  margin: 1.4em 0 .55em;
}
.rich-html h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); }
.rich-html h2 { font-size: clamp(1.45rem, 3.2vw, 2rem); }
.rich-html h3 { font-size: clamp(1.25rem, 2.6vw, 1.6rem); }
.rich-html h4 { font-size: 1.15rem; }
.rich-html p  { margin: 0 0 1.1em; }
.rich-html a  { color: #17A4E4; text-decoration: underline; text-underline-offset: 3px; }
.rich-html ul, .rich-html ol { margin: 0 0 1.2em; padding-inline-start: 1.6em; }
.rich-html li { margin-bottom: .45em; }
.rich-html strong, .rich-html b { color: var(--fg); }
.rich-html blockquote {
  margin: 1.4em 0; padding: 14px 20px;
  border-inline-start: 4px solid #17A4E4;
  background: var(--chip); border-radius: 12px;
  color: var(--fg);
}
.rich-html img { display: block; max-width: 100%; height: auto; border-radius: 16px; margin: 1.2em 0; }
.rich-html figure { margin: 1.2em 0; }
.rich-html figcaption { color: var(--fg-dim); font-size: .88em; margin-top: .4em; }
.rich-html hr { border: 0; border-top: 1px solid var(--hairline); margin: 2em 0; }
.rich-html table {
  width: 100%; border-collapse: collapse; margin: 1.4em 0;
  font-size: .95em; display: block; overflow-x: auto; white-space: nowrap;
}
.rich-html table th, .rich-html table td {
  border: 1px solid var(--hairline); padding: 10px 14px; text-align: right;
}
.rich-html table th { background: var(--chip); color: var(--fg); font-weight: 700; }
.rich-html code {
  direction: ltr; unicode-bidi: embed;
  background: var(--chip); border: 1px solid var(--chip-border);
  border-radius: 6px; padding: 2px 7px; font-size: .9em;
  font-family: ui-monospace, 'SF Mono', Consolas, monospace;
}
.rich-html pre {
  direction: ltr; text-align: left;
  background: #0d1220; color: #d7e2ea;
  border-radius: 14px; padding: 18px 20px; overflow-x: auto;
  margin: 1.4em 0; line-height: 1.7;
}
.rich-html pre code { background: none; border: 0; padding: 0; color: inherit; }
.rich-html iframe, .rich-html video, .rich-html embed, .rich-html object {
  max-width: 100%; border: 0; border-radius: 16px;
}
.rich-html iframe[src*="youtube"], .rich-html iframe[src*="vimeo"] {
  width: 100%; aspect-ratio: 16/9; height: auto;
}
[data-theme="light"] .rich-html pre { background: #0B1226; }
/* كود مخصص لتعديل حركة أو موقع العنصر */
.your-element-class {
    transform: translateX(120px) !important; 
}
