/* DM shared base: tokens, accessibility primitives and the components every concept shares
   (header, mobile menu, WhatsApp actions, project dialog, contact form, showreel).
   Each concept sets the colour tokens below for light (:root) and dark ([data-theme="dark"]). */

:root {
  /* Brand font tokens: drop the real font files in with @font-face using these exact family names */
  --font-ar-head: "STV", "Lalezar", "Tajawal", sans-serif;
  --font-ar-body: "Hacen Liner Screen Bd", "Tajawal", sans-serif;
  --font-en-head: "Myriad Bold", "Myriad Pro", "Source Sans 3", sans-serif;
  --font-en-body: "Gisha", "Noto Sans", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  --c-burgundy: #6D181F; --c-green: #133D3B; --c-cream: #EED9BE; --c-white: #FFFFFF;

  --header-h: 76px;
  --gutter: clamp(18px, 5vw, 72px);
  --dir-sign: 1;
  --btn-radius: 999px;
  --radius-field: 14px;

  /* semantic colour tokens (concepts override these) */
  --bg: #EED9BE; --fg: #133D3B; --muted: #3d5958; --accent: #6D181F; --line: rgba(19, 61, 59, .35);
  --surface: #FFFFFF; --surface-fg: #133D3B;
  --btn-bg: #133D3B; --btn-fg: #EED9BE;
  --hdr-bg: rgba(238, 217, 190, .92); --hdr-fg: #133D3B; --hdr-inv: #EED9BE;
  --cta-bg: #6D181F; --cta-fg: #EED9BE; --wa-bg: #133D3B; --wa-fg: #EED9BE;
  --menu-bg: #133D3B; --menu-fg: #EED9BE;
  --focus: #6D181F;
  --scrim: rgba(19, 61, 59, .72);
  --modal-bg: #FFFFFF; --modal-fg: #133D3B; --modal-accent: #6D181F; --modal-btn-bg: #133D3B; --modal-btn-fg: #EED9BE;
  --modal-chip-bg: #EED9BE; --modal-chip-fg: #133D3B; --modal-radius: 28px;
  color-scheme: light;
}
[data-theme="dark"] { color-scheme: dark; }
[dir="rtl"] { --dir-sign: -1; }
[data-lang="ar"] { --f-head: var(--font-ar-head); --f-body: var(--font-ar-body); --f-head-w: 400; --f-latin: var(--font-en-head); }
[data-lang="en"] { --f-head: var(--font-en-head); --f-body: var(--font-en-body); --f-head-w: 700; --f-latin: var(--font-en-head); }

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html.is-locked { overflow: hidden; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--f-body, "Tajawal", sans-serif); font-size: 17px; line-height: 1.7; -webkit-font-smoothing: antialiased; overflow-x: clip; min-height: 100vh; }
img, svg, video, canvas { max-width: 100%; }
img { display: block; }
h1, h2, h3, p, figure, blockquote, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: var(--accent); color: var(--bg); }
[id] { scroll-margin-top: calc(var(--header-h) + 14px); }
main { overflow-x: clip; }
main:focus, section:focus, [tabindex="-1"]:focus { outline: none; }

/* ---------- accessibility primitives ---------- */
.sr-only { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip { position: fixed; top: 8px; inset-inline-start: 8px; z-index: 200; background: var(--btn-bg); color: var(--btn-fg); padding: 12px 20px; border-radius: 10px; font-weight: 700; transform: translateY(-200%); }
.skip:focus { transform: none; outline: 3px solid var(--focus); outline-offset: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.display { font-family: var(--f-head); font-weight: var(--f-head-w); }
[hidden] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; transition-delay: 0s !important; }
}

