/* ===========================================================================
   Shareet — design system
   Tokens, reset, page backdrop, navigation, buttons, footer.
   Brand greens (--accent / --accent-light) and the logo gradient are fixed
   points; everything else is built around them.
   =========================================================================== */

/* ===== Reset ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
}

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

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

button {
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  background: none;
  border: none;
}

::selection {
  background: var(--accent-light);
  color: #fff;
}

/* ===== Tokens — dark (default) ===== */
:root {
  /* brand — preserved from the app identity */
  --accent: #00503B;
  --accent-light: #00704f;
  --brand-from: #006B63;
  --brand-to: #004236;
  --mint: #6dcea0;
  /* Lightened brand greens for type on a near-black canvas — the base greens
     are too dark to read at display sizes here. */
  --mint-hi: #9ae7c0;
  --mint-lo: #35a87a;

  /* canvas */
  --bg: #060708;
  --bg-soft: #090b0a;
  --surface: #0c110e;
  --surface-2: #101614;
  --surface-3: #141c19;

  /* ink */
  --text: #F5F5F5;
  --muted: #A1A1AA;
  --faint: #6b7280;

  /* lines & light */
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --line-green: rgba(0, 112, 79, 0.38);
  --glow: rgba(0, 107, 99, 0.28);
  --glow-soft: rgba(0, 107, 99, 0.14);
  --grid-line: rgba(255, 255, 255, 0.035);
  --sheen: rgba(255, 255, 255, 0.06);

  /* glass */
  --glass-bg: rgba(16, 22, 20, 0.62);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-shadow: 0 18px 50px -12px rgba(0, 0, 0, 0.7);

  /* buttons */
  --btn-ghost-bg: rgba(255, 255, 255, 0.04);
  --btn-ghost-bg-hover: rgba(255, 255, 255, 0.08);
  --btn-ghost-border: rgba(255, 255, 255, 0.12);
  --btn-ghost-border-hover: rgba(255, 255, 255, 0.22);

  /* legal */
  --legal-text: #C4C4CC;
  --legal-link: #6dcea0;
  --legal-accent: #6dcea0;

  /* toggle */
  --toggle-track: rgba(255, 255, 255, 0.06);
  --toggle-border: rgba(255, 255, 255, 0.12);
  --toggle-thumb: #eef1ef;

  /* motion */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  /* type */
  --font-ar: 'Noto Kufi Arabic', system-ui, sans-serif;
  --font-en: 'Inter', system-ui, sans-serif;

  color-scheme: dark;
}

/* ===== Tokens — light ===== */
:root[data-theme="light"] {
  --accent: #00503B;
  --accent-light: #00704f;
  --brand-from: #006B63;
  --brand-to: #004236;
  --mint: #00704f;
  /* On the light canvas the deep brand greens are the readable ones. */
  --mint-hi: #00704f;
  --mint-lo: #00503B;

  --bg: #eef1ef;
  --bg-soft: #f4f6f4;
  --surface: #ffffff;
  --surface-2: #ffffff;
  --surface-3: #f7f9f7;

  --text: #0d1411;
  --muted: #566159;
  --faint: #7c877f;

  --line: rgba(13, 20, 17, 0.1);
  --line-strong: rgba(13, 20, 17, 0.18);
  --line-green: rgba(0, 80, 59, 0.3);
  --glow: rgba(0, 107, 99, 0.16);
  --glow-soft: rgba(0, 107, 99, 0.08);
  --grid-line: rgba(13, 20, 17, 0.045);
  --sheen: rgba(255, 255, 255, 0.9);

  --glass-bg: rgba(255, 255, 255, 0.72);
  --glass-border: rgba(13, 20, 17, 0.08);
  --glass-shadow: 0 18px 50px -14px rgba(13, 20, 17, 0.18);

  --btn-ghost-bg: rgba(13, 20, 17, 0.03);
  --btn-ghost-bg-hover: rgba(13, 20, 17, 0.07);
  --btn-ghost-border: rgba(13, 20, 17, 0.12);
  --btn-ghost-border-hover: rgba(13, 20, 17, 0.24);

  --legal-text: #3b463f;
  --legal-link: #00704f;
  --legal-accent: #00704f;

  --toggle-track: rgba(13, 20, 17, 0.06);
  --toggle-border: rgba(13, 20, 17, 0.12);
  --toggle-thumb: #ffffff;

  color-scheme: light;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ar);
  line-height: 1.6;
  overflow-x: hidden;
  transition: background 0.4s var(--ease), color 0.4s var(--ease);
}

/* ===========================================================================
   Page backdrop — fixed grid + brand aurora. Sits behind everything.
   =========================================================================== */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

/* Perspective grid, faded out toward the bottom */
.backdrop__grid {
  position: absolute;
  inset: -10% -10% 0;
  background-image:
    linear-gradient(to left, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, #000 20%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, #000 20%, transparent 78%);
}

.backdrop__orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.75;
  will-change: transform;
}

