/* ============================================
   CRESTLINE MEDIA — Animations
   Mountain-themed motion design
   Atmosphere · Ascent · Summit light
   ============================================ */

/* --- Parallax Mountain Layers --- */
@keyframes mountainFloat1 {
  0%, 100% { transform: translateY(0) translateX(0); }
  50% { transform: translateY(-3px) translateX(1px); }
}

@keyframes mountainFloat2 {
  0%, 100% { transform: translateY(0) translateX(0); }
  50% { transform: translateY(-5px) translateX(-2px); }
}

@keyframes mountainFloat3 {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}

.hero__mountain-layer--1 {
  animation: mountainFloat1 12s ease-in-out infinite;
}

.hero__mountain-layer--2 {
  animation: mountainFloat2 15s ease-in-out infinite;
}

.hero__mountain-layer--3 {
  animation: mountainFloat3 10s ease-in-out infinite;
}


/* --- Aurora / Northern Lights over sky --- */
@keyframes auroraDrift {
  0% { opacity: 0.25; transform: translateX(-8%) skewX(-4deg); }
  40% { opacity: 0.55; transform: translateX(6%) skewX(3deg); }
  70% { opacity: 0.35; transform: translateX(2%) skewX(-2deg); }
  100% { opacity: 0.25; transform: translateX(-8%) skewX(-4deg); }
}

@keyframes auroraPulse {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 0.45; }
}

.hero__sky::before,
.page-hero .hero__sky::before {
  content: '';
  position: absolute;
  inset: -10% -20% 40%;
  background:
    radial-gradient(ellipse 40% 30% at 20% 40%, rgba(91, 191, 237, 0.28), transparent 70%),
    radial-gradient(ellipse 35% 25% at 70% 35%, rgba(59, 125, 216, 0.22), transparent 70%),
    radial-gradient(ellipse 30% 20% at 45% 55%, rgba(212, 168, 83, 0.12), transparent 70%);
  animation: auroraDrift 18s ease-in-out infinite;
  pointer-events: none;
  mix-blend-mode: screen;
}

.hero__sky::after,
.page-hero .hero__sky::after {
  content: '';
  position: absolute;
  inset: 0 0 45%;
  background: linear-gradient(
    115deg,
    transparent 20%,
    rgba(91, 191, 237, 0.08) 35%,
    transparent 45%,
    rgba(212, 168, 83, 0.06) 60%,
    transparent 75%
  );
  animation: auroraPulse 9s ease-in-out infinite;
  pointer-events: none;
}


/* --- Stars Twinkle --- */
@keyframes twinkle {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 0.85; }
}

@keyframes starFieldDrift {
  0% { background-position: 0 0, 0 0, 0 0, 0 0, 0 0; }
  100% { background-position: 12px -8px, -10px 6px, 8px 10px, -6px -12px, 4px 4px; }
}

.hero__stars {
  animation: twinkle 4s ease-in-out infinite alternate, starFieldDrift 60s linear infinite;
}


/* --- Summit gold horizon glow --- */
@keyframes horizonGlow {
  0%, 100% { opacity: 0.45; transform: scaleX(1); }
  50% { opacity: 0.85; transform: scaleX(1.05); }
}

.hero::after {
  content: '';
  position: absolute;
  left: 10%;
  right: 10%;
  bottom: 18%;
  height: 80px;
  background: radial-gradient(ellipse at center, rgba(240, 214, 138, 0.35), transparent 70%);
  filter: blur(24px);
  z-index: 2;
  pointer-events: none;
  animation: horizonGlow 6s ease-in-out infinite;
}


/* --- Fog Layers --- */
.hero__fog-layer {
  position: absolute;
  left: -10%;
  width: 120%;
  height: 120px;
  z-index: 3;
  opacity: 0;
  filter: blur(40px);
}

.hero__fog-layer--1 {
  bottom: 20%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.04), rgba(255,255,255,0.07), rgba(255,255,255,0.04), transparent);
  animation: fogLayer1 25s ease-in-out infinite;
}

.hero__fog-layer--2 {
  bottom: 30%;
  background: linear-gradient(90deg, transparent, rgba(168,216,240,0.03), rgba(168,216,240,0.05), rgba(168,216,240,0.03), transparent);
  animation: fogLayer2 30s ease-in-out infinite 5s;
}

