/* ============================================================
   PERLYN-IT | template-hero-section.css
   Inner Page Hero Section — Cinematic Design v2.2
   Adapted from tourism site implementation.
   Uses Perlyn-IT main.css variables only — no hardcoding.
   Works with .hero-slideshow markup hardcoded in each page.
   ============================================================ */

/* ── Hero Container ───────────────────────────────────────── */
.hero-slideshow {
  position: relative;
  width: 100%;
  min-height: 68vh;
  display: flex;
  align-items: center;
  overflow: hidden;
  background: var(--bg-primary);
  color: var(--text-primary);
  padding: clamp(6rem, 14vw, 10rem) 0 clamp(3rem, 6vw, 5rem);
}

/* ── Background Crossfade Layers ──────────────────────────── */
.hero-bg-layer {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center 35%;
  background-attachment: fixed;
  transition: opacity 1100ms cubic-bezier(0.4, 0, 0.2, 1);
  will-change: opacity, transform;
}

.hero-bg-layer-0 {
  opacity: 1;
  z-index: 1;
  animation: heroKenBurns 18s ease-in-out infinite alternate;
}

.hero-bg-layer-1 {
  opacity: 0;
  z-index: 0;
}

@keyframes heroKenBurns {
  0%   { transform: scale(1.00) translate(0,      0);     }
  33%  { transform: scale(1.03) translate(-0.4%,  0.2%);  }
  66%  { transform: scale(1.06) translate( 0.4%, -0.3%);  }
  100% { transform: scale(1.09) translate(-0.8%,  0.4%);  }
}

/* ── Overlay — dark gradient ──────────────────────────────── */
.hero-slideshow::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 2;
  background:
    linear-gradient(
      to top,
      rgba(10, 15, 30, 0.97) 0%,
      rgba(10, 15, 30, 0.75) 25%,
      rgba(10, 15, 30, 0.35) 55%,
      rgba(10, 15, 30, 0.15) 75%,
      transparent 100%
    ),
    linear-gradient(
      to bottom,
      rgba(10, 15, 30, 0.75) 0%,
      rgba(10, 15, 30, 0.30) 25%,
      transparent 45%
    ),
    linear-gradient(
      135deg,
      rgba(10, 15, 30, 0.25) 0%,
      transparent 50%
    );
  pointer-events: none;
}

/* ── Overlay — teal glow ──────────────────────────────────── */
.hero-slideshow::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 2;
  background: radial-gradient(
    ellipse 100% 80% at 50% 100%,
    rgba(13, 115, 119, 0.28) 0%,
    rgba(13, 115, 119, 0.10) 38%,
    transparent 68%
  );
  pointer-events: none;
  animation: glowBreathe 5.5s ease-in-out infinite alternate;
}

@keyframes glowBreathe {
  from { opacity: 0.65; }
  to   { opacity: 1.00; }
}

/* ── Floating Particles (injected by JS) ──────────────────── */
.hero-particles {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  overflow: hidden;
}

.hero-particle {
  position: absolute;
  border-radius: 9999px;
  animation: particleRise linear infinite;
  opacity: 0;
}

.hero-particle:nth-child(odd)  { background: rgba(201, 168, 76, 0.80); }
.hero-particle:nth-child(even) { background: rgba(255, 255, 255, 0.40); }

.hero-particle:nth-child(1)  { left:  5%; width: 3px; height: 3px; animation-duration: 12s; animation-delay:   0s; }
.hero-particle:nth-child(2)  { left: 12%; width: 2px; height: 2px; animation-duration: 17s; animation-delay:  -4s; }
.hero-particle:nth-child(3)  { left: 21%; width: 4px; height: 4px; animation-duration:  9s; animation-delay:  -8s; }
.hero-particle:nth-child(4)  { left: 30%; width: 2px; height: 2px; animation-duration: 21s; animation-delay:  -2s; }
.hero-particle:nth-child(5)  { left: 39%; width: 5px; height: 5px; animation-duration: 14s; animation-delay: -11s; }
.hero-particle:nth-child(6)  { left: 49%; width: 2px; height: 2px; animation-duration: 22s; animation-delay:  -6s; }
.hero-particle:nth-child(7)  { left: 58%; width: 4px; height: 4px; animation-duration: 11s; animation-delay: -15s; }
.hero-particle:nth-child(8)  { left: 67%; width: 2px; height: 2px; animation-duration: 16s; animation-delay:  -3s; }
.hero-particle:nth-child(9)  { left: 75%; width: 3px; height: 3px; animation-duration: 18s; animation-delay:  -9s; }
.hero-particle:nth-child(10) { left: 83%; width: 5px; height: 5px; animation-duration: 13s; animation-delay: -13s; }
.hero-particle:nth-child(11) { left: 91%; width: 2px; height: 2px; animation-duration: 15s; animation-delay:  -7s; }
.hero-particle:nth-child(12) { left: 46%; width: 3px; height: 3px; animation-duration: 19s; animation-delay: -10s; }

