:root {
  /* Kinroot Vivid palette — light mode (matches app kinroot_vivid) */
  --vivid-primary: #2563eb;
  --vivid-primary-deep: #1d4ed8;
  --vivid-primary-bright: #3b82f6;
  --vivid-sidebar: #1e3a8a;
  --vivid-sky: #0ea5e9;
  --vivid-gold: #f59e0b;
  --vivid-orange: #ea580c;
  --vivid-coral: #fb923c;
  --vivid-rose: #e11d48;
  --vivid-violet: #7c3aed;
  --vivid-indigo: #6366f1;
  --vivid-emerald: #059669;
  --vivid-emerald-soft: #d1fae5;
  --vivid-blue-soft: #dbeafe;
  --vivid-gold-soft: #fef3c7;

  --bg-deep: #f4f6f8;
  --bg-mid: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.94);
  --text: #0f172a;
  --text-muted: #64748b;
  --border: rgba(15, 23, 42, 0.08);
  --glow: 0 12px 48px rgba(37, 99, 235, 0.12);
  --radius: 20px;
  --font-ar: 'Noto Kufi Arabic', 'Segoe UI', system-ui, sans-serif;
  --font-en: 'Outfit', 'Segoe UI', system-ui, sans-serif;

  /* Scroll-driven (updated by JS) */
  --scroll-p: 0;
  --hero-p: 0;
  --section-p: 0;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-ar);
  background: var(--bg-deep);
  color: var(--text);
  line-height: 1.65;
  overflow-x: hidden;
}

#nasab-landing {
  position: relative;
  z-index: 1;
}

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

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

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

.container {
  width: min(1140px, 92vw);
  margin-inline: auto;
}

/* ── Nav ── */
.site-nav {
  position: fixed;
  inset-inline: 0;
  top: 0;
  z-index: 100;
  padding: 1rem 0;
  transition: background 0.35s ease, backdrop-filter 0.35s ease, box-shadow 0.35s ease;
}

.site-nav.is-scrolled {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  box-shadow: 0 8px 32px rgba(15, 23, 42, 0.08);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.brand img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(37, 99, 235, 0.2));
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  font-size: 0.92rem;
  color: var(--text-muted);
}

.nav-links a:hover {
  color: var(--vivid-primary);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.72rem 1.35rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.92rem;
  border: none;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--vivid-gold), #fbbf24);
  color: #1a1200;
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.28);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.7);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-vivid {
  background: linear-gradient(135deg, var(--vivid-primary-deep), var(--vivid-primary));
  color: #fff;
  box-shadow: 0 8px 28px rgba(37, 99, 235, 0.4);
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
}

/* ── Hero — glass clear, tree visible through ── */
.hero {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 7rem 0 4rem;
  overflow: hidden;
  background: transparent;
}

.hero-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 65% 50% at 18% 22%, rgba(37, 99, 235, 0.07), transparent 68%),
    radial-gradient(ellipse 55% 45% at 82% 78%, rgba(5, 150, 105, 0.06), transparent 65%),
    radial-gradient(ellipse 40% 35% at 50% 90%, rgba(245, 158, 11, 0.05), transparent 70%);
  transform: none;
}

.hero-orb {
  position: absolute;
  border-radius: 50%;
  opacity: 0.12;
  pointer-events: none;
  animation: float 8s ease-in-out infinite;
}

.hero-orb--1 {
  width: 420px;
  height: 420px;
  background: rgba(37, 99, 235, 0.08);
  top: -80px;
  inset-inline-end: -100px;
}

.hero-orb--2 {
  width: 300px;
  height: 300px;
  background: rgba(245, 158, 11, 0.07);
  bottom: 10%;
  inset-inline-start: -60px;
  animation-delay: -3s;
}

#hero-canvas {
  display: none;
}

.hero-grid {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 3rem;
  align-items: center;
}

.hero-content {
  opacity: 1;
  transform: none;
  filter: none;
  backdrop-filter: none;
}

.hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 0 1rem;
  background: linear-gradient(135deg, #1e293b 0%, var(--vivid-primary) 45%, var(--vivid-gold) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-lead {
  font-size: 1.08rem;
  color: var(--text-muted);
  max-width: 52ch;
  margin-bottom: 2rem;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(37, 99, 235, 0.12);
  color: var(--vivid-primary-deep);
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  animation: pulse-glow 3s ease-in-out infinite;
  backdrop-filter: none;
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.08);
}

