/*
 * Rawq landing page styles.
 *
 * The design system mirrors the app exactly (same palette tokens,
 * same Reem Kufi for Arabic, same warm-cream paper feel). The page
 * IS the brand: restraint, generous whitespace, content as hero.
 */

/* ── Fonts ───────────────────────────────────────────────────────── */
@font-face {
  font-family: 'Reem Kufi';
  src: url('assets/fonts/ReemKufi-Medium.ttf') format('truetype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  /* Subset hint — Arabic-only range, saves a render-blocking parse */
  unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF;
}

/* ── Palette (matches @/theme/colors.ts exactly) ─────────────────── */
:root {
  --paper: #F4EFE6;
  --paper-recess: #EDE6D9;
  --elevated: #FBF7EE;
  --ink: #1A1714;
  --ink-soft: #524A40;
  --ink-muted: #8A8073;
  --ink-faint: #B6AC9C;
  --divider: #E2D9C8;
  --hairline: rgba(26, 23, 20, 0.10);
  --accent: #9C7B3E;
  --accent-deep: #7D6029;

  /* Type scale — fluid, system-font-friendly */
  --t-micro:   12px;
  --t-caption: 13px;
  --t-body:    17px;
  --t-lg:      20px;
  --t-xl:      28px;
  --t-hero:    clamp(40px, 8vw, 64px);
  --t-arabic-flourish: clamp(40px, 7vw, 56px);

  --gap-section: clamp(64px, 10vw, 112px);
}

/*
 * Theme resolution order:
 *   1. If <html data-theme="..."> is set (manual override), it wins.
 *   2. Else, follow the OS via prefers-color-scheme.
 * The toggle script sets data-theme on first load (so there's no flash)
 * and persists the choice to localStorage. See <script> in index.html.
 */
:root[data-theme="dark"] {
  --paper: #0F0E0C;
  --paper-recess: #171411;
  --elevated: #1A1714;
  --ink: #F1ECE3;
  --ink-soft: #B5AC9E;
  --ink-muted: #7A7062;
  --ink-faint: #4C463D;
  --divider: #2A2521;
  --hairline: rgba(241, 236, 227, 0.10);
  --accent: #C4A472;
  --accent-deep: #E0BE85;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --paper: #0F0E0C;
    --paper-recess: #171411;
    --elevated: #1A1714;
    --ink: #F1ECE3;
    --ink-soft: #B5AC9E;
    --ink-muted: #7A7062;
    --ink-faint: #4C463D;
    --divider: #2A2521;
    --hairline: rgba(241, 236, 227, 0.10);
    --accent: #C4A472;
    --accent-deep: #E0BE85;
  }
}

/* Smooth the swap when the toggle flips themes — but only the colors,
   not layout. Limiting the properties keeps animations elsewhere snappy. */
body, .principles, .summary, .site-footer, .cta, .moment-pill {
  transition: background-color 300ms ease, color 300ms ease, border-color 300ms ease;
}

/* ── Top-right controls (theme + language) ──────────────────────── */
/*
 * Two quiet toggles, fixed in the top corner. Stay above the hero's
 * radial gradient. Logical positioning so they flip to the opposite
 * corner under RTL automatically.
 */
.controls {
  position: fixed;
  top: 16px;
  inset-inline-end: 16px;
  z-index: 10;
  display: flex;
  gap: 4px;
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 3px;
  box-shadow: 0 1px 0 var(--hairline);
}
.control-btn {
  appearance: none;
  background: transparent;
  border: 0;
  border-radius: 999px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 0;
  transition: background-color 200ms ease, color 200ms ease;
}
.control-btn:hover, .control-btn:focus-visible {
  background: var(--paper-recess);
  color: var(--ink);
}
.control-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.control-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* The icon shown is the theme the user would SWITCH TO if they click —
   moon when in light (click → dark), sun when in dark (click → light). */
.icon-sun  { display: none; }
.icon-moon { display: block; }
:root[data-theme="dark"] .icon-sun  { display: block; }
:root[data-theme="dark"] .icon-moon { display: none; }
/* The "other language" label is the button's own affordance — it says
   what you'd switch TO, never what you're currently on. Identical to
   how iOS / macOS language switchers label themselves. */
