/**
 * Pinaac Pharma — layout polish, motion, and accessibility.
 * Complements Tailwind CDN utilities.
 */

:root {
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  /* Logo: blue-steel darks + seafoam / aqua accents (pinaac-logo.jpeg) */
  --brand-200: 184 232 229;
  --brand-300: 110 201 207;
  --brand-400: 59 173 191;
  --brand-500: 44 143 163;
  --brand-600: 38 120 146;
  --brand-700: 31 97 119;
  --brand-900: 22 63 82;
  --surface-glow: 0 0 80px -20px rgb(var(--brand-500) / 0.35);
  --surface-rich: 0 25px 50px -12px rgba(15, 23, 42, 0.12), 0 0 0 1px rgba(148, 163, 184, 0.08);
  --surface-rich-hover: 0 32px 64px -16px rgba(15, 23, 42, 0.16), 0 0 0 1px rgb(var(--brand-400) / 0.28);
  --header-h: 3.5rem;
}

/* ——— Base ——— */
body.site-body {
  background-color: #f1f5f9;
  background-image:
    radial-gradient(ellipse 100% 60% at 0% 0%, rgb(var(--brand-400) / 0.12), transparent 50%),
    radial-gradient(ellipse 80% 50% at 100% 10%, rgb(var(--brand-500) / 0.1), transparent 45%),
    radial-gradient(ellipse 70% 40% at 50% 100%, rgb(var(--brand-700) / 0.07), transparent 50%),
    linear-gradient(180deg, #f8fafc 0%, #f1f5f9 35%, #eef7f5 100%);
  background-attachment: fixed;
}

body.site-body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 0h1v1H0zm30 30h1v1h-1z' fill='%2394a3b8' fill-opacity='0.12'/%3E%3C/svg%3E");
  background-size: 60px 60px;
}

body.site-body > *:not(.wa-fab) {
  position: relative;
  z-index: 1;
}

/* ——— Hero mesh (home + inner page headers) ——— */
.hero-mesh {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.hero-mesh::before {
  content: "";
  position: absolute;
  inset: -40% -20%;
  background:
    radial-gradient(circle at 20% 40%, rgba(255, 255, 255, 0.12) 0%, transparent 42%),
    radial-gradient(circle at 85% 15%, rgb(var(--brand-400) / 0.26) 0%, transparent 38%),
    radial-gradient(circle at 70% 80%, rgb(var(--brand-700) / 0.38) 0%, transparent 45%);
  animation: mesh-drift 18s ease-in-out infinite alternate;
}
.hero-mesh::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='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  opacity: 0.5;
  mix-blend-mode: overlay;
}

@keyframes mesh-drift {
  0% {
    transform: translate(0, 0) scale(1);
  }
  100% {
    transform: translate(-2%, 2%) scale(1.03);
  }
}

.hero-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.45;
  animation: orb-float 12s ease-in-out infinite;
}
.hero-orb--a {
  width: min(55vw, 420px);
  height: min(55vw, 420px);
  top: -15%;
  right: -10%;
  background: #3badbf;
  animation-delay: -2s;
}
.hero-orb--b {
  width: min(40vw, 320px);
  height: min(40vw, 320px);
  bottom: -20%;
  left: -5%;
  background: #1f6177;
  animation-delay: -5s;
}

@keyframes orb-float {
  0%,
  100% {
    transform: translate(0, 0);
  }
  50% {
    transform: translate(-12px, 16px);
  }
}

