/* ==========================================================================
   Masar Alburhan — design system
   One file, no build step. Driven entirely by the custom properties below.
   Logical properties throughout, so RTL falls out of dir="rtl" on <html>.

   RADIUS RULE (keep it consistent):
     --r-pill   pills, badges, language toggle only
     --r-btn    anything you click: buttons, nav pills, inputs
     --r-card   content containers: cards, bento cells
     --r-panel  large surfaces: hero art panel, hero bottom curve
   ========================================================================== */

/* --- Tokens: light (default) ---------------------------------------------- */
:root {
  /* Brand. Preserved from the app so the site and the product match. */
  --navy: #1a2b48;
  --navy-700: #24365a;
  --navy-900: #12203a;
  --amber: #f4b400;
  --amber-600: #d99e00;
  /* Amber is unreadable as text on light surfaces (1.9:1). This is the
     amber-family ink used whenever the accent has to carry words. */
  --amber-ink: #8a6100;

  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #eef1f6;
  --ink: #16233c;
  --ink-2: #4a5875; /* 7.2:1 on white */
  --ink-3: #616e8c; /* 5.4:1 on white */
  --border: #e3e7ee;
  --border-strong: #cdd4e0;

  --header-bg: rgba(247, 248, 250, 0.88);
  --focus-ring: var(--navy);
  --shadow-sm: 0 1px 2px rgba(18, 32, 58, 0.05), 0 2px 8px rgba(18, 32, 58, 0.05);
  --shadow-md: 0 12px 32px rgba(18, 32, 58, 0.1);

  --r-pill: 999px;
  --r-btn: 12px;
  --r-card: 18px;
  --r-panel: 28px;

  --maxw: 1120px;
  --gutter: 24px;
  --section-y: clamp(56px, 4vw + 38px, 88px);

  --fs-display: clamp(2rem, 1.35rem + 2.7vw, 3.05rem);
  --fs-h2: clamp(1.45rem, 1.2rem + 1.2vw, 2rem);
  --fs-h3: 1.1rem;
  --fs-lead: clamp(1.02rem, 0.98rem + 0.3vw, 1.14rem);
  --fs-sm: 0.9rem;
  --fs-xs: 0.8rem;

  /* One family covers Latin and Arabic, so the two locales share a vertical
     rhythm and the page needs a single font request. */
  --font: "IBM Plex Sans Arabic", ui-sans-serif, system-ui, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans Arabic", sans-serif;
}

/* --- Tokens: dark ---------------------------------------------------------- */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1728;
    --surface: #16223a;
    --surface-2: #1c2a45;
    --ink: #eef1f7;
    --ink-2: #b6c0d4; /* 8.9:1 on --surface */
    --ink-3: #93a0ba; /* 5.9:1 on --surface */
    --border: #26344f;
    --border-strong: #35455f;

    --header-bg: rgba(14, 23, 40, 0.88);
    --amber-ink: #f2bf45;
    --focus-ring: var(--amber);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3), 0 2px 8px rgba(0, 0, 0, 0.22);
    --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.38);
  }

  /* Header goes dark here, so the navy wordmark needs a plate to stay legible. */
  .brand-logo {
    background: #fff;
    border-radius: 7px;
    padding: 2px 5px;
  }
}

/* --- Base ------------------------------------------------------------------ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  /* Anchor targets clear the sticky header instead of hiding under it. */
  scroll-padding-block-start: 88px;
  -webkit-text-size-adjust: 100%;
}

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

a {
  color: inherit;
  text-decoration: none;
}

img,
svg {
  display: block;
  max-width: 100%;
}

/* Every interactive element gets a visible ring. The token flips per theme so
   the ring stays high-contrast in both; surfaces on navy override it to white. */
:where(a, button, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
  border-radius: var(--r-btn);
}

