/* VitaJuwel Kuwait — Option 1 "Jewelry for Water" (v2, 6 chapters)
   Design tokens locked — brand constants. */

@property --accent {
  syntax: '<color>';
  inherits: true;
  initial-value: #B98A5E;
}

:root {
  --obsidian:   #0E0D0F;
  --pearl:      #F7F4EE;
  --amber:      #B98A5E;
  --amethyst:   #8E7CC3;
  --rose:       #C9848F;
  --aventurine: #5E8C7B;
  --accent: var(--amber);
  /* Gem Refraction: global accent eases to the chapter in view */
  transition: --accent 0.8s ease;

  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'IBM Plex Sans', system-ui, sans-serif;
  --font-ar: 'IBM Plex Sans Arabic', 'IBM Plex Sans', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: auto; }

body {
  background: var(--obsidian);
  color: var(--pearl);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.65;
  overflow-x: hidden;
}

/* keyboard users get a visible ring everywhere (links lost it to color-only hover) */
a:focus-visible {
  outline: 2px solid var(--pearl);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute;
  top: -3rem;
  left: 1rem;
  z-index: 100;
  background: var(--pearl);
  color: var(--obsidian);
  padding: 0.5rem 1rem;
  border-radius: 2px;
  text-decoration: none;
}
.skip-link:focus { top: 1rem; }

/* ---------- Nav ---------- */
.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem clamp(1.25rem, 4vw, 3rem);
  background: linear-gradient(180deg, rgba(14,13,15,0.85), rgba(14,13,15,0));
}
.nav-brand {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-family: var(--font-display);
  letter-spacing: 0.28em;
  font-size: 0.95rem;
}
.nav-ar { font-family: var(--font-ar); letter-spacing: 0; font-size: 1rem; }
.nav-sep { color: var(--accent); transition: color 0.8s ease; }
.nav-links { display: flex; gap: clamp(1rem, 3vw, 2rem); align-items: center; }
.nav-links a {
  color: var(--pearl);
  text-decoration: none;
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.85;
}
.nav-links a:hover, .nav-links a:focus-visible { opacity: 1; color: var(--accent); }
.nav-cta {
  border: 1px solid var(--accent);
  padding: 0.4rem 1rem;
  border-radius: 999px;
  transition: border-color 0.8s ease;
}
@media (max-width: 600px) {
  .nav-links a:not(.nav-cta) { display: none; }
  .nav { padding: 1rem 1rem; }
  .nav-brand { letter-spacing: 0.16em; font-size: 0.85rem; }
  .nav-cta { padding: 0.35rem 0.8rem; font-size: 0.78rem; }
}

/* ---------- Fixed cinematic stage ---------- */
.stage {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: var(--obsidian);
  overflow: hidden;
}
.layer {
  position: absolute;
  inset: 0;
  opacity: 0;
  will-change: opacity;
}
/* first chapter visible before/without JS; updateLayers() takes over after boot */
.layer[data-ch="1"] { opacity: 1; }
.layer .kf,
.layer video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  /* no will-change here: 6 always-promoted full-screen surfaces exhaust
     mobile GPU tile memory (flicker); GSAP promotes during tweens anyway */
}
.layer video { opacity: 0; } /* revealed by JS once playable */
.layer .kf[src=""] { visibility: hidden; } /* lazy: hidden until data-src promoted */

/* ---------- Gem Refraction FX (CSS-only, no credits) ---------- */
.fx-sweep {
  position: absolute;
  inset: -20%;
  background: linear-gradient(115deg,
    transparent 42%,
    rgba(247,244,238,0.07) 50%,
    transparent 58%);
  transform: translateX(-60%);
  will-change: transform;
  pointer-events: none;
}
.fx-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(60% 50% at 62% 42%,
    color-mix(in srgb, var(--accent) 16%, transparent),
    transparent 70%);
  mix-blend-mode: screen;
  transition: background 0.8s ease;
  pointer-events: none;
}
.fx-prism {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(200deg, transparent 68%, rgba(142,124,195,0.05) 82%, transparent 94%),
    linear-gradient(24deg, transparent 70%, rgba(185,138,94,0.05) 84%, transparent 96%);
  mix-blend-mode: screen;
  pointer-events: none;
}
.scrim {
  position: absolute;
  inset: 0;
  /* 4.5:1 contrast for copy over imagery */
  background: linear-gradient(180deg,
    rgba(14,13,15,0.66) 0%,
    rgba(14,13,15,0.44) 42%,
    rgba(14,13,15,0.66) 100%);
  pointer-events: none;
}

/* ---------- Chapters ---------- */
main { position: relative; z-index: 1; }