/* ——— Scroll reveal ——— */
.reveal,
[data-reveal] {
  opacity: 0;
  transform: translate3d(0, 28px, 0);
  transition:
    opacity 0.75s var(--ease-out-expo),
    transform 0.75s var(--ease-out-expo);
  will-change: opacity, transform;
}
.reveal.is-visible,
[data-reveal].is-visible {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

.reveal-scale {
  opacity: 0;
  transform: scale(0.96) translate3d(0, 12px, 0);
  transition:
    opacity 0.65s var(--ease-out-expo),
    transform 0.65s var(--ease-out-expo);
}
.reveal-scale.is-visible {
  opacity: 1;
  transform: scale(1) translate3d(0, 0, 0);
}

.reveal-group.is-visible .reveal-child:nth-child(1) {
  transition-delay: 0.05s;
}
.reveal-group.is-visible .reveal-child:nth-child(2) {
  transition-delay: 0.1s;
}
.reveal-group.is-visible .reveal-child:nth-child(3) {
  transition-delay: 0.15s;
}
.reveal-group.is-visible .reveal-child:nth-child(4) {
  transition-delay: 0.2s;
}
.reveal-group.is-visible .reveal-child:nth-child(5) {
  transition-delay: 0.25s;
}
.reveal-group.is-visible .reveal-child:nth-child(6) {
  transition-delay: 0.3s;
}
.reveal-group.is-visible .reveal-child:nth-child(7) {
  transition-delay: 0.35s;
}
.reveal-group.is-visible .reveal-child:nth-child(8) {
  transition-delay: 0.4s;
}

.reveal-child {
  opacity: 0;
  transform: translate3d(0, 20px, 0);
  transition:
    opacity 0.6s var(--ease-out-expo),
    transform 0.6s var(--ease-out-expo);
}
.reveal-group.is-visible .reveal-child {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

/* ——— Hero title stagger ——— */
.hero-line {
  display: block;
  opacity: 0;
  transform: translate3d(0, 20px, 0);
  animation: hero-in 0.9s var(--ease-out-expo) forwards;
}
.hero-line:nth-child(1) {
  animation-delay: 0.1s;
}
.hero-line:nth-child(2) {
  animation-delay: 0.22s;
}
.hero-line:nth-child(3) {
  animation-delay: 0.34s;
}

/* Home hero: stats row is not 3rd child of section — explicit delay */
dl.hero-line {
  animation-delay: 0.42s;
}

@keyframes hero-visual-float {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }
  50% {
    transform: translate3d(0, -10px, 0);
  }
}

.hero-visual-float-inner {
  animation: hero-visual-float 9s ease-in-out 1s infinite alternate;
}

.hero-visual-aspect {
  aspect-ratio: 16 / 10;
}

@media (min-width: 1024px) {
  .hero-visual-aspect {
    aspect-ratio: 5 / 3;
  }
}

.hero-visual-img {
  transform: scale(1.05);
  transition: transform 0.6s var(--ease-out-expo);
}

@media (min-width: 1024px) {
  .hero-visual-wrap:hover .hero-visual-img {
    transform: scale(1.08);
  }
}

@keyframes hero-in {
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

/* ——— Cards ——— */
.card-lift {
  transition:
    transform 0.35s var(--ease-out-expo),
    box-shadow 0.35s var(--ease-out-expo),
    border-color 0.35s ease;
}
.card-lift:hover {
  transform: translateY(-4px);
  box-shadow:
    0 20px 40px -24px rgba(15, 23, 42, 0.2),
    var(--surface-glow);
  border-color: rgb(var(--brand-400) / 0.35);
}

.card-lift.card-surface-rich:hover {
  box-shadow: var(--surface-rich-hover), 0 24px 48px -20px rgba(15, 23, 42, 0.14);
  border-color: rgb(var(--brand-400) / 0.35);
}

.btn-shine {
  position: relative;
  overflow: hidden;
}
.btn-shine::after {
  content: "";
  position: absolute;
  inset: 0;
  left: -100%;
  background: linear-gradient(105deg, transparent 40%, rgba(255, 255, 255, 0.25) 50%, transparent 60%);
  transition: left 0.55s ease;
}
.btn-shine:hover::after {
  left: 100%;
}

/* ——— Section shells (inner pages + home bands) ——— */
.section-shell {
  position: relative;
  isolation: isolate;
}

.section-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: linear-gradient(
    165deg,
    rgba(255, 255, 255, 0.92) 0%,
    rgba(216, 238, 240, 0.55) 42%,
    rgba(255, 255, 255, 0.88) 100%
  );
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.section-shell--soft::before {
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.95) 0%, rgba(241, 245, 249, 0.85) 50%, rgba(236, 245, 244, 0.55) 100%);
}

.section-shell__blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  z-index: -1;
}

.heading-deco-line {
  height: 4px;
  width: 3.5rem;
  border-radius: 9999px;
  background: linear-gradient(90deg, #2c8fa3, #3badbf, #4a8eb8);
  box-shadow: 0 0 20px rgb(var(--brand-400) / 0.35);
}

/* Hero stat tiles */
.hero-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

@media (min-width: 640px) {
  .hero-stat-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.25rem;
  }
}

.hero-stat-tile {
  border-radius: 1rem;
  padding: 1rem 1.1rem;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.08) 0%, rgba(15, 23, 42, 0.35) 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
}

