/* ============================================================
   UwUMat9 — «Apple Liquid Glass» design system (neutral)
   Apple Materials + System Colors · Arabic-first RTL
   Dark "Graphite" (default) · Light "Frost" (auto)
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
  /* Backdrop — neutral near-black (Apple dark canvas) */
  --base: #0a0a0b;

  /* Text (Apple label opacities) */
  --label: rgba(255, 255, 255, 0.95);
  --secondary: rgba(235, 235, 245, 0.6);
  --tertiary: rgba(235, 235, 245, 0.3);

  /* Material tiers — neutral white fills (the glass) */
  --glass-fill: rgba(255, 255, 255, 0.08);
  --glass-fill-thin: rgba(255, 255, 255, 0.06);
  --glass-border: rgba(255, 255, 255, 0.14);
  --glass-highlight: rgba(255, 255, 255, 0.18);
  --chrome-fill: rgba(22, 22, 24, 0.62);
  --scrim: rgba(6, 6, 7, 0.4);

  /* Elevation */
  --e2: 0 8px 24px rgba(0, 0, 0, 0.3);
  --e3: 0 20px 40px rgba(0, 0, 0, 0.4);
  --e3-hover: 0 24px 48px rgba(0, 0, 0, 0.45);

  /* Interaction overlays (theme-aware) */
  --hover-overlay: rgba(255, 255, 255, 0.07);
  --active-overlay: rgba(255, 255, 255, 0.1);

  /* Brand — NEUTRAL Apple monochrome. Surfaces/buttons = brushed graphite;
     headings = a silver text sheen. No brand hue anywhere. */
  --primary: #48484a;
  --grad: linear-gradient(135deg, #5a5a5e 0%, #3a3a3c 55%, #232325 100%);
  --grad-text: linear-gradient(135deg, #ffffff 0%, #c7c7cc 100%);
  --success: #30d158;

  /* Geometry (8pt grid) */
  --radius-md: 16px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-pill: 999px;

  /* Motion */
  --ease-ios: cubic-bezier(0.32, 0.72, 0, 1);
  --dur-fast: 200ms;
  --dur-base: 300ms;

  --font: "IBM Plex Sans Arabic", -apple-system, BlinkMacSystemFont,
    "Segoe UI", system-ui, sans-serif;
}

/* Frost (light) */
@media (prefers-color-scheme: light) {
  :root {
    --base: #f2f2f7;
    --label: rgba(0, 0, 0, 0.92);
    --secondary: rgba(60, 60, 67, 0.6);
    --tertiary: rgba(60, 60, 67, 0.3);
    --glass-fill: rgba(255, 255, 255, 0.55);
    --glass-fill-thin: rgba(255, 255, 255, 0.45);
    --glass-border: rgba(255, 255, 255, 0.7);
    --glass-highlight: rgba(255, 255, 255, 0.9);
    --chrome-fill: rgba(255, 255, 255, 0.65);
    --scrim: rgba(238, 240, 250, 0.35);
    --e2: 0 8px 24px rgba(31, 38, 80, 0.1);
    --e3: 0 20px 40px rgba(31, 38, 80, 0.12);
    --e3-hover: 0 24px 48px rgba(31, 38, 80, 0.18);
    --hover-overlay: rgba(0, 0, 0, 0.05);
    --active-overlay: rgba(0, 0, 0, 0.08);
    /* Light-mode primary = near-black graphite; headings = dark silver. */
    --grad: linear-gradient(135deg, #3a3a3c 0%, #1d1d1f 100%);
    --grad-text: linear-gradient(135deg, #1d1d1f 0%, #48484a 100%);
  }
}

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

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  min-height: 100vh;
  background: var(--base);
  color: var(--label);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ---------- Light Pillar backdrop ---------- */
/* An animated violet→pink light beam (WebGL, mounted by light-pillar.js) so the
   glass Materials refract living light. The CSS gradient here is the always-on
   poster: it paints instantly and stays as the fallback on mobile / reduced
   motion / no-WebGL. `#pillar-bg` also hosts the <canvas> the script appends. */
.aurora {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  overflow: hidden;
  background: #06060a;
}
/* Poster beam — a 25°-tilted violet→pink shaft matching the WebGL pillar's
   pillarRotation. Paints instantly; the <canvas> (screen-blended) draws over it. */
.aurora::before {
  content: "";
  position: absolute;
  inset: -30%;
  transform: rotate(25deg);
  background: linear-gradient(
    180deg,
    rgba(82, 39, 255, 0.5) 0%,
    rgba(123, 80, 255, 0.34) 45%,
    rgba(255, 159, 252, 0.44) 100%
  );
  -webkit-mask-image: radial-gradient(42% 120% at 50% 50%, #000 0%, transparent 72%);
  mask-image: radial-gradient(42% 120% at 50% 50%, #000 0%, transparent 72%);
  filter: blur(60px);
}
.aurora canvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
}
/* Readability scrim above the beam. */
.aurora::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(6, 6, 10, 0.42) 0%, rgba(6, 6, 10, 0.28) 45%, rgba(6, 6, 10, 0.5) 100%);
}
@media (prefers-color-scheme: light) {
  /* Keep the dark beam but lift the scrim so light-mode glass + dark text read. */
  .aurora::after {
    background: linear-gradient(180deg, rgba(240, 240, 248, 0.66) 0%, rgba(240, 240, 248, 0.5) 45%, rgba(240, 240, 248, 0.72) 100%);
  }
}

@keyframes aurora-drift {
  from { transform: translate3d(-2%, -1.5%, 0) scale(1); }
  to   { transform: translate3d(2%, 1.5%, 0) scale(1.06); }
}

/* Grain — kills the "plastic" look */
.grain {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Glass surfaces ---------- */
.glass,
.glass-thin,
.glass-chrome {
  border: 1px solid var(--glass-border);
  box-shadow: inset 0 1px 0 var(--glass-highlight), var(--e3);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  backdrop-filter: blur(40px) saturate(180%);
}

.glass { background: var(--glass-fill); border-radius: var(--radius-xl); }

.glass-thin {
  background: var(--glass-fill-thin);
  border-radius: var(--radius-lg);
  box-shadow: inset 0 1px 0 var(--glass-highlight), var(--e2);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  backdrop-filter: blur(30px) saturate(180%);
}

.glass-chrome {
  background: var(--chrome-fill);
  -webkit-backdrop-filter: blur(60px) saturate(200%);
  backdrop-filter: blur(60px) saturate(200%);
}

/* Solid fallback when backdrop-filter is unsupported */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass, .glass-thin, .btn-glass { background: rgba(28, 28, 30, 0.92); }
  .glass-chrome { background: rgba(18, 18, 20, 0.96); }
  @media (prefers-color-scheme: light) {
    .glass, .glass-thin, .btn-glass { background: rgba(255, 255, 255, 0.94); }
    .glass-chrome { background: rgba(255, 255, 255, 0.97); }
  }
}

/* Reduce Transparency → solid surfaces (both themes) */
@media (prefers-reduced-transparency: reduce) {
  .glass, .glass-thin, .btn-glass { background: rgba(28, 28, 30, 0.96); backdrop-filter: none; -webkit-backdrop-filter: none; }
  .glass-chrome { background: rgba(18, 18, 20, 0.98); backdrop-filter: none; -webkit-backdrop-filter: none; }
  @media (prefers-color-scheme: light) {
    .glass, .glass-thin, .btn-glass { background: rgba(255, 255, 255, 0.96); }
    .glass-chrome { background: rgba(255, 255, 255, 0.98); }
  }
}

/* ---------- Layout ---------- */
.container {
  max-width: 1080px;
  margin-inline: auto;
  padding-inline: 24px;
}

.narrow { max-width: 820px; }

/* ---------- Navigation (floating chrome pill) ---------- */
.nav-wrap {
  position: sticky;
  top: 16px;
  z-index: 50;
  padding-inline: 16px;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1080px;
  margin-inline: auto;
  padding: 10px 20px;
  border-radius: var(--radius-pill);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-weight: 700;
  font-size: 20px;
  color: var(--label);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.brand .mark {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--grad);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255,255,255,0.14);
}

.brand .mark svg { width: 22px; height: 22px; color: #fff; }

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

.nav-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding-inline: 14px;
  border-radius: var(--radius-pill);
  color: var(--secondary);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  transition: color var(--dur-fast) var(--ease-ios), background var(--dur-fast) var(--ease-ios);
}

.nav-links a:hover { color: var(--label); background: var(--hover-overlay); }
.nav-links a[aria-current="page"] { color: var(--label); background: var(--active-overlay); }

/* Auth CTAs on the nav — login + dashboard shortcuts into the app. */
.nav-cta { display: flex; align-items: center; gap: 8px; }
.nav-cta .btn { min-height: 40px; padding-inline: 16px; font-size: 14px; }
/* Below the wide breakpoint the middle links hide; the CTAs stay. */
@media (max-width: 720px) {
  .nav-links { display: none; }
  .nav-cta .btn-login { display: none; } /* keep just "الداشبورد" on tight screens */
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 24px;
  border-radius: var(--radius-md);
  border: 0;
  font-family: var(--font);
  font-size: 17px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-ios), box-shadow var(--dur-fast) var(--ease-ios), background var(--dur-fast) var(--ease-ios);
}

