/* Muthl — shared design tokens & base styles */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;0,600;1,400&family=JetBrains+Mono:wght@400&display=swap');

/* Ya Modren Pro — brand Arabic font (loads locally if installed) */
@font-face {
  font-family: 'Ya Modren Pro';
  src: local('Ya Modren Pro'), local('YaModrenPro'), local('Ya Modern Pro');
  font-display: swap;
}

/* Force Western digits — when Ya Modren Pro displays Arabic-Indic glyphs, swap them */
@font-face {
  font-family: 'WesternDigits';
  src: local('Helvetica Neue'), local('Arial'), local('Segoe UI');
  unicode-range: U+0660-0669, U+06F0-06F9, U+0030-0039;
}

:root {
  /* Brand palette — refined, more elegant tones */
  --cream:       #FAF7F0;
  --cream-soft:  #FDFBF5;
  --cream-deep:  #ECE4D2;
  --navy:        #1B2A4A;
  --navy-soft:   #2A3A5C;
  --gold:        #A6824A;
  --gold-soft:   #C09865;
  --blue-grey:   #4A5066;
  --beige-warm:  #D8BE93;
  --beige-mid:   #C4AE8E;
  --slate:       #5C6B80;
  --ink:         #1B2A4A;
  --line:        rgba(27, 42, 74, 0.10);
  --line-strong: rgba(27, 42, 74, 0.20);

  /* Type — Ya Modren Pro is the brand Arabic font */
  --f-ar: 'WesternDigits', 'Ya Modren Pro', 'Tajawal', system-ui, sans-serif;
  --f-en: 'Cormorant Garamond', 'Tex Gyre Bonum', Georgia, serif;
  --f-mono: 'JetBrains Mono', ui-monospace, monospace;

  /* Spacing */
  --maxw: 1280px;
  --pad: clamp(20px, 3.5vw, 60px);

  /* Accessible gold for small text (≈4.6:1 on cream) — borders/icons keep --gold */
  --gold-ink: #8A6A38;
  --slate-ink: #515A6E;

  /* Unified elevation language — warm navy-toned shadows, never black */
  --shadow-rest: 0 2px 8px -4px rgba(27, 42, 74, 0.08);
  --shadow-lift: 0 18px 40px -20px rgba(27, 42, 74, 0.16);

  /* Intentional radius scale */
  --r-sm: 2px;   /* images / plans */
  --r-md: 4px;   /* cards */
  --r-pill: 999px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--f-ar);
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

html[dir="rtl"] body { font-family: var(--f-ar); }
html[dir="ltr"] body { font-family: var(--f-en); }

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

/* Type scale */
.h-display {
  font-family: var(--f-ar);
  font-weight: 500;
  font-size: clamp(40px, 6vw, 84px);
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: var(--navy);
}
.h-display-en {
  font-family: var(--f-en);
  font-weight: 400;
  font-style: italic;
  font-size: clamp(28px, 4vw, 56px);
  line-height: 1.15;
  color: var(--navy);
}
.h-section {
  font-family: var(--f-ar);
  font-weight: 500;
  font-size: clamp(28px, 3.4vw, 44px);
  line-height: 1.2;
  color: var(--navy);
  letter-spacing: -0.005em;
}
.eyebrow {
  font-family: var(--f-en);
  font-style: italic;
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 0.12em;
  color: var(--gold-ink);
  text-transform: lowercase;
}
.eyebrow-ar {
  font-family: var(--f-ar);
  font-weight: 400;
  font-size: 13px;
  letter-spacing: 0.18em;
  color: var(--gold);
}
.body-lg { font-size: 18px; line-height: 1.75; color: var(--blue-grey); }
.body { font-size: 16px; line-height: 1.7; color: var(--blue-grey); }
.caption {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--slate);
  text-transform: uppercase;
}

/* Arabic script shouldn't borrow Latin's negative tracking — it compresses connected letters.
   Keep tight tracking for Latin display type only. */
html[dir="rtl"] .h-display,
html[dir="rtl"] .h-section,
html[dir="rtl"] .brand-name { letter-spacing: 0; }

/* Container */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--pad); }