.backdrop__orb--one {
  top: -18vh;
  right: -6vw;
  width: 52vw;
  height: 52vw;
  max-width: 720px;
  max-height: 720px;
  background: radial-gradient(circle, var(--glow) 0%, transparent 68%);
  animation: orbDrift 22s var(--ease) infinite alternate;
}

.backdrop__orb--two {
  top: 22vh;
  left: -12vw;
  width: 46vw;
  height: 46vw;
  max-width: 620px;
  max-height: 620px;
  background: radial-gradient(circle, var(--glow-soft) 0%, transparent 70%);
  animation: orbDrift 28s 1.5s var(--ease) infinite alternate-reverse;
}

@keyframes orbDrift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(-4vw, 6vh, 0) scale(1.12); }
}

/* A hairline that fades in/out — used to separate bands */
.rule {
  width: 100%;
  height: 1px;
  border: 0;
  background: linear-gradient(to left, transparent, var(--line), transparent);
}

/* ===========================================================================
   Layout primitives
   =========================================================================== */
.shell {
  position: relative;
  z-index: 1;
}

.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

.section {
  padding: 104px 0;
}

@media (max-width: 720px) {
  .section { padding: 72px 0; }
  .container { padding: 0 18px; }
}

/* Visible to screen readers only — used where a visual element is duplicated
   or decorative and needs a single clean text equivalent. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Inline link inside a paragraph */
.inline-link {
  color: var(--mint);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: opacity 0.25s var(--ease);
}

.inline-link:hover { opacity: 0.75; }

/* Eyebrow label above a section heading */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-en);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mint);
  margin-bottom: 18px;
}

.eyebrow::before {
  content: "";
  width: 18px;
  height: 1px;
  background: currentColor;
  opacity: 0.6;
}

.section__title {
  font-size: clamp(1.75rem, 3.8vw, 2.7rem);
  font-weight: 800;
  line-height: 1.5;
  letter-spacing: -0.005em;
  color: var(--text);
  max-width: 20ch;
}

.section__lede {
  margin-top: 16px;
  font-size: clamp(1rem, 1.5vw, 1.125rem);
  font-weight: 400;
  line-height: 1.85;
  color: var(--muted);
  max-width: 56ch;
}

.section__head {
  margin-bottom: 56px;
}

/* ===========================================================================
   Buttons
   =========================================================================== */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 52px;
  padding: 0 26px;
  border-radius: 999px;
  font-family: var(--font-ar);
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
  isolation: isolate;
  overflow: hidden;
  transition:
    transform 0.28s var(--ease),
    box-shadow 0.28s var(--ease),
    background 0.28s var(--ease),
    border-color 0.28s var(--ease);
}

.btn:focus-visible {
  outline: 2px solid var(--mint);
  outline-offset: 3px;
}

.btn:active { transform: translateY(0) scale(0.985); }

/* Primary — brand gradient with a light sweep on hover */
.btn--primary {
  color: #fff;
  background: linear-gradient(135deg, var(--brand-from), var(--brand-to));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 1px 2px rgba(0, 0, 0, 0.3),
    0 10px 30px -10px var(--glow);
}

.btn--primary::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.22) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: transform 0.7s var(--ease);
}

.btn--primary:hover {
  transform: translateY(-2px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 2px 4px rgba(0, 0, 0, 0.3),
    0 18px 44px -12px var(--glow);
}

.btn--primary:hover::after { transform: translateX(120%); }

/* Ghost — glass with a hairline border */
.btn--ghost {
  color: var(--text);
  background: var(--btn-ghost-bg);
  border: 1px solid var(--btn-ghost-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.btn--ghost:hover {
  transform: translateY(-2px);
  background: var(--btn-ghost-bg-hover);
  border-color: var(--btn-ghost-border-hover);
}

.btn__arrow {
  transition: transform 0.28s var(--ease);
}

/* RTL: the arrow points left, so nudge it left on hover */
.btn:hover .btn__arrow { transform: translateX(-4px); }

/* ===== App Store button ===== */
.appstore-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  height: 56px;
  padding: 0 26px 0 22px;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, var(--brand-from), var(--brand-to));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 1px 2px rgba(0, 0, 0, 0.3),
    0 12px 34px -10px var(--glow);
  position: relative;
  overflow: hidden;
  isolation: isolate;
  transition: transform 0.28s var(--ease), box-shadow 0.28s var(--ease);
}

.appstore-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.24) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: transform 0.7s var(--ease);
}

.appstore-btn:hover {
  transform: translateY(-2px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    0 2px 4px rgba(0, 0, 0, 0.3),
    0 20px 48px -12px var(--glow);
}

.appstore-btn:hover::after { transform: translateX(120%); }

.appstore-btn:focus-visible {
  outline: 2px solid var(--mint);
  outline-offset: 3px;
}

.appstore-btn__apple {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
}

.appstore-btn__text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.15;
  font-family: var(--font-en);
  direction: ltr;
}

.appstore-btn__small {
  font-size: 10px;
  font-weight: 500;
  opacity: 0.82;
  letter-spacing: 0.04em;
}

