/* Rosyvely — motion, depth & premium UI layer (loads after main.css + ui-polish.css) */

:root {
  --rv-ease-spring: cubic-bezier(0.34, 1.45, 0.64, 1);
  --rv-ease-smooth: cubic-bezier(0.22, 1, 0.36, 1);
  --rv-duration-fast: 0.22s;
  --rv-duration: 0.45s;
  --rv-duration-slow: 0.85s;
  --rv-glow-red: rgba(200, 16, 46, 0.35);
  --rv-glow-blue: rgba(29, 90, 168, 0.28);
  --rv-surface-glass: rgba(255, 255, 255, 0.72);
  --rv-border-glow: linear-gradient(
    135deg,
    rgba(200, 16, 46, 0.55),
    rgba(29, 90, 168, 0.45),
    rgba(200, 16, 46, 0.35)
  );
}

/* —— Ambient page atmosphere —— */
body::before,
body::after {
  content: "";
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  filter: blur(80px);
  opacity: 0.45;
  animation: rvOrbFloat 18s var(--rv-ease-smooth) infinite alternate;
}

body::before {
  width: min(55vw, 420px);
  height: min(55vw, 420px);
  top: -8%;
  right: -5%;
  background: radial-gradient(circle, rgba(200, 16, 46, 0.18) 0%, transparent 70%);
}

body::after {
  width: min(50vw, 380px);
  height: min(50vw, 380px);
  bottom: 10%;
  left: -8%;
  background: radial-gradient(circle, rgba(29, 90, 168, 0.16) 0%, transparent 70%);
  animation-delay: -6s;
}

@keyframes rvOrbFloat {
  from {
    transform: translate(0, 0) scale(1);
  }
  to {
    transform: translate(2%, 3%) scale(1.08);
  }
}

main,
.site-header,
.site-footer {
  position: relative;
  z-index: 1;
}

/* —— Page enter —— */
html.rv-loading body {
  overflow: hidden;
}

.rv-page-loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  transition: opacity 0.5s var(--rv-ease-smooth), visibility 0.5s;
}