/* ===== Header / Nav — full-bleed, scroll-aware (transparent over hero → slim navy bar) ===== */
.site-header {
  position: fixed;
  top: 0; inset-inline: 0;
  z-index: 50;
  background: transparent;
  transition: background .35s ease, border-color .35s ease, box-shadow .35s ease;
  border-bottom: 1px solid transparent;
}
/* Soft top scrim so cream text/logo always read over a bright hero */
.site-header::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(27,42,74,0.55), rgba(27,42,74,0.0));
  pointer-events: none;
  opacity: 1;
  transition: opacity .35s ease;
}
/* Scrolled state (added by JS on hero pages) — condensed navy glass bar */
.site-header.scrolled {
  background: rgba(27, 42, 74, 0.9) !important;
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border-bottom-color: rgba(237, 230, 217, 0.12) !important;
  box-shadow: 0 8px 30px -18px rgba(0,0,0,0.5);
}
.site-header.scrolled::before { opacity: 0 !important; }

/* Fixed header overlaps content → give non-hero pages top breathing room */
main { padding-top: 96px; }
body:has(.hero-frame) main,
body:has(.project-hero) main,
body[data-screen-label="01 Home"] main,
body[data-screen-label="03 Muthl 2 — Al-Safwah"] main,
body[data-screen-label="02 Muthl 3 — Al-Fayhaa"] main { padding-top: 0; }

/* Light text on the dark scrim / navy bar */
.site-header,
.site-header a,
.site-header button,
.site-header .nav-links,
.site-header .nav-links a { color: var(--cream); }
.site-header .nav-links a:hover,
.site-header .nav-links a.active { color: var(--gold-soft); }
.site-header .nav-links a.active::after { background: var(--gold-soft); }
body { position: relative; }

/* Pages without a dark hero: the bar is solid navy from the top (cream bg behind) */
body[data-header-mode="solid"] .site-header {
  background: rgba(27, 42, 74, 0.92);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border-bottom-color: rgba(237, 230, 217, 0.1);
}
body[data-header-mode="solid"] .site-header::before { opacity: 0; }
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 72px;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--pad);
  transition: height .35s ease;
}
.site-header.scrolled .nav-inner { height: 60px; }
.brand {
  display: flex; align-items: center; gap: 14px;
}
.brand-mark {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border: 1px solid var(--gold);
  border-radius: 50%;
  color: var(--gold);
  font-family: var(--f-ar);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.02em;
}
.brand-name {
  font-family: var(--f-ar);
  font-weight: 500;
  font-size: 22px;
  color: var(--navy);
  letter-spacing: -0.01em;
}
.brand-sub {
  font-family: var(--f-en);
  font-style: italic;
  font-size: 12px;
  color: var(--slate);
  letter-spacing: 0.04em;
}
.nav-links {
  display: flex; gap: clamp(16px, 2.4vw, 36px);
  align-items: center;
  font-size: 15px;
  color: var(--blue-grey);
}
.nav-links a {
  position: relative;
  padding: 6px 0;
  letter-spacing: 0.01em;
  transition: color .25s ease;
}
.nav-links a::after {
  content: ''; position: absolute; inset-inline: 0; bottom: -3px;
  height: 1px; background: var(--gold-soft);
  transform: scaleX(0); transform-origin: center;
  transition: transform .3s cubic-bezier(.2,.7,.2,1);
}
.nav-links a:hover::after,
.nav-links a.active::after { transform: scaleX(1); }
.nav-cta {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px;
  background: var(--navy);
  color: var(--cream);
  border-radius: 999px;
  font-size: 14px;
  letter-spacing: 0.02em;
  transition: background .25s ease, transform .15s ease, box-shadow .25s ease;
}
.nav-cta:hover { background: var(--navy-soft); box-shadow: var(--shadow-rest); }
.nav-cta:active { transform: translateY(1px); }
.nav-lang {
  font-family: var(--f-en);
  font-style: italic;
  font-size: 14px;
  color: var(--slate);
  border: 1px solid var(--line);
  padding: 6px 12px;
  border-radius: 999px;
  transition: all .25s ease;
}
.nav-lang:hover { border-color: var(--gold); color: var(--gold); }

