/* ==========================================================================
   Balsam — sadeed.org
   Tokens are lifted from the app itself: colours from
   masar_mobile_app/lib/utils/app_color.dart and from the logo gradient.
   One stylesheet serves both LTR and RTL via CSS logical properties.
   ========================================================================== */

/* --- Fonts: self-hosted, woff2 only, split by script ---------------------- */

@font-face {
  font-family: "Readex Pro";
  font-style: normal;
  font-weight: 300 600;
  font-display: swap;
  src: url("../fonts/ReadexPro-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Readex Pro";
  font-style: normal;
  font-weight: 300 600;
  font-display: swap;
  src: url("../fonts/ReadexPro-arabic.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1,
    U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF,
    U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
  font-family: "Zain";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/Zain-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Zain";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/Zain-arabic.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1,
    U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF,
    U+FE70-FE74, U+FE76-FEFC;
}

/* --- Tokens --------------------------------------------------------------- */

:root {
  /* Surfaces — from AppColors.backGroundColor / profileOptionColor / borderColor */
  --ground: #fafeff;
  --surface: #f6f8ff;
  --line: #e4e7f2;

  /* Text — from AppColors.appColor / appTextColor */
  --ink: #111329;
  --ink-soft: #3a3c52;
  --muted: #6a6b80;

  /* Brand — sampled from the logo gradient, navy first (the wordmark) */
  --navy: #003a74;
  --azure: #085aa3;
  --teal: #07a29f;
  --teal-ink: #056f6d;
  --violet: #825ca1;
  --rose: #c45f97;
  --coral: #f87782;
  --peach: #fe967d;

  /* Coins — AppColors.orangeButton */
  --amber: #ffb21e;

  /* The logo arc, used exactly once per page */
  --arc: linear-gradient(
    90deg,
    var(--navy) 0%,
    var(--azure) 18%,
    var(--teal) 36%,
    var(--violet) 56%,
    var(--rose) 74%,
    var(--coral) 89%,
    var(--peach) 100%
  );

  /* Type */
  --display: "Zain", "Readex Pro", system-ui, sans-serif;
  --body: "Readex Pro", system-ui, -apple-system, "Segoe UI", sans-serif;

  --t-hero: clamp(2.125rem, 1.45rem + 3.2vw, 3.5rem);
  --t-h1: clamp(1.8rem, 1.35rem + 2.1vw, 2.6rem);
  --t-h2: clamp(1.2rem, 1.06rem + 0.7vw, 1.5rem);
  --t-h3: clamp(1.02rem, 0.97rem + 0.25vw, 1.14rem);
  --t-body: clamp(1rem, 0.975rem + 0.12vw, 1.0625rem);
  --t-small: 0.875rem;

  --lh-display: 1.16;
  --lh-body: 1.68;

  /* Rhythm */
  --gap: clamp(1.25rem, 0.9rem + 1.6vw, 2rem);
  --measure: 63ch;
  --page: 46rem;
  --radius: 14px;
}

/* Arabic is optically smaller than Latin at the same nominal size, and Readex's
   Arabic carries taller ascenders — so the RTL tree gets its own scale and
   leading rather than reusing the Latin one. */
html[lang="ar"] {
  --t-hero: clamp(2.3rem, 1.6rem + 3.4vw, 3.85rem);
  --t-h1: clamp(2rem, 1.5rem + 2.3vw, 2.9rem);
  --t-h2: clamp(1.34rem, 1.18rem + 0.8vw, 1.68rem);
  --t-h3: clamp(1.12rem, 1.06rem + 0.28vw, 1.26rem);
  --t-body: clamp(1.09rem, 1.06rem + 0.14vw, 1.16rem);
  --t-small: 0.95rem;
  --lh-display: 1.34;
  --lh-body: 1.95;
  --measure: 58ch;
}

/* --- Reset ---------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}
* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--ground);
  color: var(--ink);
  font-family: var(--body);
  font-size: var(--t-body);
  font-weight: 400;
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--azure);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
a:hover {
  color: var(--navy);
}

:focus-visible {
  outline: 3px solid var(--azure);
  outline-offset: 3px;
  border-radius: 3px;
}

/* --- Layout --------------------------------------------------------------- */

.wrap {
  inline-size: 100%;
  max-inline-size: var(--page);
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 0.9rem + 2vw, 2rem);
}

.skip {
  position: absolute;
  inset-block-start: -100vh;
  inset-inline-start: 0;
  background: var(--navy);
  color: #fff;
  padding: 0.7rem 1.1rem;
  z-index: 10;
  text-decoration: none;
}
.skip:focus {
  inset-block-start: 0;
  color: #fff;
}

/* --- Header --------------------------------------------------------------- */

.site-header {
  border-block-end: 1px solid var(--line);
  background: var(--ground);
}
.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.7rem var(--gap);
  padding-block: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--navy);
  margin-inline-end: auto;
}
.brand img {
  inline-size: 38px;
  block-size: auto;
}
.brand b {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.4rem;
  line-height: 1;
  letter-spacing: 0.01em;
}
html[lang="ar"] .brand b {
  font-size: 1.65rem;
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.15rem;
  list-style: none;
  padding: 0;
}
.site-nav a {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: var(--t-small);
  font-weight: 500;
  padding-block: 0.15rem;
  border-block-end: 2px solid transparent;
}
.site-nav a:hover {
  color: var(--navy);
  border-block-end-color: var(--line);
}
.site-nav a[aria-current="page"] {
  color: var(--navy);
  border-block-end-color: var(--navy);
}

