/* ============================================================
   أثر — Keep Athar
   Editorial ink-and-paper aesthetic. Arabic-first, RTL.
   ============================================================ */

:root {
  --ink: #0c1310;
  --ink-2: #101a16;
  --ink-3: #16231d;
  --bone: #f1ead9;
  --bone-dim: #cfc7b4;
  --gold: #c9a24b;
  --gold-soft: #e3c885;
  --moss: #2e5c47;
  --line: rgba(241, 234, 217, 0.14);
  --line-strong: rgba(241, 234, 217, 0.3);

  --font-ar-display: "Noto Kufi Arabic", sans-serif;
  --font-ar-body: "IBM Plex Sans Arabic", sans-serif;
  --font-en-display: "Fraunces", serif;
  --font-en-body: "IBM Plex Sans Arabic", sans-serif;

  --display: var(--font-ar-display);
  --body: var(--font-ar-body);

  --space: clamp(1.25rem, 4vw, 3.5rem);
  --radius: 22px;
}

html[lang="en"] {
  --display: var(--font-en-display);
  --body: var(--font-en-body);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; overflow-x: clip; }

body {
  background: var(--ink);
  color: var(--bone);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.9;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--gold); color: var(--ink); }

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

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

/* ---------- grain + atmosphere ---------- */
.grain {
  position: fixed; inset: -50%;
  width: 200%; height: 200%;
  pointer-events: none; z-index: 60;
  opacity: 0.5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.07'/%3E%3C/svg%3E");
  animation: grain 9s steps(10) infinite;
}
@keyframes grain {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-3%, 2%); }
  40% { transform: translate(2%, -3%); }
  60% { transform: translate(-2%, -2%); }
  80% { transform: translate(3%, 3%); }
}

