/* ---------------------------------------------------------------------------
   Mawtini · Palestine — site stylesheet
   Tokens mirror the app's DesignSystem.swift so the site and the app can never
   drift apart. The app is a fixed dark theme; so is this.
   Written with logical properties throughout, so the Arabic (RTL) pages need
   no separate rules.
   --------------------------------------------------------------------------- */

@font-face {
  font-family: "Reem Kufi";
  src: url("../fonts/ReemKufi-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Reem Kufi";
  src: url("../fonts/ReemKufi-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Changa";
  src: url("../fonts/Changa-Medium.ttf") format("truetype");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Changa";
  src: url("../fonts/Changa-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-display: swap;
}

:root {
  /* Surfaces */
  --void: #000000;
  --ink: #14120f;
  --surface: #1c1813;
  --bezel: #241f1a;
  --well: #17130e;

  /* Text (warm white) */
  --chalk: #f4eee3;
  --chalk-dim: rgba(244, 238, 227, 0.62);
  --chalk-faint: rgba(244, 238, 227, 0.34);
  --hairline: rgba(244, 238, 227, 0.10);
  --scan-paper: #eee7d8;

  /* Heritage accents */
  --olive: #8fa24e;
  --olive-bright: #b7c56e;
  --terracotta: #d18a5e;
  --tatreez: #c6483a;
  --tatreez-bright: #e08072;
  --sea: #5e8ca1;
  --gold: #d6a24c;
  --gold-bright: #e7c078;

  /* Spacing (MWSpacing) */
  --sp-xs: 4px;
  --sp-sm: 8px;
  --sp-md: 12px;
  --sp-lg: 16px;
  --sp-xl: 24px;
  --sp-xxl: 32px;

  /* Radii (MWRadius) */
  --r-sm: 8px;
  --r-md: 12px;
  --r-control: 16px;
  --r-lg: 20px;
  --r-card: 22px;

  --display: "Reem Kufi", "Segoe UI", system-ui, sans-serif;
  --ui: "Changa", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;

  --measure: 68ch;
  --page: 1080px;
}

/* --------------------------------------------------------------------------- */

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

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

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

body {
  margin: 0;
  background: var(--ink);
  color: var(--chalk);
  font-family: var(--ui);
  font-weight: 500;
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

a {
  color: var(--gold-bright);
  text-decoration-color: rgba(214, 162, 76, 0.45);
  text-underline-offset: 3px;
}
a:hover {
  color: var(--gold);
  text-decoration-color: currentColor;
}

:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}

h1,
h2,
h3,
h4 {
  font-family: var(--display);
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 var(--sp-md);
  letter-spacing: 0.01em;
}

h1 {
  font-size: clamp(2rem, 5vw, 3rem);
}
h2 {
  font-size: clamp(1.5rem, 3.2vw, 2.1rem);
}
h3 {
  font-size: 1.2rem;
}

p {
  margin: 0 0 var(--sp-lg);
  max-width: var(--measure);
}

ul,
ol {
  max-width: var(--measure);
  padding-inline-start: 1.35em;
}
li {
  margin-bottom: var(--sp-sm);
}

hr {
  border: 0;
  border-top: 1px solid var(--hairline);
  margin: var(--sp-xxl) 0;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
  background: var(--surface);
  padding: 0.1em 0.4em;
  border-radius: var(--r-sm);
}

/* Skip link ---------------------------------------------------------------- */

.skip {
  position: absolute;
  inset-inline-start: -9999px;
  top: 0;
  background: var(--gold);
  color: var(--ink);
  padding: var(--sp-md) var(--sp-lg);
  z-index: 100;
  border-radius: 0 0 var(--r-md) 0;
}
.skip:focus {
  inset-inline-start: 0;
}

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

.wrap {
  width: min(100% - 2.5rem, var(--page));
  margin-inline: auto;
}

.section {
  padding-block: clamp(3rem, 8vw, 5.5rem);
}

.section--tight {
  padding-block: clamp(2rem, 5vw, 3.5rem);
}

.section + .section {
  border-top: 1px solid var(--hairline);
}

.overline {
  font-family: var(--ui);
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 var(--sp-md);
}

.lede {
  font-size: 1.15rem;
  color: var(--chalk-dim);
  max-width: 60ch;
}

.muted {
  color: var(--chalk-dim);
}

.small {
  font-size: 0.9rem;
}

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

.site-head {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(20, 18, 15, 0.86);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--hairline);
}

.site-head__inner {
  display: flex;
  align-items: center;
  gap: var(--sp-lg);
  min-height: 64px;
  padding-block: var(--sp-sm);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  color: var(--chalk);
  text-decoration: none;
  flex: 0 0 auto;
}
.brand img {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--hairline);
}
.brand__name {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.05rem;
  line-height: 1.1;
}
.brand__sub {
  display: block;
  font-family: var(--ui);
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--chalk-faint);
}

