/* Ungrade Enhanced Visuals: 3D Depth, Film Grain, Liquid Ambient & Living Sphere */

/* 1. Film Grain / Noise Overlay */
.noise-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  mix-blend-mode: overlay;
}

[data-theme="light"] .noise-layer {
  opacity: 0.03;
  mix-blend-mode: multiply;
}

/* 2. Ambient Fluid Aurora Canvas */
.ambient-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.75;
  filter: blur(48px);
  transform: translateZ(0);
}

[data-theme="light"] .ambient-canvas {
  opacity: 0.45;
  filter: blur(60px);
}

/* Ensure app-scroll content sits above ambient canvas */
.app-shell {
  perspective: 1200px;
}

.app-scroll {
  position: relative;
  z-index: 2;
}

/* 3. 3D Card Depth & Specular Sheen */
.hero,
.mode-card,
.article-card,
.checkin-card,
.step-card,
.practice-timer,
.practice-card {
  position: relative;
  transform-style: preserve-3d;
  will-change: transform, box-shadow;
  transition: transform 0.22s cubic-bezier(0.2, 0, 0.2, 1), 
              box-shadow 0.25s cubic-bezier(0.2, 0, 0.2, 1),
              border-color 0.25s ease;
}

/* Specular reflection glint */
.card-specular-glare {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 5;
  mix-blend-mode: overlay;
  background: radial-gradient(circle 220px at var(--glare-x, 50%) var(--glare-y, 50%), rgba(255, 255, 255, 0.24) 0%, rgba(255, 255, 255, 0.04) 50%, transparent 80%);
}

[data-theme="light"] .card-specular-glare {
  mix-blend-mode: soft-light;
  background: radial-gradient(circle 220px at var(--glare-x, 50%) var(--glare-y, 50%), rgba(255, 255, 255, 0.6) 0%, rgba(255, 255, 255, 0.1) 50%, transparent 80%);
}

.card-tilted .card-specular-glare {
  opacity: 1;
}

/* Internal elements pop out slightly with 3D translation */
.hero-copy,
.hero-art,
.mode-card h2,
.mode-card p,
.mode-card .round-arrow,
.checkin-card h2,
.checkin-card .button {
  transform: translateZ(10px);
  transition: transform 0.22s ease;
}

/* 4. Spring Stagger Entrance for Cards */
@keyframes springCardIn {
  0% {
    opacity: 0;
    transform: translateY(22px) scale(0.965);
  }
  65% {
    opacity: 1;
    transform: translateY(-2px) scale(1.006);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.animate-spring-in {
  animation: springCardIn 520ms cubic-bezier(0.18, 0.89, 0.32, 1.15) backwards;
  animation-delay: calc(var(--stagger-index, 0) * 48ms);
}

@media (prefers-reduced-motion: reduce) {
  .animate-spring-in {
    animation: none !important;
  }
  .hero, .mode-card, .article-card, .checkin-card, .step-card {
    transform: none !important;
  }
}

/* 5. Living Breathing Sphere Widget */
.living-sphere-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 16px 12px;
  margin: 14px 0 18px;
  background: radial-gradient(circle at 50% 45%, var(--accent-subtle) 0%, transparent 70%);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  touch-action: none;
  user-select: none;
}

.living-sphere-canvas {
  width: 220px;
  height: 220px;
  display: block;
  cursor: grab;
  touch-action: none;
}

.living-sphere-canvas:active {
  cursor: grabbing;
}

.sphere-phase-badge {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--accent);
  margin-top: 6px;
  padding: 4px 14px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 20px;
  transition: all 0.35s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.sphere-phase-badge i {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: phasePulse 2s ease-in-out infinite;
}

@keyframes phasePulse {
  0%, 100% { opacity: 0.4; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.3); }
}

.sphere-subtitle {
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
  text-align: center;
  line-height: 1.5;
}

.sphere-toggle-btn {
  margin-top: 10px;
  font-size: 12px;
  padding: 6px 16px;
  min-height: 34px;
}