.glow {
  position: fixed; z-index: 0; pointer-events: none;
  width: 70vmax; height: 70vmax; border-radius: 50%;
  filter: blur(120px); opacity: 0.35;
}
.glow-a { top: -30vmax; inset-inline-start: -20vmax; background: radial-gradient(circle, #1d3a2c 0%, transparent 60%); }
.glow-b { bottom: -35vmax; inset-inline-end: -25vmax; background: radial-gradient(circle, rgba(201, 162, 75, 0.16) 0%, transparent 60%); }

/* ---------- nav ---------- */
.nav {
  position: fixed; top: 0; inset-inline: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.1rem var(--space);
  background: linear-gradient(to bottom, rgba(12, 19, 16, 0.85), transparent);
  backdrop-filter: blur(2px);
}
.brand {
  display: flex; align-items: center; gap: 0.65rem;
  font-family: var(--font-ar-display);
  font-weight: 700; font-size: 1.35rem; letter-spacing: 0.02em;
}
.brand .star { width: 20px; height: 20px; color: var(--gold); }
.brand .star svg { animation: spin 24s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.nav-links {
  display: flex; gap: 2.2rem;
  font-size: 0.92rem; color: var(--bone-dim);
}
.nav-links a { position: relative; transition: color 0.3s; }
.nav-links a::after {
  content: ""; position: absolute; bottom: -5px; inset-inline-start: 0;
  width: 0; height: 1px; background: var(--gold); transition: width 0.35s ease;
}
.nav-links a:hover { color: var(--bone); }
.nav-links a:hover::after { width: 100%; }

.lang-toggle {
  font-family: var(--font-en-display);
  font-size: 0.85rem; letter-spacing: 0.08em;
  border: 1px solid var(--line-strong); border-radius: 99px;
  padding: 0.45rem 1.1rem; cursor: pointer;
  background: transparent; color: var(--bone);
  transition: background 0.3s, color 0.3s, border-color 0.3s;
}
.lang-toggle:hover { background: var(--bone); color: var(--ink); border-color: var(--bone); }
html[lang="en"] .lang-toggle { font-family: var(--font-ar-display); }

/* ---------- hero ---------- */
.hero {
  position: relative; min-height: 100svh;
  display: flex; flex-direction: column; justify-content: center;
  padding: 7rem var(--space) 4rem;
  overflow: hidden;
}
#traces {
  position: absolute; inset: 0; z-index: 0;
  width: 100%; height: 100%;
}
.hero > *:not(#traces) { position: relative; z-index: 2; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 0.8rem;
  font-size: clamp(0.8rem, 1.4vw, 0.95rem);
  color: var(--gold-soft); letter-spacing: 0.04em;
  margin-bottom: clamp(1.2rem, 3vh, 2.4rem);
}
.eyebrow::before {
  content: ""; width: 3rem; height: 1px; background: var(--gold);
}

.hero-title {
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(3.2rem, 13vw, 11.5rem);
  line-height: 1.3;
  letter-spacing: 0.01em;
  margin-top: clamp(0.4rem, 2vh, 1.2rem);
}
html[lang="en"] .hero-title { line-height: 0.98; letter-spacing: -0.02em; font-weight: 600; }

.hero-title .w { display: inline-block; }
.hero-title .hollow {
  color: transparent;
  -webkit-text-stroke: 2px var(--gold);
  text-stroke: 2px var(--gold);
}

.hero-sub {
  max-width: 34em;
  margin-top: clamp(1.2rem, 3vh, 2.2rem);
  font-size: clamp(1.02rem, 2vw, 1.3rem);
  color: var(--bone-dim);
}
.hero-sub strong { color: var(--bone); font-weight: 600; }

.hero-cta { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: clamp(1.8rem, 4vh, 3rem); }

.btn {
  display: inline-flex; align-items: center; gap: 0.6rem;
  padding: 0.95rem 2rem; border-radius: 99px;
  font-family: var(--body); font-size: 1rem; font-weight: 600;
  border: 1px solid var(--bone); cursor: pointer;
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), background 0.3s, color 0.3s, box-shadow 0.3s;
}
.btn:hover { transform: translateY(-3px); }
.btn-solid { background: var(--bone); color: var(--ink); }
.btn-solid:hover { box-shadow: 0 14px 40px -12px rgba(241, 234, 217, 0.45); }
.btn-ghost { background: transparent; color: var(--bone); border-color: var(--line-strong); }
.btn-ghost:hover { border-color: var(--gold); color: var(--gold-soft); }

.hero-foot {
  display: flex; justify-content: space-between; align-items: flex-end;
  margin-top: auto; padding-top: 3rem;
  font-size: 0.85rem; color: var(--bone-dim);
}
.hero-foot .domain { font-family: var(--font-en-display); font-style: italic; letter-spacing: 0.05em; }
.scroll-hint { display: inline-flex; align-items: center; gap: 0.5rem; }
.scroll-hint .dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--gold);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 0.3; transform: scale(0.8); } 50% { opacity: 1; transform: scale(1.15); } }

/* ---------- marquee ---------- */
.marquee {
  border-block: 1px solid var(--line);
  padding: 1.1rem 0; overflow: hidden;
  background: var(--ink-2);
  position: relative; z-index: 2;
}
.marquee-track {
  display: flex; width: max-content; gap: 3rem;
  animation: marquee 30s linear infinite;
}
.marquee:hover .marquee-track { animation-play-state: paused; }
.marquee-track span {
  display: inline-flex; align-items: center; gap: 3rem;
  white-space: nowrap;
  font-family: var(--display); font-weight: 700;
  font-size: clamp(1rem, 2.4vw, 1.5rem);
  color: var(--bone-dim);
}
.marquee-track .sep { color: var(--gold); }
@keyframes marquee { to { transform: translateX(-50%); } }
html[dir="rtl"] .marquee-track { animation-name: marquee-rtl; }
@keyframes marquee-rtl {
  from { transform: translateX(-50%); }
  to { transform: translateX(0); }
}

/* ---------- sections ---------- */
section { position: relative; z-index: 2; padding: clamp(5rem, 12vh, 9rem) var(--space); }