/* Login menu — one entry in the bar, two doors behind it */
.nav-login { position: relative; }
.nav-login-trigger {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 16px;
  background: transparent;
  color: var(--slate);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--f-ar);
  font-size: 14px;
  cursor: pointer;
  transition: border-color .25s ease, color .25s ease, background .25s ease;
}
.nav-login-trigger:hover,
.nav-login.open .nav-login-trigger { border-color: var(--gold); color: var(--gold); }
.nav-login-caret { font-size: 10px; color: var(--gold); }
.nav-login.open .nav-login-caret { transform: rotate(180deg); }

.nav-login-menu {
  position: absolute;
  top: calc(100% + 12px);
  inset-inline-end: 0;
  min-width: 160px;
  background: var(--navy);
  border: 1px solid rgba(237,230,217,0.18);
  padding: 6px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity .2s ease, transform .2s ease, visibility 0s linear .2s;
  box-shadow: 0 18px 40px rgba(0,0,0,0.35);
  z-index: 60;
  pointer-events: none;
}
.nav-login.open .nav-login-menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: none;
  transition: opacity .2s ease, transform .2s ease, visibility 0s;
}
.nav-login-menu a {
  display: block;
  padding: 11px 14px;
  color: var(--cream) !important;
  transition: background .2s ease;
}
.nav-login-menu a + a { border-top: 1px solid rgba(237,230,217,0.12); }
.nav-login-menu a:hover { background: rgba(237,230,217,0.08); }
.nav-login-menu b { display: block; font-size: 14.5px; font-weight: 500; }

