/**
 * PravaApp Design Enhancements
 * Animations, scroll reveals, atmospheric effects, and per-page personality
 * Non-critical — lazy-loaded after main CSS
 */

/* ==========================================================================
   SHARED DESIGN TOKENS
   ========================================================================== */

:root {
  /* Evolved neutrals */
  --prava-dark: #0a0e1a;
  --prava-dark-surface: #12162a;
  --prava-muted: #7a7894;

  /* Layered shadow system */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 8px rgba(0,0,0,0.1), 0 8px 16px rgba(0,0,0,0.08), 0 16px 32px rgba(0,0,0,0.04);
  --shadow-lg: 0 8px 16px rgba(0,0,0,0.12), 0 16px 32px rgba(0,0,0,0.1), 0 32px 64px rgba(0,0,0,0.06);
  --shadow-glow: 0 0 40px rgba(129,62,242,0.15);
}

/* ==========================================================================
   GLASSMORPHISM NAVIGATION
   ========================================================================== */

.nav {
  background: rgba(5, 8, 18, 0.55) !important;
  backdrop-filter: blur(24px) saturate(1.6) brightness(0.95) !important;
  -webkit-backdrop-filter: blur(24px) saturate(1.6) brightness(0.95) !important;
  border-bottom: 1px solid rgba(255,255,255,0.07) !important;
  transition: background 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease !important;
}

/* Intensify glass effect on scroll (class toggled by scroll-reveal.js) */
.nav.nav--scrolled {
  background: rgba(5, 8, 18, 0.8) !important;
  border-bottom: 1px solid rgba(255,255,255,0.1) !important;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2),
              0 1px 0 rgba(255, 255, 255, 0.04) inset !important;
}

/* Ensure Webflow's .w-nav never shows a background */
.w-nav,
.nav-container {
  background: transparent !important;
}

/* Mobile nav menu — dark glass instead of gray */
[data-nav-menu-open] {
  background: rgba(5, 8, 18, 0.95) !important;
  backdrop-filter: blur(24px) saturate(1.4) !important;
  -webkit-backdrop-filter: blur(24px) saturate(1.4) !important;
  border-top: 1px solid rgba(255,255,255,0.06);
}

/* Per-page nav tint — subtle hue shift in the glass */
.page-deep-work .nav {
  background: rgba(13, 4, 40, 0.55) !important;
}
.page-deep-work .nav.nav--scrolled {
  background: rgba(13, 4, 40, 0.82) !important;
}

.page-quit-scrolling .nav {
  background: rgba(26, 8, 16, 0.55) !important;
}
.page-quit-scrolling .nav.nav--scrolled {
  background: rgba(26, 8, 16, 0.82) !important;
}

/* ==========================================================================
   NOISE TEXTURE OVERLAY (shared)
   ========================================================================== */

.section::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.3'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
  opacity: 0.3;
  pointer-events: none;
  z-index: 0;
}

.section > * {
  position: relative;
  z-index: 1;
}

/* ==========================================================================
   HERO ENTRANCE CHOREOGRAPHY (CSS-only, 5-step stagger)
   ========================================================================== */

/* Initial hidden states */
.hero-animate .h1-heading,
.hero-animate .h2-heading,
.hero-animate .subheading,
.hero-animate .button-group,
.hero-animate .trust-microcopy,
.hero-animate picture {
  opacity: 0;
}