.hero-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-bottom: 2.5rem;
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.stat {
  text-align: start;
}

.stat strong {
  display: block;
  font-size: 1.5rem;
  color: var(--vivid-primary);
  font-weight: 800;
}

.stat span {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ── Device mockups ── */
.mockup-stage {
  position: relative;
  min-height: 420px;
}

.mockup-glow {
  position: absolute;
  inset: 10% 5%;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.08), transparent 72%);
  pointer-events: none;
}

.device {
  position: absolute;
  border-radius: 28px;
  background: linear-gradient(145deg, #1a2a38, #0d1820);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.55), var(--glow);
  overflow: hidden;
}

.device--phone {
  width: 220px;
  height: 450px;
  inset-inline-end: 0;
  top: 20px;
  transform: rotate(4deg);
  animation: float 6s ease-in-out infinite;
  z-index: 3;
}

.device--desktop {
  width: 420px;
  height: 290px;
  inset-inline-start: 0;
  bottom: 0;
  border-radius: 16px;
  animation: float 7s ease-in-out infinite reverse;
  z-index: 2;
}

.device-bar {
  height: 14px;
  background: linear-gradient(180deg, #1a2a38, #0d1820);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.device-shot {
  width: 100%;
  height: calc(100% - 22px);
  object-fit: cover;
  object-position: top center;
  display: block;
  background: #f8fafc;
}

.device--desktop .device-shot {
  height: calc(100% - 14px);
}

.device-shot--phone {
  border-radius: 0 0 24px 24px;
}

.device-notch {
  height: 22px;
  background: #0a1218;
  display: flex;
  align-items: center;
  justify-content: center;
}

.device-notch span {
  width: 60px;
  height: 5px;
  border-radius: 99px;
  background: #1e293b;
}

.device-screen {
  padding: 12px;
  height: calc(100% - 22px);
  background: linear-gradient(180deg, #0f172a 0%, #0c4a44 100%);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.device-screen--wide {
  height: 100%;
  padding: 14px;
}

.ui-bar {
  height: 8px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.12);
}

.ui-bar--short {
  width: 45%;
}

.ui-card {
  flex: 1;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.ui-node {
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.35), rgba(37, 99, 235, 0.35));
  min-height: 36px;
  animation: shimmer 4s ease-in-out infinite;
}

.ui-sidebar {
  width: 28%;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.25);
}

.ui-main {
  flex: 1;
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 8px;
}

/* ── Sections ── */
.section {
  padding: 5.5rem 0;
  position: relative;
}

.scroll-stage {
  --section-p: 0;
  opacity: calc(0.55 + var(--section-p) * 0.45);
  transform: translateY(calc((1 - var(--section-p)) * 56px));
  transition: opacity 0.15s linear, transform 0.15s linear;
}

/* Hero is never dimmed, blurred, or scroll-faded */
.hero,
.hero.scroll-stage {
  --section-p: 1;
  opacity: 1 !important;
  transform: none !important;
  filter: none !important;
  backdrop-filter: none !important;
  transition: none !important;
  background: transparent !important;
}

.hero-bg {
  background: transparent !important;
  backdrop-filter: none !important;
}

.hero .reveal,
.hero-content,
.hero .mockup-stage {
  opacity: 1 !important;
  transform: none !important;
  filter: none !important;
  backdrop-filter: none !important;
}

.scroll-stage.is-active {
  opacity: 1;
  transform: none;
}

.section-head {
  text-align: center;
  max-width: 640px;
  margin: 0 auto 3rem;
}

