/* ==========================================================================
   onebase. v7
   Simplicity + WhatsApp hero -> 3-way contrast + pain/fix -> Instant-sync
   sticky-phone story -> Warm-Stone early access.
   Two families (IBM Plex Sans / Arabic), three body sizes below the hero.
   ========================================================================== */

:root {
  --white: #FFFFFF;
  --canvas: #F3F4EF;
  --surface-subtle: #F8F9F5;
  --line: #E5E7E0;
  --line-strong: #D0D5CB;

  --ink: #0F1A15;
  --ink-2: #38433D;
  --muted: #55605A;

  --brand: #0E3B2E;
  --brand-mid: #14563F;
  --brand-deep: #09281F;
  --mint: #2EE59D;
  --mint-hover: #52EEA9;
  --mint-ink: #072219;
  --on-brand: #FFFFFF;
  --on-brand-muted: #C9DCD3;
  --brand-rule: rgba(255, 255, 255, 0.14);

  --inflow-ink: #076D43;
  --inflow-bg: #E6F5EC;
  --due: #B4234E;

  --font-en: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-ar: "IBM Plex Sans Arabic", "IBM Plex Sans", -apple-system, BlinkMacSystemFont, sans-serif;

  --text-heading: clamp(1.9rem, 3vw, 2.6rem);
  --text-body: 1.0625rem;
  --text-sm: 0.875rem;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --header-h: 68px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  scroll-behavior: smooth;
  background: var(--brand);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  background: var(--white);
  color: var(--ink);
  font-family: var(--font-en);
  font-size: var(--text-body);
  line-height: 1.6;
  overflow-x: clip;
  font-variant-numeric: tabular-nums lining-nums;
}

[dir="rtl"] body { font-family: var(--font-ar); line-height: 1.72; }

h1, h2, h3, h4 { margin: 0; font-weight: 700; text-wrap: balance; }
p { margin: 0; }
img { display: block; max-width: 100%; height: auto; }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2.5px solid var(--mint); outline-offset: 2px; }
section[id] { scroll-margin-top: var(--header-h); }

.container { width: min(1180px, 100%); margin-inline: auto; padding-inline: 28px; }

.skip-link {
  position: absolute; inset-block-start: -52px; inset-inline-start: 16px; z-index: 200;
  padding: 10px 16px; border-radius: 10px; background: var(--mint); color: var(--mint-ink);
  font-size: var(--text-sm); font-weight: 600; transition: inset-block-start 160ms var(--ease);
}
.skip-link:focus { inset-block-start: 12px; }

.brand-wordmark {
  direction: ltr; unicode-bidi: isolate; font-family: var(--font-en);
  font-weight: 700; letter-spacing: -0.03em; line-height: 1; display: inline-flex; align-items: baseline;
}
.brand-wordmark .dot { color: var(--mint); }

/* ---------------------------------------------------------------- Header */
.site-header {
  position: fixed; inset-block-start: 0; inset-inline: 0; z-index: 80;
  background: transparent; border-block-end: 1px solid transparent;
  transition: background-color 200ms var(--ease), border-color 200ms var(--ease);
}
.site-header--scrolled {
  background: var(--white);
  border-block-end-color: var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: var(--header-h); }
.brand-lockup { display: inline-flex; align-items: center; gap: 10px; direction: ltr; flex-shrink: 0; }
.brand-badge {
  width: 34px; height: 34px; border-radius: 9px; overflow: hidden; background: var(--brand-mid);
  border: 1px solid rgba(255, 255, 255, 0.16); display: inline-flex;
  transition: border-color 200ms var(--ease);
}
.site-header--scrolled .brand-badge { background: var(--brand); border-color: transparent; }
.brand-badge img { width: 34px; height: 34px; object-fit: cover; transform: scale(1.36); }
.site-header .brand-wordmark { font-size: 1.5rem; color: var(--on-brand); transition: color 200ms var(--ease); }
.site-header--scrolled .brand-wordmark { color: var(--ink); }

.nav-links { display: flex; gap: 32px; }
.nav-link { font-size: var(--text-sm); font-weight: 500; color: rgba(255, 255, 255, 0.82); transition: color 160ms var(--ease); }
.nav-link:hover { color: var(--on-brand); }
.site-header--scrolled .nav-link { color: var(--muted); }
.site-header--scrolled .nav-link:hover { color: var(--ink); }

.header-actions { display: flex; align-items: center; gap: 10px; }
.lang-btn {
  min-height: 36px; padding-inline: 14px; border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.26); background: rgba(255, 255, 255, 0.08);
  color: var(--on-brand); font-size: var(--text-sm); font-weight: 600; cursor: pointer;
  transition: background-color 160ms var(--ease), border-color 160ms var(--ease), color 160ms var(--ease);
}
.lang-btn:hover { background: rgba(255, 255, 255, 0.16); border-color: rgba(255, 255, 255, 0.44); }
.site-header--scrolled .lang-btn {
  border-color: var(--line-strong); background: var(--surface-subtle); color: var(--ink);
}
.site-header--scrolled .lang-btn:hover { border-color: var(--brand); background: var(--white); }

