/* ============================================================
   Safarna — safarna.app landing
   Tokens mirror the app design system (src/theme/tokens.ts).
   ============================================================ */

/* ---------- fonts (self-hosted) ---------- */
@font-face {
  font-family: 'Alegreya';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('assets/fonts/alegreya-var.woff2') format('woff2');
}
@font-face {
  font-family: 'Alegreya';
  font-style: italic;
  font-weight: 400 800;
  font-display: swap;
  src: url('assets/fonts/alegreya-italic-var.woff2') format('woff2');
}
@font-face {
  font-family: 'Alegreya Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('assets/fonts/alegreya-sans-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Alegreya Sans';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('assets/fonts/alegreya-sans-500.woff2') format('woff2');
}
@font-face {
  font-family: 'Alegreya Sans';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('assets/fonts/alegreya-sans-700.woff2') format('woff2');
}
@font-face {
  font-family: 'Noto Naskh Arabic';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('assets/fonts/noto-naskh-arabic-var.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF;
}

/* ---------- tokens ---------- */
:root {
  --bg: #F7F5F1;
  --surface: #FFFFFF;
  --wash: #EFEBE4;
  --border: #E4DFD6;
  --hairline: #ECE8E1;

  --ink: #221E19;
  --ink-2: #57504A;
  --ink-3: #746D64;

  --emerald: #0B6E4F;
  --emerald-press: #085840;
  --emerald-deep: #0A4A38;
  --tint: #E5F1EB;
  --tint-border: #C3DED2;

  --danger: #B42318;
  --gold: #A87E2F;
  --gold-deep: #8C6620;

  --on-photo: #F7F5F1;
  --on-photo-dim: rgba(247, 245, 241, 0.82);

  --serif: 'Alegreya', Georgia, 'Times New Roman', serif;
  --sans: 'Alegreya Sans', -apple-system, 'Segoe UI', sans-serif;
  --naskh: 'Noto Naskh Arabic', 'Geeza Pro', serif;

  /* fluid type scale, ~1.3 ratio */
  --step-5: clamp(2.7rem, 1.4rem + 5.2vw, 4.6rem);   /* hero */
  --step-4: clamp(1.9rem, 1.35rem + 2.2vw, 2.8rem);  /* h2 */
  --step-3: clamp(1.45rem, 1.2rem + 1vw, 1.85rem);   /* h3 */
  --step-0: 1.125rem;                                /* body 18 */
  --step--1: 0.9375rem;                              /* 15 */
  --step--2: 0.8125rem;                              /* 13 labels */

  --gutter: clamp(1.25rem, 5vw, 2.5rem);
  --section: clamp(5rem, 9vw + 2rem, 9rem);
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;

  --shadow-card: 0 2px 6px rgba(59, 52, 43, 0.06);
  --shadow-float: 0 4px 10px rgba(59, 52, 43, 0.14);

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1); /* quint-ish */
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: var(--step-0);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { font-family: var(--serif); text-wrap: balance; margin: 0 0 0.5em; }
h1 { font-size: var(--step-5); font-weight: 800; line-height: 1.04; letter-spacing: -0.015em; }
h2 { font-size: var(--step-4); font-weight: 700; line-height: 1.12; letter-spacing: -0.01em; }
h3 { font-size: var(--step-3); font-weight: 700; line-height: 1.2; }
p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }
img { max-width: 100%; display: block; }

.container { max-width: 68rem; margin-inline: auto; padding-inline: var(--gutter); }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* ---------- header ---------- */
.site-header {
  position: absolute; inset: 0 0 auto 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center;
  padding: clamp(1.1rem, 3vw, 1.75rem) var(--gutter);
}
.wordmark {
  display: flex; align-items: baseline; gap: 0.55rem;
  color: var(--on-photo); text-decoration: none;
}
.wordmark-latin { font-family: var(--serif); font-weight: 700; font-size: 1.35rem; letter-spacing: 0.01em; }
.wordmark-arabic { font-family: var(--naskh); font-size: 1.15rem; opacity: 0.9; }
.header-cta {
  font-family: var(--sans); font-weight: 500; font-size: var(--step--1);
  color: var(--on-photo); text-decoration: none;
  border: 1px solid rgba(247, 245, 241, 0.45);
  border-radius: 999px; padding: 0.5rem 1.1rem;
  transition: background-color 200ms var(--ease-out), border-color 200ms var(--ease-out);
}
.header-cta:hover { background: rgba(247, 245, 241, 0.14); border-color: rgba(247, 245, 241, 0.7); }