.btn:active { transform: scale(0.96); }

.btn-primary {
  background: var(--grad);
  color: #fff;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255,255,255,0.12);
}

.btn-primary:hover { box-shadow: 0 14px 34px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255,255,255,0.16); }

.btn-glass {
  background: var(--glass-fill-thin);
  color: var(--label);
  border: 1px solid var(--glass-border);
  box-shadow: inset 0 1px 0 var(--glass-highlight);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  backdrop-filter: blur(30px) saturate(180%);
}

.btn-glass:hover { background: var(--glass-fill); }

/* ---------- Hero ---------- */
.hero {
  padding-block: 96px 64px;
  text-align: center;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 600;
  color: var(--secondary);
  margin-bottom: 28px;
}

.hero-badge .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 10px var(--success);
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse { 50% { opacity: 0.45; } }

.display {
  font-size: clamp(38px, 7vw, 68px);
  font-weight: 700;
  line-height: 1.28;
  letter-spacing: -0.015em;
  margin-bottom: 20px;
}

.grad-text {
  background: var(--grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero p.lead {
  max-width: 640px;
  margin: 0 auto 12px;
  font-size: 19px;
  color: var(--secondary);
}

.hero .lead-en {
  font-size: 15px;
  color: var(--tertiary);
  margin-bottom: 36px;
}

.hero-cta { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; }

/* ---------- Sections ---------- */
.section { padding-block: 56px; }

.section-title {
  font-size: 28px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 8px;
}

.section-sub {
  text-align: center;
  color: var(--secondary);
  margin-bottom: 40px;
}

.grid {
  display: grid;
  gap: 20px;
}

.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }

@media (max-width: 900px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 560px) {
  .grid-4, .grid-3 { grid-template-columns: 1fr; }
}

.card {
  padding: 24px;
  transition: transform var(--dur-base) var(--ease-ios), box-shadow var(--dur-base) var(--ease-ios);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: inset 0 1px 0 var(--glass-highlight), var(--e3-hover), 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.card .icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: var(--grad);
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 16px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.card h3 { font-size: 17px; font-weight: 600; margin-bottom: 6px; }
.card p { font-size: 14px; color: var(--secondary); line-height: 1.7; }

.step-num {
  font-size: 13px;
  font-weight: 700;
  color: var(--tertiary);
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}

/* ---------- Legal (prose) ---------- */
.page-header { padding-block: 72px 24px; text-align: center; }

.page-header h1 { font-size: clamp(30px, 5vw, 42px); font-weight: 700; margin-bottom: 10px; }

.page-header .meta { color: var(--tertiary); font-size: 14px; }

.prose-card { padding: clamp(24px, 5vw, 48px); margin-bottom: 32px; }

.prose h2 {
  font-size: 21px;
  font-weight: 700;
  margin: 36px 0 12px;
  padding-top: 8px;
}

.prose h2:first-child { margin-top: 0; }

.prose h2::before {
  content: "";
  display: inline-block;
  width: 22px;
  height: 4px;
  border-radius: 2px;
  background: var(--grad);
  margin-inline-end: 10px;
  vertical-align: middle;
}

.prose p, .prose li { color: var(--secondary); font-size: 16px; }
.prose p { margin-bottom: 12px; }
.prose ul { padding-inline-start: 22px; margin-bottom: 12px; }
.prose li { margin-bottom: 6px; }
.prose strong { color: var(--label); font-weight: 600; }
.prose a { color: #f5f5f7; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(255,255,255,0.35); }
.prose a:hover { text-decoration: underline; }

@media (prefers-color-scheme: light) {
  .prose a { color: #1d1d1f; text-decoration-color: rgba(0,0,0,0.35); }
}

.lang-note {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
  color: var(--secondary);
  margin-bottom: 20px;
}

/* Numbers / emails / URLs inside Arabic text stay LTR (bidi-isolate) */
.ltr { direction: ltr; unicode-bidi: isolate; }

.text-center { text-align: center; }
.note-small { font-size: 14px; }

/* ---------- Footer ---------- */
footer {
  margin-top: 64px;
  padding-block: 40px;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 28px 32px;
  border-radius: var(--radius-xl);
}

.footer-inner .links { display: flex; flex-wrap: wrap; gap: 6px; }

.footer-inner .links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding-inline: 10px;
  color: var(--secondary);
  text-decoration: none;
  font-size: 14px;
}

.footer-inner .links a:hover { color: var(--label); }

.footer-inner .copy { color: var(--tertiary); font-size: 13px; }

/* ---------- Motion & a11y ---------- */
.reveal { animation: rise 0.6s var(--ease-ios) both; }
.reveal-1 { animation-delay: 60ms; }
.reveal-2 { animation-delay: 120ms; }
.reveal-3 { animation-delay: 180ms; }

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .aurora { animation: none; }
  .hero-badge .dot { animation: none; }
  .reveal, .reveal-1, .reveal-2, .reveal-3 { animation: fade 0.3s ease both; }
  * { transition-duration: 0.01ms !important; }
  @keyframes fade { from { opacity: 0; } to { opacity: 1; } }
}

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

::selection { background: rgba(255, 255, 255, 0.22); }