.skip-link {
  position: absolute;
  inset-inline-start: var(--gutter);
  inset-block-start: -100px;
  z-index: 100;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-btn);
  padding: 12px 18px;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  transition: inset-block-start 0.15s ease;
}
.skip-link:focus-visible {
  inset-block-start: 12px;
}

.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section {
  padding-block: var(--section-y);
}

/* --- Header ---------------------------------------------------------------- */
.header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--header-bg);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
/* Blur is decoration, not structure: fall back to an opaque bar where the
   user has asked for less transparency or the browser has no backdrop-filter. */
@supports not (backdrop-filter: blur(12px)) {
  .header {
    background: var(--bg);
  }
}
@media (prefers-reduced-transparency: reduce) {
  .header {
    background: var(--bg);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 68px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.brand-logo {
  height: 34px;
  width: auto;
}
.brand-name {
  font-weight: 700;
  font-size: 1.08rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  white-space: nowrap;
}

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-inline-start: auto;
}
.nav a {
  padding: 8px 12px;
  border-radius: var(--r-btn);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--ink-2);
  white-space: nowrap;
  transition: color 0.15s ease, background 0.15s ease;
}
.nav a:hover {
  color: var(--ink);
  background: var(--surface-2);
}
.nav a[aria-current="page"] {
  color: var(--ink);
  font-weight: 600;
}

.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  background: var(--surface-2);
  border-radius: var(--r-pill);
  flex-shrink: 0;
}
/* Language is named in its own language. Flags mark countries, not languages,
   and the previous 🇬🇧/🇮🇶 pair rendered inconsistently on Android. */
.lang-pill {
  display: inline-flex;
  align-items: center;
  border-radius: var(--r-pill);
  padding: 5px 13px;
  font-family: inherit;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--ink-2);
  white-space: nowrap;
  transition: color 0.15s ease, background 0.15s ease;
}
.lang-pill:hover {
  color: var(--ink);
}
.lang-pill--active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  cursor: default;
}

/* --- Buttons --------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.97rem;
  line-height: 1.2;
  padding: 13px 22px;
  border-radius: var(--r-btn);
  border: 1.5px solid transparent;
  cursor: pointer;
  white-space: nowrap; /* a wrapped CTA label is a broken CTA */
  transition: transform 0.12s ease, background 0.15s ease,
    border-color 0.15s ease, box-shadow 0.15s ease;
}
.btn:active {
  transform: translateY(1px);
}

/* Amber on navy ink: 9.4:1. The one accent on the page, used identically
   everywhere it appears. */
.btn--primary {
  background: var(--amber);
  color: var(--navy-900);
}
.btn--primary:hover {
  background: var(--amber-600);
}

.btn--outline {
  background: transparent;
  color: var(--ink);
  border-color: var(--border-strong);
}
.btn--outline:hover {
  background: var(--surface-2);
  border-color: var(--ink-3);
}

/* --- Surfaces on navy ------------------------------------------------------ */
.on-navy {
  background: var(--navy);
  color: #fff;
}
/* The hero is a navy surface too, so it takes the same treatment. Without
   this, .btn--outline resolves to dark ink and vanishes on the hero in light
   mode. */
.on-navy :focus-visible,
.hero :focus-visible {
  outline-color: #fff;
}
.on-navy .btn--outline,
.hero .btn--outline {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.42);
}
.on-navy .btn--outline:hover,
.hero .btn--outline:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.7);
}

/* --- Hero ------------------------------------------------------------------ */
.hero {
  background: radial-gradient(
    120% 130% at 12% 0%,
    var(--navy-700) 0%,
    var(--navy) 58%
  );
  color: #fff;
  padding-block: clamp(44px, 3vw + 32px, 72px) clamp(56px, 4vw + 40px, 84px);
  border-end-start-radius: var(--r-panel);
  border-end-end-radius: var(--r-panel);
}

.hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  align-items: center;
  gap: clamp(28px, 4vw, 56px);
}