/* Step 1: Background clip-path reveal (0ms) */
header.section.hero-animate {
  animation: heroReveal 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes heroReveal {
  from {
    clip-path: circle(0% at 50% 50%);
  }
  to {
    clip-path: circle(150% at 50% 50%);
  }
}

/* Step 2: Headline rises with letter-spacing tightening (300ms) */
.hero-animate .h1-heading {
  animation: headlineRise 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.3s forwards;
}

@keyframes headlineRise {
  from {
    opacity: 0;
    transform: translateY(30px);
    letter-spacing: 0.05em;
  }
  to {
    opacity: 1;
    transform: translateY(0);
    letter-spacing: -0.03em;
  }
}

/* H2 subtitle also rises (450ms) */
.hero-animate .h2-heading {
  animation: fadeUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.45s forwards;
}

/* Step 3: Description fades up (600ms) */
.hero-animate .subheading {
  animation: fadeUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.6s forwards;
}

/* Step 4: CTA buttons pop in with overshoot (900ms) */
.hero-animate .button-group {
  animation: buttonPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.9s forwards;
}

@keyframes buttonPop {
  from {
    opacity: 0;
    transform: scale(0.85) translateY(15px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Step 5: Trust microcopy fades in (1200ms) */
.hero-animate .trust-microcopy {
  animation: fadeIn 0.5s ease-out 1.2s forwards;
}

/* Hero image slides in */
.hero-animate picture {
  animation: fadeUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.4s forwards;
}

/* Shared keyframes */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(25px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 0.7; }
}

/* ==========================================================================
   SCROLL-REVEAL CSS
   ========================================================================== */

[data-reveal] {
  opacity: 0;
  transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}

[data-reveal="up"] {
  transform: translateY(40px);
}

[data-reveal="left"] {
  transform: translateX(-40px);
}

[data-reveal="right"] {
  transform: translateX(40px);
}

[data-reveal="scale"] {
  transform: scale(0.92);
}

[data-reveal].revealed {
  opacity: 1;
  transform: translate(0) scale(1);
}

/* ==========================================================================
   CARD MICRO-INTERACTIONS (CSS-only)
   ========================================================================== */

.card {
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease !important;
}

.card:hover {
  transform: perspective(1000px) rotateX(2deg) translateY(-4px) !important;
  box-shadow: var(--shadow-lg) !important;
}

/* Feature items with left border */
.divider-vertical {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

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

/* ==========================================================================
   MAGNETIC BUTTON STYLES (hero CTAs)
   ========================================================================== */

.hero-magnetic-btn {
  transition: transform 0.15s ease-out;
}

/* ==========================================================================
   MAIN PAGE — "The Gateway" Personality
   ========================================================================== */

/* Ambient glow for main page hero */
body:not(.page-deep-work):not(.page-quit-scrolling) header.section::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 40% 20%, rgba(129,62,242,0.15), transparent 60%);
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
}

/* Portal cards — gradient borders on hover */
body:not(.page-deep-work):not(.page-quit-scrolling) .card a[href*="deep-work/"] {
  border: 2px solid transparent;
  background-clip: padding-box;
  transition: all 0.4s ease;
}

body:not(.page-deep-work):not(.page-quit-scrolling) .card a[href*="deep-work/"]:hover {
  border-color: transparent;
  box-shadow: 0 0 0 2px #6B00FF, 0 0 30px rgba(107,0,255,0.2);
  background-color: rgba(13,8,40,0.3);
}

body:not(.page-deep-work):not(.page-quit-scrolling) .card a[href*="quit-scrolling/"]:hover {
  border-color: transparent;
  box-shadow: 0 0 0 2px #e8457a, 0 0 30px rgba(232,69,122,0.2);
  background-color: rgba(26,13,20,0.3);
}

/* Main page hero layout — asymmetric 55/45 text-dominant */
body:not(.page-deep-work):not(.page-quit-scrolling) header .grid-layout.desktop-5-column {
  grid-template-columns: 1.2fr 1fr !important;
}

/* Main hero richer gradient button */
body:not(.page-deep-work):not(.page-quit-scrolling) .button:not(.secondary-button) {
  background-image: linear-gradient(135deg, #6c3ce0, #a855f7, #d429ff) !important;
}

/* ==========================================================================
   DEEP WORK — "The Depths" Personality
   ========================================================================== */

/* Topographic contour overlay replacing grid */
.page-deep-work .deep-work-hero::before {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 800 600'%3E%3Cstyle%3Epath%7Bfill:none;stroke:rgba(255,255,255,0.06);stroke-width:1%7D%3C/style%3E%3Cpath d='M0 300Q200 250 400 280T800 260'/%3E%3Cpath d='M0 340Q200 290 400 320T800 300'/%3E%3Cpath d='M0 380Q200 330 400 360T800 340'/%3E%3Cpath d='M0 260Q200 210 400 240T800 220'/%3E%3Cpath d='M0 220Q200 170 400 200T800 180'/%3E%3Cpath d='M0 420Q200 370 400 400T800 380'/%3E%3Cpath d='M0 180Q200 130 400 160T800 140'/%3E%3Cpath d='M0 460Q200 410 400 440T800 420'/%3E%3C/svg%3E") !important;
  opacity: 0.5 !important;
  background-size: cover !important;
}

/* Deep Work ambient glow */
.page-deep-work .deep-work-hero .container::before {
  content: '';
  position: absolute;
  inset: -50%;
  background: radial-gradient(ellipse at 30% 30%, rgba(107,0,255,0.2), transparent 55%);
  filter: blur(80px);
  pointer-events: none;
  z-index: -1;
}

/* Slower rotating gradient (90s = meditative) */
.page-deep-work .deep-work-hero::after {
  animation-duration: 90s !important;
}

/* Deep Work evolved gradient */
.page-deep-work .deep-work-hero {
  background: linear-gradient(135deg, #2a0080, #6B00FF, #9b40ff) !important;
}

/* Deep dark surfaces */
.page-deep-work .section {
  background-color: #0d0828;
}

/* Accent line that draws across section tops */
.page-deep-work .section:not(:first-of-type)::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 80%;
  height: 1px;
  background: linear-gradient(90deg, transparent, #6B00FF, #9b40ff, transparent);
  transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 2;
}

.page-deep-work .section:not(:first-of-type).revealed::before {
  transform: translateX(-50%) scaleX(1);
}

/* Feature card left borders on reveal */
.page-deep-work .divider-vertical {
  border-left-color: transparent;
  transition: border-left-color 0.6s ease 0.3s;
}

.page-deep-work .divider-vertical.revealed {
  border-left-color: #6B00FF;
}

/* Deep Work hero layout — asymmetric 45/55 image-dominant */
.page-deep-work .deep-work-hero .grid-layout.desktop-5-column {
  grid-template-columns: 1fr 1.2fr !important;
}

/* Deep Work image vertical offset */
.page-deep-work .deep-work-hero .grid-layout > div:nth-child(1) {
  margin-top: -2rem;
}

/* ==========================================================================
   QUIT SCROLLING — "The Liberation" Personality
   ========================================================================== */

/* Light rays from center-top replacing grid */
.page-quit-scrolling .quit-scrolling-hero::before {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.08) 0%, transparent 50%),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 4%,
      rgba(255,255,255,0.03) 4%,
      rgba(255,255,255,0.03) 4.5%
    ) !important;
  opacity: 0.6 !important;
}

/* Quit Scrolling ambient glow */
.page-quit-scrolling .quit-scrolling-hero .container::before {
  content: '';
  position: absolute;
  inset: -50%;
  background: radial-gradient(ellipse at 60% 20%, rgba(232,69,122,0.18), transparent 55%);
  filter: blur(80px);
  pointer-events: none;
  z-index: -1;
}

/* Warmer evolved gradient */
.page-quit-scrolling .quit-scrolling-hero {
  background: linear-gradient(135deg, #c42b2b, #e8457a, #ff6b9d) !important;
}

/* Warm dark surfaces */
.page-quit-scrolling .section {
  background-color: #1a0d14;
}

/* Warmer border-radius */
.page-quit-scrolling .card,
.page-quit-scrolling .demo-cta-card {
  border-radius: 20px !important;
}

/* Light leak gradient overlays in feature section corners */
.page-quit-scrolling .ix-card-background::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 300px;
  height: 300px;
  background: radial-gradient(ellipse at 100% 100%, rgba(255,107,157,0.12), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.page-quit-scrolling .ix-card-background::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 250px;
  height: 250px;
  background: radial-gradient(ellipse at 0% 0%, rgba(232,69,122,0.1), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* Quit Scrolling hero layout — asymmetric 45/55 image-dominant (unified with Deep Work) */
.page-quit-scrolling .quit-scrolling-hero .grid-layout.desktop-5-column {
  grid-template-columns: 1fr 1.2fr !important;
}

/* Quit Scrolling image vertical offset */
.page-quit-scrolling .quit-scrolling-hero .grid-layout > div:nth-child(1) {
  margin-top: -2rem;
}

/* ==========================================================================
   EDITORIAL FEATURE GRID (6-column system)
   ========================================================================== */

.grid-layout.desktop-3-column.tablet-2-column.mobile-landscape-1-column {
  display: grid !important;
  grid-template-columns: repeat(6, 1fr) !important;
  gap: 2rem !important;
}

/* Row 1: primary features span 3 each */
.grid-layout.desktop-3-column.tablet-2-column.mobile-landscape-1-column > *:nth-child(1),
.grid-layout.desktop-3-column.tablet-2-column.mobile-landscape-1-column > *:nth-child(2) {
  grid-column: span 3;
}

/* Row 2: supporting features span 2 each */
.grid-layout.desktop-3-column.tablet-2-column.mobile-landscape-1-column > *:nth-child(3),
.grid-layout.desktop-3-column.tablet-2-column.mobile-landscape-1-column > *:nth-child(4),
.grid-layout.desktop-3-column.tablet-2-column.mobile-landscape-1-column > *:nth-child(5) {
  grid-column: span 2;
}

/* Row 3: closing feature full-width */
.grid-layout.desktop-3-column.tablet-2-column.mobile-landscape-1-column > *:nth-child(6) {
  grid-column: span 6;
}

/* ==========================================================================
   OVERLAPPING ELEMENTS & SPACING
   ========================================================================== */

/* Dashboard screenshots overlap into section below */
.ix-card-background .card-body picture img {
  transition: transform 0.3s ease;
}

.ix-card-background {
  position: relative;
  z-index: 2;
  margin-bottom: -4rem;
}

/* Section spacing rhythm */
header.section {
  padding-bottom: 10rem !important;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media screen and (max-width: 991px) {
  .h1-heading {
    font-size: clamp(2.5rem, 6vw, 4rem) !important;
  }

  /* Reset editorial grid to 2-column on tablet */
  .grid-layout.desktop-3-column.tablet-2-column.mobile-landscape-1-column {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .grid-layout.desktop-3-column.tablet-2-column.mobile-landscape-1-column > * {
    grid-column: span 1 !important;
  }

  .grid-layout.desktop-3-column.tablet-2-column.mobile-landscape-1-column > *:nth-child(6) {
    grid-column: span 2 !important;
  }

  /* Reset hero layouts — tablet */
  body:not(.page-deep-work):not(.page-quit-scrolling) header .grid-layout.desktop-5-column,
  .page-deep-work .deep-work-hero .grid-layout.desktop-5-column,
  .page-quit-scrolling .quit-scrolling-hero .grid-layout.desktop-5-column {
    grid-template-columns: 1fr !important;
    text-align: center;
  }

  .page-deep-work .deep-work-hero .grid-layout > div:nth-child(1),
  .page-quit-scrolling .quit-scrolling-hero .grid-layout > div:nth-child(1) {
    margin-top: 0;
    display: flex;
    justify-content: center;
  }

  /* Compact hero image on tablet — centered, restrained */
  .deep-work-hero .grid-layout > div:nth-child(1) img,
  .quit-scrolling-hero .grid-layout > div:nth-child(1) img {
    max-width: 40% !important;
    width: auto !important;
    height: auto;
  }

  /* Center hero text + buttons on tablet */
  .deep-work-hero .grid-layout > div:nth-child(2),
  .quit-scrolling-hero .grid-layout > div:nth-child(2) {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .deep-work-hero .button-group,
  .quit-scrolling-hero .button-group {
    justify-content: center;
  }

  /* Tighter hero spacing on tablet */
  .deep-work-hero,
  .quit-scrolling-hero {
    min-height: auto !important;
    padding-top: 2rem !important;
    padding-bottom: 1rem !important;
  }

  header.section {
    padding-bottom: 3rem !important;
  }

  /* Compact grid gap on tablet */
  .deep-work-hero .grid-layout.desktop-5-column,
  .quit-scrolling-hero .grid-layout.desktop-5-column {
    gap: 1.5rem !important;
  }

  .ix-card-background {
    margin-bottom: -2rem;
  }
}

@media screen and (max-width: 767px) {
  .h1-heading {
    font-size: clamp(2rem, 8vw, 3rem) !important;
  }

  .h2-heading {
    font-size: 1.6rem !important;
  }

  /* Reset editorial grid to 1-column on mobile */
  .grid-layout.desktop-3-column.tablet-2-column.mobile-landscape-1-column {
    grid-template-columns: 1fr !important;
  }

  .grid-layout.desktop-3-column.tablet-2-column.mobile-landscape-1-column > * {
    grid-column: span 1 !important;
  }

  /* ---- UNIFIED MOBILE HERO (deep-work + quit-scrolling) ---- */

  /* Single-column, centered, compact */
  .deep-work-hero .grid-layout.desktop-5-column,
  .quit-scrolling-hero .grid-layout.desktop-5-column {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
    text-align: center;
    max-width: 100%;
  }

  /* Hero image: compact centered brand badge */
  .page-deep-work .deep-work-hero .grid-layout > div:nth-child(1),
  .page-quit-scrolling .quit-scrolling-hero .grid-layout > div:nth-child(1) {
    margin-top: 0;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .deep-work-hero .grid-layout > div:nth-child(1) img,
  .quit-scrolling-hero .grid-layout > div:nth-child(1) img {
    max-width: 35% !important;
    width: auto !important;
    height: auto;
  }

  /* Hero text: centered column */
  .deep-work-hero .grid-layout > div:nth-child(2),
  .quit-scrolling-hero .grid-layout > div:nth-child(2) {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  /* Compact buttons on mobile — side by side */
  .deep-work-hero .button-group,
  .quit-scrolling-hero .button-group {
    justify-content: center;
    width: 100%;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 0.5rem !important;
  }

  .deep-work-hero .button,
  .quit-scrolling-hero .button {
    padding: 12px 20px !important;
    font-size: 0.9rem !important;
    flex: 1 !important;
    min-width: 0 !important;
    white-space: nowrap !important;
  }

  /* Tighter hero padding on mobile */
  header.section {
    padding-bottom: 2rem !important;
    min-height: auto !important;
  }

  .deep-work-hero,
  .quit-scrolling-hero {
    min-height: auto !important;
    padding-top: 1rem !important;
    padding-bottom: 0.5rem !important;
  }

  /* Trust microcopy — smaller, centered */
  .deep-work-hero .trust-microcopy,
  .quit-scrolling-hero .trust-microcopy {
    text-align: center;
    font-size: 0.75rem !important;
    margin-top: 0.25rem !important;
  }

  /* Tighter subheading on mobile */
  .deep-work-hero .subheading,
  .quit-scrolling-hero .subheading {
    font-size: 0.95rem !important;
    line-height: 1.5 !important;
    margin-bottom: 0.5rem !important;
  }

  .ix-card-background {
    margin-bottom: 0;
  }
}

/* ==========================================================================
   REDUCED MOTION
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  /* Disable hero entrance choreography */
  header.section.hero-animate {
    animation: none;
    clip-path: none;
  }

  .hero-animate .h1-heading,
  .hero-animate .h2-heading,
  .hero-animate .subheading,
  .hero-animate .button-group,
  .hero-animate .trust-microcopy,
  .hero-animate picture {
    opacity: 1;
    animation: none;
    transform: none;
  }

  /* Disable scroll reveals — just show */
  [data-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
  }

  /* Disable card hover */
  .card:hover {
    transform: none !important;
  }

  /* Disable deep work accent line */
  .page-deep-work .section:not(:first-of-type)::before {
    transform: translateX(-50%) scaleX(1);
    transition: none;
  }
}