/* Hamburger button — hidden on desktop, visible on mobile */
.nav-toggle {
  display: none;
  width: 42px; height: 42px;
  padding: 0;
  background: transparent;
  border: 1px solid rgba(237,230,217,0.3);
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  align-items: center;
  justify-content: center;
}
.nav-toggle span {
  display: block;
  position: absolute;
  left: 11px; right: 11px;
  height: 1.5px;
  background: var(--cream);
  border-radius: 2px;
  transition: transform .3s ease, opacity .25s ease, top .3s ease;
}
.nav-toggle span:nth-child(1) { top: 13px; }
.nav-toggle span:nth-child(2) { top: 20px; }
.nav-toggle span:nth-child(3) { top: 27px; }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { top: 20px; transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { top: 20px; transform: rotate(-45deg); }

/* Mobile drawer */
.nav-mobile {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(27,42,74,0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 100;
  padding: 80px 28px 40px;
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s ease, visibility 0s linear .3s;
  overflow-y: auto;
}
.nav-mobile.open {
  opacity: 1;
  visibility: visible;
  transition: opacity .3s ease;
}
.nav-mobile-close {
  position: absolute;
  top: 22px; inset-inline-end: 22px;
  width: 42px; height: 42px;
  background: transparent;
  border: 1px solid rgba(237,230,217,0.3);
  border-radius: 6px;
  color: var(--cream);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}
.nav-mobile a, .nav-mobile button {
  display: block;
  padding: 16px 4px;
  font-family: var(--f-ar);
  font-size: 19px;
  color: var(--cream);
  border-bottom: 1px solid rgba(237,230,217,0.1);
  width: 100%;
  text-align: start;
  background: transparent;
  cursor: pointer;
}
.nav-mobile a.active { color: var(--gold); }
.nav-mobile a:hover, .nav-mobile button:hover { color: var(--gold); }
.nav-mobile .nav-mobile-sub {
  padding: 0 16px;
  margin-bottom: 8px;
}
.nav-mobile .nav-mobile-sub a {
  font-size: 16px;
  padding: 12px 4px;
  color: rgba(237,230,217,0.85);
  border-bottom-color: rgba(237,230,217,0.06);
}
.nav-mobile .nav-mobile-section-label {
  display: block;
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--gold);
  text-transform: uppercase;
  padding: 22px 4px 8px;
  border: 0;
}
.nav-mobile .nav-mobile-actions {
  margin-top: 24px;
  display: flex; gap: 10px; flex-wrap: wrap;
}
.nav-mobile .nav-mobile-actions a,
.nav-mobile .nav-mobile-actions button {
  flex: 1; min-width: 130px;
  text-align: center;
  padding: 12px 18px;
  border: 1px solid rgba(237,230,217,0.3);
  border-radius: 999px;
  font-size: 13px;
  font-family: var(--f-en);
}
.nav-mobile .nav-mobile-actions .nav-cta {
  background: var(--gold);
  border-color: var(--gold);
  font-family: var(--f-ar);
  font-size: 14px;
}
body.mobile-menu-open { overflow: hidden; }

@media (max-width: 880px) {
  .nav-links { display: none; }
  .nav-toggle { display: inline-flex; }
  /* Header becomes a sticky solid bar pushing content below, not floating over video */
  .site-header {
    position: sticky;
    top: 0; left: 0; right: 0;
    background: rgba(27, 42, 74, 0.95);
    border: 0;
    border-bottom: 1px solid rgba(237,230,217,0.08);
  }
  .nav-inner { height: 60px; }
  /* Hero pages: remove the special "no padding" rule so the header sits above the hero, not over it */
  body:has(.hero-frame) main,
  body:has(.project-hero) main,
  body[data-screen-label="01 Home"] main,
  body[data-screen-label="03 Muthl 2 — Al-Safwah"] main,
  body[data-screen-label="02 Muthl 3 — Al-Fayhaa"] main { padding-top: 0; }
  /* Pages without hero — reduce default top padding (header is no longer floating) */
  main { padding-top: 24px; }
  /* CTA button compact on mobile */
  .nav-cta {
    padding: 8px 14px;
    font-size: 13px;
  }
  .brand-logo { height: 44px; }
}

/* Brand logo */
.brand { display: inline-flex; align-items: center; }
.brand-logo {
  height: 48px;
  width: auto;
  display: block;
  object-fit: contain;
  transition: transform .3s ease, height .35s ease;
  filter: brightness(0) invert(1) opacity(0.95);
}
.site-header.scrolled .brand-logo { height: 40px; }
.brand-logo.ripple {
  animation: brand-ripple 700ms cubic-bezier(.25,.6,.25,1);
}
@keyframes brand-ripple {
  0%   { transform: translateY(0)     scale(1);    }
  30%  { transform: translateY(-2px)  scale(1.04); }
  60%  { transform: translateY(0)     scale(0.98); }
  100% { transform: translateY(0)     scale(1);    }
}
.brand-logo-footer {
  height: 110px;
  filter: brightness(0) invert(1) opacity(0.95);
}

/* Splash screen */
body.splash-active { overflow: hidden; }

#muthl-splash {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--cream);
  display: grid; place-items: center;
  transition: transform .8s cubic-bezier(.65,.05,.36,1), opacity .8s;
  will-change: transform;
}
#muthl-splash.out {
  transform: translateY(-100%);
  opacity: 1;
}
.splash-inner {
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
}
.splash-logo-wrap {
  position: relative;
  width: clamp(280px, 44vw, 540px);
  aspect-ratio: 800 / 459;
  overflow: hidden;
}
.splash-logo {
  display: block;
  width: 100%; height: auto;
  opacity: 0;
  animation: splash-logo-in 1.4s cubic-bezier(.25,.6,.25,1) 0.2s forwards;
}
.splash-mask {
  position: absolute; top: 0; bottom: 0; left: 0;
  width: 100%;
  background: var(--cream);
  transform-origin: right center;
  animation: splash-reveal 1.6s cubic-bezier(.65,.05,.36,1) 0.1s forwards;
  pointer-events: none;
  z-index: 2;
}

/* Animated logo video used as splash (transparent — WebM provides alpha channel) */
.splash-video {
  display: block;
  width: clamp(320px, 60vw, 720px);
  height: auto;
  max-height: 70vh;
  object-fit: contain;
  background: transparent;
  mix-blend-mode: multiply;
}

@keyframes splash-logo-in {
  0%   { opacity: 0; }
  30%  { opacity: 1; }
  100% { opacity: 1; }
}
@keyframes splash-reveal {
  0%   { transform: scaleX(1); }
  100% { transform: scaleX(0); }
}

@media (prefers-reduced-motion: reduce) {
  #muthl-splash { display: none !important; }
}