/* ---------- hero ---------- */
.hero { position: relative; min-height: 100svh; display: flex; align-items: flex-end; overflow: hidden; }
.hero-media, .hero-media img, .waitlist-media, .waitlist-media img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
}
.hero-media img { object-position: 50% 70%; }
.hero-scrim {
  position: absolute; inset: 0;
  background:
    linear-gradient(200deg, rgba(26, 21, 16, 0.5) 0%, rgba(26, 21, 16, 0.12) 45%, rgba(26, 21, 16, 0.6) 100%);
}
.hero-inner {
  position: relative; z-index: 2; width: 100%;
  padding-block: clamp(6rem, 14vh, 9rem) clamp(3.5rem, 9vh, 6rem);
  color: var(--on-photo);
  max-width: 68rem;
}
.hero h1 { color: var(--on-photo); max-width: 11ch; }
.hero-kicker {
  font-family: var(--sans); font-size: var(--step--1); font-weight: 500;
  letter-spacing: 0.04em; color: var(--on-photo-dim); margin-bottom: 1.1rem;
}
.hero-kicker [lang="ar"] { font-family: var(--naskh); font-size: 1.2em; letter-spacing: 0; }
.kicker-sep { margin-inline: 0.55rem; opacity: 0.6; }
.hero-sub {
  font-size: clamp(1.1rem, 1rem + 0.5vw, 1.3rem); line-height: 1.55;
  max-width: 34rem; color: var(--on-photo-dim); margin: 1.25rem 0 2rem;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.9rem; }

/* staged entrance — CSS-only, autoplays, reduced-motion gets none */
@media (prefers-reduced-motion: no-preference) {
  .hero-inner > * { animation: rise 800ms var(--ease-out) both; }
  .hero-inner > *:nth-child(2) { animation-delay: 90ms; }
  .hero-inner > *:nth-child(3) { animation-delay: 180ms; }
  .hero-inner > *:nth-child(4) { animation-delay: 270ms; }
  @keyframes rise {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: none; }
  }
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--sans); font-weight: 700; font-size: 1rem;
  min-height: 48px; padding: 0.7rem 1.6rem; border-radius: var(--radius-md);
  text-decoration: none; border: 1px solid transparent; cursor: pointer;
  transition: background-color 180ms var(--ease-out), color 180ms var(--ease-out),
              border-color 180ms var(--ease-out), transform 180ms var(--ease-out);
}
.btn:active { transform: translateY(1px); }
.btn-light { background: var(--surface); color: var(--ink); }
.btn-light:hover { background: var(--bg); }
.btn-ghost-light { color: var(--on-photo); border-color: rgba(247, 245, 241, 0.45); }
.btn-ghost-light:hover { background: rgba(247, 245, 241, 0.14); }
.btn-primary { background: var(--emerald); color: #fff; }
.btn-primary:hover { background: var(--emerald-press); }
.btn-primary[disabled] { opacity: 0.55; cursor: default; }

/* ---------- sections ---------- */
.section { padding-block: var(--section); }
.section-wash { background: var(--wash); }

.kicker {
  font-family: var(--sans); font-size: var(--step--2); font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--emerald);
  margin-bottom: 0.9rem;
}
.kicker-gold { color: var(--gold-deep); }

.split {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: clamp(2.25rem, 5vw, 4.5rem); align-items: center;
}
@media (min-width: 800px) { .split-flip > .split-copy { order: 2; } }
.split-copy p { color: var(--ink-2); max-width: 62ch; }