.control-btn--lang {
  min-width: 36px;
  padding: 0 10px;
}

/* ── Reset + base ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
               'Helvetica Neue', Arial, sans-serif;
  font-size: var(--t-body);
  line-height: 1.55;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--ink); text-decoration: none; }
a:hover { color: var(--accent-deep); }
ul { list-style: none; padding: 0; margin: 0; }

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}
.container--narrow { max-width: 640px; }

.eyebrow {
  font-size: var(--t-micro);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
  font-weight: 500;
  margin: 0 0 24px;
}

/* ── HERO ────────────────────────────────────────────────────────── */
.hero {
  padding: clamp(56px, 12vw, 120px) 0 clamp(40px, 8vw, 80px);
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 0%, rgba(156, 123, 62, 0.11), transparent 42%),
    linear-gradient(to bottom, transparent, rgba(156, 123, 62, 0.03));
  pointer-events: none;
}
.mark {
  width: clamp(72px, 12vw, 96px);
  height: clamp(72px, 12vw, 96px);
  margin: 0 auto 32px;
  display: block;
  /* The icon already has a paper-cream background that matches */
  background: transparent;
}
/*
 * Hero on-load stagger.
 *
 * Each element in the hero shares one fade-up keyframe (`heroRise`)
 * and varies only its `animation-delay`. Reading top-to-bottom on the
 * page corresponds to the order of reveal, so the visual hierarchy
 * matches the time hierarchy. The pace is intentionally slower than
 * a typical SaaS hero — closer to turning a page than a swipe.
 */
@keyframes heroRise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.mark            { animation: heroRise 900ms cubic-bezier(0.2, 0.7, 0.2, 1) 0ms both; }
.arabic-flourish {
  font-family: 'Reem Kufi', system-ui, sans-serif;
  font-size: clamp(28px, 4.5vw, 36px);
  font-weight: 500;
  color: var(--accent);
  margin: 0 0 24px;
  line-height: 1;
  direction: rtl;
  unicode-bidi: isolate;
  animation: heroRise 900ms cubic-bezier(0.2, 0.7, 0.2, 1) 150ms both;
}
.headline {
  font-size: var(--t-hero);
  font-weight: 400;
  letter-spacing: -0.015em;
  margin: 0 auto 28px;
  line-height: 1.1;
  max-width: 720px;
  color: var(--ink);
  animation: heroRise 900ms cubic-bezier(0.2, 0.7, 0.2, 1) 300ms both;
}
.vision {
  max-width: 520px;
  margin: 0 auto 48px;
  font-size: var(--t-lg);
  line-height: 1.5;
  color: var(--ink-soft);
  animation: heroRise 900ms cubic-bezier(0.2, 0.7, 0.2, 1) 450ms both;
}
.moment-strip    { animation: heroRise 900ms cubic-bezier(0.2, 0.7, 0.2, 1) 600ms both; }
.cta-row         { animation: heroRise 900ms cubic-bezier(0.2, 0.7, 0.2, 1) 750ms both; }
.promise         { animation: heroRise 900ms cubic-bezier(0.2, 0.7, 0.2, 1) 900ms both; }
.moment-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  max-width: 640px;
  margin: 0 auto 36px;
}
.moment-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: var(--elevated);
  color: var(--ink-soft);
  font-size: var(--t-caption);
  letter-spacing: 0.01em;
}

/* CTA buttons — Play / App Store badges */
.cta-row {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 0 0 32px;
}
.cta {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 12px 24px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 12px;
  min-width: 200px;
  /* Logical property — "start" flips to right-align under RTL automatically */
  text-align: start;
  transition: opacity 120ms ease, transform 120ms ease;
}
[dir="rtl"] .cta { align-items: flex-end; }
.cta:hover, .cta:focus-visible {
  color: var(--paper);
  opacity: 0.85;
  transform: translateY(-1px);
}
.cta:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
/* "Coming soon" variant — visually present so users know to expect
   both stores, but non-interactive (no hover lift, no pointer). */
