/* ════════════════════════════════════════════════════════════════════════
 * BUNYAN × MASMAK — DAWN AESTHETIC LAYER
 *
 * Editorial-luxury elevation: warm limewash canvas, paper-grain texture,
 * 24k gold accents, calligraphic display typography. Inspired by the
 * Masmak Fortress at first light — heritage that feels modern.
 *
 * Total layer weight: ~7 KB. Pure CSS, zero JS additions.
 * GPU-only animations. Mobile-light. Reduced-motion respected.
 * ════════════════════════════════════════════════════════════════════════ */


/* ── 0. REFINED COLOUR PROFILE ──────────────────────────────────────── */
:root {
  /* The Dawn palette — calibrated for warmth without yellowness */
  --dawn-canvas:    #FAF6EC;    /* limewash ivory — base */
  --dawn-surface:   #FFFDF6;    /* paper raised surface */
  --dawn-sunk:      #F1E9D2;    /* impressed surface */
  --dawn-ink:       #1F1808;    /* burnt clay text */
  --dawn-ink-soft:  #4A3D1E;
  --dawn-ink-mute:  #7A6B40;
  --dawn-rule:      #DDD0A6;
  --dawn-rule-soft: #EAE0BD;

  /* 24k gold — three stops for foil shimmer */
  --gold-deep:    #8A682C;
  --gold-mid:     #C9A45A;
  --gold-bright:  #F4D77A;
  --gold-leaf:    linear-gradient(135deg,
    var(--gold-deep) 0%,
    var(--gold-mid) 28%,
    var(--gold-bright) 50%,
    var(--gold-mid) 72%,
    var(--gold-deep) 100%);

  /* Editorial accents */
  --kufic-red:    #A0392A;     /* falconry red — for marks of distinction */
  --palm:         #1F6B3F;     /* date-palm green */

  /* Override existing tokens to align with Dawn */
  --color-surface:        var(--dawn-canvas);
  --color-surface-raised: var(--dawn-surface);
  --color-surface-sunk:   var(--dawn-sunk);
  --color-text-primary:   var(--dawn-ink);
  --color-text-secondary: var(--dawn-ink-soft);
  --color-text-muted:     var(--dawn-ink-mute);
  --color-border:         var(--dawn-rule-soft);
  --color-border-strong:  var(--dawn-rule);
  --color-divider:        #F0E7CC;
  --color-accent:         var(--gold-mid);
}