.badge {
  display: inline-block;
  background: rgba(244, 180, 0, 0.16);
  color: #ffd35e; /* 10.2:1 on --navy */
  border: 1px solid rgba(244, 180, 0, 0.42);
  font-weight: 600;
  font-size: var(--fs-xs);
  letter-spacing: 0.02em;
  padding: 5px 13px;
  border-radius: var(--r-pill);
  margin-bottom: 18px;
}

.hero-title {
  font-size: var(--fs-display);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin: 0 0 16px;
  text-wrap: balance;
}

.hero-desc {
  max-width: 46ch;
  color: rgba(255, 255, 255, 0.84);
  font-size: var(--fs-lead);
  margin: 0 0 28px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* Brand panel. Replace the logo with a real app screenshot when one exists;
   see the note in index.html. */
.hero-art {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  border-radius: var(--r-panel);
  background: linear-gradient(
      160deg,
      rgba(255, 255, 255, 0.12),
      rgba(255, 255, 255, 0.02)
    ),
    rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
  padding: 24px;
}
/* The logo is a transparent PNG whose wordmark is navy, so it needs a light
   plate anywhere the surface is dark. Same reason the footer logo has one. */
.hero-art picture {
  display: block;
  width: min(74%, 290px);
  background: #fff;
  border-radius: var(--r-card);
  padding: clamp(16px, 2.4vw, 24px) clamp(22px, 3.4vw, 34px);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.3);
}
.hero-art img {
  width: 100%;
  height: auto;
}

/* --- Section headings ------------------------------------------------------ */
.section-head {
  max-width: 60ch;
  margin-bottom: clamp(28px, 3vw, 44px);
}
.section-title {
  font-size: var(--fs-h2);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin: 0;
  text-wrap: balance;
}
.section-sub {
  color: var(--ink-2);
  font-size: var(--fs-lead);
  margin: 12px 0 0;
}

/* --- Steps rail ------------------------------------------------------------ */
.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(20px, 3vw, 40px);
}
.step {
  position: relative;
  padding-block-start: 26px;
  border-block-start: 2px solid var(--border-strong);
}
/* The rail marker carries the sequence, so the copy does not need to say
   "step one". */
.step::before {
  content: "";
  position: absolute;
  inset-block-start: -7px;
  inset-inline-start: 0;
  width: 12px;
  height: 12px;
  border-radius: var(--r-pill);
  background: var(--amber);
  border: 2px solid var(--bg);
}
.step-title {
  font-size: var(--fs-h3);
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 6px;
}
.step-text {
  color: var(--ink-2);
  font-size: var(--fs-sm);
  margin: 0;
}

/* --- Feature bento --------------------------------------------------------- */
.bento {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 16px;
}
.cell {
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  background: var(--surface);
  padding: 24px 22px;
  grid-column: span 2;
}
/* Exactly four items, four cells: one wide lead, three supporting. */
.cell--lead {
  grid-column: span 6;
  padding: clamp(26px, 3.4vw, 40px);
  background: linear-gradient(150deg, var(--navy-700), var(--navy));
  border-color: transparent;
  color: #fff;
}
.cell--lead .feature-title {
  color: #fff;
  font-size: calc(var(--fs-h3) * 1.3);
}
.cell--lead .feature-text {
  color: rgba(255, 255, 255, 0.84);
  font-size: var(--fs-lead);
  max-width: 52ch;
}
.cell--lead .feature-icon {
  background: rgba(255, 255, 255, 0.14);
  color: var(--amber);
}
.cell--lead :focus-visible {
  outline-color: #fff;
}
.cell--tinted {
  background: linear-gradient(
    170deg,
    rgba(244, 180, 0, 0.14),
    rgba(244, 180, 0, 0.04)
  );
  border-color: rgba(244, 180, 0, 0.28);
}