.header-cta {
  display: inline-flex; align-items: center; min-height: 36px; padding-inline: 18px; border-radius: 999px;
  background: var(--mint); color: var(--mint-ink); font-size: var(--text-sm); font-weight: 600;
  transition: background-color 160ms var(--ease), color 160ms var(--ease);
}
.header-cta:hover { background: var(--mint-hover); }
.site-header--scrolled .header-cta { background: var(--brand); color: var(--on-brand); }
.site-header--scrolled .header-cta:hover { background: var(--brand-mid); }

/* ---------------------------------------------------------------- Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding-inline: 24px;
  border-radius: 14px; border: 1.5px solid transparent; font-size: var(--text-body); font-weight: 600; cursor: pointer;
  transition: background-color 160ms var(--ease), border-color 160ms var(--ease), transform 140ms var(--ease);
}
.btn:active { transform: scale(0.985); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn--mint { background: var(--mint); color: var(--mint-ink); }
.btn--mint:hover { background: var(--mint-hover); }
.btn--ghost-light {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.28);
  color: var(--on-brand);
}
.btn--ghost-light:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.48);
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.btn--brand { background: var(--brand); color: var(--on-brand); }
.btn--brand:hover { background: var(--brand-mid); }
.btn--outline { background: var(--white); border-color: var(--line-strong); color: var(--ink); }
.btn--outline:hover { border-color: var(--brand); }
.btn--full { width: 100%; }

/* ---------------------------------------------------------------- Phone frame */
.phone-frame {
  appearance: none; display: block; width: 100%; padding: 8px; border-radius: 36px;
  border: 1px solid rgba(255, 255, 255, 0.14); background: #101A16; cursor: zoom-in; text-align: start;
  box-shadow: 0 28px 64px -22px rgba(4, 16, 12, 0.62), 0 8px 20px -10px rgba(4, 16, 12, 0.35);
  transition: transform 220ms var(--ease), box-shadow 220ms var(--ease);
}
.phone-frame:hover { transform: translateY(-4px); }
.phone-screen { display: block; position: relative; overflow: hidden; border-radius: 29px; background: var(--canvas); }
.phone-status-bar {
  display: block; position: relative; z-index: 2; height: 26px;
  direction: ltr; unicode-bidi: isolate;
  background: var(--canvas); color: var(--ink);
  transition: background-color 160ms var(--ease), color 160ms var(--ease);
}
.status-svg { display: block; width: 100%; height: 100%; }
.phone-screen > img { width: 100%; height: auto; margin-block-start: -2px; }
.phone-frame[data-top="sheet"] .phone-screen > img,
.story-frame[data-top="sheet"] .story-stack img.is-sheet { transform: scale(1.012); }
.phone-frame[data-top="sheet"] .phone-screen > img { margin-block-start: -4px; }
.story-stack img.is-sheet { top: -4px; }

.phone-frame[data-top="sheet"] .phone-status-bar,
.phone-frame[data-top="sheet"] .phone-screen { background: #AAB9B1; }
.phone-frame[data-top="dark"] .phone-status-bar,
.phone-frame[data-top="dark"] .phone-screen { background: #1C6B50; }
.phone-frame[data-top="dark"] .phone-status-bar { color: var(--on-brand); }
.phone-frame[data-top="manual"] .phone-status-bar,
.phone-frame[data-top="manual"] .phone-screen { background: #898F8A; }

/* ---------------------------------------------------------------- Hero */
.hero {
  background-color: var(--brand);
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.032) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.032) 1px, transparent 1px);
  background-size: 64px 64px;
  color: var(--on-brand);
  padding-block: calc(var(--header-h) + 52px) 76px;
}
.hero-head { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 22px; }
.hero-title {
  font-size: clamp(2.6rem, 5.2vw, 4.35rem); line-height: 1.03; letter-spacing: -0.04em;
  color: var(--on-brand); max-width: 17ch;
}
[dir="rtl"] .hero-title { font-size: clamp(2.3rem, 4.4vw, 3.8rem); line-height: 1.22; letter-spacing: 0; max-width: 18ch; }
.hero-sub { font-size: var(--text-body); color: var(--on-brand-muted); max-width: 56ch; }

