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

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Cairo', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 14% 12%, rgba(0, 234, 255, .22), transparent 32%),
    radial-gradient(circle at 86% 34%, rgba(139, 92, 246, .16), transparent 34%),
    linear-gradient(135deg, #031118 0%, #050a12 48%, #101022 100%);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.modal-open { overflow: hidden; }

img, picture, svg { display: block; max-width: 100%; }
button, input { font: inherit; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }

::selection { background: rgba(0, 234, 255, .28); color: #fff; }

.bg-aurora,
.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -2;
}

.bg-aurora { overflow: hidden; }
.bg-aurora span {
  position: absolute;
  width: 520px;
  height: 520px;
  border-radius: 999px;
  filter: blur(95px);
  opacity: .28;
  transform: translate3d(0,0,0);
  animation: floatBlob 14s var(--ease) infinite alternate;
  animation-play-state: paused;
}
.bg-aurora span:nth-child(1) { right: -160px; top: -140px; background: #00eaff; }
.bg-aurora span:nth-child(2) { left: -160px; top: 22%; background: #14e7c0; animation-duration: 17s; }
.bg-aurora span:nth-child(3) { left: 18%; bottom: -250px; background: #8b5cf6; animation-duration: 19s; opacity: .18; }

.bg-grid {
  z-index: -1;
  background-image:
    linear-gradient(rgba(255,255,255,.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.024) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(circle at 50% 20%, black 0 45%, transparent 78%);
}

body.site-ready .bg-aurora span,
body.site-ready .bg-grid,
body.site-ready .bg-grid::after {
  animation-play-state: running;
}

.scroll-progress {
  position: fixed;
  inset: 0 auto auto 0;
  height: 3px;
  width: 100%;
  transform: scaleX(0);
  transform-origin: left center;
  z-index: 9999;
  background: linear-gradient(90deg, var(--teal), var(--cyan), var(--violet));
  box-shadow: 0 0 14px rgba(0,234,255,.72);
  will-change: transform;
}
html[dir="rtl"] .scroll-progress { transform-origin: right center; }

.interactive { cursor: pointer; -webkit-tap-highlight-color: transparent; }

.is-hidden { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { filter: none !important; transform: translate3d(0, 8px, 0) scale(.998) !important; }
  .reveal.is-visible { transform: translate3d(0, 0, 0) scale(1) !important; }
  .bg-aurora span,
  .bg-grid,
  .avatar::before,
  .avatar::after,
  .status-indicator::after,
  .evc-border,
  .ayah-orbit {
    animation-duration: 18s !important;
  }
  .ripple,
  .flower-petal,
  .neon-streak {
    animation-duration: 260ms !important;
  }
}

/* v4 background polish: same identity, smoother depth */
body {
  background:
    radial-gradient(circle at 12% 12%, rgba(0, 234, 255, .24), transparent 30%),
    radial-gradient(circle at 88% 30%, rgba(139, 92, 246, .18), transparent 34%),
    radial-gradient(circle at 52% 92%, rgba(20, 231, 192, .11), transparent 32%),
    linear-gradient(135deg, #031118 0%, #050a12 48%, #101022 100%);
}
.bg-grid {
  background-image:
    linear-gradient(rgba(0,234,255,.036) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,234,255,.03) 1px, transparent 1px),
    radial-gradient(circle at 50% 50%, rgba(255,255,255,.035) 0 1px, transparent 1px);
  background-size: 72px 72px, 72px 72px, 36px 36px;
  animation: gridDrift 22s linear infinite;
  animation-play-state: paused;
}
.bg-aurora span:nth-child(1) { opacity: .32; }
.bg-aurora span:nth-child(2) { opacity: .24; }
.bg-aurora span:nth-child(3) { opacity: .2; }

@keyframes gridDrift {
  to { background-position: 72px 72px, 72px 72px, 36px 36px; }
}

/* v6 smart background modes: driven by profile status, not by a user switch */
body {
  --status-color: var(--cyan);
  --status-glow: rgba(0, 234, 255, .45);
  transition: background 700ms var(--ease), filter 280ms var(--ease);
}

body.bg-mode-sleep {
  background:
    radial-gradient(circle at 18% 10%, rgba(125,211,252,.14), transparent 30%),
    radial-gradient(circle at 85% 38%, rgba(99,102,241,.12), transparent 34%),
    linear-gradient(135deg, #020711 0%, #040817 48%, #090b18 100%);
}
body.bg-mode-stars {
  background:
    radial-gradient(circle at 10% 12%, rgba(247,201,72,.13), transparent 28%),
    radial-gradient(circle at 86% 30%, rgba(0,234,255,.12), transparent 33%),
    linear-gradient(135deg, #030c14 0%, #050a12 48%, #0d1020 100%);
}
body.bg-mode-aurora {
  background:
    radial-gradient(circle at 12% 12%, rgba(39,230,129,.18), transparent 30%),
    radial-gradient(circle at 88% 30%, rgba(0,234,255,.16), transparent 34%),
    radial-gradient(circle at 52% 92%, rgba(20,231,192,.11), transparent 32%),
    linear-gradient(135deg, #031118 0%, #050a12 48%, #101022 100%);
}
body.bg-mode-coding {
  background:
    radial-gradient(circle at 12% 12%, rgba(0,234,255,.22), transparent 30%),
    radial-gradient(circle at 84% 28%, rgba(14,165,233,.12), transparent 33%),
    linear-gradient(135deg, #031018 0%, #050b13 48%, #071525 100%);
}
body.bg-mode-gaming {
  background:
    radial-gradient(circle at 13% 12%, rgba(169,112,255,.18), transparent 31%),
    radial-gradient(circle at 88% 34%, rgba(255,61,142,.12), transparent 34%),
    radial-gradient(circle at 48% 92%, rgba(0,234,255,.11), transparent 32%),
    linear-gradient(135deg, #050814 0%, #080b18 48%, #130b25 100%);
}

.bg-grid::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  background-image:
    radial-gradient(circle, rgba(255,255,255,.72) 0 1px, transparent 1.5px),
    radial-gradient(circle, rgba(0,234,255,.45) 0 1px, transparent 1.4px);
  background-size: 118px 118px, 176px 176px;
  background-position: 16px 20px, 72px 48px;
  mask-image: radial-gradient(circle at 50% 28%, black 0 42%, transparent 76%);
  transition: opacity 700ms var(--ease);
  animation: starTwinkle 5.4s ease-in-out infinite alternate;
  animation-play-state: paused;
}

@media (max-width: 560px) {
  .bg-aurora span {
    filter: blur(58px);
    opacity: .12;
  }
  .bg-grid {
    background-size: 92px 92px, 92px 92px, 46px 46px;
    opacity: .48;
  }
  .scroll-progress {
    height: 2px;
    box-shadow: 0 0 8px rgba(0,234,255,.52);
  }
}

/* v9.1 softer mobile background/performance profile */
@media (max-width: 560px) {
  body.bg-mode-gaming .bg-aurora span,
  body.bg-mode-aurora .bg-aurora span,
  body.bg-mode-coding .bg-aurora span {
    opacity: .14;
  }

  body.bg-mode-sleep .bg-aurora span,
  body.bg-mode-stars .bg-aurora span {
    opacity: .1;
  }

  body.low-power-mode .bg-aurora span,
  body.low-power-mode .bg-grid {
    opacity: .1;
  }
}
body.bg-mode-stars .bg-grid::after,
body.bg-mode-sleep .bg-grid::after { opacity: .34; }
body.bg-mode-gaming .bg-aurora span:nth-child(1) { background: #a970ff; opacity: .30; }
body.bg-mode-gaming .bg-aurora span:nth-child(2) { background: #ff3d8e; opacity: .22; }
body.bg-mode-gaming .bg-aurora span:nth-child(3) { background: #00eaff; opacity: .18; }
body.bg-mode-sleep .bg-aurora span { opacity: .12; animation-duration: 24s; }
body.bg-mode-stars .bg-aurora span { opacity: .16; animation-duration: 20s; }
body.bg-mode-coding .bg-grid { animation-duration: 15s; }

@keyframes starTwinkle {
  from { transform: translate3d(0,0,0); opacity: .18; }
  to { transform: translate3d(18px,-10px,0); opacity: .42; }
}

/* Device-only light mode for weaker phones. Accessibility reduced-motion remains respected separately. */
body.low-power-mode .bg-aurora span,
body.low-power-mode .bg-grid,
body.low-power-mode .avatar::before,
body.low-power-mode .avatar::after,
body.low-power-mode .ayah-orbit {
  animation-duration: 26s !important;
  opacity: .14;
}
body.low-power-mode .social-card,
body.low-power-mode .hero-card-body,
body.low-power-mode .ayah-float,
body.low-power-mode .share-modal {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
body.low-power-mode .flower-petal:nth-child(n+5) { display: none; }

body.user-reduced-motion *,
body.user-reduced-motion *::before,
body.user-reduced-motion *::after {
  scroll-behavior: auto !important;
  transition-duration: 180ms !important;
}
body.user-reduced-motion .bg-aurora span,
body.user-reduced-motion .bg-grid,
body.user-reduced-motion .avatar::before,
body.user-reduced-motion .avatar::after,
body.user-reduced-motion .status-indicator::after,
body.user-reduced-motion .evc-border,
body.user-reduced-motion .ayah-orbit {
  animation-duration: 18s !important;
  opacity: .14;
}
body.user-reduced-motion .reveal {
  filter: none !important;
  transform: translate3d(0, 8px, 0) scale(.998) !important;
}
body.user-reduced-motion .reveal.is-visible {
  transform: translate3d(0, 0, 0) scale(1) !important;
}