.feature-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--r-btn);
  background: var(--surface-2);
  color: var(--amber-ink);
  display: grid;
  place-items: center;
  margin-bottom: 16px;
}
.feature-icon svg {
  width: 22px;
  height: 22px;
}
.feature-title {
  font-size: var(--fs-h3);
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 8px;
}
.feature-text {
  color: var(--ink-2);
  font-size: var(--fs-sm);
  margin: 0;
}

/* --- Trust band ------------------------------------------------------------ */
.trust {
  padding: clamp(26px, 4vw, 52px);
  border-radius: var(--r-panel);
}
.trust-inner {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: clamp(28px, 4vw, 56px);
  align-items: start;
}
.trust-title {
  font-size: var(--fs-h2);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.015em;
  margin: 0 0 14px;
  text-wrap: balance;
}
.trust-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: var(--fs-sm);
  color: #ffd35e;
  border-bottom: 1px solid rgba(255, 211, 94, 0.4);
  padding-bottom: 2px;
}
.trust-link:hover {
  border-bottom-color: #ffd35e;
}
.trust-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.trust-item {
  padding-block: 18px;
  border-block-start: 1px solid rgba(255, 255, 255, 0.16);
}
.trust-item:first-child {
  border-block-start: 0;
  padding-block-start: 0;
}
.trust-item:last-child {
  padding-block-end: 0;
}
.trust-item h3 {
  font-size: var(--fs-h3);
  font-weight: 700;
  margin: 0 0 5px;
}
.trust-item p {
  color: rgba(255, 255, 255, 0.78);
  font-size: var(--fs-sm);
  margin: 0;
  max-width: 58ch;
}

/* --- Support --------------------------------------------------------------- */
.support-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-sm);
  padding: clamp(28px, 4vw, 48px);
  max-width: 760px;
  margin-inline: auto;
  text-align: center;
}
.support-text {
  color: var(--ink-2);
  max-width: 56ch;
  margin: 14px auto 26px;
}
.support-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}
.support-contacts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 28px;
  justify-content: center;
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.support-link {
  color: var(--ink-2);
  font-weight: 600;
  font-size: var(--fs-sm);
  border-radius: 4px;
}
.support-link:hover {
  color: var(--amber-ink);
}

/* --- Legal pages ----------------------------------------------------------- */
.legal-page {
  max-width: 860px;
  margin-inline: auto;
}
.back-link {
  display: inline-block;
  color: var(--ink-2);
  font-weight: 600;
  font-size: var(--fs-sm);
  margin-bottom: 20px;
  border-radius: 4px;
}
.back-link:hover {
  color: var(--ink);
}
.legal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-sm);
  padding: clamp(26px, 4vw, 48px);
}
.legal-card > .section-title {
  font-size: clamp(1.7rem, 1.3rem + 1.6vw, 2.35rem);
}
.legal-updated {
  color: var(--ink-3);
  font-size: var(--fs-sm);
  margin: 8px 0 22px;
}
.legal-intro {
  color: var(--ink);
  font-size: var(--fs-lead);
  margin: 0;
}

/* On-page contents. The privacy URL is the app-store listing link, so it is
   the most-visited page on the site and needs to be navigable. */
.legal-toc {
  margin-block: 28px 8px;
  padding: 20px 22px;
  background: var(--surface-2);
  border-radius: var(--r-card);
}
.legal-toc h2 {
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 12px;
}
.legal-toc ol {
  margin: 0;
  padding-inline-start: 20px;
  columns: 2;
  column-gap: 28px;
  font-size: var(--fs-sm);
}
.legal-toc li {
  margin-bottom: 6px;
  break-inside: avoid;
}
.legal-toc a {
  color: var(--ink-2);
  font-weight: 500;
  border-radius: 4px;
}
.legal-toc a:hover {
  color: var(--amber-ink);
  text-decoration: underline;
}