html.rv-ready .rv-page-loader {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.rv-page-loader__mark {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  animation: rvLoaderPulse 1.2s ease-in-out infinite;
}

.rv-page-loader__logo {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  letter-spacing: -0.02em;
}

.rv-page-loader__bar {
  width: 120px;
  height: 3px;
  border-radius: var(--radius-pill);
  background: var(--line);
  overflow: hidden;
}

.rv-page-loader__bar::after {
  content: "";
  display: block;
  width: 40%;
  height: 100%;
  background: linear-gradient(90deg, var(--brand-red), var(--accent-soft));
  border-radius: inherit;
  animation: rvLoaderBar 1s var(--rv-ease-smooth) infinite;
}

@keyframes rvLoaderPulse {
  0%,
  100% {
    opacity: 0.85;
    transform: scale(0.98);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes rvLoaderBar {
  0% {
    transform: translateX(-120%);
  }
  100% {
    transform: translateX(320%);
  }
}

/* —— Scroll reveals —— */
.rv-reveal {
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity var(--rv-duration-slow) var(--rv-ease-smooth),
    transform var(--rv-duration-slow) var(--rv-ease-smooth);
}

.rv-reveal.rv-visible {
  opacity: 1;
  transform: translateY(0);
}

.rv-reveal--fade {
  transform: none;
}

.rv-reveal--scale {
  transform: scale(0.96);
}

.rv-reveal--scale.rv-visible {
  transform: scale(1);
}

.rv-stagger > .rv-reveal:nth-child(1) {
  transition-delay: 0ms;
}
.rv-stagger > .rv-reveal:nth-child(2) {
  transition-delay: 80ms;
}
.rv-stagger > .rv-reveal:nth-child(3) {
  transition-delay: 160ms;
}
.rv-stagger > .rv-reveal:nth-child(4) {
  transition-delay: 240ms;
}
.rv-stagger > .rv-reveal:nth-child(5) {
  transition-delay: 320ms;
}
.rv-stagger > .rv-reveal:nth-child(6) {
  transition-delay: 400ms;
}

/* —— Header premium —— */
.site-header {
  transition:
    background var(--rv-duration) var(--rv-ease-smooth),
    box-shadow var(--rv-duration) var(--rv-ease-smooth),
    border-color var(--rv-duration);
}

.site-header.is-scrolled {
  background: rgba(10, 49, 97, 0.92);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  box-shadow: 0 8px 32px rgba(10, 49, 97, 0.28);
}

.site-header .nav a {
  position: relative;
  overflow: hidden;
}

.site-header .nav a::after {
  content: "";
  position: absolute;
  left: 0.5rem;
  right: 0.5rem;
  bottom: 0.35rem;
  height: 2px;
  background: linear-gradient(90deg, #fff, rgba(255, 255, 255, 0.5));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--rv-duration) var(--rv-ease-spring);
}

.site-header .nav a:hover::after,
.site-header .nav a[aria-current="page"]::after {
  transform: scaleX(1);
}

.logo {
  transition: transform var(--rv-duration-fast) var(--rv-ease-spring);
}

.logo:hover {
  transform: scale(1.02);
}

/* —— Buttons —— */
.btn {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 40%,
    rgba(255, 255, 255, 0.22) 50%,
    transparent 60%
  );
  transform: translateX(-120%);
  transition: transform 0.6s var(--rv-ease-smooth);
  pointer-events: none;
}

.btn:hover::before {
  transform: translateX(120%);
}

.btn:not(.btn--ghost) {
  background: linear-gradient(145deg, var(--brand-red) 0%, #9e0b24 100%);
  border-color: transparent;
  box-shadow: 0 4px 18px var(--rv-glow-red);
}

.btn:not(.btn--ghost):hover {
  box-shadow: 0 8px 28px var(--rv-glow-red);
  transform: translateY(-2px);
}

.home-hero__btn-primary {
  background: linear-gradient(145deg, #e01432 0%, var(--brand-red) 45%, #a30d26 100%);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}

/* —— Home hero cinematic —— */
.home-hero__img {
  animation: rvKenBurns 22s var(--rv-ease-smooth) infinite alternate;
}

@keyframes rvKenBurns {
  from {
    transform: scale(1);
  }
  to {
    transform: scale(1.08);
  }
}

.home-hero__content {
  animation: rvHeroCardIn 1s var(--rv-ease-smooth) 0.15s both;
}

@keyframes rvHeroCardIn {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.home-hero__title {
  animation: rvHeroLineIn 0.95s var(--rv-ease-smooth) 0.35s both;
}

@keyframes rvHeroLineIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* —— Catalog hero —— */
.catalog-hero__panel {
  position: relative;
  overflow: hidden;
  animation: rvHeroCardIn 0.9s var(--rv-ease-smooth) 0.1s both;
}

.catalog-hero__panel::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  padding: 2px;
  background: var(--rv-border-glow);
  background-size: 200% 200%;
  animation: rvBorderShift 6s linear infinite;
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0.65;
}

@keyframes rvBorderShift {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 200% 50%;
  }
}

/* —— Catálogo: nunca ocultar (carga dinámica de miles de cards) —— */
.page-products #catalog,
.page-products #catalog .card-product,
.page-products #catalog .card-product.rv-reveal,
.page-products .section:has(#catalog),
.page-products .section--catalog-grid,
.page-products .catalog-toolbar-sticky,
.page-products .catalog-hero__panel {
  opacity: 1 !important;
  visibility: visible !important;
  transform: none !important;
}

.page-products #catalog.rv-stagger > .card-product {
  transition-delay: 0ms !important;
}

/* —— Product cards —— */
.card-product {
  position: relative;
  overflow: hidden;
  transition:
    transform var(--rv-duration) var(--rv-ease-spring),
    box-shadow var(--rv-duration) var(--rv-ease-smooth),
    border-color var(--rv-duration);
}

.card-product::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: var(--rv-border-glow);
  background-size: 200% 200%;
  opacity: 0;
  transition: opacity var(--rv-duration);
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  z-index: 2;
}

.card-product:hover::before {
  opacity: 1;
  animation: rvBorderShift 4s linear infinite;
}

.card-product:hover {
  transform: translateY(-8px) scale(1.01);
  box-shadow:
    0 20px 48px rgba(10, 49, 97, 0.16),
    0 0 0 1px rgba(255, 255, 255, 0.8) inset;
}

.card-product__img,
.card-product__main-stage img {
  transition: transform 0.65s var(--rv-ease-smooth);
}

.card-product:hover .card-product__img,
.card-product:hover .card-product__main-stage img {
  transform: scale(1.06);
}

.card-product__gallery {
  overflow: hidden;
}

/* —— Section headings —— */
.section__head h2 {
  position: relative;
  display: inline-block;
}

.section__head h2::after {
  content: "";
  display: block;
  width: 3rem;
  height: 3px;
  margin-top: 0.5rem;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--brand-red), var(--accent-soft));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.6s var(--rv-ease-spring);
}

.section__head.rv-visible h2::after,
.rv-visible .section__head h2::after {
  transform: scaleX(1);
}

/* —— Contact & blog cards —— */
.contact-card,
.blog-card {
  transition:
    transform var(--rv-duration) var(--rv-ease-spring),
    box-shadow var(--rv-duration);
}

.contact-card:hover,
.blog-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.contact-stack__block,
.contact-tile {
  transition:
    transform var(--rv-duration) var(--rv-ease-smooth),
    border-color var(--rv-duration),
    box-shadow var(--rv-duration);
}

.contact-stack__block:hover {
  transform: translateX(4px);
  border-color: var(--accent-soft);
}

.contact-page .contact-intro,
.contact-page .contact-actions,
.contact-page .contact-directions {
  animation: rvHeroCardIn 0.85s var(--rv-ease-smooth) 0.05s both;
}

/* —— Footer —— */
.site-footer {
  position: relative;
  background: linear-gradient(180deg, var(--bg-elevated) 0%, #e8eef8 100%);
}

.site-footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--brand-red),
    var(--accent-soft),
    var(--brand-red),
    transparent
  );
  background-size: 200% 100%;
  animation: rvBorderShift 8s linear infinite;
}