.hero__fog-layer--3 {
  bottom: 12%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.05), rgba(255,255,255,0.08), rgba(255,255,255,0.05), transparent);
  animation: fogLayer3 20s ease-in-out infinite 10s;
}

@keyframes fogLayer1 {
  0% { transform: translateX(-15%); opacity: 0; }
  25% { opacity: 0.6; }
  50% { transform: translateX(10%); opacity: 0.3; }
  75% { opacity: 0.7; }
  100% { transform: translateX(-15%); opacity: 0; }
}

@keyframes fogLayer2 {
  0% { transform: translateX(10%); opacity: 0; }
  30% { opacity: 0.5; }
  60% { transform: translateX(-12%); opacity: 0.3; }
  100% { transform: translateX(10%); opacity: 0; }
}

@keyframes fogLayer3 {
  0% { transform: translateX(-8%); opacity: 0; }
  40% { opacity: 0.4; }
  70% { transform: translateX(8%); opacity: 0.6; }
  100% { transform: translateX(-8%); opacity: 0; }
}


/* --- Hero Content Entrance --- */
@keyframes heroFadeUp {
  0% {
    opacity: 0;
    transform: translateY(40px);
    filter: blur(6px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

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

.hero__badge {
  animation: heroFadeUp 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.2s both;
}

.hero__title {
  animation: heroFadeUp 0.95s cubic-bezier(0.16, 1, 0.3, 1) 0.4s both;
}

.hero__title-gradient {
  background-size: 200% auto;
  animation: titleShimmer 8s linear infinite;
}

.hero__subtitle {
  animation: heroFadeUp 0.95s cubic-bezier(0.16, 1, 0.3, 1) 0.6s both;
}

.hero__actions {
  animation: heroFadeUp 0.95s cubic-bezier(0.16, 1, 0.3, 1) 0.8s both;
}

.page-hero__content {
  animation: heroFadeUp 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.25s both;
}


/* --- Glow Pulse (for CTA) --- */
@keyframes glowPulse {
  0%, 100% {
    box-shadow: 0 0 20px rgba(212, 168, 83, 0.3),
                0 0 40px rgba(212, 168, 83, 0.1);
  }
  50% {
    box-shadow: 0 0 30px rgba(212, 168, 83, 0.5),
                0 0 60px rgba(212, 168, 83, 0.2);
  }
}

.btn--primary {
  animation: glowPulse 3s ease-in-out infinite;
  position: relative;
  overflow: hidden;
}

.btn--primary:hover {
  animation: none;
}

@keyframes btnSheen {
  0% { transform: translateX(-120%) skewX(-18deg); }
  100% { transform: translateX(220%) skewX(-18deg); }
}

.btn--primary::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 40%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.28), transparent);
  transform: translateX(-120%) skewX(-18deg);
  pointer-events: none;
}

.btn--primary:hover::after {
  animation: btnSheen 0.75s ease-out;
}


/* --- Card Hover Shine --- */
@keyframes cardShine {
  0% { left: -100%; }
  100% { left: 200%; }
}

.peak-card {
  transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.45s ease,
              border-color 0.3s ease;
  transform-style: preserve-3d;
  will-change: transform;
}

.peak-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.05),
    transparent
  );
  transition: none;
  pointer-events: none;
}

.peak-card:hover::after {
  animation: cardShine 0.8s ease-out;
}

.peak-card.tilt-active {
  transition: transform 0.1s ease-out;
}


/* --- Floating Particles --- */
@keyframes particleFloat {
  0% {
    transform: translateY(0) translateX(0) scale(1);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    transform: translateY(-400px) translateX(100px) scale(0.3);
    opacity: 0;
  }
}

@keyframes emberRise {
  0% {
    transform: translateY(0) scale(0.6);
    opacity: 0;
  }
  15% { opacity: 0.9; }
  100% {
    transform: translateY(-280px) translateX(var(--drift, 40px)) scale(0.2);
    opacity: 0;
  }
}

.particles {
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: 1;
  pointer-events: none;
}

.particle {
  position: absolute;
  width: 3px;
  height: 3px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  animation: particleFloat linear infinite;
}