/* Quick splash on internal navigation (faster + simpler than first-visit splash) */
#muthl-splash.splash-quick .splash-logo {
  animation: splash-logo-quick 0.6s cubic-bezier(.25,.6,.25,1) 0s forwards;
}
#muthl-splash.splash-quick .splash-mask {
  animation: splash-reveal-quick 0.7s cubic-bezier(.65,.05,.36,1) 0s forwards;
}
@keyframes splash-logo-quick {
  0%   { opacity: 0; }
  40%  { opacity: 1; }
  100% { opacity: 1; }
}
@keyframes splash-reveal-quick {
  0%   { transform: scaleX(1); }
  100% { transform: scaleX(0); }
}

/* Outgoing transition overlay (shows briefly before page navigation) */
.muthl-splash-outgoing {
  position: fixed; inset: 0; z-index: 10000;
  background: var(--cream);
  display: grid; place-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .28s cubic-bezier(.4,0,.2,1);
}
.muthl-splash-outgoing.in {
  opacity: 1;
  pointer-events: auto;
}
.muthl-splash-outgoing .splash-logo--out {
  opacity: 0;
  animation: splash-out-fadein .35s cubic-bezier(.25,.6,.25,1) .05s forwards;
}
@keyframes splash-out-fadein {
  0%   { opacity: 0; transform: scale(0.96); }
  100% { opacity: 1; transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .muthl-splash-outgoing { display: none !important; }
}

/* Nav dropdown */
/* Nav dropdown */
.nav-dd { position: relative; }
.nav-dd-trigger {
  display: inline-flex; align-items: center;
  cursor: pointer;
}
.nav-dd-menu {
  position: absolute;
  top: calc(100% + 12px);
  inset-inline-start: 0;
  min-width: 220px;
  background: var(--navy);
  border: 1px solid rgba(237,230,217,0.18);
  padding: 8px 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity .2s ease, transform .2s ease, visibility 0s linear .2s;
  box-shadow: 0 18px 40px rgba(0,0,0,0.35);
  z-index: 60;
  pointer-events: none;
}
.nav-dd:hover .nav-dd-menu,
.nav-dd:focus-within .nav-dd-menu,
.nav-dd.open .nav-dd-menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: none;
  transition: opacity .2s ease, transform .2s ease, visibility 0s;
}
.nav-dd-menu a {
  display: block;
  padding: 10px 18px;
  font-size: 14px;
  color: var(--cream) !important;
  white-space: nowrap;
  transition: background .2s, color .2s;
}
.nav-dd-menu a:hover { background: rgba(166,130,74,0.18); color: var(--gold) !important; }
.nav-dd-menu a.active { color: var(--gold) !important; }
.nav-dd-menu a::after { display: none !important; }

/* Footer */
.site-footer {
  background: var(--navy);
  color: var(--cream);
  padding: 80px 0 40px;
  margin-top: 120px;
}
.site-footer .h-section { color: var(--cream); }
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 56px;
  align-items: start;
}
.footer-grid h4 {
  font-family: var(--f-ar); font-weight: 500;
  font-size: 13px; letter-spacing: 0.16em;
  color: var(--beige-warm);
  margin: 0 0 20px;
  text-transform: uppercase;
}
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid li { margin-bottom: 12px; font-size: 14px; color: rgba(237,230,217,0.75); }
.footer-grid li a:hover { color: var(--beige-warm); }
.footer-tag {
  font-family: var(--f-en);
  font-style: italic;
  font-size: 22px;
  color: var(--beige-warm);
  margin-top: 18px;
  line-height: 1.4;
}
.footer-bot {
  margin-top: 60px; padding-top: 28px;
  border-top: 1px solid rgba(237,230,217,0.14);
  display: flex; justify-content: space-between; gap: 20px;
  font-family: var(--f-mono);
  font-size: 11px; letter-spacing: 0.12em;
  color: rgba(237,230,217,0.55);
  text-transform: uppercase;
}
@media (max-width: 880px) {
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 40px; }
  .footer-bot { flex-direction: column; }
}

/* Wave divider — fluid wave inspired by the logo */
.wave {
  display: block; width: 100%; height: 28px;
  color: var(--gold);
  opacity: 0.5;
  margin: clamp(40px, 6vw, 80px) 0;
}

/* ===== Polish: focus, reduced-motion ===== */
/* Smooth scroll only for anchor navigation (in-page links) — NOT for general scrolling.
   Applying it to <html> makes regular scrolling feel sluggish on mobile. JS handles anchors. */