/* —— Catalog toolbar —— */
.na-catalog-pill {
  transition:
    transform var(--rv-duration-fast) var(--rv-ease-spring),
    box-shadow var(--rv-duration-fast),
    background var(--rv-duration-fast);
}

.na-catalog-pill:hover {
  transform: translateY(-2px);
}

.na-catalog-pill.is-active {
  animation: rvPillPop 0.4s var(--rv-ease-spring);
}

@keyframes rvPillPop {
  0% {
    transform: scale(0.92);
  }
  60% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

/* —— PDP —— */
.na-fnm-detail-main,
.na-pdp {
  animation: rvHeroCardIn 0.7s var(--rv-ease-smooth) both;
}

.na-fnm-pdp-buybox,
.na-pdp-buybox {
  border-radius: var(--radius);
  background: var(--rv-surface-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.65);
  box-shadow: var(--shadow-md);
  padding: clamp(1.25rem, 3vw, 2rem);
}

.na-fnm-pdp-stage,
.na-fnm-pdp-gallery {
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

/* —— Hero pages (contact, blog) —— */
.hero.contact-hero,
main > .hero {
  animation: rvHeroCardIn 0.85s var(--rv-ease-smooth) 0.05s both;
}

/* —— Tech grid overlay on home hero —— */
.home-hero__scrim {
  background:
    linear-gradient(180deg, rgba(10, 49, 97, 0.55) 0%, rgba(10, 49, 97, 0.82) 100%),
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.03) 0,
      rgba(255, 255, 255, 0.03) 1px,
      transparent 1px,
      transparent 48px
    ),
    repeating-linear-gradient(
      0deg,
      rgba(255, 255, 255, 0.03) 0,
      rgba(255, 255, 255, 0.03) 1px,
      transparent 1px,
      transparent 48px
    );
}

.home-hero__media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 20%, rgba(200, 16, 46, 0.15), transparent 45%);
  pointer-events: none;
  animation: rvOrbFloat 12s ease-in-out infinite alternate;
}

/* —— Index featured cards —— */
.section .card-product {
  background: linear-gradient(180deg, #fff 0%, #f8fbff 100%);
}

/* —— Blog list —— */
.blog-card {
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
}

.blog-card img {
  transition: transform 0.6s var(--rv-ease-smooth);
}

.blog-card:hover img {
  transform: scale(1.05);
}

/* —— Search focus glow —— */
.na-catalog-search:focus {
  box-shadow:
    0 0 0 3px var(--accent-glow),
    inset 0 1px 2px rgba(10, 49, 97, 0.06);
}

/* —— Price contact / CTA pulse —— */
.na-pdp-actions-row .na-fnm-contact-btn,
.home-hero__btn-primary {
  animation: rvCtaGlow 3s ease-in-out infinite;
}

@keyframes rvCtaGlow {
  0%,
  100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.06);
  }
}

/* —— Reduced motion —— */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .rv-reveal {
    opacity: 1;
    transform: none;
  }

  body::before,
  body::after {
    display: none;
  }

  .rv-page-loader {
    display: none;
  }
}