.lang-switch {
  font-size: var(--t-small);
  color: var(--muted);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.2rem 0.75rem;
  white-space: nowrap;
}
.lang-switch:hover {
  border-color: var(--navy);
  color: var(--navy);
}

/* --- Main ----------------------------------------------------------------- */

main {
  padding-block: clamp(2rem, 1.4rem + 2.6vw, 3.5rem) 1rem;
}

h1,
h2,
h3 {
  font-family: var(--display);
  font-weight: 700;
  line-height: var(--lh-display);
  color: var(--ink);
  text-wrap: balance;
}
h1 {
  font-size: var(--t-h1);
  letter-spacing: -0.01em;
}
html[lang="ar"] h1,
html[lang="ar"] h2,
html[lang="ar"] h3 {
  letter-spacing: 0;
}
.hero h1 {
  font-size: var(--t-hero);
}
h2 {
  font-size: var(--t-h2);
  margin-block-start: 2.5rem;
}
h3 {
  font-size: var(--t-h3);
  font-family: var(--body);
  font-weight: 600;
  margin-block-start: 1.6rem;
}

p,
li {
  max-inline-size: var(--measure);
}
p + p,
p + ul,
p + ol,
h2 + p,
h3 + p {
  margin-block-start: 0.9rem;
}
h2 + p,
h3 + p {
  margin-block-start: 0.7rem;
}

ul,
ol {
  margin-block-start: 0.9rem;
  padding-inline-start: 1.35rem;
}
li + li {
  margin-block-start: 0.45rem;
}

.lede {
  font-size: clamp(1.06rem, 1rem + 0.4vw, 1.22rem);
  color: var(--ink-soft);
  margin-block-start: 1.1rem;
}
html[lang="ar"] .lede {
  font-size: clamp(1.16rem, 1.08rem + 0.45vw, 1.34rem);
}

/* The signature element: the logo arc, drawn once per page, marking the single
   most important thing on it. Nowhere else does the gradient appear. */
.arc {
  inline-size: 7.5rem;
  block-size: 4px;
  border-radius: 2px;
  background: var(--arc);
  margin-block-start: 1.25rem;
}
html[dir="rtl"] .arc {
  background: linear-gradient(
    270deg,
    var(--navy) 0%,
    var(--azure) 18%,
    var(--teal) 36%,
    var(--violet) 56%,
    var(--rose) 74%,
    var(--coral) 89%,
    var(--peach) 100%
  );
}

/* --- Contact block (the Apple-facing deliverable) ------------------------- */

.contact {
  margin-block-start: 1.9rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-inline-start: 4px solid var(--navy);
  border-radius: var(--radius);
  padding: clamp(1.15rem, 0.9rem + 1.1vw, 1.75rem);
  max-inline-size: 34rem;
}
.contact h2 {
  margin-block-start: 0;
  font-size: var(--t-h3);
  font-family: var(--body);
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
html[lang="ar"] .contact h2 {
  text-transform: none;
  letter-spacing: 0;
}
.contact .email {
  display: inline-block;
  margin-block-start: 0.55rem;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.35rem, 1.1rem + 1.4vw, 1.9rem);
  line-height: 1.25;
  color: var(--navy);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
  word-break: break-word;
  direction: ltr;
  unicode-bidi: isolate;
}
.contact .email:hover {
  color: var(--azure);
}
.contact .reply {
  margin-block-start: 0.75rem;
  color: var(--teal-ink);
  font-weight: 500;
}
.contact .note {
  margin-block-start: 0.6rem;
  font-size: var(--t-small);
  color: var(--muted);
}

/* --- FAQ ------------------------------------------------------------------ */

.faq {
  margin-block-start: 1.1rem;
  border-block-start: 1px solid var(--line);
}
.faq div {
  border-block-end: 1px solid var(--line);
  padding-block: 1.15rem;
}
.faq dt {
  font-weight: 600;
  color: var(--ink);
  max-inline-size: var(--measure);
}
.faq dd {
  margin: 0.45rem 0 0;
  margin-inline-start: 0;
  color: var(--ink-soft);
  max-inline-size: var(--measure);
}