.quiet-list { list-style: none; margin: 1.6rem 0 0; padding: 0; }
.quiet-list li {
  font-family: var(--sans); font-size: var(--step--1); color: var(--ink-2);
  padding: 0.55rem 0 0.55rem 1.5rem; position: relative;
  border-top: 1px solid var(--hairline);
}
.quiet-list li:last-child { border-bottom: 1px solid var(--hairline); }
.quiet-list li::before {
  content: ''; position: absolute; left: 0.15rem; top: 1.12rem;
  width: 7px; height: 7px; border-radius: 50%; background: var(--emerald);
}

/* ---------- map vignette ---------- */
.map-vignette { margin: 0; border-radius: var(--radius-xl); overflow: hidden; box-shadow: var(--shadow-float); }
.map-vignette svg { display: block; width: 100%; height: auto; }
.mv-country {
  font-family: var(--sans); font-size: 15px; font-weight: 700;
  letter-spacing: 0.35em; fill: #FFFFFF; fill-opacity: 0.38; text-anchor: middle;
}
.mv-city { font-family: var(--sans); font-size: 12px; fill: #FFFFFF; fill-opacity: 0.85; }
.mv-emoji { font-size: 17px; text-anchor: middle; }
.mv-pill {
  font-family: var(--sans); font-size: 11px; font-weight: 500;
  fill: #F7F5F1; text-anchor: middle;
}
.route-glow {
  fill: none; stroke: rgba(255, 255, 255, 0.28); stroke-width: 8; stroke-linecap: round;
}
.route-line { fill: none; stroke: #FFFFFF; stroke-width: 3.5; stroke-linecap: round; }
.route-live { fill: none; stroke: #FFFFFF; stroke-width: 3; stroke-linecap: round; stroke-dasharray: 1 8; }

/* ---------- halal matrix card ---------- */
.card {
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-card);
}
.matrix-card { padding: clamp(1.4rem, 3vw, 2rem); max-width: 26rem; justify-self: center; width: 100%; }
.matrix-head { margin-bottom: 1.1rem; }
.matrix-title { font-family: var(--serif); font-weight: 700; font-size: 1.3rem; margin: 0; }
.matrix-meta { font-family: var(--sans); font-size: var(--step--2); color: var(--ink-3); margin: 0.15rem 0 0; }
.matrix-row {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.8rem 0; border-top: 1px solid var(--hairline);
}
.matrix-label { font-family: var(--sans); font-weight: 500; font-size: var(--step--1); }
.seg {
  display: inline-flex; background: var(--wash); border-radius: 999px; padding: 3px;
}
.seg-opt {
  font-family: var(--sans); font-size: 0.78rem; font-weight: 700;
  color: var(--ink-3); border-radius: 999px; padding: 0.22rem 0.7rem;
}
.seg-yes { background: var(--emerald); color: #fff; }
.seg-unknown { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-card); }
.matrix-consensus {
  display: flex; align-items: center; gap: 0.4rem;
  font-family: var(--sans); font-size: var(--step--2); font-weight: 500;
  color: var(--emerald-deep); margin: -0.2rem 0 0.6rem;
}
.check { width: 14px; height: 14px; }
.matrix-foot {
  font-family: var(--sans); font-size: var(--step--2); color: var(--ink-3);
  margin: 0.6rem 0 0; padding-top: 0.8rem; border-top: 1px solid var(--hairline);
}

/* ---------- together / privacy ---------- */
.pair {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: clamp(2.5rem, 6vw, 5rem);
}
.pair-item p { color: var(--ink-2); max-width: 46ch; }
.vignette-pill {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-family: var(--sans); font-size: var(--step--2); font-weight: 500; color: var(--ink);
  background: var(--surface); border: 1px solid var(--hairline); border-radius: 999px;
  box-shadow: var(--shadow-card); padding: 0.45rem 0.95rem; margin-top: 0.9rem;
}
.pill-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--emerald); }
.chips { display: flex; gap: 0.5rem; margin-top: 1rem; }
.chip {
  font-family: var(--sans); font-size: var(--step--2); font-weight: 700;
  color: var(--ink-3); background: var(--wash); border: 1px solid transparent;
  border-radius: 999px; padding: 0.35rem 0.9rem;
}
.chip-active { color: var(--emerald-deep); background: var(--tint); border-color: var(--tint-border); }

