/* Morpheus Dreams home page: icons, hero sky animation, scroll reveals, blog cards.
   Everything animated is switched off for prefers-reduced-motion. */

/* ---------- Icons (inline SVG sprite, gradient strokes) ---------- */
.md-icon {
  width: 40px;
  height: 40px;
  fill: none;
  stroke: url(#md-grad);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  /* Paths use pathLength="1": a dash of 1 draws the whole stroke. */
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  overflow: visible;
}
.md-icon.sm { width: 22px; height: 22px; stroke-width: 1.9; }
.icon-orb {
  position: relative;
  width: 88px;
  height: 88px;
  border-radius: 28px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(120% 120% at 30% 20%, rgba(167, 139, 250, 0.28), transparent 60%),
    linear-gradient(160deg, rgba(30, 27, 75, 0.9), rgba(15, 15, 35, 0.9));
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08) inset, 0 10px 30px rgba(88, 28, 135, 0.35);
  isolation: isolate;
}
.icon-orb::before {
  /* Rotating gradient rim */
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: conic-gradient(from var(--md-angle, 0deg), #fbbf24, #a78bfa, #2dd4bf, #fbbf24);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0.55;
  z-index: -1;
  animation: md-spin 8s linear infinite;
}
.icon-orb.sm { width: 64px; height: 64px; border-radius: 20px; }
.icon-orb.round { border-radius: 50%; width: 96px; height: 96px; }
@property --md-angle { syntax: '<angle>'; initial-value: 0deg; inherits: false; }
@keyframes md-spin { to { --md-angle: 360deg; } }

/* Icons draw themselves when their card is revealed, and again on hover. */
.reveal .md-icon { stroke-dashoffset: 1; }
.reveal.in .md-icon { animation: md-draw 1.4s 0.15s cubic-bezier(0.65, 0, 0.35, 1) forwards; }
.hover-draw:hover .md-icon { animation: md-draw 1.1s cubic-bezier(0.65, 0, 0.35, 1) both; }
@keyframes md-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }

/* ---------- Hero sky ---------- */
.hero-sky { position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
.hero-sky canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.aurora {
  position: absolute;
  width: 60vmax;
  height: 60vmax;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
  mix-blend-mode: screen;
  animation: md-drift 26s ease-in-out infinite alternate;
}
.aurora.a1 { background: radial-gradient(circle, #7c3aed, transparent 65%); top: -20vmax; left: -10vmax; }
.aurora.a2 { background: radial-gradient(circle, #0d9488, transparent 65%); bottom: -25vmax; right: -15vmax; animation-duration: 32s; }
.aurora.a3 { background: radial-gradient(circle, #db2777, transparent 65%); top: 30%; left: 35%; width: 40vmax; height: 40vmax; opacity: 0.18; animation-duration: 38s; }
@keyframes md-drift {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(6vmax, 4vmax, 0) scale(1.12); }
  100% { transform: translate3d(-4vmax, 7vmax, 0) scale(0.95); }
}

/* Floating moon with soft halo rings */
.moon { animation: moonGlow 4s ease-in-out infinite alternate, md-float 9s ease-in-out infinite; }
.moon-halo {
  position: absolute;
  top: calc(10% - 40px);
  left: calc(15% - 40px);
  width: 200px;
  height: 200px;
  border-radius: 50%;
  border: 1px solid rgba(253, 230, 138, 0.25);
  z-index: 1;
  animation: md-halo 6s ease-out infinite;
  pointer-events: none;
}
.moon-halo.h2 { animation-delay: 3s; }
@keyframes md-float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -14px; } }
@keyframes md-halo { from { transform: scale(0.6); opacity: 0.8; } to { transform: scale(1.8); opacity: 0; } }

/* Hero text reveal */
.hero-in > * { opacity: 0; transform: translateY(24px); filter: blur(8px); }
.hero-in.go > * { animation: md-rise 1s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; }
.hero-in.go > *:nth-child(2) { animation-delay: 0.15s; }
.hero-in.go > *:nth-child(3) { animation-delay: 0.3s; }
.hero-in.go > *:nth-child(4) { animation-delay: 0.45s; }
@keyframes md-rise { to { opacity: 1; transform: none; filter: none; } }
.shimmer {
  background-size: 200% auto;
  animation: md-shimmer 6s linear infinite;
}
@keyframes md-shimmer { to { background-position: 200% center; } }

/* ---------- Scroll reveal ---------- */
.reveal { opacity: 0; transform: translateY(36px) scale(0.98); transition: opacity 0.9s ease, transform 0.9s cubic-bezier(0.2, 0.8, 0.2, 1); }
.reveal.in { opacity: 1; transform: none; }
.stagger > .reveal:nth-child(2) { transition-delay: 0.12s; }
.stagger > .reveal:nth-child(3) { transition-delay: 0.24s; }
.stagger > .reveal:nth-child(4) { transition-delay: 0.36s; }
.stagger > .reveal:nth-child(5) { transition-delay: 0.48s; }
.stagger > .reveal:nth-child(6) { transition-delay: 0.6s; }

/* Glass feature cards with a light sweep on hover */
.glass-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(160deg, rgba(31, 41, 55, 0.55), rgba(30, 27, 75, 0.45));
  border: 1px solid rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(6px);
}
.glass-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, 0.08) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: transform 0.9s ease;
  pointer-events: none;
}
.glass-card:hover::after { transform: translateX(120%); }
.glass-card:hover { border-color: rgba(167, 139, 250, 0.35); }

/* ---------- Blog cards ---------- */
.blog-card { display: flex; flex-direction: column; gap: 0.75rem; padding: 1.75rem; border-radius: 1rem; height: 100%; }
.blog-card .tags { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.blog-card .tag { font-size: 0.72rem; padding: 0.15rem 0.6rem; border-radius: 999px; background: rgba(45, 212, 191, 0.12); color: #5eead4; }
.blog-card .more { margin-top: auto; display: inline-flex; align-items: center; gap: 0.4rem; color: #fcd34d; font-weight: 600; }
.blog-card:hover .more .md-icon { transform: translateX(4px); }
.blog-card .more .md-icon { transition: transform 0.3s ease; }
html[dir='rtl'] .flip-rtl { transform: scaleX(-1); }
html[dir='rtl'] .blog-card:hover .more .md-icon { transform: scaleX(-1) translateX(4px); }

@media (prefers-reduced-motion: reduce) {
  .aurora, .moon, .moon-halo, .icon-orb::before, .shimmer { animation: none !important; }
  .moon-halo { display: none; }
  .hero-in > *, .reveal { opacity: 1 !important; transform: none !important; filter: none !important; transition: none !important; animation: none !important; }
  .reveal .md-icon, .reveal.in .md-icon, .hover-draw:hover .md-icon { stroke-dashoffset: 0 !important; animation: none !important; }
  .glass-card::after { display: none; }
}
