/* ========================================
   Ansa Therapies — Custom Styles
   Velvet Plum palette
   ======================================== */

:root {
  --primary: #1C1626;
  --accent: #8B6FA3;
  --accent-light: #B89FCC;
  --bg: #FAF8FC;
  --surface: #FFFFFF;
  --text: #2D2438;
  --text-muted: #7A6B8A;
  --border: #E8E0F0;
  --warm: #C4956A;
  --shadow: rgba(28, 22, 38, 0.08);
  --shadow-lg: rgba(28, 22, 38, 0.12);
}

/* ---- Grain overlay (premium texture) ---- */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.07;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}

/* Subtle second grain layer on dark sections for added texture */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
  opacity: 0.04;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.5' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 128px 128px;
}

/* ---- Scroll reveal (standard) ---- */
[data-reveal] {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.9s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}
[data-reveal].revealed {
  opacity: 1;
  transform: translateY(0);
}
[data-reveal][data-delay="1"] { transition-delay: 0.15s; }
[data-reveal][data-delay="2"] { transition-delay: 0.3s; }
[data-reveal][data-delay="3"] { transition-delay: 0.45s; }
[data-reveal][data-delay="4"] { transition-delay: 0.6s; }
[data-reveal][data-delay="5"] { transition-delay: 0.75s; }

/* ---- Hero reveal (slower, more dramatic) ---- */
#hero [data-reveal] {
  transform: translateY(40px);
  transition: opacity 1.4s cubic-bezier(0.16, 1, 0.3, 1),
              transform 1.4s cubic-bezier(0.16, 1, 0.3, 1);
  transition-delay: 0.6s;
}
#hero [data-reveal][data-delay="1"] { transition-delay: 1.0s; }
#hero [data-reveal][data-delay="2"] { transition-delay: 1.5s; }
#hero [data-reveal][data-delay="3"] { transition-delay: 2.0s; }

/* ---- Nav morph ---- */
#nav-island {
  transition: background 0.4s ease, box-shadow 0.4s ease, border-color 0.4s ease;
}
/* Transparent state: white text needs shadow over hero image */
#nav-island:not(.morphed) .nav-brand,
#nav-island:not(.morphed) .nav-link {
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35), 0 2px 12px rgba(28, 22, 38, 0.3);
}
#nav-island:not(.morphed) .hamburger-line {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
/* Morphed state: dark text on frosted glass, clear the shadow */
#nav-island.morphed .nav-brand,
#nav-island.morphed .nav-link {
  text-shadow: none;
}
#nav-island.morphed {
  background: rgba(255, 255, 255, 0.82) !important;
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  box-shadow: 0 4px 30px var(--shadow);
  border-color: var(--border) !important;
}
#nav-island.morphed .nav-link {
  color: var(--text) !important;
}
#nav-island.morphed .nav-brand {
  color: var(--primary) !important;
}
#nav-island.morphed .hamburger-line {
  background-color: var(--text) !important;
}

/* ---- Mobile menu ---- */
#mobile-menu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0.22, 1, 0.36, 1),
              opacity 0.35s ease;
  opacity: 0;
}
#mobile-menu.open {
  max-height: 320px;
  opacity: 1;
}

/* ---- FAB pulse ---- */
@keyframes fab-pulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(139, 111, 163, 0.3); }
  50% { box-shadow: 0 4px 30px rgba(139, 111, 163, 0.55); }
}
.fab-pulse {
  animation: fab-pulse 2.5s ease-in-out infinite;
}

/* ---- Active tactile feedback ---- */
.tactile:active {
  transform: scale(0.98) !important;
  transition: transform 0.1s ease !important;
}

/* ---- Smooth scroll ---- */
html {
  scroll-behavior: smooth;
}

/* ---- Form focus ring ---- */
input:focus, textarea:focus, select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: var(--accent) !important;
}

/* ---- Hamburger lines ---- */
.hamburger-line {
  transition: transform 0.3s ease, opacity 0.3s ease;
  transform-origin: center;
}
.hamburger-open .hamburger-line:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.hamburger-open .hamburger-line:nth-child(2) {
  opacity: 0;
}
.hamburger-open .hamburger-line:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ---- Parallax bg for testimonial ---- */
.parallax-bg {
  background-attachment: fixed;
  background-size: cover;
  background-position: center;
}
@supports (-webkit-touch-callout: none) {
  .parallax-bg {
    background-attachment: scroll;
  }
}

/* ---- Service alternating layout ---- */
@media (min-width: 768px) {
  .service-block:nth-child(even) {
    flex-direction: row-reverse;
  }
}

/* ---- Premium shadow tints (plum-tinted, not grey) ---- */
.shadow-premium {
  box-shadow:
    0 1px 2px rgba(28, 22, 38, 0.04),
    0 8px 24px rgba(139, 111, 163, 0.06),
    0 24px 60px rgba(28, 22, 38, 0.04);
}

.shadow-premium-lg {
  box-shadow:
    0 1px 2px rgba(28, 22, 38, 0.05),
    0 12px 36px rgba(139, 111, 163, 0.10),
    0 40px 80px rgba(28, 22, 38, 0.08);
}

/* ---- Inner refraction border for premium surfaces ---- */
.surface-premium {
  background: linear-gradient(180deg, #FFFFFF 0%, #FEFCFE 100%);
  border: 1px solid rgba(232, 224, 240, 0.6);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 1px 2px rgba(28, 22, 38, 0.03),
    0 12px 32px rgba(139, 111, 163, 0.06);
}

/* ---- Kerning tighten for display text ---- */
.display-tracking {
  letter-spacing: -0.03em;
}

/* ---- Link underline animation ---- */
.link-underline {
  position: relative;
  display: inline-block;
}
.link-underline::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 1px;
  background-color: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
.link-underline:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* ---- Smooth image zoom on hover for premium cards ---- */
.img-zoom-container {
  overflow: hidden;
}
.img-zoom-container img {
  transition: transform 1.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.img-zoom-container:hover img {
  transform: scale(1.04);
}

/* ---- Section divider: subtle gradient line ---- */
.section-divider {
  position: relative;
}
.section-divider::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(139, 111, 163, 0.2), transparent);
}

/* ---- Hero text shadow for legibility over busy images ---- */
.hero-text {
  text-shadow:
    0 1px 3px rgba(0, 0, 0, 0.4),
    0 4px 24px rgba(28, 22, 38, 0.5),
    0 0 80px rgba(28, 22, 38, 0.3);
}

.hero-button-shadow {
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.25),
    0 12px 40px rgba(139, 111, 163, 0.35),
    0 0 60px rgba(28, 22, 38, 0.2);
}

/* ---- Reduced motion support ---- */
@media (prefers-reduced-motion: reduce) {
  [data-reveal],
  [data-reveal].revealed,
  .fab-pulse,
  .img-zoom-container img {
    transition: none !important;
    animation: none !important;
    transform: none !important;
    opacity: 1 !important;
  }
}