.nav {
  margin-inline-start: auto;
  display: flex;
  align-items: center;
  gap: var(--sp-xs);
  flex-wrap: wrap;
}
.nav a {
  color: var(--chalk-dim);
  text-decoration: none;
  font-size: 0.92rem;
  padding: var(--sp-sm) var(--sp-md);
  border-radius: var(--r-control);
}
.nav a:hover {
  color: var(--chalk);
  background: rgba(244, 238, 227, 0.06);
}
.nav a[aria-current="page"] {
  color: var(--chalk);
  background: rgba(244, 238, 227, 0.08);
}

.lang-switch {
  font-family: var(--ui);
  border: 1px solid var(--hairline);
  border-radius: var(--r-control);
  padding: var(--sp-sm) var(--sp-md) !important;
  color: var(--gold-bright) !important;
  white-space: nowrap;
}

@media (max-width: 760px) {
  .site-head__inner {
    flex-wrap: wrap;
  }
  .nav {
    width: 100%;
    margin-inline-start: 0;
    justify-content: flex-start;
    gap: 0;
    overflow-x: auto;
    padding-bottom: var(--sp-xs);
  }
  .nav a {
    padding-inline: var(--sp-sm);
    white-space: nowrap;
  }
}

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

.hero {
  position: relative;
  overflow: hidden;
  background: var(--void);
  border-bottom: 1px solid var(--hairline);
}

.hero__art {
  position: absolute;
  inset-block: 0;
  inset-inline-end: 0;
  width: 46%;
  max-width: 520px;
  opacity: 0.72;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(to left, #000 55%, transparent 100%);
  mask-image: linear-gradient(to left, #000 55%, transparent 100%);
}
html[dir="rtl"] .hero__art {
  -webkit-mask-image: linear-gradient(to right, #000 55%, transparent 100%);
  mask-image: linear-gradient(to right, #000 55%, transparent 100%);
}
.hero__art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* `.hero__inner` nests INSIDE `.wrap` rather than sharing an element with it:
   `.wrap` centres itself with `margin-inline: auto`, so a max-width applied to
   the same element centres the hero copy in the viewport instead of aligning it
   to the page gutter — and pushes it under the artwork. */
.hero__inner {
  position: relative;
  z-index: 1;
  padding-block: clamp(3.5rem, 10vw, 7rem);
  max-width: 34rem;
}

/* Four stats in a 34rem column fit three-then-one; a 2×2 block reads as
   deliberate. */
.hero .stat-strip {
  grid-template-columns: repeat(2, 1fr);
}

/* Reem Kufi's descenders (the ي tail) drop well below the baseline, so line-height 1
   drives them straight through the rule beneath. */
.wordmark {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(3.5rem, 12vw, 5.5rem);
  line-height: 1.35;
  margin: 0 0 var(--sp-lg);
  color: var(--chalk);
}

.wordmark-rule {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--chalk-dim);
  margin-bottom: var(--sp-xl);
}
.wordmark-rule::before {
  content: "";
  width: 32px;
  height: 1px;
  background: var(--chalk-faint);
  flex: 0 0 auto;
}

.hero__tagline {
  font-size: clamp(1.25rem, 3vw, 1.6rem);
  line-height: 1.45;
  color: var(--chalk);
  margin-bottom: var(--sp-lg);
  font-family: var(--display);
  font-weight: 600;
}

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

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-md);
  margin-top: var(--sp-xl);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-sm);
  font-family: var(--ui);
  font-weight: 600;
  font-size: 1rem;
  padding: var(--sp-md) var(--sp-xl);
  border-radius: var(--r-control);
  text-decoration: none;
  border: 1px solid transparent;
  transition: transform 0.15s ease, background-color 0.15s ease;
}
.btn:hover {
  transform: translateY(-1px);
}

.btn--primary {
  background: var(--olive);
  color: #10130a;
}
.btn--primary:hover {
  background: var(--olive-bright);
  color: #10130a;
}

.btn--ghost {
  border-color: var(--hairline);
  color: var(--chalk);
  background: rgba(244, 238, 227, 0.04);
}
.btn--ghost:hover {
  color: var(--chalk);
  background: rgba(244, 238, 227, 0.09);
}

/* Cards / grids ------------------------------------------------------------ */

.grid {
  display: grid;
  gap: var(--sp-lg);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
}

.card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-card);
  padding: var(--sp-xl);
}
.card h3 {
  margin-bottom: var(--sp-sm);
}
.card p:last-child {
  margin-bottom: 0;
}
.card__icon {
  font-size: 1.5rem;
  line-height: 1;
  margin-bottom: var(--sp-md);
  display: block;
}