.particle:nth-child(1) { left: 10%; bottom: 10%; animation-duration: 15s; animation-delay: 0s; }
.particle:nth-child(2) { left: 25%; bottom: 5%; animation-duration: 18s; animation-delay: 2s; }
.particle:nth-child(3) { left: 45%; bottom: 15%; animation-duration: 12s; animation-delay: 4s; }
.particle:nth-child(4) { left: 60%; bottom: 8%; animation-duration: 20s; animation-delay: 1s; }
.particle:nth-child(5) { left: 75%; bottom: 12%; animation-duration: 16s; animation-delay: 3s; }
.particle:nth-child(6) { left: 90%; bottom: 6%; animation-duration: 14s; animation-delay: 5s; }
.particle:nth-child(7) { left: 35%; bottom: 3%; animation-duration: 22s; animation-delay: 7s; }
.particle:nth-child(8) { left: 55%; bottom: 18%; animation-duration: 17s; animation-delay: 6s; }

.particle--gold {
  width: 4px;
  height: 4px;
  background: rgba(212, 168, 83, 0.75);
  box-shadow: 0 0 10px rgba(212, 168, 83, 0.45);
  animation-name: emberRise;
}


/* --- Counter Animation --- */
@keyframes countUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.stat.reveal--visible .stat__number {
  animation: countUp 0.6s ease-out both;
}


/* --- Ridge Line Animation --- */
@keyframes ridgeLine {
  0% { width: 0; }
  100% { width: 100%; }
}

.ridge__bg-line::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, transparent, rgba(212,168,83,0.6), transparent);
}

.ridge__bg-line.reveal--visible::after {
  animation: ridgeLine 2s ease-out both;
}


/* --- Section label draw-in --- */
@keyframes labelIn {
  from { opacity: 0; letter-spacing: 0.35em; transform: translateY(8px); }
  to { opacity: 1; letter-spacing: 0.15em; transform: translateY(0); }
}

@keyframes peakUnderline {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

.section-label.reveal--visible,
.reveal--visible .section-label {
  animation: labelIn 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.reveal--visible .section-title::after,
.section-title.reveal--visible::after {
  animation: peakUnderline 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.25s both;
}


/* --- Enhanced scroll reveals --- */
.reveal {
  opacity: 0;
  transform: translateY(36px);
  transition:
    opacity 0.85s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.85s cubic-bezier(0.16, 1, 0.3, 1),
    filter 0.85s ease;
  filter: blur(4px);
}

.reveal--visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  filter: blur(0);
}

.reveal--left {
  transform: translateX(-40px);
}

.reveal--left.reveal--visible {
  transform: translateX(0);
}

.reveal--right {
  transform: translateX(40px);
}

.reveal--right.reveal--visible {
  transform: translateX(0);
}

.reveal--scale {
  transform: scale(0.92);
}

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

.reveal--delay-1 { transition-delay: 0.1s; }
.reveal--delay-2 { transition-delay: 0.2s; }
.reveal--delay-3 { transition-delay: 0.3s; }
.reveal--delay-4 { transition-delay: 0.4s; }
.reveal--delay-5 { transition-delay: 0.5s; }


/* --- Blog Card Image Overlay --- */
.blog-card {
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.4s ease;
}

.blog-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(10, 22, 40, 0.12);
}

.blog-card__image-wrapper {
  overflow: hidden;
}

.blog-card__image-wrapper::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 50%, rgba(10, 22, 40, 0.1) 100%);
  transition: opacity var(--transition-base);
}

.blog-card:hover .blog-card__image-wrapper::after {
  opacity: 0.5;
}

.blog-card:hover .blog-card__image,
.blog-card:hover .blog-featured__image {
  transform: scale(1.05);
}

.blog-card__image,
.blog-featured__image {
  transition: transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.blog-featured {
  transition: transform 0.45s ease, box-shadow 0.45s ease;
}

.blog-featured:hover {
  transform: translateY(-4px);
}


/* --- Nav Link Underline --- */
.nav__link {
  position: relative;
}

.nav__link::before {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--color-gold);
  border-radius: 1px;
  transition: all var(--transition-base);
  transform: translateX(-50%);
}

.nav__link:hover::before {
  width: 20px;
}


/* --- Smooth Page Transitions --- */
.page-transition {
  animation: pageIn 0.65s cubic-bezier(0.16, 1, 0.3, 1);
}

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