.sec-head { margin-bottom: clamp(2.5rem, 6vh, 4.5rem); }
.sec-label {
  display: inline-flex; align-items: center; gap: 0.7rem;
  font-size: 0.85rem; color: var(--gold-soft); letter-spacing: 0.06em;
  margin-bottom: 1.2rem;
}
.sec-label::before { content: "✦"; color: var(--gold); font-size: 0.7rem; }
.sec-title {
  font-family: var(--display); font-weight: 800;
  font-size: clamp(2rem, 6vw, 4.2rem);
  line-height: 1.35;
}
html[lang="en"] .sec-title { font-weight: 600; line-height: 1.08; letter-spacing: -0.015em; }
.sec-title em { font-style: normal; color: var(--gold); }

/* ---------- manifesto ---------- */
.manifesto { border-top: 1px solid var(--line); }
.manifesto-grid {
  display: grid; grid-template-columns: 1.2fr 0.8fr;
  gap: clamp(2rem, 6vw, 6rem); align-items: start;
}
.manifesto-body p { color: var(--bone-dim); margin-bottom: 1.4rem; max-width: 38em; }
.manifesto-body p strong { color: var(--bone); }
.manifesto-quote {
  position: sticky; top: 7rem;
  border-inline-start: 2px solid var(--gold);
  padding-inline-start: 1.6rem;
}
.manifesto-quote blockquote {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(1.25rem, 2.6vw, 1.7rem); line-height: 1.8;
  color: var(--bone);
}
html[lang="en"] .manifesto-quote blockquote { line-height: 1.4; font-weight: 500; font-style: italic; }
.manifesto-quote cite { display: block; margin-top: 1rem; font-style: normal; font-size: 0.88rem; color: var(--bone-dim); }

.stats {
  display: grid; grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line); border-radius: var(--radius);
  margin-top: clamp(3rem, 8vh, 5rem); overflow: hidden;
  background: var(--ink-2);
}
.stat { padding: clamp(1.5rem, 4vw, 2.8rem); text-align: center; }
.stat + .stat { border-inline-start: 1px solid var(--line); }
.stat .num {
  font-family: var(--font-en-display);
  font-size: clamp(2.6rem, 7vw, 5rem); font-weight: 600;
  color: var(--gold); line-height: 1;
}
.stat .lbl { margin-top: 0.7rem; font-size: 0.9rem; color: var(--bone-dim); }

/* ---------- apps ---------- */
.apps { border-top: 1px solid var(--line); }
.app-row {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: clamp(2rem, 6vw, 5rem); align-items: center;
  padding: clamp(2.5rem, 7vh, 5rem) 0;
}
.app-row + .app-row { border-top: 1px solid var(--line); }
.app-row:nth-child(even) .app-visual { order: -1; }