/* ── 1. PAPER-GRAIN TEXTURE — subtle, 1KB inline SVG ─────────────────── */
/* Tile of dotted noise applied as fixed background to body for depth */
body {
  background-color: var(--dawn-canvas) !important;
  background-image:
    radial-gradient(ellipse 60% 50% at 85% 15%, rgba(244, 215, 122, .07) 0%, transparent 60%),
    radial-gradient(ellipse 50% 60% at 10% 90%, rgba(31, 24, 8, .04) 0%, transparent 65%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.12  0 0 0 0 0.09  0 0 0 0 0.03  0 0 0 0.035 0'/></filter><rect width='160' height='160' filter='url(%23n)'/></svg>") !important;
  background-attachment: fixed, fixed, scroll;
  background-size: auto, auto, 160px 160px;
}

/* Disable expensive texture on mobile (saves paint time) */
@media (max-width: 720px) {
  body { background-image: none !important; background-color: var(--dawn-canvas) !important; }
}


/* ── 2. TYPOGRAPHY — three-font calligraphic system ─────────────────── */
:root {
  --font-display-cal: 'Aref Ruqaa', 'Reem Kufi', 'IBM Plex Sans Arabic', serif;
  --font-display-geo: 'Reem Kufi', 'IBM Plex Sans Arabic', sans-serif;
  --font-body-ar:     'IBM Plex Sans Arabic', 'Tajawal', system-ui, sans-serif;
  --font-edit-en:     'Cormorant Garamond', Georgia, serif;
}

body {
  font-family: var(--font-body-ar);
  letter-spacing: 0.005em;     /* slight breathing for Arabic body */
}
h1, h2, h3, h4 { font-family: var(--font-display-geo); }
.bn-cal       { font-family: var(--font-display-cal); }   /* opt-in calligraphy */
.bn-edit      { font-family: var(--font-edit-en); font-style: italic; }

/* Selection — gold leaf */
::selection { background: var(--gold-bright); color: var(--dawn-ink); }


/* ── 3. THE GOLD-LEAF SHIMMER UTILITY ────────────────────────────────── */
.gold-leaf {
  background: var(--gold-leaf);
  background-size: 200% auto;
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}
@media (prefers-reduced-motion: no-preference) {
  .gold-leaf { animation: gold-leaf-flow 8s linear infinite; }
}
@keyframes gold-leaf-flow {
  to { background-position: 200% center; }
}

/* The word "بنيان" in headlines */
.word-bunyan, .hero h1 .word-bunyan {
  background: var(--gold-leaf) !important;
  background-size: 200% auto !important;
  -webkit-background-clip: text !important;
          background-clip: text !important;
  color: transparent !important;
  -webkit-text-fill-color: transparent !important;
  filter: drop-shadow(0 6px 24px rgba(244, 215, 122, .28));
}
@media (prefers-reduced-motion: no-preference) {
  .word-bunyan { animation: gold-leaf-flow 9s linear infinite; }
}


/* ── 4. THE MASMAK MARK — refined CSS hooks ──────────────────────────── */
.bunyan-mark { color: var(--dawn-ink); }

/* The gold apex dots animate softly */
@media (prefers-reduced-motion: no-preference) {
  .bunyan-mark .bn-node {
    animation: masmak-apex-glow 4.2s ease-in-out infinite;
    transform-origin: center;
  }
  .bunyan-mark .bn-node:nth-of-type(2) { animation-delay: .6s; }
}
@keyframes masmak-apex-glow {
  0%, 100% { filter: drop-shadow(0 0 0 transparent);             opacity: 1; }
  50%      { filter: drop-shadow(0 0 6px rgba(244, 215, 122, .8)); opacity: .9; }
}


/* ── 5. THE EDITORIAL LABEL (DIRIYAH · DUSK · 2026) ────────────────── */
.label-rule, .hero-elevated .label-rule {
  font-family: var(--font-edit-en) !important;
  font-style: normal !important;
  font-weight: 500 !important;
  text-transform: uppercase;
  letter-spacing: 0.55em !important;
  font-size: clamp(.7rem, .68rem + .25vw, .8rem) !important;
  color: var(--gold-deep) !important;
  position: relative;
  padding-inline-start: 56px;
}
.label-rule::before, .hero-elevated .label-rule::before {
  width: 44px !important;
  background: linear-gradient(90deg, transparent, var(--gold-deep)) !important;
  opacity: .9 !important;
}


/* ── 6. THE MONUMENT HEADLINE — calligraphic warmth ─────────────────── */
.hero-elevated h1 {
  font-family: var(--font-display-cal) !important;
  font-weight: 700 !important;
  font-size: clamp(3.0rem, 9vw, 8rem) !important;
  line-height: 1.05 !important;
  letter-spacing: -0.02em !important;
  color: var(--dawn-ink) !important;
  margin: clamp(1.5rem, 3.2vh, 2.8rem) 0 clamp(1rem, 2vh, 1.6rem) !important;
}

/* Tagline — refined italic */
.hero-elevated .hero-tagline {
  font-family: var(--font-edit-en) !important;
  font-style: italic !important;
  font-weight: 400 !important;
  font-size: clamp(1.15rem, 1.7vw, 1.55rem) !important;
  line-height: 1.55 !important;
  color: var(--dawn-ink-soft) !important;
  max-width: 44ch;
}
.hero-elevated .hero-tagline em {
  color: var(--gold-deep) !important;
  font-style: normal;
  font-weight: 600;
  border-bottom: 1px solid rgba(138, 104, 44, .35) !important;
}

/* Lead — calmer */
.hero-elevated .hero-lead {
  font-size: clamp(.96rem, .98vw, 1.08rem) !important;
  line-height: 1.85 !important;
  color: var(--dawn-ink) !important;
  max-width: 58ch;
}


/* ── 7. PRIMARY CTA — refined obsidian with gold ring ───────────────── */
.hero-elevated .btn-primary,
.hero-elevated .btn-primary.lg {
  background: linear-gradient(135deg, #2A1F0E 0%, #1F1808 60%, #150F04 100%) !important;
  color: #FAF6EC !important;
  font-family: var(--font-display-geo) !important;
  font-weight: 700 !important;
  padding: 1.1rem 2.6rem !important;
  font-size: 1.02rem !important;
  border-radius: 999px !important;
  border: 1px solid rgba(201, 164, 90, .35) !important;
  letter-spacing: .04em;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  box-shadow:
    inset 0 1px 0 rgba(244, 215, 122, .18),
    0 1px 0 rgba(244, 215, 122, .12),
    0 20px 50px rgba(31, 24, 8, .35),
    0 4px 12px rgba(31, 24, 8, .18) !important;
}
/* Gold thread shimmer on hover */
.hero-elevated .btn-primary::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(244, 215, 122, .45) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform .9s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
  z-index: -1;
}
.hero-elevated .btn-primary:hover::after { transform: translateX(100%); }
.hero-elevated .btn-primary:hover {
  transform: translateY(-3px) !important;
  box-shadow:
    inset 0 1px 0 rgba(244, 215, 122, .25),
    0 1px 0 rgba(244, 215, 122, .18),
    0 28px 64px rgba(31, 24, 8, .42),
    0 6px 16px rgba(31, 24, 8, .22) !important;
}

/* Secondary CTA */
.hero-elevated .btn-demo-hero {
  background: transparent;
  color: var(--dawn-ink) !important;
  border: 1px solid var(--dawn-rule) !important;
  font-family: var(--font-display-geo);
  font-weight: 600;
  padding: 1.1rem 2.4rem;
  border-radius: 999px;
  letter-spacing: .03em;
  transition: all .3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}
.hero-elevated .btn-demo-hero::before {
  content: '';
  position: absolute; inset: 0;
  background: var(--gold-leaf);
  background-size: 200% auto;
  opacity: 0;
  transition: opacity .35s ease;
  z-index: -1;
}
.hero-elevated .btn-demo-hero:hover {
  border-color: transparent !important;
  color: var(--dawn-ink) !important;
  transform: translateY(-3px);
  box-shadow: 0 16px 38px rgba(201, 164, 90, .25);
}
.hero-elevated .btn-demo-hero:hover::before { opacity: .85; }


/* ── 8. NAVBAR — refined limewash glass ─────────────────────────────── */
.nav {
  background: rgba(250, 246, 236, .82) !important;
  backdrop-filter: saturate(180%) blur(20px) !important;
  -webkit-backdrop-filter: saturate(180%) blur(20px) !important;
  border-bottom: 1px solid var(--color-divider) !important;
}
@media (max-width: 720px) {
  .nav {
    background: rgba(250, 246, 236, .96) !important;
    backdrop-filter: none !important;
  }
}
.nav-links a {
  font-family: var(--font-display-geo);
  font-size: .95rem;
  font-weight: 600;
  letter-spacing: .01em;
  color: var(--dawn-ink-soft) !important;
}
.nav-links a:hover { color: var(--gold-deep) !important; }

/* Brand wordmark Latin label refined */
.bunyan-lockup .bw-en,
.nav .bunyan-lockup .bw-en {
  font-family: var(--font-edit-en) !important;
  font-style: italic !important;
  letter-spacing: .42em !important;
  font-size: .68rem !important;
  color: var(--gold-deep) !important;
  margin-top: 2px;
}
.bunyan-lockup .bw-ar,
.nav .bunyan-lockup .bw-ar {
  font-family: var(--font-display-cal) !important;
  font-weight: 700;
  font-size: 1.4rem !important;
  color: var(--dawn-ink) !important;
  letter-spacing: -0.01em;
}


/* ── 9. SECTION HEADS — editorial chapter style ─────────────────────── */
.section-head { position: relative; }
.section-head[data-num]::after {
  content: attr(data-num);
  position: absolute;
  top: -6px;
  right: 0;
  font-family: var(--font-edit-en);
  font-style: italic;
  font-size: .82rem;
  letter-spacing: .3em;
  color: var(--gold-deep);
  opacity: .8;
}
.section-head .eyebrow {
  font-family: var(--font-edit-en) !important;
  font-style: italic !important;
  font-size: 1rem !important;
  color: var(--gold-deep) !important;
  letter-spacing: .22em !important;
  margin-bottom: .8rem !important;
  display: inline-block !important;
}
.section-head h2 {
  font-family: var(--font-display-cal) !important;
  font-size: clamp(2.2rem, 5.2vw, 4.2rem) !important;
  font-weight: 700;
  line-height: 1.12 !important;
  letter-spacing: -.02em;
  color: var(--dawn-ink) !important;
}
.section-head p {
  font-size: clamp(1rem, 1.1vw, 1.15rem) !important;
  color: var(--dawn-ink-soft) !important;
  line-height: 1.85 !important;
  margin-top: 1.2rem;
  max-width: 58ch;
  margin-inline: auto;
}


/* ── 10. STEP CARDS — magazine spread feel ──────────────────────────── */
.step-card {
  background: var(--dawn-surface) !important;
  border: 1px solid var(--dawn-rule-soft) !important;
  border-radius: 18px !important;
  padding: clamp(1.8rem, 2.8vw, 2.6rem) !important;
  box-shadow: 0 1px 0 rgba(31, 24, 8, .04), 0 18px 40px -24px rgba(31, 24, 8, .08);
  position: relative;
  overflow: hidden;
}
.step-card::before {
  /* gold corner accent line */
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 36px; height: 36px;
  border-top: 1.5px solid var(--gold-mid);
  border-right: 1.5px solid var(--gold-mid);
  border-top-right-radius: 18px;
  opacity: .6;
  transition: opacity .35s ease, width .35s ease, height .35s ease;
}
.step-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 1px 0 rgba(31, 24, 8, .06), 0 32px 60px -24px rgba(31, 24, 8, .15);
  border-color: var(--dawn-rule) !important;
}
.step-card:hover::before { opacity: 1; width: 56px; height: 56px; }
.step-num {
  font-family: var(--font-edit-en) !important;
  font-style: italic !important;
  font-size: 3.6rem !important;
  font-weight: 500;
  color: var(--gold-mid) !important;
  opacity: .35 !important;
  line-height: 1;
  margin-bottom: 1rem;
}
.step-card h3 {
  font-family: var(--font-display-cal) !important;
  font-size: 1.45rem !important;
  margin-bottom: .65rem !important;
  color: var(--dawn-ink) !important;
}
.step-card p {
  font-size: .96rem !important;
  line-height: 1.85 !important;
  color: var(--dawn-ink-soft) !important;
}