/* Respect reduced-motion by killing MOVEMENT only — keep gentle color/background
   transitions so the interface still feels alive (true accessibility, not flat). */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
  .reveal, .reveal.in { opacity: 1 !important; transform: none !important; }
  [data-parallax] { transform: none !important; }
  .back-to-top, .read-progress { transition: opacity .2s ease !important; }
}

/* Keyboard focus — clearly visible for accessibility */
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  border-radius: 2px;
}
a:focus-visible, button:focus-visible {
  outline-color: var(--gold);
}
.site-header :focus-visible {
  outline-color: var(--cream);
}

/* ===== Reading progress bar — used on long pages (FAQ, projects) ===== */
.read-progress {
  position: fixed;
  top: 0; inset-inline-start: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(90deg, var(--gold), var(--gold-soft, var(--gold)));
  z-index: 200;
  pointer-events: none;
  transition: width .12s linear;
}
@media (max-width: 880px) {
  .read-progress { top: 60px; } /* sit under the sticky header */
}

/* ===== Back to top button ===== */
.back-to-top {
  position: fixed;
  bottom: clamp(20px, 4vw, 36px);
  inset-inline-end: clamp(20px, 4vw, 36px);
  width: 48px; height: 48px;
  background: var(--navy);
  color: var(--cream);
  border: 1px solid rgba(237,230,217,0.2);
  border-radius: 50%;
  display: grid; place-items: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity .25s ease, transform .25s ease, visibility 0s linear .25s, background .25s ease;
  z-index: 90;
  box-shadow: 0 8px 22px -6px rgba(27,42,74,0.4);
}
.back-to-top.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition: opacity .25s ease, transform .25s ease, visibility 0s, background .25s ease;
}
.back-to-top:hover {
  background: var(--gold);
  border-color: var(--gold);
}
.back-to-top svg {
  width: 20px; height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ===== Lightbox (gallery) — branded, dependency-free ===== */
.archive-gallery .ph { cursor: zoom-in; }
.lightbox {
  position: fixed; inset: 0; z-index: 300;
  display: flex; align-items: center; justify-content: center;
  background: rgba(13, 21, 48, 0.96);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  opacity: 0; visibility: hidden;
  transition: opacity .3s ease, visibility 0s linear .3s;
  padding: clamp(20px, 5vw, 64px);
}
.lightbox.open { opacity: 1; visibility: visible; transition: opacity .3s ease; }
.lightbox img {
  max-width: 100%; max-height: 86vh;
  object-fit: contain;
  border-radius: 3px;
  box-shadow: 0 24px 80px -20px rgba(0,0,0,0.7);
  transform: scale(.98); transition: transform .35s cubic-bezier(.2,.7,.2,1);
}
.lightbox.open img { transform: scale(1); }
.lightbox .lb-cap {
  position: absolute; inset-block-end: 26px; inset-inline: 0;
  text-align: center; color: rgba(237,230,217,0.8);
  font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase;
}
.lightbox .lb-btn {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 52px; height: 52px; display: grid; place-items: center;
  color: var(--cream); background: rgba(27,42,74,0.5);
  border: 1px solid rgba(237,230,217,0.25); border-radius: 50%;
  cursor: pointer; transition: background .2s, border-color .2s;
}
.lightbox .lb-btn:hover { background: var(--gold); border-color: var(--gold); }
.lightbox .lb-prev { inset-inline-start: clamp(12px, 3vw, 40px); }
.lightbox .lb-next { inset-inline-end: clamp(12px, 3vw, 40px); }
.lightbox .lb-close {
  position: absolute; top: clamp(16px, 3vw, 32px); inset-inline-end: clamp(16px, 3vw, 32px);
  width: 46px; height: 46px; display: grid; place-items: center;
  color: var(--cream); background: rgba(27,42,74,0.5);
  border: 1px solid rgba(237,230,217,0.25); border-radius: 50%;
  cursor: pointer; font-size: 22px; line-height: 1; transition: background .2s, border-color .2s;
}
.lightbox .lb-close:hover { background: var(--gold); border-color: var(--gold); }
.lightbox .lb-count {
  position: absolute; top: clamp(16px, 3vw, 32px); inset-inline-start: clamp(16px, 3vw, 40px);
  color: var(--gold-soft); font-family: var(--f-en); font-style: italic; font-size: 15px;
}
@media (max-width: 640px) { .lightbox .lb-btn { width: 42px; height: 42px; } }
body.lightbox-open { overflow: hidden; }

/* ===== Skip link for accessibility ===== */
.skip-link {
  position: absolute;
  top: 0; inset-inline-start: 0;
  padding: 12px 18px;
  background: var(--navy);
  color: var(--cream);
  z-index: 1000;
  transform: translateY(-100%);
  transition: transform .2s ease;
}
.skip-link:focus-visible {
  transform: translateY(0);
  outline: none;
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 28px;
  border-radius: 999px;
  font-size: 15px;
  letter-spacing: 0.01em;
  transition: background .3s cubic-bezier(.2,.7,.2,1), color .3s ease, transform .15s ease, box-shadow .3s ease, border-color .3s ease;
  cursor: pointer;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--navy);
  color: var(--cream);
}
.btn-primary:hover { background: var(--gold); color: var(--cream); box-shadow: var(--shadow-lift); }
.btn-ghost {
  background: transparent;
  color: var(--navy);
  border: 1px solid var(--line-strong);
}
.btn-ghost:hover { border-color: var(--gold); color: var(--gold); }
.btn-gold {
  background: var(--gold);
  color: var(--cream);
}
.btn-gold:hover { background: var(--navy); }