/* ---------- reveal (class-driven, only when motion is allowed) ---------- */
.has-motion [data-reveal] { transition: opacity 1.1s cubic-bezier(.2, .7, .2, 1) var(--d, 0ms), transform 1.1s cubic-bezier(.2, .7, .2, 1) var(--d, 0ms), clip-path 1.3s cubic-bezier(.6, 0, .2, 1) var(--d, 0ms), filter 1.1s ease var(--d, 0ms); }
.has-motion [data-reveal]:not(.is-in) { opacity: 0; transform: translate3d(0, 48px, 0); }
.has-motion [data-reveal="fade"]:not(.is-in) { transform: none; }
.has-motion [data-reveal="blur"]:not(.is-in) { transform: none; filter: blur(18px); opacity: .2; }
.has-motion [data-reveal="scale"]:not(.is-in) { transform: scale(.88); }
.has-motion [data-reveal="side"]:not(.is-in) { transform: translate3d(calc(-60px * var(--dir-sign)), 0, 0); }
.has-motion [data-reveal="mask"]:not(.is-in) { opacity: 1; transform: none; clip-path: inset(18% 18% 18% 18% round 999px); }
.has-motion [data-reveal="mask"].is-in { clip-path: inset(0 0 0 0 round var(--mask-r, 28px)); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; padding: 0 26px; border-radius: var(--btn-radius); background: var(--btn-bg); color: var(--btn-fg); border: 2px solid var(--btn-bd, transparent); font-family: var(--f-body); font-weight: 700; font-size: 16px; line-height: 1.2; text-align: center; transition: filter .2s ease, transform .2s ease; }
.btn:hover { filter: brightness(1.12); }
.btn--ghost { background: transparent; color: var(--btn-ghost-fg, currentColor); border-color: currentColor; }
.btn__dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }

/* ---------- header ---------- */
.hdr { position: fixed; top: 0; inset-inline: 0; z-index: 50; min-height: var(--header-h); display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 clamp(12px, 3vw, 40px); background: var(--hdr-bg); color: var(--hdr-fg); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); transition: background-color .5s ease, color .5s ease; }
.hdr.is-menu { background: transparent; color: var(--menu-fg); -webkit-backdrop-filter: none; backdrop-filter: none; }
.hdr__logo { display: block; padding: 10px; margin-inline-start: -10px; line-height: 0; border-radius: 8px; }
.hdr__logo img { width: 112px; height: auto; }
.hdr__nav ul { display: flex; align-items: center; gap: clamp(8px, 1.6vw, 28px); }
.hdr__nav a { display: block; padding: 10px 8px; font-family: var(--f-body); font-size: 15px; font-weight: 500; line-height: 1.3; border-bottom: 2px solid transparent; transition: border-color .2s ease; }
.hdr__nav a:hover { border-bottom-color: currentColor; }
.hdr__nav a[aria-current="true"] { border-bottom-color: currentColor; font-weight: 700; }
.hdr__tools { display: flex; align-items: center; gap: 10px; }
.lang-btn { display: flex; align-items: center; gap: 2px; min-height: 44px; border: 1.5px solid currentColor; background: transparent; border-radius: 999px; padding: 3px; font-family: var(--font-en-head); font-weight: 700; font-size: 13px; direction: ltr; }
.lang-btn i { font-style: normal; }
.lang-btn span { display: block; padding: 7px 11px; border-radius: 999px; line-height: 1.2; }
.lang-btn span[data-on="true"] { background: currentColor; }
.lang-btn span[data-on="true"] i { font-style: normal; color: var(--hdr-inv); }
.hdr.is-menu .lang-btn span[data-on="true"] i { color: var(--menu-bg); }
.lang-btn .ar-glyph { font-family: var(--font-ar-body); font-size: 15px; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 1.5px solid currentColor; background: transparent; display: inline-flex; align-items: center; justify-content: center; flex-direction: column; gap: 5px; padding: 0; }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.theme-btn .i-moon { display: none; }
[data-theme="dark"] .theme-btn .i-sun { display: none; }
[data-theme="dark"] .theme-btn .i-moon { display: block; }
.menu-btn { display: none; }
.menu-btn i { display: block; width: 18px; height: 2px; background: currentColor; border-radius: 2px; transition: transform .25s ease; }
.menu-btn[aria-expanded="true"] i:first-child { transform: translateY(3.5px) rotate(45deg); }
.menu-btn[aria-expanded="true"] i:last-child { transform: translateY(-3.5px) rotate(-45deg); }
.hdr__cta { background: var(--cta-bg); color: var(--cta-fg); min-height: 44px; padding: 0 22px; font-size: 15px; border-radius: var(--cta-radius, 999px); }

.menu { position: fixed; inset: 0; z-index: 49; background: var(--menu-bg); color: var(--menu-fg); display: flex; flex-direction: column; justify-content: center; gap: 4px; padding: 100px 28px 130px; overflow-y: auto; }
.menu a { display: flex; align-items: baseline; gap: 14px; padding: 6px 0; font-family: var(--f-head); font-weight: var(--f-head-w); font-size: clamp(34px, 11vw, 48px); line-height: 1.3; }
.menu a small { font-family: var(--font-mono); font-size: 13px; font-weight: 400; direction: ltr; }
.menu a[aria-current="true"] { text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 8px; }