.hero-triad {
  margin-block-start: 56px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 28px;
}
.triad-item {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: clamp(190px, 21vw, 244px);
  margin-block-start: 34px;
  flex-shrink: 0;
}
.triad-item--center {
  width: clamp(214px, 24vw, 276px);
  margin-block-start: 0;
}
.triad-item .phone-frame { padding: 7px; border-radius: 32px; }
.triad-item .phone-screen { border-radius: 26px; }
.triad-item .phone-status-bar { height: 24px; }
.triad-item figcaption {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--on-brand-muted);
  text-align: center;
}
.triad-item--center figcaption { color: var(--on-brand); }

/* ---------------------------------------------------------------- Problem + Compare */
.problem {
  background: var(--white);
  color: var(--ink);
  padding-block: 104px;
}
.problem-head {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 720px;
  margin-block-end: 40px;
}
.section-title { font-size: var(--text-heading); line-height: 1.1; letter-spacing: -0.028em; color: var(--ink); max-width: 20ch; }
[dir="rtl"] .section-title { line-height: 1.3; letter-spacing: 0; }
.section-title--light { color: var(--on-brand); }
.body-muted { color: var(--ink-2); max-width: 58ch; }

.compare-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin-block-end: 72px;
}
.compare-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 26px 24px;
  border-radius: 18px;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
}
.compare-card--featured {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--on-brand);
}
.compare-tag {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--muted);
}
.compare-card--featured .compare-tag { color: var(--mint); }
.compare-title {
  font-size: var(--text-body);
  font-weight: 700;
  color: var(--ink);
}
.compare-card--featured .compare-title {
  color: var(--on-brand);
  direction: ltr;
  unicode-bidi: isolate;
  align-self: flex-start;
}
.compare-body {
  font-size: var(--text-sm);
  color: var(--ink-2);
  line-height: 1.6;
}
.compare-card--featured .compare-body { color: var(--on-brand-muted); }

.pain-block { display: flex; flex-direction: column; }
.pain-heading {
  font-size: var(--text-heading);
  line-height: 1.12;
  letter-spacing: -0.026em;
  color: var(--ink);
  margin-block-end: 28px;
}
[dir="rtl"] .pain-heading { line-height: 1.3; letter-spacing: 0; }

.pain-table {
  border-block-start: 1.5px solid var(--ink);
}
.pain-labels {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 48px;
  padding-block: 14px;
  border-block-end: 1px solid var(--line-strong);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--muted);
}
.pain-labels span:last-child { color: var(--brand); }

.pain-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.pain-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 48px;
  padding-block: 22px;
  border-block-end: 1px solid var(--line);
  align-items: baseline;
}
.pain-cell { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.pain-mobile-label { display: none; font-size: var(--text-sm); font-weight: 600; color: var(--muted); }
.pain-cell--after .pain-mobile-label { color: var(--brand); }
.pain-quote { color: var(--muted); font-weight: 500; }
.pain-fix { color: var(--ink); font-weight: 600; }

.problem-bridge {
  margin-block-start: 36px;
  font-weight: 600;
  color: var(--brand);
}

/* ---------------------------------------------------------------- Story */
.story { background: var(--brand-deep); color: var(--on-brand); padding-block: 56px 104px; }
.story-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 0.82fr); gap: 72px; }
.story-grid > * { min-width: 0; }
.story-head { display: flex; flex-direction: column; gap: 16px; padding-block: 40px 8px; }
.story-lead { color: var(--on-brand-muted); max-width: 46ch; }

.act-title { font-size: var(--text-sm); font-weight: 600; color: var(--mint); margin-block-end: 6px; }
.chapter {
  min-height: 54vh; display: flex; flex-direction: column; justify-content: center; gap: 14px;
  padding-block: 36px; opacity: 0.34; transition: opacity 160ms var(--ease);
}
.chapter--act-start { border-block-start: 1px solid var(--brand-rule); }
.chapter.is-active { opacity: 1; }
.chapter h4 { font-size: var(--text-heading); line-height: 1.12; letter-spacing: -0.026em; color: var(--on-brand); max-width: 18ch; }
[dir="rtl"] .chapter h4 { line-height: 1.32; letter-spacing: 0; }
.chapter p { color: var(--on-brand-muted); max-width: 44ch; }
.chapter-example {
  margin-block-start: 6px;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-inline-start: 3px solid var(--mint);
  max-width: 44ch;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.chapter-example-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--mint);
}
.chapter-example-text {
  font-size: var(--text-sm);
  color: var(--on-brand);
  line-height: 1.55;
}
.chapter-phone { display: none; }

.story-stage-col { position: relative; }
.story-stage {
  position: sticky; top: var(--header-h); height: calc(100vh - var(--header-h));
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
}
.story-frame { width: min(300px, calc((100vh - var(--header-h) - 120px) / 2.25)); }
.story-stack { display: block; position: relative; aspect-ratio: 786 / 1702; }
.story-stack img {
  position: absolute; inset-inline-start: 0; top: -2px; width: 100%; height: auto;
  opacity: 0; transition: opacity 150ms var(--ease);
}
.story-stack img.is-active { opacity: 1; }
.story-caption { display: flex; gap: 12px; font-size: var(--text-sm); color: var(--on-brand-muted); }
.story-caption strong { color: var(--on-brand); font-weight: 600; }