/* ===== Unified elevation for flat cards across all pages =====
   Page <style> blocks don't declare box-shadow on these, so this applies cleanly. */
.feat,
.warranty-card,
.unit-card,
.vm,
.pmap-card,
.archive-stats > div {
  box-shadow: var(--shadow-rest);
  transition: box-shadow .35s ease, transform .35s cubic-bezier(.2,.7,.2,1), border-color .35s ease;
}
.feat:hover,
.warranty-card:hover,
.pmap-card:hover {
  box-shadow: var(--shadow-lift);
  transform: translateY(-3px);
}
/* Project cards already elevated — just unify the rest/hover shadow tone */
.proj-card { box-shadow: var(--shadow-rest); }
.proj-card:hover { box-shadow: var(--shadow-lift); }

/* Image placeholder — striped warm-tone, with monospace label */
.ph {
  position: relative;
  overflow: hidden;
  background:
    repeating-linear-gradient(135deg,
      rgba(150,113,57,0.04) 0 14px,
      rgba(150,113,57,0.10) 14px 28px),
    linear-gradient(180deg, var(--cream-deep), var(--beige-mid));
  border: 1px solid var(--line);
  overflow: hidden;
  display: grid; place-items: center;
  color: var(--navy);
}
.ph::after {
  content: attr(data-label);
  position: absolute;
  inset: auto 0 14px 0;
  text-align: center;
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  color: rgba(31,46,80,0.55);
  text-transform: uppercase;
  pointer-events: none;
}
.ph .ph-icon {
  width: 56px; height: 56px;
  border: 1px solid rgba(31,46,80,0.25);
  border-radius: 50%;
  display: grid; place-items: center;
  color: rgba(31,46,80,0.45);
  font-family: var(--f-en);
  font-style: italic;
  font-size: 18px;
}
.ph-photo > img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  z-index: 1;
  transition: transform .8s cubic-bezier(.2,.7,.2,1);
}
.proj-card:hover .ph-photo > img { transform: scale(1.03); }
.ph-photo::after { z-index: 2; color: rgba(237,230,217,0.85); }

/* Section spacing */
section { padding: clamp(60px, 9vw, 120px) 0; }

/* Subtle reveal on scroll */
.reveal {
  opacity: 0; transform: translateY(20px);
  transition: opacity 1s ease, transform 1s cubic-bezier(.2,.7,.2,1);
}
.reveal.in { opacity: 1; transform: none; }

/* Tag chips */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 12px;
  color: var(--blue-grey);
  background: rgba(255,255,255,0.4);
}
.chip-status-live { color: var(--gold); border-color: rgba(150,113,57,0.4); }
.chip-status-soon { color: var(--slate); }
.chip-status-done { color: #4a7c59; border-color: rgba(74,124,89,0.35); }

/* Dot */
.dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
  display: inline-block;
}