/* --- Loading Shimmer (for images) --- */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.shimmer {
  background: linear-gradient(
    90deg,
    var(--color-cloud) 25%,
    var(--color-snow) 50%,
    var(--color-cloud) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}


/* --- Testimonial Fade --- */
@keyframes testimonialIn {
  from { opacity: 0; transform: scale(0.95) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.testimonial--active {
  animation: testimonialIn 0.55s cubic-bezier(0.16, 1, 0.3, 1);
}


/* --- Mountain Peak Accent on Section Headers --- */
.section-title::after {
  content: '';
  display: block;
  width: 60px;
  height: 3px;
  margin-top: var(--space-4);
  background: var(--gradient-gold);
  border-radius: 2px;
  transform-origin: left center;
  transform: scaleX(0);
}

.text-center .section-title::after {
  margin-left: auto;
  margin-right: auto;
  transform-origin: center;
}

.section--dark .section-title::after {
  background: var(--gradient-gold);
}


/* --- CTA atmosphere --- */
@keyframes ctaGlowBreath {
  0%, 100% { opacity: 0.45; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.08); }
}

.cta-section {
  position: relative;
  overflow: hidden;
}

.cta-section__glow {
  animation: ctaGlowBreath 5s ease-in-out infinite;
}

.cta-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 80%, rgba(59, 125, 216, 0.18), transparent 40%),
    radial-gradient(circle at 80% 30%, rgba(212, 168, 83, 0.12), transparent 35%);
  pointer-events: none;
  animation: auroraPulse 10s ease-in-out infinite;
}


/* --- Generic cards / contact / form lift --- */
.card,
.contact-form-card,
.contact-info-card,
.tier-card,
.value-card {
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.4s ease;
}

.card:hover,
.contact-info-card:hover,
.tier-card:hover {
  transform: translateY(-6px);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  animation: focusRing 0.45s ease;
}

@keyframes focusRing {
  0% { box-shadow: 0 0 0 0 rgba(59, 125, 216, 0.35); }
  100% { box-shadow: 0 0 0 4px rgba(59, 125, 216, 0.1); }
}


/* --- Footer mountain breathe --- */
@keyframes footerBreathe {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.footer__mountains svg {
  animation: footerBreathe 8s ease-in-out infinite;
}


/* --- Magnetic button helper --- */
.btn--magnetic {
  transition: transform 0.2s ease-out;
}


/* --- Scroll progress ridge --- */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  z-index: 9999;
  background: linear-gradient(90deg, #3b7dd8, #5bbfed, #d4a853);
  box-shadow: 0 0 12px rgba(212, 168, 83, 0.45);
  transform-origin: left;
  pointer-events: none;
}


/* --- Ascent trail on page heroes --- */
.page-hero {
  position: relative;
  overflow: hidden;
}

.page-hero .hero__mountain-layer--3 {
  animation: mountainFloat3 14s ease-in-out infinite;
}

.page-hero .hero__mountain-layer--4 {
  animation: mountainFloat1 18s ease-in-out infinite;
}


/* --- Article content fade cascade --- */
.article__header.reveal--visible .article__category {
  animation: labelIn 0.6s ease both;
}

.article__content.reveal--visible > * {
  animation: heroFadeUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.article__content.reveal--visible > *:nth-child(1) { animation-delay: 0.05s; }
.article__content.reveal--visible > *:nth-child(2) { animation-delay: 0.1s; }
.article__content.reveal--visible > *:nth-child(3) { animation-delay: 0.15s; }
.article__content.reveal--visible > *:nth-child(4) { animation-delay: 0.2s; }
.article__content.reveal--visible > *:nth-child(5) { animation-delay: 0.25s; }
.article__content.reveal--visible > *:nth-child(6) { animation-delay: 0.3s; }
.article__content.reveal--visible > *:nth-child(7) { animation-delay: 0.35s; }
.article__content.reveal--visible > *:nth-child(8) { animation-delay: 0.4s; }


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

  .hero__mountain-layer--1,
  .hero__mountain-layer--2,
  .hero__mountain-layer--3,
  .hero__mountain-layer--4 {
    animation: none;
  }

  .hero__stars {
    animation: none;
    opacity: 0.6;
  }

  .hero__sky::before,
  .hero__sky::after,
  .hero::after,
  .cta-section::before,
  .cta-section__glow,
  .footer__mountains svg {
    animation: none !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
    filter: none;
  }

  .scroll-progress {
    display: none;
  }
}