/* ---------- duas ---------- */
.section-dua { background: linear-gradient(180deg, var(--bg) 0%, #F2EEE7 100%); }
.dua-inner { max-width: 40rem; text-align: center; }
.gold-rule { display: block; width: 40px; height: 2px; background: var(--gold); margin: 0 auto 1.4rem; }
.dua-arabic {
  font-family: var(--naskh);
  font-size: clamp(1.8rem, 1.3rem + 2.4vw, 2.7rem);
  line-height: 2.05; color: var(--ink); margin: 1.4rem 0 1.6rem;
}
.dua-translation {
  font-style: italic; font-size: 1.15rem; line-height: 1.7; color: var(--ink-2);
  max-width: 36rem; margin-inline: auto;
}
.dua-source {
  font-family: var(--sans); font-size: var(--step--2); font-weight: 500;
  letter-spacing: 0.06em; color: var(--gold-deep); margin-top: 1.1rem;
}
.dua-note {
  font-size: var(--step--1); color: var(--ink-3); max-width: 30rem;
  margin: 2.2rem auto 0;
}

/* ---------- waitlist ---------- */
.waitlist { position: relative; padding-block: clamp(6rem, 14vh, 10rem); overflow: hidden; }
.waitlist-media img { object-position: 50% 60%; }
.waitlist-scrim { position: absolute; inset: 0; background: rgba(26, 21, 16, 0.62); }
.waitlist-inner { position: relative; z-index: 2; text-align: center; color: var(--on-photo); max-width: 44rem; }
.waitlist h2 { color: var(--on-photo); }
.waitlist-sub { color: var(--on-photo-dim); font-size: 1.15rem; margin-bottom: 2rem; }
#waitlist-form {
  display: flex; gap: 0.7rem; justify-content: center; flex-wrap: wrap; margin: 0 auto;
}
#waitlist-form input[type="email"] {
  font-family: var(--sans); font-size: 1rem; color: var(--ink);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 0.7rem 1.1rem; min-height: 48px;
  width: min(22rem, 100%);
}
#waitlist-form input[type="email"]::placeholder { color: var(--ink-2); }
#waitlist-form input[type="email"]:focus-visible {
  outline: 2px solid var(--emerald); outline-offset: 1px; border-color: var(--emerald);
}
.hp { position: absolute; left: -9999px; top: auto; }
.form-status {
  font-family: var(--sans); font-size: var(--step--1); font-weight: 500;
  min-height: 1.4em; margin-top: 0.9rem; color: var(--on-photo);
}
.form-status.is-error { color: #F4B9B1; }
.waitlist-privacy { font-family: var(--sans); font-size: var(--step--2); color: rgba(247, 245, 241, 0.78); margin-top: 0.4rem; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--hairline); padding-block: 2.2rem; }
.footer-inner { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 0.75rem; }
.footer-mark { font-family: var(--serif); font-weight: 700; margin: 0; }
.footer-mark [lang="ar"] { font-family: var(--naskh); font-weight: 400; margin-left: 0.35rem; color: var(--ink-2); }
.footer-meta { font-family: var(--sans); font-size: var(--step--2); color: var(--ink-3); margin: 0; }

/* ---------- scroll reveal (JS enhances; default fully visible) ---------- */
@media (prefers-reduced-motion: no-preference) {
  [data-reveal].pre-reveal { opacity: 0; transform: translateY(18px); }
  [data-reveal].revealed {
    opacity: 1; transform: none;
    transition: opacity 700ms var(--ease-out), transform 700ms var(--ease-out);
  }
}

/* focus visibility for keyboard users on photo surfaces */
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--emerald); outline-offset: 2px;
}
.hero a:focus-visible, .waitlist a:focus-visible, .site-header a:focus-visible, .waitlist button:focus-visible {
  outline-color: var(--on-photo);
}