.app-info .app-index {
  font-family: var(--font-en-display); font-style: italic;
  color: var(--gold); font-size: 1rem;
}
.app-name {
  font-family: var(--display); font-weight: 800;
  font-size: clamp(2rem, 5vw, 3.4rem); line-height: 1.4;
  margin: 0.5rem 0 0.3rem;
}
html[lang="en"] .app-name { font-weight: 600; line-height: 1.1; }
.app-latin {
  font-family: var(--font-en-display); font-style: italic;
  color: var(--bone-dim); font-size: 1.05rem; letter-spacing: 0.06em;
}
.app-desc { margin-top: 1.1rem; color: var(--bone-dim); max-width: 30em; }
.app-tags { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1.4rem; }
.tag {
  font-size: 0.78rem; padding: 0.35rem 0.9rem; border-radius: 99px;
  border: 1px solid var(--line-strong); color: var(--bone-dim);
}
.tag.live { border-color: var(--moss); background: rgba(46, 92, 71, 0.25); color: #9fd6bb; }
.tag.soon { border-color: rgba(201, 162, 75, 0.5); color: var(--gold-soft); }

/* phone mockup */
.app-visual { display: flex; justify-content: center; }
.phone {
  width: min(270px, 70vw); aspect-ratio: 9 / 19;
  border-radius: 40px; border: 1px solid var(--line-strong);
  background: var(--ink-3);
  padding: 12px; position: relative;
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, 0.7), 0 0 0 6px rgba(241, 234, 217, 0.04);
  transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.app-row:hover .phone { transform: translateY(-8px) rotate(-1.2deg); }
.phone::before {
  content: ""; position: absolute; top: 22px; left: 50%;
  transform: translateX(-50%); width: 34%; height: 22px;
  background: var(--ink); border-radius: 99px; z-index: 3;
}
.screen {
  width: 100%; height: 100%; border-radius: 30px; overflow: hidden;
  display: flex; flex-direction: column; gap: 10px;
  padding: 54px 16px 16px;
  background:
    radial-gradient(120% 60% at 50% 0%, var(--screen-tint, rgba(201, 162, 75, 0.22)) 0%, transparent 65%),
    var(--ink-2);
}
.screen .s-title {
  font-family: var(--display); font-weight: 800;
  font-size: 1.15rem; color: var(--bone);
}
.screen .s-sub { font-size: 0.68rem; color: var(--bone-dim); }
.s-card {
  border-radius: 14px; background: rgba(241, 234, 217, 0.06);
  border: 1px solid var(--line); padding: 0.7rem 0.8rem;
  font-size: 0.7rem; color: var(--bone-dim);
  display: flex; justify-content: space-between; align-items: center;
}
.s-card b { color: var(--bone); font-size: 0.78rem; font-weight: 600; }
.s-pill { color: var(--accent, var(--gold)); font-weight: 700; }
.s-bar { height: 6px; border-radius: 99px; background: rgba(241, 234, 217, 0.08); overflow: hidden; }
.s-bar i { display: block; height: 100%; border-radius: 99px; background: var(--accent, var(--gold)); }

/* ---------- principles ---------- */
.principles { border-top: 1px solid var(--line); background: var(--ink-2); }
.prin-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px;
  background: var(--line); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
}
.prin {
  background: var(--ink-2); padding: clamp(1.8rem, 4vw, 3rem);
  position: relative; overflow: hidden;
  transition: background 0.4s;
}
.prin:hover { background: var(--ink-3); }
.prin .p-num {
  font-family: var(--font-en-display); font-style: italic;
  font-size: 3rem; color: rgba(201, 162, 75, 0.35); line-height: 1;
}
.prin h3 {
  font-family: var(--display); font-weight: 800;
  font-size: clamp(1.25rem, 2.6vw, 1.7rem); margin: 1rem 0 0.6rem;
}
html[lang="en"] .prin h3 { font-weight: 600; }
.prin p { color: var(--bone-dim); font-size: 0.98rem; max-width: 28em; }
.prin::after {
  content: "✦"; position: absolute; bottom: -1rem; inset-inline-end: 0.5rem;
  font-size: 6rem; color: rgba(201, 162, 75, 0.06);
  transition: color 0.4s, transform 0.5s;
}
.prin:hover::after { color: rgba(201, 162, 75, 0.16); transform: rotate(20deg); }

/* ---------- pledge ---------- */
.pledge { text-align: center; border-top: 1px solid var(--line); }
.pledge-star { width: 54px; height: 54px; margin: 0 auto 2rem; color: var(--gold); }
.pledge-star svg { animation: spin 30s linear infinite; }
.pledge-title {
  font-family: var(--display); font-weight: 800;
  font-size: clamp(1.8rem, 5vw, 3.4rem); line-height: 1.5;
  max-width: 22em; margin: 0 auto;
}
html[lang="en"] .pledge-title { line-height: 1.15; font-weight: 600; }
.pledge-title em { font-style: normal; color: var(--gold); }
.pledge-body {
  max-width: 44em; margin: 1.8rem auto 0; color: var(--bone-dim);
  font-size: clamp(1rem, 1.8vw, 1.1rem);
}