.chapter { height: 200vh; position: relative; }
.chapter--scrub { height: 320vh; } /* scroll room for the scrubbed money shot */

.chapter-content {
  /* CSS sticky does the pinning: compositor-native, no per-frame JS.
     (GSAP pinning repositions on the main thread and visibly lags
     native scroll on mobile — the flicker.) */
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh; /* track the mobile URL bar instead of jumping */
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 0.9rem;
  padding: 84px clamp(1.25rem, 6vw, 4rem) 0; /* top: fixed-nav clearance */
}
/* product-forward chapters keep copy left so the bottle stays visible right */
.chapter-content--left {
  align-items: flex-start;
  text-align: left;
  max-width: 720px;
  margin-right: auto;
  padding-left: clamp(1.25rem, 8vw, 7rem);
}
.chapter-content--left .ar-line,
.chapter-content--left .ar-sub { align-self: flex-start; }

.kicker {
  font-size: 0.8125rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--accent);
  transition: color 0.8s ease;
}

.headline {
  font-family: var(--font-display);
  font-weight: 300;
  font-optical-sizing: auto;
  font-size: clamp(2.3rem, 6.5vw, 4.8rem);
  line-height: 1.06;
  letter-spacing: -0.015em; /* Fraunces reads tighter = more couture at display sizes */
  max-width: 15ch;
}
.headline .word { display: inline-block; }

.ar-line {
  font-family: var(--font-ar);
  font-weight: 500; /* Arabic needs the weight to hold its own next to the serif */
  font-size: clamp(1.2rem, 3vw, 1.75rem);
  opacity: 0.95;
}
.ar-line--small { font-size: 1.05rem; }

.sub {
  max-width: 42ch;
  opacity: 0.9;
  font-size: clamp(1rem, 2vw, 1.15rem); /* never below 16px (mobile readability) */
  line-height: 1.7;
}
.ar-sub {
  font-family: var(--font-ar);
  max-width: 42ch;
  opacity: 0.82;
  font-size: clamp(0.95rem, 1.8vw, 1.05rem);
}
.micro {
  font-size: 0.875rem;
  letter-spacing: 0.06em;
  opacity: 0.78;
}

.caption {
  font-family: var(--font-display);
  font-weight: 300;
  font-style: italic;
  font-size: clamp(1.4rem, 3.5vw, 2.2rem);
  opacity: 0.94;
}
.chapter-content--minimal { justify-content: flex-end; padding-bottom: 12vh; gap: 0.4rem; }

.text-cta {
  margin-top: 0.6rem;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transition: color 0.8s ease;
}
.text-cta:hover, .text-cta:focus-visible { color: var(--pearl); }
.text-cta--gift { text-transform: none; letter-spacing: 0.02em; opacity: 0.85; }
.text-cta--gift span { font-family: var(--font-ar); margin-inline-start: 0.4rem; }