.appstore-btn__large {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* Compact variant used inside the nav */
.appstore-btn--sm {
  height: 42px;
  padding: 0 18px 0 15px;
  gap: 9px;
}

.appstore-btn--sm .appstore-btn__apple { width: 18px; height: 18px; }
.appstore-btn--sm .appstore-btn__small { display: none; }
.appstore-btn--sm .appstore-btn__large { font-size: 14px; }

/* ===========================================================================
   Navigation — floating glass bar that condenses on scroll
   =========================================================================== */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 90;
  display: flex;
  justify-content: center;
  padding: 18px 18px 0;
  transition: padding 0.4s var(--ease);
}

.nav[data-scrolled="true"] { padding-top: 10px; }

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: 100%;
  max-width: 1120px;
  height: 64px;
  padding: 0 10px 0 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  transition:
    height 0.4s var(--ease),
    background 0.4s var(--ease),
    border-color 0.4s var(--ease),
    box-shadow 0.4s var(--ease),
    max-width 0.4s var(--ease);
}

.nav[data-scrolled="true"] .nav__inner {
  height: 58px;
  max-width: 940px;
  background: var(--glass-bg);
  border-color: var(--glass-border);
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
}

.nav__brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px;
  border-radius: 999px;
  transition: opacity 0.25s var(--ease);
}

.nav__brand:hover { opacity: 0.82; }

.nav__wordmark {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text);
}

.nav__links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav__link {
  position: relative;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--muted);
  transition: color 0.25s var(--ease), background 0.25s var(--ease);
}

.nav__link:hover {
  color: var(--text);
  background: var(--btn-ghost-bg-hover);
}

.nav__actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

@media (max-width: 900px) {
  .nav__links { display: none; }
}

@media (max-width: 480px) {
  .nav__inner { padding: 0 6px; }
  .nav__wordmark { display: none; }
}

/* ===========================================================================
   Theme toggle — compact icon button that lives in the nav
   =========================================================================== */
.theme-toggle {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--toggle-border);
  background: var(--toggle-track);
  color: var(--muted);
  overflow: hidden;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition:
    color 0.3s var(--ease),
    border-color 0.3s var(--ease),
    background 0.3s var(--ease),
    box-shadow 0.3s var(--ease);
}

.theme-toggle:hover {
  color: var(--text);
  border-color: var(--line-green);
  box-shadow: 0 0 18px var(--glow);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--mint);
  outline-offset: 3px;
}

/* The two icons live stacked; the active one rotates into place. */
.theme-toggle__icon {
  grid-area: 1 / 1;
  display: grid;
  place-items: center;
  transition: transform 0.45s var(--ease), opacity 0.3s var(--ease);
}

.theme-toggle[data-state="dark"] .theme-toggle__icon--sun,
.theme-toggle[data-state="light"] .theme-toggle__icon--moon {
  opacity: 0;
  transform: rotate(-90deg) scale(0.4);
}

.theme-toggle[data-state="dark"] .theme-toggle__icon--moon,
.theme-toggle[data-state="light"] .theme-toggle__icon--sun {
  opacity: 1;
  transform: rotate(0) scale(1);
}

/* ===========================================================================
   Footer
   =========================================================================== */
.site-footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
  padding: 72px 0 0;
}

.footer__top {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 48px;
  padding-bottom: 56px;
}

.footer__brand-row {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.footer__wordmark {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.footer__tagline {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.9;
  max-width: 38ch;
}

.footer__col-title {
  font-family: var(--font-en);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 18px;
}

.footer__list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  list-style: none;
}

.footer__link {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  width: fit-content;
  font-size: 0.92rem;
  color: var(--muted);
  transition: color 0.25s var(--ease), gap 0.25s var(--ease);
}

.footer__link:hover {
  color: var(--text);
  gap: 13px;
}

.footer__link svg { flex-shrink: 0; opacity: 0.8; }

.footer__bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 22px 0 28px;
  border-top: 1px solid var(--line);
}

.footer__copy {
  font-size: 0.85rem;
  color: var(--faint);
}

.footer__legal-links {
  display: flex;
  align-items: center;
  gap: 20px;
}

.footer__legal-link {
  font-size: 0.85rem;
  color: var(--muted);
  transition: color 0.25s var(--ease);
}

.footer__legal-link:hover { color: var(--mint); }

@media (max-width: 780px) {
  .footer__top {
    grid-template-columns: 1fr 1fr;
    gap: 36px;
  }
  .footer__brand-col { grid-column: 1 / -1; }
}

/* ===========================================================================
   Scroll reveal — driven by IntersectionObserver in src/reveal.rs
   =========================================================================== */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition:
    opacity 0.7s var(--ease-out) var(--reveal-delay, 0ms),
    transform 0.7s var(--ease-out) var(--reveal-delay, 0ms);
}

.reveal[data-reveal="in"] {
  opacity: 1;
  transform: none;
}

/* ===== Reduced motion: keep the design, drop the movement ===== */
@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;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}