@keyframes particleRise {
  0%   { bottom: -10px; opacity: 0;    transform: translateX(0)    rotate(0deg);   }
  7%   { opacity: 0.90; }
  50%  { opacity: 0.55;                transform: translateX(18px)  rotate(180deg); }
  92%  { opacity: 0.15; }
  100% { bottom: 108%;  opacity: 0;    transform: translateX(-8px)  rotate(360deg); }
}

/* ── Gold Progress Bar (injected by JS) ───────────────────── */
.hero-progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 4px;
  width: 0%;
  background: var(--gradient-gold);
  z-index: 50;
  transition: width 0.12s linear;
  border-radius: 0 9999px 9999px 0;
  box-shadow:
    0 0  8px rgba(201, 168, 76, 0.85),
    0 0 22px rgba(201, 168, 76, 0.50),
    0 0 45px rgba(201, 168, 76, 0.22);
}

/* ── Bottom Hairline Rule (injected by JS) ────────────────── */
.hero-rule {
  position: absolute;
  bottom: 4px;
  left: 0;
  right: 0;
  height: 1px;
  z-index: 30;
  background: linear-gradient(
    to right,
    transparent 0%,
    rgba(201, 168, 76, 0.12) 15%,
    rgba(201, 168, 76, 0.60) 50%,
    rgba(201, 168, 76, 0.12) 85%,
    transparent 100%
  );
  pointer-events: none;
}

/* ── Content Container ────────────────────────────────────── */
.hero-slideshow .container {
  position: relative;
  z-index: 10;
}

/* ── Eyebrow Tag ──────────────────────────────────────────── */
.hero-slideshow .hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-gold-light);
  padding: 0.35rem 1rem 0.35rem 0.75rem;
  background: rgba(10, 15, 30, 0.75);
  border: 1px solid rgba(201, 168, 76, 0.55);
  border-radius: 9999px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow:
    0 4px 20px rgba(10, 15, 30, 0.50),
    0 0 0 1px rgba(201, 168, 76, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.10);
  margin-bottom: 1.25rem;
  animation: heroFadeDown 0.7s cubic-bezier(0.165, 0.84, 0.44, 1) both;
}

/* Pulsing gold dot */
.hero-slideshow .hero-eyebrow::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 9999px;
  background: var(--accent-gold);
  flex-shrink: 0;
  animation: pulseDot 2.4s ease-in-out infinite;
  box-shadow: 0 0 8px rgba(201, 168, 76, 0.9);
}

@keyframes pulseDot {
  0%, 100% { transform: scale(1.0); opacity: 1.0; }
  50%       { transform: scale(1.9); opacity: 0.3; }
}

/* ── Hero Title ───────────────────────────────────────────── */
.hero-slideshow .hero-title,
.hero-slideshow h1 {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: clamp(2rem, 3.8vw, 3.5rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  text-shadow:
    0 2px 10px rgba(10, 15, 30, 0.90),
    0 8px 40px rgba(10, 15, 30, 0.55);
  margin-bottom: 0;
  padding-bottom: 1.75rem;
  animation: heroReveal 1.0s cubic-bezier(0.165, 0.84, 0.44, 1) 0.08s both;
}

/* Gold italic last word applied by JS */
.hero-slideshow .hero-title em,
.hero-slideshow h1 em {
  font-style: italic;
  background: var(--gradient-gold);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: heroReveal 1.0s cubic-bezier(0.165, 0.84, 0.44, 1) 0.18s both;
}

/* Gold underline rule after title */
.hero-slideshow .hero-title::after,
.hero-slideshow h1::after {
  content: '';
  display: block;
  margin-top: 1.25rem;
  height: 2px;
  width: 0;
  background: var(--gradient-gold);
  border-radius: 9999px;
  animation: underlineGrow 0.9s cubic-bezier(0.165, 0.84, 0.44, 1) 0.55s forwards;
  opacity: 0;
}

@keyframes underlineGrow {
  0%   { width: 0;      opacity: 0; }
  15%  { opacity: 1; }
  100% { width: 120px;  opacity: 1; }
}

/* ── Subtitle / Description ───────────────────────────────── */
.hero-slideshow .hero-subtitle,
.hero-slideshow p.hero-subtitle {
  font-family: var(--font-body);
  font-size: clamp(0.9375rem, 1.8vw, 1.125rem);
  font-weight: 400;
  font-style: italic;
  color: var(--text-secondary);
  line-height: 1.75;
  margin-top: 0.75rem;
  margin-bottom: 2rem;
  text-shadow: 0 2px 20px rgba(10, 15, 30, 0.65);
  animation: heroFadeUp 0.9s cubic-bezier(0.165, 0.84, 0.44, 1) 0.30s both;
}

/* Plain <p> fallback */
.hero-slideshow .container p:not([class]) {
  font-family: var(--font-body);
  font-size: 1.0625rem;
  font-weight: 400;
  color: var(--text-secondary);
  line-height: 1.75;
  margin-top: 0.75rem;
  margin-bottom: 2rem;
  text-shadow: 0 2px 14px rgba(10, 15, 30, 0.55);
  animation: heroFadeUp 0.9s cubic-bezier(0.165, 0.84, 0.44, 1) 0.30s both;
}

/* ── Breadcrumb ───────────────────────────────────────────── */
.hero-slideshow .hero-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 400;
  animation: heroFadeDown 0.6s cubic-bezier(0.165, 0.84, 0.44, 1) both;
}