.stat-strip {
  display: grid;
  gap: var(--sp-lg);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr));
  margin-top: var(--sp-xl);
}
.stat {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: var(--sp-lg);
  text-align: center;
}
.stat__num {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.9rem;
  color: var(--gold-bright);
  line-height: 1.1;
  display: block;
}
.stat__label {
  font-size: 0.85rem;
  color: var(--chalk-dim);
}

/* Screenshot shelf --------------------------------------------------------- */

.shelf {
  display: flex;
  gap: var(--sp-lg);
  overflow-x: auto;
  padding-block: var(--sp-sm) var(--sp-lg);
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  scrollbar-color: var(--chalk-faint) transparent;
}
.shot {
  flex: 0 0 auto;
  width: min(72vw, 260px);
  scroll-snap-align: start;
}
.shot img {
  width: 100%;
  border-radius: var(--r-lg);
  border: 1px solid var(--hairline);
  background: var(--void);
}
.shot figcaption {
  margin-top: var(--sp-md);
  font-size: 0.88rem;
  color: var(--chalk-dim);
  line-height: 1.45;
}
.shot figcaption b {
  color: var(--chalk);
  font-weight: 600;
  display: block;
}

/* Wide enough for three per row: show all six at once instead of a scroller
   whose last caption is sliced by the viewport edge. */
@media (min-width: 1000px) {
  .shelf {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--sp-xl);
    overflow: visible;
  }
  .shot {
    width: auto;
  }
}

/* Split feature rows ------------------------------------------------------- */

.split {
  display: grid;
  gap: clamp(1.5rem, 5vw, 3.5rem);
  grid-template-columns: 1fr;
  align-items: center;
}
@media (min-width: 860px) {
  .split {
    grid-template-columns: 1fr 1fr;
  }
  .split--flip .split__media {
    order: -1;
  }
}
.split__media img {
  border-radius: var(--r-lg);
  border: 1px solid var(--hairline);
  margin-inline: auto;
  max-width: 300px;
  background: var(--void);
}
.split--wide .split__media img {
  max-width: 100%;
}

/* Pledge / callout --------------------------------------------------------- */

.pledge {
  background: linear-gradient(
    160deg,
    rgba(143, 162, 78, 0.12),
    rgba(28, 24, 19, 0.6)
  );
  border: 1px solid rgba(143, 162, 78, 0.28);
  border-radius: var(--r-card);
  padding: clamp(1.5rem, 4vw, 2.5rem);
}
.pledge ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: var(--sp-md);
  max-width: none;
}
.pledge li {
  display: flex;
  gap: var(--sp-md);
  align-items: flex-start;
  margin: 0;
}
.pledge li::before {
  content: "✓";
  color: var(--olive-bright);
  font-weight: 700;
  flex: 0 0 auto;
  line-height: 1.6;
}

.note {
  border-inline-start: 3px solid var(--gold);
  background: rgba(214, 162, 76, 0.07);
  padding: var(--sp-lg) var(--sp-xl);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  margin-block: var(--sp-xl);
}
html[dir="rtl"] .note {
  border-radius: var(--r-md) 0 0 var(--r-md);
}
.note p:last-child {
  margin-bottom: 0;
}

.reverent {
  border-inline-start: 3px solid var(--tatreez);
  background: rgba(198, 72, 58, 0.07);
}

/* Steps -------------------------------------------------------------------- */

.steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
  max-width: var(--measure);
}
.steps li {
  counter-increment: step;
  position: relative;
  padding-inline-start: 3.2rem;
  margin-bottom: var(--sp-xl);
}
.steps li::before {
  content: counter(step);
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  width: 2.2rem;
  height: 2.2rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(214, 162, 76, 0.14);
  border: 1px solid rgba(214, 162, 76, 0.4);
  color: var(--gold-bright);
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.95rem;
}
.steps li b {
  display: block;
  color: var(--chalk);
  font-weight: 600;
  font-family: var(--display);
  font-size: 1.1rem;
  margin-bottom: var(--sp-xs);
}

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

.faq h2 {
  margin-top: var(--sp-xxl);
}
.faq h2:first-child {
  margin-top: 0;
}

.faq details {
  border-bottom: 1px solid var(--hairline);
  padding-block: var(--sp-lg);
}
.faq details[open] summary {
  color: var(--gold-bright);
}
.faq summary {
  cursor: pointer;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.08rem;
  list-style: none;
  display: flex;
  gap: var(--sp-md);
  align-items: baseline;
}
.faq summary::-webkit-details-marker {
  display: none;
}
.faq summary::before {
  content: "＋";
  color: var(--gold);
  flex: 0 0 auto;
  font-size: 0.9em;
}
.faq details[open] summary::before {
  content: "－";
}
.faq details > *:not(summary) {
  margin-top: var(--sp-md);
}
.faq details p:last-child {
  margin-bottom: 0;
}