@media (max-width: 899px) {
  .hdr__nav { display: none; }
  .menu-btn { display: inline-flex; }
}
@media (max-width: 759px) {
  :root { --header-h: 68px; }
  .hdr__cta { display: none; }
  .hdr__logo img { width: 96px; }
  .hdr__tools { gap: 8px; }
}

/* ---------- fixed actions ---------- */
.fab { position: fixed; bottom: 28px; inset-inline-end: 28px; z-index: 48; min-height: 52px; padding: 0 22px; border-radius: 999px; background: var(--wa-bg); color: var(--wa-fg); display: flex; align-items: center; gap: 10px; font-family: var(--f-body); font-weight: 700; font-size: 15px; box-shadow: 0 0 0 3px var(--bg), 0 12px 30px rgba(0, 0, 0, .25); }
.fab:hover { filter: brightness(1.12); }
.fab i { width: 10px; height: 10px; border-radius: 50%; background: currentColor; }
.dock { display: none; position: fixed; z-index: 48; bottom: 0; inset-inline: 0; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); grid-template-columns: 1fr auto; gap: 10px; background: linear-gradient(to top, var(--bg) 55%, transparent); }
.dock a { min-height: 56px; border-radius: 999px; display: flex; align-items: center; justify-content: center; gap: 10px; font-family: var(--f-body); font-weight: 700; font-size: 16px; box-shadow: 0 10px 26px rgba(0, 0, 0, .22); }
.dock .dock__cta { background: var(--cta-bg); color: var(--cta-fg); }
.dock .dock__wa { background: var(--wa-bg); color: var(--wa-fg); padding: 0 22px; font-size: 15px; }
.dock i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
@media (max-width: 759px) {
  .fab { display: none; }
  .dock { display: grid; }
}