/* ---------- footer ---------- */
.footer {
  border-top: 1px solid var(--line);
  padding: clamp(3rem, 8vh, 5rem) var(--space) 2rem;
  position: relative; z-index: 2; overflow: hidden;
}
.footer-grid {
  display: flex; justify-content: space-between; align-items: flex-start;
  flex-wrap: wrap; gap: 2rem;
}
.footer-brand .f-domain {
  font-family: var(--font-en-display); font-style: italic;
  font-size: clamp(1.6rem, 4vw, 2.6rem); color: var(--bone);
}
.footer-brand p { color: var(--bone-dim); font-size: 0.92rem; margin-top: 0.6rem; max-width: 26em; }
.footer-links { display: flex; gap: clamp(2rem, 6vw, 5rem); }
.footer-links .col { display: flex; flex-direction: column; gap: 0.7rem; font-size: 0.92rem; }
.footer-links .col span { color: var(--gold-soft); font-size: 0.8rem; margin-bottom: 0.3rem; letter-spacing: 0.05em; }
.footer-links .col a { color: var(--bone-dim); transition: color 0.3s; }
.footer-links .col a:hover { color: var(--bone); }

.footer-word {
  font-family: var(--font-ar-display); font-weight: 900;
  font-size: clamp(6rem, 24vw, 22rem); line-height: 1.1;
  text-align: center; margin-top: 2rem;
  color: transparent;
  -webkit-text-stroke: 1px rgba(241, 234, 217, 0.24);
  user-select: none; pointer-events: none;
}
.footer-base {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.8rem;
  font-size: 0.8rem; color: var(--bone-dim);
  border-top: 1px solid var(--line); padding-top: 1.4rem; margin-top: -1rem;
}

/* ---------- privacy page ---------- */
.legal { max-width: 760px; margin: 0 auto; padding-top: 9rem; }
.legal h1 {
  font-family: var(--display); font-weight: 800;
  font-size: clamp(2.2rem, 6vw, 3.6rem); line-height: 1.4; margin-bottom: 0.8rem;
}
html[lang="en"] .legal h1 { line-height: 1.1; font-weight: 600; }
.legal .updated { color: var(--gold-soft); font-size: 0.9rem; margin-bottom: 3rem; }
.legal h2 {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(1.3rem, 3vw, 1.7rem);
  margin: 2.8rem 0 0.8rem; color: var(--bone);
  display: flex; align-items: center; gap: 0.7rem;
}
.legal h2::before { content: "✦"; color: var(--gold); font-size: 0.8rem; }
.legal p, .legal li { color: var(--bone-dim); }
.legal ul { padding-inline-start: 1.4rem; margin: 0.6rem 0 1rem; }
.legal li { margin-bottom: 0.5rem; }
.legal strong { color: var(--bone); }
.legal .callout {
  border: 1px solid rgba(201, 162, 75, 0.4); border-radius: var(--radius);
  background: rgba(201, 162, 75, 0.07);
  padding: 1.4rem 1.6rem; margin: 2rem 0;
}
.legal .callout p { color: var(--bone); margin: 0; }
.back-home {
  display: inline-flex; align-items: center; gap: 0.5rem;
  margin-top: 3rem; color: var(--gold-soft); font-weight: 600;
}
.back-home:hover { color: var(--gold); }

/* ---------- reveal helpers (GSAP) ---------- */
.reveal, .reveal-line { will-change: transform, opacity; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .manifesto-grid { grid-template-columns: 1fr; }
  .manifesto-quote { position: static; }
  .app-row { grid-template-columns: 1fr; gap: 2.2rem; }
  .app-row:nth-child(even) .app-visual { order: 0; }
  .prin-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .nav-links { display: none; }
  .stats { grid-template-columns: 1fr; }
  .stat + .stat { border-inline-start: none; border-top: 1px solid var(--line); }
  .hero-foot { flex-direction: column; align-items: flex-start; gap: 0.8rem; }
  .footer-grid { flex-direction: column; }
}

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