/* --- Cards / feature list ------------------------------------------------- */

.cards {
  list-style: none;
  padding: 0;
  margin-block-start: 1.4rem;
  display: grid;
  gap: 0.85rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
}
.cards li {
  max-inline-size: none;
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
}
.cards b {
  display: block;
  font-weight: 600;
  color: var(--navy);
}
.cards span {
  display: block;
  margin-block-start: 0.3rem;
  color: var(--ink-soft);
  font-size: var(--t-small);
  line-height: 1.6;
}

/* --- Steps (used only where something genuinely is a sequence) ------------ */

.steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
  margin-block-start: 1.2rem;
}
.steps li {
  counter-increment: step;
  position: relative;
  padding-inline-start: 2.65rem;
  min-block-size: 1.9rem;
  max-inline-size: var(--measure);
}
.steps li + li {
  margin-block-start: 1rem;
}
.steps li::before {
  content: counter(step);
  position: absolute;
  inset-inline-start: 0;
  inset-block-start: 0.15rem;
  inline-size: 1.85rem;
  block-size: 1.85rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  font-variant-numeric: lining-nums;
}

/* --- Callout -------------------------------------------------------------- */

.callout {
  margin-block-start: 1.5rem;
  padding: 1rem 1.15rem;
  background: #fff;
  border: 1px solid var(--line);
  border-inline-start: 4px solid var(--amber);
  border-radius: var(--radius);
  max-inline-size: var(--measure);
}
.callout p {
  max-inline-size: none;
}

/* --- Hero ----------------------------------------------------------------- */

.hero {
  display: grid;
  gap: var(--gap);
  align-items: center;
  grid-template-columns: 1fr;
}
@media (min-width: 46rem) {
  .hero {
    grid-template-columns: 1.35fr 0.65fr;
  }
}
.hero-art {
  justify-self: center;
  inline-size: min(240px, 60%);
}
@media (min-width: 46rem) {
  .hero-art {
    inline-size: 100%;
    max-inline-size: 240px;
  }
}

.tagline {
  font-family: var(--display);
  font-weight: 700;
  color: var(--navy);
  font-size: clamp(1.05rem, 0.98rem + 0.4vw, 1.25rem);
  margin-block-start: 1.4rem;
}

/* --- Buttons -------------------------------------------------------------- */

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-block-start: 1.6rem;
}
.btn {
  display: inline-block;
  padding: 0.7rem 1.3rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: var(--t-small);
  text-decoration: none;
  border: 1px solid var(--navy);
  transition: background-color 120ms ease, color 120ms ease;
}
.btn-solid {
  background: var(--navy);
  color: #fff;
}
.btn-solid:hover {
  background: var(--azure);
  color: #fff;
}
.btn-ghost {
  color: var(--navy);
  background: transparent;
}
.btn-ghost:hover {
  background: var(--surface);
  color: var(--navy);
}

/* --- Meta / legal --------------------------------------------------------- */

.updated {
  color: var(--muted);
  font-size: var(--t-small);
  margin-block-start: 0.9rem;
}

.legal h2 {
  margin-block-start: 2.2rem;
}

/* --- Footer --------------------------------------------------------------- */

.site-footer {
  margin-block-start: clamp(2.5rem, 2rem + 2vw, 4rem);
  border-block-start: 1px solid var(--line);
  padding-block: 1.8rem 2.4rem;
  color: var(--muted);
  font-size: var(--t-small);
}
.site-footer ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.15rem;
  list-style: none;
  padding: 0;
  margin: 0 0 0.9rem;
}
.site-footer li {
  max-inline-size: none;
  margin: 0;
}
.site-footer a {
  color: var(--ink-soft);
  text-decoration: none;
}
.site-footer a:hover {
  color: var(--navy);
  text-decoration: underline;
}
.site-footer p {
  max-inline-size: var(--measure);
}
.site-footer p + p {
  margin-block-start: 0.4rem;
}

/* --- 404 ------------------------------------------------------------------ */

.center-404 {
  text-align: center;
  padding-block: clamp(2rem, 1.5rem + 3vw, 4.5rem);
}
.center-404 p,
.center-404 .arc {
  margin-inline: auto;
}
.center-404 .actions {
  justify-content: center;
}

/* --- Motion --------------------------------------------------------------- */

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

/* --- Print ---------------------------------------------------------------- */

@media print {
  .site-nav,
  .lang-switch,
  .skip,
  .actions {
    display: none;
  }
  body {
    background: #fff;
  }
  a[href^="mailto:"]::after {
    content: " (" attr(href) ")";
  }
}