/* ---------- showreel ---------- */
.reel { position: relative; overflow: hidden; background: #111; aspect-ratio: 16 / 9; isolation: isolate; }
.reel__poster, .reel video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.reel video { opacity: 0; transition: opacity .3s ease; background: #000; }
.reel.is-playing video { opacity: 1; }
.reel__btn { position: absolute; inset-inline-start: clamp(14px, 2.4vw, 28px); bottom: clamp(14px, 2.4vw, 28px); z-index: 2; display: inline-flex; align-items: center; gap: 14px; min-height: 56px; padding: 6px 24px 6px 6px; padding-inline: 6px 24px; border: 0; border-radius: 999px; background: var(--reel-btn-bg, #EED9BE); color: var(--reel-btn-fg, #133D3B); font-family: var(--f-body); font-weight: 700; font-size: 16px; box-shadow: 0 8px 24px rgba(0, 0, 0, .3); transition: transform .2s ease; }
.reel__btn:hover { transform: scale(1.03); }
.reel__icon { width: 46px; height: 46px; border-radius: 50%; background: var(--reel-icon-bg, #6D181F); color: var(--reel-icon-fg, #EED9BE); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.reel__icon svg { width: 18px; height: 18px; fill: currentColor; margin-inline-start: 2px; }
[dir="rtl"] .reel__icon svg { transform: scaleX(-1); margin-inline-start: 0; margin-inline-end: 2px; }
.reel.is-playing .reel__btn, .reel.is-playing .reel__poster { visibility: hidden; }
.reel :focus-visible { outline-color: #fff; box-shadow: 0 0 0 6px #000; }

/* ---------- project dialog ---------- */
dialog.modal { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: clamp(0px, 3vw, 40px); border: 0; background: transparent; color: var(--modal-fg); overflow: hidden; }
dialog.modal[open] { display: flex; align-items: center; justify-content: center; }
dialog.modal::backdrop { background: var(--scrim); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.modal__sheet { position: relative; width: 100%; max-width: 1080px; max-height: 92vh; max-height: 92dvh; overflow: auto; overscroll-behavior: contain; background: var(--modal-bg); color: var(--modal-fg); border-radius: var(--modal-radius); padding: clamp(20px, 4vw, 48px); display: flex; flex-direction: column; gap: 28px; box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .55); }
.modal__top { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.modal__eyebrow { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-family: var(--f-body); font-size: 14px; font-weight: 700; color: var(--modal-accent); }
.modal__badge { font-size: 12px; font-weight: 500; padding: 2px 10px; border: 1px dashed currentColor; border-radius: 999px; }
.modal__name { font-family: var(--f-head); font-weight: var(--f-head-w); font-size: clamp(34px, 5vw, 62px); line-height: 1.15; margin-top: 6px; }
.modal__close { flex: none; width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--modal-btn-bg); color: var(--modal-btn-fg); display: inline-flex; align-items: center; justify-content: center; }
.modal__close svg { width: 20px; height: 20px; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; fill: none; }
.modal__cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 28px; }
.modal__label { display: block; font-size: 14px; font-weight: 700; margin-bottom: 8px; color: var(--modal-fg); opacity: .8; }
.modal__about { font-size: 19px; line-height: 1.75; text-wrap: pretty; }
.modal__chips { display: flex; flex-wrap: wrap; gap: 8px; }
.modal__chips li { font-size: 15px; padding: 7px 14px; border-radius: 999px; background: var(--modal-chip-bg); color: var(--modal-chip-fg); }
.modal__gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); grid-auto-rows: 160px; gap: 10px; }
.modal__gallery figure { position: relative; overflow: hidden; border-radius: 16px; background: var(--modal-chip-bg); }
.modal__gallery img { width: 100%; height: 100%; object-fit: cover; }
.modal__vid { position: absolute; top: 10px; inset-inline-start: 10px; display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px 5px 8px; padding-inline: 8px 12px; border-radius: 999px; background: var(--modal-btn-bg); color: var(--modal-btn-fg); font-size: 12px; font-weight: 700; line-height: 1.2; }
.modal__vid svg { width: 11px; height: 11px; fill: currentColor; }
[dir="rtl"] .modal__vid svg { transform: scaleX(-1); }
.modal__result { display: grid; grid-template-columns: auto 1fr; gap: 6px 28px; align-items: center; background: var(--modal-btn-bg); color: var(--modal-btn-fg); border-radius: 22px; padding: 24px 28px; }
.modal__result b { grid-row: span 2; font-family: var(--font-en-head); font-weight: 900; font-size: clamp(40px, 6vw, 72px); line-height: 1; direction: ltr; }
.modal__result span { font-size: 15px; }
@media (max-width: 759px) {
  .modal__sheet { max-height: 100dvh; height: 100%; border-radius: var(--modal-radius) var(--modal-radius) 0 0; align-self: flex-end; }
  dialog.modal { align-items: flex-end; padding: 0; }
  dialog.modal[open] { align-items: flex-end; }
  .modal__sheet { height: auto; max-height: 94dvh; }
  .modal__result { grid-template-columns: 1fr; }
  .modal__result b { grid-row: auto; }
}

/* ---------- contact form ---------- */
.dm-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 16px; font-family: var(--f-body); color: inherit; }
.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.field--wide { grid-column: 1 / -1; }
.field label { font-size: 15px; font-weight: 500; }
.field label b { font-weight: 400; opacity: .85; font-size: 13px; }
.field input, .field select, .field textarea { width: 100%; min-height: 54px; border-radius: var(--radius-field); border: 1.5px solid color-mix(in srgb, currentColor 72%, transparent); background: color-mix(in srgb, currentColor 7%, transparent); color: inherit; padding: 0 16px; font-size: 16px; }
.field textarea { padding: 14px 16px; resize: vertical; min-height: 120px; }
.field select option { background: Canvas; color: CanvasText; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 3px solid var(--focus); outline-offset: 2px; border-color: currentColor; }
.field [aria-invalid="true"] { border-width: 2.5px; border-style: dashed; }
.field__err { font-size: 14px; font-weight: 700; display: flex; gap: 6px; align-items: center; }
.field__err::before { content: "\26A0"; flex: none; }
.dm-form__actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.dm-form__actions p { font-size: 15px; }
.dm-form .btn { min-height: 56px; padding: 0 34px; font-size: 16px; border: 2px solid var(--form-btn-bd, transparent); background: var(--form-btn-bg, currentColor); color: var(--form-btn-fg, var(--bg)); }
.dm-form .btn--wa { background: transparent; color: inherit; border-color: currentColor; padding: 0 24px; }
.form-done { border-radius: 24px; padding: 40px 28px; background: color-mix(in srgb, currentColor 10%, transparent); font-family: var(--f-head); font-weight: var(--f-head-w); font-size: clamp(24px, 3vw, 34px); line-height: 1.4; }

/* ---------- misc ---------- */
.clients { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.clients li { min-height: 84px; display: flex; align-items: center; justify-content: center; text-align: center; padding: 8px; border: 1.5px dashed var(--line); font-size: 14px; }
.live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.foot-note { font-size: 14px; color: var(--muted); }
@media (forced-colors: active) {
  .btn, .reel__btn, .fab, .dock a { border: 2px solid ButtonText; }
}