/* ---------------------------------------------------------------- Beta */
.cta { background: var(--canvas); padding-block: 96px; border-block-start: 1px solid var(--line); }
.cta-grid { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 64px; align-items: start; }
.cta-grid > * { min-width: 0; }
.cta-copy { display: flex; flex-direction: column; gap: 16px; padding-block-start: 8px; }
.form-panel { background: var(--white); border: 1px solid var(--line); border-radius: 20px; padding: 32px; }
.form-title { font-size: var(--text-body); margin-block-end: 18px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-block-end: 12px; }
.form-grid > * { min-width: 0; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: var(--text-sm); font-weight: 600; color: var(--ink-2); }
.field input, .field select {
  width: 100%; min-height: 46px; padding: 8px 12px; border-radius: 10px; border: 1.5px solid var(--line-strong);
  background: var(--surface-subtle); font-size: var(--text-body); color: var(--ink);
}
.field input:focus, .field select:focus { border-color: var(--brand); background: var(--white); }
.field input.is-error { border-color: var(--due); }
.field-error { display: block; min-height: 18px; font-size: var(--text-sm); font-weight: 600; color: var(--due); }
.form-success {
  display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 20px; border-radius: 14px;
  background: var(--inflow-bg); border: 1px solid #C3E7D2; color: var(--inflow-ink);
}

/* ---------------------------------------------------------------- Footer */
.site-footer { background: var(--white); border-block-start: 1px solid var(--line); padding-block: 30px; font-size: var(--text-sm); color: var(--muted); }
.footer-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.footer-mark { font-size: var(--text-body); color: var(--ink); }
.footer-lang {
  padding: 8px 16px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface-subtle);
  font-size: var(--text-sm); font-weight: 600; cursor: pointer; transition: border-color 160ms var(--ease);
}
.footer-lang:hover { border-color: var(--brand); }

/* ---------------------------------------------------------------- Lightbox */
.lightbox { position: fixed; inset: 0; z-index: 120; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(10, 24, 18, 0.9); }
.lightbox-dialog { width: min(440px, 100%); display: flex; flex-direction: column; gap: 12px; color: var(--on-brand); }
.lightbox-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.lightbox-bar strong { font-size: var(--text-sm); font-weight: 600; }
.lightbox-controls { display: flex; gap: 8px; }
.lightbox-btn {
  width: 40px; height: 40px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.08); color: var(--on-brand); display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background-color 160ms var(--ease);
}
.lightbox-btn:hover { background: rgba(255, 255, 255, 0.2); }
[dir="rtl"] #lb-prev svg, [dir="rtl"] #lb-next svg { transform: scaleX(-1); }
.lightbox-img-wrap { align-self: center; border-radius: 26px; overflow: hidden; border: 7px solid #101A16; background: var(--canvas); }
.lightbox-img-wrap img { max-height: 76vh; width: auto; }

/* ---------------------------------------------------------------- Responsive */
@media (max-width: 960px) {
  .compare-grid { grid-template-columns: 1fr; gap: 14px; margin-block-end: 56px; }
  .story-grid { grid-template-columns: 1fr; gap: 0; }
  .story-stage-col { display: none; }
  .chapter { min-height: 0; opacity: 1; padding-block: 36px; }
  .chapter-phone { display: block; width: min(280px, 76vw); margin: 12px auto 0; }
  .cta-grid { grid-template-columns: 1fr; gap: 36px; }
}

@media (max-width: 820px) {
  .nav-links { display: none; }
}

@media (max-width: 760px) {
  .hero-triad {
    justify-content: flex-start;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 16px;
    padding-inline: 16vw;
    margin-inline: -28px;
    padding-block-end: 6px;
    scrollbar-width: none;
  }
  .hero-triad::-webkit-scrollbar { display: none; }
  .triad-item,
  .triad-item--center {
    width: 68vw;
    margin-block-start: 0;
    scroll-snap-align: center;
  }

  .pain-labels { display: none; }
  .pain-row { grid-template-columns: 1fr; gap: 14px; padding-block: 20px; }
  .pain-mobile-label { display: block; }
}

@media (max-width: 640px) {
  .container { padding-inline: 18px; }
  .hero { padding-block: calc(var(--header-h) + 32px) 56px; }
  .hero-head .btn { width: 100%; }
  .hero-triad { margin-inline: -18px; margin-block-start: 40px; }
  .header-cta { display: none; }
  .problem, .cta { padding-block: 68px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-panel { padding: 22px 18px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
