@import 'tailwindcss';

/*
 * Design tokens. Palette is sampled from the brand poster on the current site:
 * background #050807, gold from the scarab's filigree. Gold is the single accent;
 * the turquoise/emerald lives only inside the photography.
 */
@theme {
  --color-ink: #050807;
  --color-ink-2: #0a100e;
  --color-ink-3: #101815;
  --color-line: rgb(241 236 224 / 0.14);
  --color-line-strong: rgb(241 236 224 / 0.3);
  --color-bone: #f1ece0;
  --color-mist: #a9a89e;
  --color-gold: #c9a14a;
  --color-gold-hi: #e6c877;
  --color-danger: #ff8f7e;

  --font-sans: var(--font-jost), var(--font-cairo), ui-sans-serif, system-ui, sans-serif;
  --font-serif: var(--font-cormorant), var(--font-cairo), ui-serif, Georgia, serif;

  --radius-ui: 4px;
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
}

@layer base {
  html {
    background: var(--color-ink);
    color-scheme: dark;
    scroll-padding-top: 5rem;
    -webkit-text-size-adjust: 100%;
  }

  @media (prefers-reduced-motion: no-preference) {
    html {
      scroll-behavior: smooth;
    }
  }

  body {
    background: var(--color-ink);
    color: var(--color-bone);
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
  }

  ::selection {
    background: var(--color-gold);
    color: var(--color-ink);
  }

  :focus-visible {
    outline: 2px solid var(--color-gold-hi);
    outline-offset: 3px;
  }

  /* next/font bakes a local-Arial fallback (which has Arabic glyphs) into --font-jost, so on Arabic
     pages Cairo has to lead the stack or it is never reached. Latin-only blocks opt back into Jost. */
  :lang(ar) {
    --font-sans: var(--font-cairo), ui-sans-serif, system-ui, sans-serif;
    --font-serif: var(--font-cairo), ui-serif, Georgia, serif;
  }
  [lang='en'] {
    font-family: var(--font-jost), ui-sans-serif, system-ui, sans-serif;
  }

  body:has(dialog[open]) {
    overflow: hidden;
  }
}

@layer components {
  /* Small label with a leading hairline. Arabic must not be tracked or uppercased. */
  .eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.9rem;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--color-gold);
  }
  .eyebrow::before {
    content: '';
    width: 2.25rem;
    height: 1px;
    background: currentColor;
  }

  .hero-glow {
    background: radial-gradient(closest-side, color-mix(in srgb, var(--color-gold) 13%, transparent), transparent);
  }

  .fade-bottom {
    -webkit-mask-image: linear-gradient(to bottom, #000 55%, transparent 98%);
    mask-image: linear-gradient(to bottom, #000 55%, transparent 98%);
  }

  /* Headline words rise out of a clipped line: transform only, text is visible without it. */
  .mask-word {
    display: inline-block;
    overflow: hidden;
    vertical-align: top;
    padding-block: 0.06em 0.14em;
    margin-block: -0.06em -0.14em;
  }
  .word {
    display: inline-block;
  }

  .header-bg {
    position: absolute;
    inset: 0;
    z-index: -1;
    background: rgb(5 8 7 / 0.84);
    border-bottom: 1px solid var(--color-line);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
  }
}

/* Unlayered on purpose: must beat Tailwind's tracking/uppercase utilities. Arabic joins break if tracked. */
:lang(ar) .eyebrow {
  font-size: 0.875rem;
  letter-spacing: 0;
  text-transform: none;
}
:lang(ar) .tracked {
  letter-spacing: 0;
  text-transform: none;
}

/* ---- Motion: CSS-only entrance so hero content never waits on JavaScript ---- */
@keyframes word-up {
  from {
    transform: translateY(105%);
  }
  to {
    transform: none;
  }
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
/* Transform only: the LCP image must be fully painted from its first frame. */
@keyframes scarab-in {
  from {
    transform: translateY(36px) scale(1.04);
  }
  to {
    transform: none;
  }
}
@keyframes hero-drift {
  to {
    transform: translateY(64px);
    opacity: 0.15;
  }
}
@keyframes header-bg {
  to {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .word {
    animation: word-up 1.1s var(--ease-out-expo) both;
    animation-delay: calc(var(--i, 0) * 90ms + 120ms);
  }
  .rise {
    animation: rise 1s var(--ease-out-expo) both;
    animation-delay: var(--d, 0ms);
  }
  .scarab-in {
    animation: scarab-in 1.6s var(--ease-out-expo) both;
  }
  .menu-dialog[open] .menu-link {
    animation: rise 0.7s var(--ease-out-expo) both;
    animation-delay: calc(var(--i, 0) * 70ms + 80ms);
  }

  /* Scroll-driven, compositor-only. Unsupported browsers simply skip it. */
  @supports (animation-timeline: scroll()) {
    .hero-drift {
      animation: hero-drift linear both;
      animation-timeline: scroll(root block);
      animation-range: 0 90vh;
    }
    .header-bg {
      opacity: 0;
      animation: header-bg linear both;
      animation-timeline: scroll(root block);
      animation-range: 0 120px;
    }
  }
}

/* Below-the-fold reveals are driven by Motion; never leave them hidden if motion is off. */
@media (prefers-reduced-motion: reduce) {
  [data-reveal] {
    opacity: 1 !important;
    transform: none !important;
  }
}

.menu-dialog::backdrop {
  background: rgb(5 8 7 / 0.92);
}

@keyframes mobile-bar-in {
  from {
    transform: translateY(100%);
    visibility: hidden;
  }
  to {
    transform: none;
    visibility: visible;
  }
}

/* Appears after the hero. Browsers without scroll timelines just show it always. */
@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: scroll()) {
    .mobile-bar {
      animation: mobile-bar-in 1ms linear both;
      animation-timeline: scroll(root block);
      animation-range: 60vh 75vh;
    }
  }
}