.hero-slideshow .hero-breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.hero-slideshow .hero-breadcrumb a:hover {
  color: var(--accent-teal-light);
}

.hero-slideshow .hero-breadcrumb-sep {
  color: var(--text-muted);
  opacity: 0.5;
}

.hero-slideshow .hero-breadcrumb-current {
  color: var(--text-secondary);
}

/* ── CTA Buttons ──────────────────────────────────────────── */
.hero-slideshow .hero-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
  animation: heroFadeUp 1s cubic-bezier(0.165, 0.84, 0.44, 1) 0.50s both;
}

/* ── Bottom Glow ──────────────────────────────────────────── */
.hero-glow {
  position: absolute;
  bottom: -24px;
  left: 0;
  right: 0;
  height: 220px;
  background: radial-gradient(
    ellipse 85% 100% at 50% 100%,
    rgba(13, 115, 119, 0.30) 0%,
    rgba(13, 115, 119, 0.12) 32%,
    rgba(13, 115, 119, 0.04) 58%,
    transparent 78%
  );
  pointer-events: none;
  z-index: 3;
  animation: glowBreathe 5.5s ease-in-out infinite alternate;
}

/* ── One-shot shimmer (injected by JS) ────────────────────── */
.hero-shimmer-layer {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 25%,
    rgba(255, 255, 255, 0.18) 50%,
    transparent 75%
  );
  background-size: 200% 100%;
  pointer-events: none;
  z-index: 2;
  animation: shimmerSweep 1.6s cubic-bezier(0.4, 0, 0.2, 1) 1.0s forwards;
  opacity: 0;
}

@keyframes shimmerSweep {
  0%   { background-position: 200% 0; opacity: 0; }
  12%  { opacity: 1; }
  100% { background-position: -80% 0; opacity: 0; }
}

/* ── Core Keyframes ───────────────────────────────────────── */
@keyframes heroFadeDown {
  from { opacity: 0; transform: translateY(-20px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

@keyframes heroReveal {
  from { opacity: 0; transform: translateY(20px); filter: blur(3px); }
  to   { opacity: 1; transform: translateY(0);    filter: blur(0);   }
}

/* ── Responsive — Tablet ──────────────────────────────────── */
@media (max-width: 992px) {
  .hero-slideshow {
    min-height: 56vh;
    padding: clamp(5rem, 12vw, 8rem) 0 clamp(2.5rem, 5vw, 4rem);
  }
}

@media (max-width: 768px) {
  .hero-slideshow {
    min-height: 48vh;
    padding: clamp(4rem, 10vw, 6rem) 0 clamp(2rem, 4vw, 3rem);
  }

  .hero-bg-layer {
    background-attachment: scroll;
  }

  .hero-slideshow .hero-title,
  .hero-slideshow h1 {
    font-size: clamp(1.75rem, 6vw, 2.5rem);
  }

  .hero-slideshow .hero-subtitle,
  .hero-slideshow p.hero-subtitle {
    font-size: 0.9375rem;
  }

  .hero-slideshow .hero-actions {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ── Responsive — Mobile ──────────────────────────────────── */
@media (max-width: 576px) {
  .hero-slideshow {
    min-height: 44vh;
  }

  .hero-slideshow .hero-title,
  .hero-slideshow h1 {
    font-size: clamp(1.5rem, 7vw, 2rem);
    padding-bottom: 1.25rem;
  }

  .hero-slideshow .hero-subtitle,
  .hero-slideshow p.hero-subtitle {
    font-style: normal;
  }

  .hero-slideshow .hero-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .hero-particles { display: none; }
}

/* ── Reduced Motion ───────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .hero-bg-layer,
  .hero-bg-layer-0 {
    transition: opacity 200ms linear !important;
    animation: none !important;
    transform: none !important;
  }

  .hero-slideshow::after,
  .hero-glow { animation: none !important; }

  .hero-slideshow .hero-eyebrow,
  .hero-slideshow .hero-title,
  .hero-slideshow h1,
  .hero-slideshow .hero-title em,
  .hero-slideshow h1 em,
  .hero-slideshow .hero-subtitle,
  .hero-slideshow p,
  .hero-slideshow .hero-breadcrumb,
  .hero-slideshow .hero-actions {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
  }

  .hero-slideshow .hero-title::after,
  .hero-slideshow h1::after {
    animation: none !important;
    width: 120px !important;
    opacity: 1 !important;
  }

  .hero-eyebrow::before,
  .hero-particle,
  .hero-shimmer-layer { animation: none !important; }
  .hero-progress-bar  { transition: none !important; }
}