.cta--soon {
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--ink-faint);
  cursor: default;
}
.cta--soon:hover, .cta--soon:focus-visible {
  color: var(--ink-soft);
  opacity: 1;
  transform: none;
}
.cta__line1 {
  font-size: 11px;
  letter-spacing: 0.04em;
  opacity: 0.7;
  line-height: 1.2;
}
.cta__line2 {
  font-size: 18px;
  font-weight: 500;
  line-height: 1.2;
  margin-top: 2px;
}

.promise {
  font-size: var(--t-caption);
  color: var(--ink-muted);
  margin: 0;
}

/* ── PRINCIPLES ──────────────────────────────────────────────────── */
.principles {
  padding: var(--gap-section) 0;
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  background: var(--paper-recess);
}
.principle-list li {
  font-size: clamp(22px, 4vw, 28px);
  font-weight: 400;
  line-height: 1.4;
  color: var(--ink);
  padding: 18px 0;
  border-bottom: 1px solid var(--hairline);
}
.principle-list li:last-child { border-bottom: none; }

/* ── THE LOOP ────────────────────────────────────────────────────── */
.loop {
  padding: var(--gap-section) 0;
  text-align: center;
}
.loop-line {
  max-width: 720px;
  margin: 0 auto 18px;
  font-size: clamp(24px, 4vw, 34px);
  line-height: 1.35;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-weight: 400;
}
.loop-body {
  font-size: var(--t-caption);
  color: var(--ink-muted);
  margin: 0;
  letter-spacing: 0.01em;
}

/* ── SUMMARY (Inside / For / From — 3 columns) ──────────────────── */
.summary {
  padding: var(--gap-section) 0;
  border-top: 1px solid var(--hairline);
}
.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(32px, 5vw, 64px);
  align-items: start;
}
.summary-col .eyebrow {
  margin-bottom: 20px;
}
.summary-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.summary-list li {
  font-size: var(--t-body);
  line-height: 1.5;
  color: var(--ink-soft);
  padding: 10px 0;
  border-bottom: 1px solid var(--hairline);
}
.summary-list li:last-child { border-bottom: none; }
.summary-body {
  font-size: var(--t-body);
  line-height: 1.6;
  color: var(--ink-soft);
  margin: 0;
}
.summary-body em {
  font-style: italic;
  color: var(--ink);
}
/* Stack the 3 columns at narrow widths so each gets full breathing
   room. The 720px breakpoint matches the preview grid's mobile flip
   so the page collapses in one consistent step. */
@media (max-width: 720px) {
  .summary-grid {
    grid-template-columns: 1fr;
    gap: 48px;
  }
}

/* ── FOOTER ──────────────────────────────────────────────────────── */
.site-footer {
  padding: 48px 0 64px;
  border-top: 1px solid var(--hairline);
  text-align: center;
  background: var(--paper-recess);
}
.site-footer p {
  margin: 0 0 8px;
  font-size: var(--t-caption);
  color: var(--ink-muted);
}
.site-footer a {
  color: var(--ink-muted);
  border-bottom: 1px solid var(--hairline);
}
.site-footer a:hover { color: var(--ink); border-bottom-color: var(--ink-muted); }
.footer-quiet { color: var(--ink-faint); }

/* ── Scroll-reveal motion ────────────────────────────────────────── */
/*
 * Elements with .reveal start invisible and gently rise into view when
 * an IntersectionObserver adds .is-visible (see the inline <script>
 * at the bottom of index.html). Two principles:
 *   - the move is *with* the reader's scroll, never against it
 *   - everything is restored to its natural position before the
 *     element matters — no "halfway in" intermediate state lingers
 *
 * Stagger is done via --reveal-delay set inline on the element, so
 * a single CSS rule serves the whole page.
 */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition:
    opacity 700ms cubic-bezier(0.2, 0.7, 0.2, 1),
    transform 700ms cubic-bezier(0.2, 0.7, 0.2, 1);
  transition-delay: var(--reveal-delay, 0ms);
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}
/* If JS is disabled or the observer never fires (rare), the content
   must still be readable. This selector forces visibility once the
   document is fully loaded, regardless. */
.js-no-motion .reveal {
  opacity: 1;
  transform: none;
  transition: none;
}

/* ── Smooth anchor scroll (for future in-page links) ────────────── */
html { scroll-behavior: smooth; }

/* ── Reduced motion respects ────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; }
}