/* Hairline divider */
.hr {
  height: 1px; background: var(--line);
  border: 0; margin: 0;
}

/* Number glyph (en) */
.num {
  font-family: var(--f-en);
  font-style: italic;
  font-weight: 400;
  color: var(--gold);
}

/* Marquee tag for status */
.status-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px;
  background: rgba(150,113,57,0.10);
  border-radius: 999px;
  font-size: 12px;
  color: var(--gold);
}

/* ==========================================================================
   Financing calculator — حاسبة التمويل
   ========================================================================== */
.fin-section { padding-block: clamp(48px, 7vw, 88px); }

.fin-calc {
  display: grid;
  grid-template-columns: 1fr 1.05fr;
  gap: clamp(20px, 3vw, 44px);
  background: var(--cream-soft);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: clamp(24px, 4vw, 48px);
  box-shadow: var(--shadow-rest);
}
.fin-head { grid-column: 1 / -1; }
.fin-eyebrow {
  font-family: var(--f-mono);
  font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--gold-ink);
}
.fin-head h2 {
  font-family: var(--f-ar);
  font-size: clamp(22px, 3vw, 30px);
  color: var(--navy);
  margin: 10px 0 6px;
  font-weight: 700;
}
.fin-head p { color: var(--slate-ink); font-size: 14px; max-width: 60ch; margin: 0; }

/* Inputs */
.fin-inputs { display: flex; flex-direction: column; gap: 16px; align-self: start; }
.fin-field { display: flex; flex-direction: column; gap: 7px; }
.fin-label {
  font-size: 13px; color: var(--slate); font-weight: 600;
  letter-spacing: 0.01em;
}
.fin-input {
  display: flex; align-items: center;
  background: var(--cream);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  padding: 0 14px;
  transition: border-color .2s, box-shadow .2s;
}
.fin-input:focus-within {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(166,130,74,0.14);
}
.fin-input input {
  flex: 1; min-width: 0;
  border: 0; background: transparent; outline: 0;
  font-family: var(--f-en);
  font-size: 20px; font-weight: 600;
  color: var(--navy);
  padding: 13px 0;
  letter-spacing: 0.02em;
}
.fin-input input::placeholder { color: rgba(92,107,128,0.45); font-weight: 400; }
.fin-input i {
  font-style: normal;
  font-family: var(--f-mono);
  font-size: 12px; letter-spacing: 0.08em;
  color: var(--slate);
  padding-inline-start: 10px;
  white-space: nowrap;
}

/* Results */
.fin-results {
  display: flex; flex-direction: column; gap: 18px;
  background: var(--navy);
  border-radius: 16px;
  padding: clamp(22px, 3vw, 32px);
  color: var(--cream);
}
.fin-monthly {
  display: flex; flex-direction: column; gap: 6px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(250,247,240,0.14);
}
.fin-monthly-label {
  font-family: var(--f-mono);
  font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--gold-soft);
}
.fin-monthly-value { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.fin-monthly-value b {
  font-family: var(--f-en);
  font-size: clamp(34px, 6vw, 48px);
  font-weight: 600; line-height: 1;
  color: var(--cream);
  letter-spacing: 0.01em;
}
.fin-monthly-value small { font-size: 13px; color: rgba(250,247,240,0.65); }

.fin-breakdown { margin: 0; display: flex; flex-direction: column; gap: 0; }
.fin-breakdown > div {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 11px 0;
  border-bottom: 1px solid rgba(250,247,240,0.08);
}
.fin-breakdown dt { font-size: 13.5px; color: rgba(250,247,240,0.72); margin: 0; }
.fin-breakdown dd {
  margin: 0;
  font-family: var(--f-en);
  font-size: 16px; font-weight: 600;
  color: var(--cream);
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.fin-breakdown .fin-total dt { color: var(--cream); font-weight: 700; }
.fin-breakdown .fin-total dd { color: var(--gold-soft); font-size: 17px; }

.fin-cta { width: 100%; justify-content: center; margin-top: 4px; }
.fin-note { font-size: 11.5px; line-height: 1.6; color: rgba(250,247,240,0.5); margin: 0; }

@media (max-width: 820px) {
  .fin-calc { grid-template-columns: 1fr; }
}