/* ── 11. SCROLL HINT — refined editorial ───────────────────────────── */
.hero-elevated .scroll-hint {
  color: var(--dawn-ink-mute) !important;
  font-family: var(--font-edit-en) !important;
  font-style: italic !important;
  letter-spacing: .35em;
  font-size: .72rem;
}


/* ── 12. STATS — editorial ───────────────────────────────────────────── */
.hero-elevated .stats {
  border-top: 1px solid var(--dawn-rule-soft) !important;
}
.hero-elevated .stat strong {
  font-family: var(--font-display-cal) !important;
  font-size: clamp(1.8rem, 2.8vw, 2.6rem) !important;
  color: var(--gold-deep) !important;
  font-weight: 700;
  letter-spacing: -.02em;
  background: var(--gold-leaf);
  background-size: 200% auto;
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}
.hero-elevated .stat span {
  font-family: var(--font-edit-en) !important;
  font-style: italic;
  font-size: .92rem !important;
  color: var(--dawn-ink-soft) !important;
}


/* ── 13. DIRIYAH DIAMOND DIVIDER — refined ──────────────────────────── */
.bn-divider { margin: clamp(3rem, 6vw, 5rem) auto !important; }
.bn-divider::before, .bn-divider::after {
  max-width: 240px !important;
  height: 1px !important;
  background: linear-gradient(90deg, transparent, var(--gold-deep)) !important;
}
.bn-divider::after {
  background: linear-gradient(90deg, var(--gold-deep), transparent) !important;
}
.bn-divider span {
  background: var(--gold-leaf) !important;
  background-size: 200% auto !important;
  width: 10px !important; height: 10px !important;
  box-shadow: 0 0 0 4px rgba(201, 164, 90, .12), 0 0 16px rgba(244, 215, 122, .4) !important;
}
@media (prefers-reduced-motion: no-preference) {
  .bn-divider span { animation: gold-leaf-flow 6s linear infinite; }
}


/* ── 14. SCROLLBAR — refined gold thread ───────────────────────────── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--gold-mid), var(--gold-deep));
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--gold-deep); background-clip: padding-box; }


/* ── 15. PROGRESS BAR — refined gold ─────────────────────────────────── */
.bn-scrollbar { height: 2.5px !important; }
.bn-scrollbar::after {
  background: var(--gold-leaf) !important;
}


/* ── 16. SECTION SPACING — generous ─────────────────────────────────── */
section.section, section.how, section.features {
  padding-block: clamp(4rem, 8vh, 8rem);
}