.legal-list {
  margin: 28px 0 0;
  padding-inline-start: 22px;
}
.legal-item {
  margin-bottom: 26px;
}
.legal-item:last-child {
  margin-bottom: 0;
}
.legal-item::marker {
  color: var(--amber-ink);
  font-weight: 700;
}
.legal-heading {
  font-size: var(--fs-h3);
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 8px;
  line-height: 1.35;
}
.legal-body {
  color: var(--ink-2);
  margin: 0 0 10px;
}
.legal-body:last-child {
  margin-bottom: 0;
}

/* --- Footer ---------------------------------------------------------------- */
.footer {
  background: var(--navy-900);
  color: rgba(255, 255, 255, 0.72);
  padding-block: 36px;
}
.footer :focus-visible {
  outline-color: #fff;
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px 28px;
  flex-wrap: wrap;
}
.footer-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}
.footer-logo {
  height: 44px;
  width: auto;
  background: #fff;
  border-radius: var(--r-btn);
  padding: 6px;
}
.footer-name {
  font-weight: 700;
  color: #fff;
  font-size: 1.02rem;
}
.footer-tagline {
  font-size: var(--fs-sm);
  color: rgba(255, 255, 255, 0.66);
  max-width: 34ch;
}
.footer-nav {
  display: flex;
  gap: 8px;
  font-weight: 600;
  font-size: var(--fs-sm);
  flex-wrap: wrap;
}
.footer-nav a {
  color: rgba(255, 255, 255, 0.86);
  padding: 6px 10px;
  border-radius: var(--r-btn);
}
.footer-nav a:hover {
  color: var(--amber);
  background: rgba(255, 255, 255, 0.08);
}
.footer-copy {
  font-size: var(--fs-sm);
  color: rgba(255, 255, 255, 0.6);
  flex-basis: 100%;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

/* --- Responsive ------------------------------------------------------------ */
@media (max-width: 900px) {
  .hero-inner {
    grid-template-columns: 1fr;
  }
  /* Copy leads on narrow screens: with the panel on top, the headline and the
     primary CTA got pushed to the bottom edge of the fold. */
  .hero-art {
    aspect-ratio: 16 / 9;
    max-width: 420px;
    margin-inline: auto;
  }
  .hero-art picture {
    width: min(60%, 220px);
  }
  .hero-desc {
    max-width: none;
  }
  .cell--lead {
    grid-template-columns: 1fr;
  }
  .trust-inner {
    grid-template-columns: 1fr;
  }
  .steps {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .step {
    padding-block: 22px 24px;
  }
  .cell,
  .cell--lead {
    grid-column: span 6;
  }
}

@media (max-width: 720px) {
  :root {
    --gutter: 18px;
  }
  /* The nav used to be display:none below 860px with nothing in its place,
     which made About and Support unreachable on the phones that are most of
     the audience. It now wraps to a scrollable second row: four links do not
     justify a menu the user has to open. */
  .header-inner {
    flex-wrap: wrap;
    gap: 10px 12px;
    padding-block: 10px;
    min-height: 0;
  }
  .lang-toggle {
    margin-inline-start: auto;
  }
  .nav {
    order: 3;
    flex-basis: 100%;
    margin-inline-start: 0;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 2px;
  }
  .nav::-webkit-scrollbar {
    display: none;
  }
  .nav a {
    background: var(--surface-2);
    padding: 11px 16px; /* keeps the tap target at 44px+ */
  }
  html {
    scroll-padding-block-start: 128px;
  }
  .legal-toc ol {
    columns: 1;
  }
  .footer-inner {
    justify-content: flex-start;
  }
  .btn {
    flex: 1 1 auto;
  }
}

@media (max-width: 380px) {
  .brand-name {
    display: none;
  }
}

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

/* --- Print: legal pages get read and filed -------------------------------- */
@media print {
  .header,
  .footer,
  .back-link,
  .legal-toc,
  .skip-link {
    display: none;
  }
  body {
    background: #fff;
    color: #000;
  }
  .legal-card {
    border: 0;
    box-shadow: none;
    padding: 0;
  }
}