/* Legal document ----------------------------------------------------------- */

.doc {
  max-width: 46rem;
}
.doc h2 {
  margin-top: var(--sp-xxl);
  scroll-margin-top: 90px;
}
.doc h3 {
  margin-top: var(--sp-xl);
}
.doc__meta {
  color: var(--chalk-faint);
  font-size: 0.9rem;
  margin-bottom: var(--sp-xxl);
}

.toc {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: var(--sp-lg) var(--sp-xl);
  margin-bottom: var(--sp-xxl);
}
.toc p {
  margin: 0 0 var(--sp-sm);
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--chalk-faint);
}
.toc ol {
  margin: 0;
  padding-inline-start: 1.2em;
  columns: 2;
  column-gap: var(--sp-xl);
}
@media (max-width: 640px) {
  .toc ol {
    columns: 1;
  }
}
.toc li {
  margin-bottom: var(--sp-xs);
}
.toc a {
  color: var(--chalk-dim);
  text-decoration: none;
}
.toc a:hover {
  color: var(--gold-bright);
  text-decoration: underline;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: var(--sp-xl);
  font-size: 0.95rem;
}
.table-scroll {
  overflow-x: auto;
}
th,
td {
  text-align: start;
  padding: var(--sp-md);
  border-bottom: 1px solid var(--hairline);
  vertical-align: top;
}
th {
  color: var(--gold);
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Apps list ---------------------------------------------------------------- */

.app-list {
  display: grid;
  gap: var(--sp-md);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  list-style: none;
  padding: 0;
  max-width: none;
}
/* The grid stretches the <li>, not the <a> inside it — without this, a two-line
   tagline leaves its row-mates short. */
.app-list > li {
  display: flex;
}

.app-row {
  flex: 1;
  display: flex;
  gap: var(--sp-lg);
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: var(--sp-lg);
  text-decoration: none;
  color: var(--chalk);
  transition: border-color 0.15s ease, background-color 0.15s ease;
  margin: 0;
}
.app-row:hover {
  border-color: rgba(214, 162, 76, 0.45);
  background: #221d17;
  color: var(--chalk);
}
.app-row__mark {
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: rgba(214, 162, 76, 0.12);
  border: 1px solid var(--hairline);
  font-size: 1.4rem;
}
.app-row__name {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.02rem;
  display: block;
}
.app-row__tag {
  color: var(--chalk-dim);
  font-size: 0.9rem;
  line-height: 1.4;
}

/* Contact ------------------------------------------------------------------ */

.contact-card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-card);
  padding: clamp(1.5rem, 4vw, 2.5rem);
  text-align: center;
}
.contact-card .mail {
  font-family: var(--display);
  font-size: clamp(1.2rem, 3.5vw, 1.7rem);
  font-weight: 600;
  display: inline-block;
  margin-block: var(--sp-sm) var(--sp-lg);
  word-break: break-word;
}

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

.site-foot {
  border-top: 1px solid var(--hairline);
  background: var(--void);
  padding-block: var(--sp-xxl);
  margin-top: var(--sp-xxl);
  font-size: 0.92rem;
}
.foot-grid {
  display: grid;
  gap: var(--sp-xl);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  margin-bottom: var(--sp-xl);
}
.foot-grid h4 {
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--chalk-faint);
  font-family: var(--ui);
  margin-bottom: var(--sp-md);
}
.foot-grid ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.foot-grid li {
  margin-bottom: var(--sp-sm);
}
.foot-grid a {
  color: var(--chalk-dim);
  text-decoration: none;
}
.foot-grid a:hover {
  color: var(--gold-bright);
}
.colophon {
  border-top: 1px solid var(--hairline);
  padding-top: var(--sp-lg);
  color: var(--chalk-faint);
  font-size: 0.85rem;
}
.colophon p {
  max-width: none;
  margin-bottom: var(--sp-sm);
}

/* Utility ------------------------------------------------------------------ */

.center {
  text-align: center;
}
.center p,
.center .lede {
  margin-inline: auto;
}
.stack > * + * {
  margin-top: var(--sp-lg);
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Arabic typography tuning -------------------------------------------------- */

html[lang="ar"] body {
  font-size: 18px;
  line-height: 1.9;
}
/* Arabic display type carries marks above and tails below the line; the Latin
   heading leading crowds them. */
html[lang="ar"] h1,
html[lang="ar"] h2,
html[lang="ar"] h3,
html[lang="ar"] .hero__tagline,
html[lang="ar"] .faq summary {
  line-height: 1.55;
}

html[lang="ar"] .overline,
html[lang="ar"] .wordmark-rule,
html[lang="ar"] th,
html[lang="ar"] .foot-grid h4,
html[lang="ar"] .toc p {
  letter-spacing: 0;
  text-transform: none;
}