.section-head h2 {
  font-size: clamp(1.8rem, 3.5vw, 2.6rem);
  margin: 0 0 0.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.section-head p {
  color: var(--text-muted);
  margin: 0;
  font-size: 1.05rem;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.25rem;
}

.feature-card {
  padding: 1.5rem;
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: 0 4px 24px rgba(15, 23, 42, 0.05);
  transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.feature-card:hover {
  transform: translateY(-6px);
  border-color: rgba(37, 99, 235, 0.22);
  box-shadow: 0 20px 50px rgba(37, 99, 235, 0.12);
}

.feature-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 1.35rem;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, var(--vivid-blue-soft), #eff6ff);
}

.feature-card:nth-child(1) .feature-icon { background: linear-gradient(135deg, #d1fae5, #ecfdf5); }
.feature-card:nth-child(2) .feature-icon { background: linear-gradient(135deg, #dbeafe, #eff6ff); }
.feature-card:nth-child(3) .feature-icon { background: linear-gradient(135deg, #e0f2fe, #f0f9ff); }
.feature-card:nth-child(4) .feature-icon { background: linear-gradient(135deg, #e0e7ff, #eef2ff); }
.feature-card:nth-child(5) .feature-icon { background: linear-gradient(135deg, #fef3c7, #fffbeb); }
.feature-card:nth-child(6) .feature-icon { background: linear-gradient(135deg, #fce7f3, #fdf2f8); }
.feature-card:nth-child(7) .feature-icon { background: linear-gradient(135deg, #ede9fe, #f5f3ff); }
.feature-card:nth-child(8) .feature-icon { background: linear-gradient(135deg, #ffedd5, #fff7ed); }

.feature-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
}

.feature-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.92rem;
}

#features.is-active .feature-card.reveal.is-visible {
  animation: card-rise 0.75s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

#features .feature-card.reveal:nth-child(1) { animation-delay: 0.04s; }
#features .feature-card.reveal:nth-child(2) { animation-delay: 0.08s; }
#features .feature-card.reveal:nth-child(3) { animation-delay: 0.12s; }
#features .feature-card.reveal:nth-child(4) { animation-delay: 0.16s; }
#features .feature-card.reveal:nth-child(5) { animation-delay: 0.2s; }
#features .feature-card.reveal:nth-child(6) { animation-delay: 0.24s; }
#features .feature-card.reveal:nth-child(7) { animation-delay: 0.28s; }
#features .feature-card.reveal:nth-child(8) { animation-delay: 0.32s; }

/* ── Steps ── */
.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  counter-reset: step;
}

.step {
  position: relative;
  padding: 2rem 1.5rem 1.5rem;
  border-radius: var(--radius);
  background: linear-gradient(160deg, var(--vivid-blue-soft), #ffffff);
  border: 1px solid var(--border);
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.04);
  transform: translateX(calc((1 - var(--section-p)) * 40px));
  opacity: calc(0.5 + var(--section-p) * 0.5);
}

#how.is-active .step {
  transform: none;
  opacity: 1;
  transition: transform 0.7s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.7s ease;
}

#how.is-active .step:nth-child(2) { transition-delay: 0.12s; }
#how.is-active .step:nth-child(3) { transition-delay: 0.24s; }

.step::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  top: -14px;
  inset-inline-start: 1.5rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--vivid-gold), var(--vivid-primary-bright));
  color: #fff;
  font-weight: 800;
  display: grid;
  place-items: center;
  font-size: 0.95rem;
}

.step h3 {
  margin: 0.5rem 0 0.5rem;
}

.step p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.92rem;
}

/* ── Platforms ── */
.platforms {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: center;
}

.platform-card {
  padding: 2rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  box-shadow: 0 4px 24px rgba(15, 23, 42, 0.05);
}

.platform-card h3 {
  margin: 0 0 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.platform-card p {
  margin: 0;
  color: var(--text-muted);
}

.shots-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.shot {
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  aspect-ratio: 9/16;
  background: #f1f5f9;
  position: relative;
  transform: scale(calc(0.94 + var(--section-p) * 0.06));
  box-shadow: 0 16px 40px rgba(37, 99, 235, calc(var(--section-p) * 0.1));
}

.shot--wide {
  aspect-ratio: 16/10;
  grid-column: span 2;
}

.shot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  opacity: 1;
}

.shot-label {
  position: absolute;
  bottom: 0;
  inset-inline: 0;
  padding: 0.75rem 1rem;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.75));
  font-size: 0.82rem;
  font-weight: 600;
}

/* ── CTA ── */
.cta {
  padding: 5rem 0 6rem;
}

.cta-box {
  text-align: center;
  padding: 3.5rem 2rem;
  border-radius: 28px;
  background:
    radial-gradient(ellipse at top, rgba(251, 191, 36, 0.14), transparent 55%),
    linear-gradient(145deg, var(--vivid-blue-soft), #ffffff);
  border: 1px solid rgba(37, 99, 235, 0.14);
  box-shadow: var(--glow);
  transform: scale(calc(0.92 + var(--section-p) * 0.08));
  opacity: calc(0.6 + var(--section-p) * 0.4);
}

#join.is-active .cta-box {
  transform: scale(1);
  opacity: 1;
  transition: transform 0.8s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.8s ease;
}

.cta-box h2 {
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  margin: 0 0 0.75rem;
}

.cta-box p {
  color: var(--text-muted);
  max-width: 50ch;
  margin: 0 auto 2rem;
}

.cta-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 1rem;
}

.cta-note {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ── Footer ── */
.site-footer {
  padding: 2.5rem 0;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.88rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1.5rem;
  align-items: center;
}

/* ── Scroll journey: living family tree ── */
.living-tree {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

#living-tree-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.94;
}

.living-tree__glow {
  position: absolute;
  width: min(28vmax, 280px);
  height: min(28vmax, 280px);
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(16, 185, 129, 0.14) 0%,
    rgba(37, 99, 235, 0.06) 45%,
    transparent 72%
  );
  bottom: 8%;
  inset-inline-start: 6%;
  opacity: 0.55;
  pointer-events: none;
}

.living-tree__ground {
  position: absolute;
  bottom: 0;
  inset-inline: 0;
  height: 18vh;
  background: linear-gradient(
    180deg,
    transparent,
    rgba(5, 150, 105, 0.06)
  );
}

.section-divider {
  height: 1px;
  max-width: min(1140px, 92vw);
  margin: 0 auto;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(5, 150, 105, calc(0.12 + var(--scroll-p) * 0.28)),
    rgba(245, 158, 11, calc(0.1 + var(--scroll-p) * 0.2)),
    transparent
  );
  transform: scaleX(calc(0.3 + var(--scroll-p) * 0.7));
  opacity: calc(0.4 + var(--scroll-p) * 0.6);
}

/* ── Animations ── */
.reveal {
  opacity: 0;
  transform: translateY(36px);
  transition:
    opacity 0.75s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.75s cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* Keep hero above generic reveal rules (loaded later in cascade) */
.hero .reveal,
.hero-content,
.hero .mockup-stage {
  opacity: 1 !important;
  transform: none !important;
  filter: none !important;
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0) rotate(4deg);
  }
  50% {
    transform: translateY(-14px) rotate(4deg);
  }
}

@keyframes pulse-glow {
  0%,
  100% {
    box-shadow: 0 0 0 rgba(251, 191, 36, 0);
  }
  50% {
    box-shadow: 0 0 24px rgba(37, 99, 235, 0.18);
  }
}

@keyframes card-rise {
  from {
    opacity: 0;
    transform: translateY(28px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes shimmer {
  0%,
  100% {
    opacity: 0.65;
  }
  50% {
    opacity: 1;
  }
}

/* ── Flutter loader (hidden on landing) ── */
#nasab-flutter-root {
  display: none;
}

body.nasab-app-mode #nasab-landing {
  display: none !important;
}

body.nasab-app-mode #nasab-flutter-root {
  display: block;
}

body.nasab-app-mode #app-loading {
  display: flex;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .living-tree,
  .hero-orb,
  .device--phone,
  .device--desktop {
    animation: none !important;
  }

  .hero-grid,
  .mockup-stage,
  .hero-bg,
  .scroll-stage,
  .step,
  .shot,
  .cta-box,
  .section-divider {
    transform: none !important;
    opacity: 1 !important;
    filter: none !important;
    transition: none !important;
  }

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

/* ── Responsive ── */
@media (max-width: 900px) {
  #living-tree-canvas {
    opacity: 0.85;
  }

  .living-tree__glow {
    width: 32vmax;
    height: 32vmax;
    inset-inline-start: 0;
  }

  .hero-grid,
  .platforms,
  .steps {
    grid-template-columns: 1fr;
  }

  .mockup-stage {
    min-height: 360px;
    margin-top: 2rem;
  }

  .device--desktop {
    width: 280px;
    height: 190px;
  }

  .device--phone {
    width: 170px;
    height: 340px;
  }

  .nav-links {
    display: none;
  }
}

@media (max-width: 600px) {
  .hero-ctas,
  .cta-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .btn {
    width: 100%;
  }
}