/* Premium surfaces */
.card-surface-rich {
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 250, 252, 0.95) 45%, rgba(216, 238, 240, 0.65) 100%);
  box-shadow: var(--surface-rich);
  border-color: rgba(203, 213, 225, 0.55);
}

.card-surface-rich:hover,
a.card-surface-rich:hover {
  box-shadow: var(--surface-rich-hover);
}

/* Products page category bands */
.products-cat {
  position: relative;
  margin-bottom: 2.5rem;
  padding: 1.75rem 1.25rem 2rem;
  border-radius: 1.5rem;
  border: 1px solid rgba(226, 232, 240, 0.9);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 252, 0.9) 100%);
  box-shadow: 0 4px 24px -8px rgba(15, 23, 42, 0.08);
}

@media (min-width: 640px) {
  .products-cat {
    padding: 2rem 2rem 2.25rem;
  }
}

.products-cat--alt {
  background: linear-gradient(165deg, rgba(216, 238, 240, 0.5) 0%, rgba(255, 255, 255, 0.95) 40%, rgba(241, 245, 249, 0.6) 100%);
  border-color: rgb(var(--brand-200) / 0.5);
}

.products-cat:last-of-type {
  margin-bottom: 0;
}

/* Page hero bottom accent */
.page-hero-accent::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgb(var(--brand-400) / 0.45), rgba(255, 255, 255, 0.25), transparent);
  pointer-events: none;
}

/* ——— Header ——— */
.site-header {
  transition:
    background-color 0.35s ease,
    box-shadow 0.35s ease,
    border-color 0.35s ease;
}

.site-header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgb(var(--brand-400) / 0.25), transparent);
  opacity: 0.8;
  pointer-events: none;
}

.site-header.is-scrolled {
  box-shadow: 0 10px 40px -20px rgba(15, 23, 42, 0.15);
  border-color: rgba(226, 232, 240, 0.6);
  background-color: rgba(255, 255, 255, 0.92) !important;
}

.nav-link {
  position: relative;
  transition:
    color 0.2s ease,
    background-color 0.2s ease;
}
.nav-link:not([aria-current="page"])::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 6px;
  width: 0;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, #2c8fa3, #267892);
  transform: translateX(-50%);
  transition: width 0.3s var(--ease-out-expo);
}
.nav-link:not([aria-current="page"]):hover::after {
  width: calc(100% - 24px);
}

/* ——— Footer link underline ——— */
.footer-link {
  position: relative;
  transition: color 0.2s ease;
}
.footer-link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 0;
  height: 1px;
  background: currentColor;
  transition: width 0.3s var(--ease-out-expo);
}
.footer-link:hover::after {
  width: 100%;
}

.site-footer-rich::before {
  content: "";
  position: absolute;
  left: 5%;
  right: 5%;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgb(var(--brand-400) / 0.45), rgb(var(--brand-300) / 0.28), transparent);
  pointer-events: none;
}

.footer-ambient {
  background: radial-gradient(ellipse 80% 60% at 15% 0%, rgb(var(--brand-400) / 0.14), transparent 55%);
}

/* Floating WhatsApp button (includes/footer.php) — must stay out of body > * { position: relative } */
.wa-fab {
  position: fixed;
  z-index: 60;
  bottom: max(1.25rem, env(safe-area-inset-bottom, 0px));
  right: max(1.25rem, env(safe-area-inset-right, 0px));
}
@media (min-width: 640px) {
  .wa-fab {
    bottom: max(1.5rem, env(safe-area-inset-bottom, 0px));
    right: max(1.5rem, env(safe-area-inset-right, 0px));
  }
}

/* ——— Reduced motion ——— */
@media (prefers-reduced-motion: reduce) {
  .hero-mesh::before,
  .hero-orb,
  .hero-line {
    animation: none !important;
  }
  .hero-line {
    opacity: 1;
    transform: none;
  }
  .hero-visual-float-inner {
    animation: none;
  }
  .hero-visual-img {
    transform: none;
    transition: none;
  }
  .product-card-media img {
    transition: none !important;
  }
  .group:hover .product-card-media img {
    transform: none !important;
  }
  .reveal,
  [data-reveal],
  .reveal-scale,
  .reveal-child {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .reveal-group.is-visible .reveal-child {
    transition-delay: 0s !important;
  }
  .card-lift:hover {
    transform: none;
  }
  .hero-stat-tile {
    backdrop-filter: none;
  }
  .btn-shine::after {
    display: none;
  }
  .nav-link::after {
    display: none;
  }
  .wa-fab:hover {
    transform: none;
  }
}