/* ---------- Blend cards (CH4) ---------- */
.blend-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(0.9rem, 2.5vw, 1.4rem);
  margin-top: 1.2rem;
  width: min(100%, 900px);
}
.blend-card {
  background: linear-gradient(165deg, rgba(28,22,18,0.6), rgba(14,13,15,0.72)); /* warm, on-brand */
  border: 1px solid rgba(185,138,94,0.18); /* amber-tinted, ties the palette through */
  border-top: 2px solid var(--card-accent, var(--accent));
  border-radius: 8px;
  padding: 1.4rem 1.2rem 1.2rem;
  backdrop-filter: blur(8px);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.blend-card h3 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.45rem;
  color: var(--card-accent, var(--pearl));
}
.blend-ar { font-family: var(--font-ar); opacity: 0.85; }
.blend-stones { font-size: 0.84rem; opacity: 0.75; margin: 0.35rem 0 0.7rem; }
.blend-price { font-family: var(--font-display); font-size: 1.4rem; font-variant-numeric: tabular-nums; }
.blend-price span { font-size: 0.78rem; letter-spacing: 0.15em; opacity: 0.7; }
.card-cta {
  margin-top: 0.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px; /* touch-target minimum */
  border: 1px solid var(--card-accent, var(--accent));
  color: var(--pearl);
  border-radius: 999px;
  padding: 0.55rem 1.2rem;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-decoration: none;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.card-cta:hover, .card-cta:focus-visible {
  background: var(--card-accent, var(--accent));
  color: var(--obsidian);
}
@media (max-width: 820px) {
  .blend-cards { grid-template-columns: 1fr; width: min(100%, 380px); }
  .blend-card { padding: 1rem 1rem 0.9rem; }
}

/* ---------- CTAs (CH6) ---------- */
.cta-row { display: flex; gap: 0.9rem; flex-wrap: wrap; justify-content: center; margin-top: 0.8rem; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1.7rem;
  border-radius: 999px;
  text-decoration: none;
  font-size: 0.9rem;
  letter-spacing: 0.08em;
}
.btn-primary {
  background: var(--accent);
  color: var(--obsidian);
  font-weight: 500;
  transition: background-color 0.8s ease;
}
.btn-ghost {
  border: 1px solid rgba(247,244,238,0.55); /* 3:1 component contrast */
  color: var(--pearl);
  background: rgba(14,13,15,0.3);
  transition: background-color 0.2s ease;
}
.btn-ghost:hover, .btn-ghost:focus-visible { background: rgba(247,244,238,0.12); }
.btn:hover, .btn:focus-visible { transform: translateY(-1px); }
.btn:focus-visible { outline: 2px solid var(--pearl); outline-offset: 3px; }

.trust-row {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1.6rem;
  margin-top: 1.6rem;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.78;
}
.trust-row li::before { content: '◆ '; color: var(--accent); font-size: 0.6rem; }

/* ---------- Footer ---------- */
.footer {
  position: relative;
  z-index: 1;
  background: var(--obsidian);
  text-align: center;
  padding: 3rem 1.5rem 4rem;
  border-top: 1px solid rgba(247,244,238,0.08);
}
.footer p:first-child {
  font-family: var(--font-display);
  letter-spacing: 0.25em;
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  align-items: baseline;
}
.footer p:first-child span[lang="ar"] { font-family: var(--font-ar); letter-spacing: 0; }
.footer-sub { font-size: 0.8rem; opacity: 0.62; margin-top: 0.6rem; }

/* ---------- Mobile keyframe framing ----------
   The 6 keyframes are 16:9; on a portrait phone object-fit:cover crops the
   sides. Bias each layer's focal point to keep the product in frame, and drop
   the product-forward copy to the bottom so it no longer sits over the bottle. */
@media (max-width: 640px) {
  .layer .kf,
  .layer video { object-position: 50% center; }
  .layer[data-ch="1"] .kf { object-position: 66% center; } /* single bottle, right of center */
  .layer[data-ch="5"] .kf { object-position: 42% center; } /* poster before pour video: keep the pour */
  .layer[data-ch="6"] .kf { object-position: 46% center; } /* collection lineup */

  /* stronger bottom scrim so bottom-anchored copy stays ≥4.5:1 over imagery */
  .scrim {
    background: linear-gradient(180deg,
      rgba(14,13,15,0.45) 0%,
      rgba(14,13,15,0.30) 34%,
      rgba(14,13,15,0.82) 78%,
      rgba(14,13,15,0.90) 100%);
  }

  /* product-forward chapters: copy sits below the bottle, centered */
  .chapter-content--left {
    align-items: center;
    text-align: center;
    justify-content: flex-end;
    padding: 0 1.25rem 12vh;
    max-width: none;
    margin-right: 0;
  }
  .chapter-content--left .ar-line,
  .chapter-content--left .ar-sub { align-self: center; }
  /* wrap the headline instead of overflowing the narrow frame */
  .headline { font-size: clamp(2rem, 8vw, 2.6rem); max-width: 11ch; }
  /* keep body copy inside the viewport so it wraps rather than clipping */
  .sub, .ar-sub, .micro { max-width: 100%; }
}

/* ---------- Touch-device performance ----------
   mix-blend-mode overlays and backdrop blur force full-screen composite passes
   every frame on phone GPUs — the source of scroll flicker/jank. Drop them on
   touch; the keyframes, scrim, and accent shifts carry the look on their own. */
@media (pointer: coarse) {
  .fx-sweep, .fx-glow, .fx-prism { display: none; }
  .blend-card {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: rgba(14, 13, 15, 0.78); /* compensate for the lost blur */
  }
}

/* Reduced-motion stacked sections use background-position, not object-fit —
   bias them the same way so the product stays in frame on phones. */
@media (max-width: 640px) {
  body.rm #ch1 { background-position: 66% center; }
  body.rm #ch5 { background-position: 42% center; }
  body.rm #ch6 { background-position: 46% center; }
}
body.rm .stage { display: none; }
body.rm .chapter {
  height: auto;
  min-height: 100vh;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  box-shadow: inset 0 0 0 100vmax rgba(14,13,15,0.55); /* scrim substitute */
}
body.rm .chapter-content { height: auto; min-height: 100vh; }

/* CSS-only safety net if JS never runs under reduced motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto !important; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
