/* ================================================
   HERO SLIDER — v2.0 Complete Redesign
   Mobile-first | Fully responsive
   ================================================ */

/* ---------- Section ---------- */
.hero-section {
  position: relative;
  height: calc(100vh - 80px);
  overflow: hidden;
  background: #05130a;
  isolation: isolate;
  /* Override any global section padding from the theme */
  padding: 0 !important;
  margin: 0;
}

@supports (height: 1svh) {
  .hero-section {
    height: calc(100svh - 80px);
  }
}

/* ---------- Slider Track ---------- */
.hero-slider {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* ---------- Slide ---------- */
.hero-slide {
  position: absolute;
  inset: 0;
  visibility: hidden;
  pointer-events: none;
  overflow: hidden;
  will-change: transform;
}

.hero-slide.active {
  visibility: visible;
  pointer-events: auto;
  z-index: 1;
}

/* ---------- Background Image ---------- */
.hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transform-origin: center;
  will-change: transform;
  /* Force GPU layer to prevent flicker during slide transitions */
  transform: translateZ(0);
}

.hero-slide.active .hero-bg {
  animation: heroZoom 10s ease-in-out forwards;
}

@keyframes heroZoom {
  /* Start at scale(1) — no jump on the first frame */
  from { transform: scale(1); }
  to   { transform: scale(1.06); }
}

/* ---------- Gradient Overlay ---------- */
.hero-overlay {
  position: absolute;
  inset: 0;
  /* Promote to own GPU layer — keeps it in sync with the animated .hero-bg layer
     so the browser never composites them separately (no flash/flicker) */
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  /* Single gradient — no dip below 0.42, no gaps */
  background: linear-gradient(
    to bottom,
    rgba(3, 14, 7, 0.52) 0%,
    rgba(3, 14, 7, 0.42) 30%,
    rgba(3, 14, 7, 0.68) 65%,
    rgba(3, 14, 7, 0.94) 100%
  );
}

/* ---------- Floating Particles ---------- */
.hero-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

/* Small (default) */
.hero-particle {
  position: absolute;
  display: block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: hsl(var(--accent-glow));
  box-shadow:
    0 0 6px 2px hsl(var(--accent-glow) / 0.75),
    0 0 14px 5px hsl(var(--accent-glow) / 0.35);
  opacity: 0;
  animation: particleFloat linear infinite;
}

/* Medium */
.hero-particle.prt-md {
  width: 9px;
  height: 9px;
  background: hsl(var(--accent-glow));
  box-shadow:
    0 0 8px 3px hsl(var(--accent-glow) / 0.85),
    0 0 22px 7px hsl(var(--accent-glow) / 0.45),
    0 0 40px 12px hsl(var(--accent-glow) / 0.18);
}

/* Large */
.hero-particle.prt-lg {
  width: 14px;
  height: 14px;
  background: hsl(var(--accent-glow));
  box-shadow:
    0 0 10px 4px hsl(var(--accent-glow) / 0.90),
    0 0 28px 9px hsl(var(--accent-glow) / 0.55),
    0 0 55px 16px hsl(var(--accent-glow) / 0.25);
  animation-name: particleFloatLg;
}

@keyframes particleFloat {
  0%   { opacity: 0;   transform: translateY(0)     scale(0.4); }
  12%  { opacity: 1; }
  75%  { opacity: 0.85; }
  100% { opacity: 0;   transform: translateY(-45px)  scale(1.15); }
}

/* Large particles thêm pulse nhẹ khi lên */
@keyframes particleFloatLg {
  0%   { opacity: 0;   transform: translateY(0)     scale(0.5); }
  10%  { opacity: 1; }
  50%  { opacity: 1;   transform: translateY(-22px)  scale(1.1); }
  80%  { opacity: 0.7; }
  100% { opacity: 0;   transform: translateY(-50px)  scale(0.8); }
}

/* ---------- Content Body ---------- */
.hero-body {
  position: relative;
  z-index: 10;
  height: 100%;
  display: flex;
  align-items: flex-end;
}

.hero-inner {
  width: 100%;
  /* No max-width cap — padding handles spacing at all viewport sizes */
  padding: 1.5rem 1.25rem calc(3.75rem + env(safe-area-inset-bottom, 0px));
}

.hero-content {
  width: 100%;
  /* Wide by default; breakpoints fine-tune per screen */
  max-width: 46rem;
  animation: contentReveal 0.85s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.hero-slide:not(.active) .hero-content {
  animation: none;
}

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

/* ---------- Title ---------- */
.hero-title {
  font-family: 'Be Vietnam Pro', sans-serif;
  font-size: clamp(1.625rem, 6vw, 4.25rem);
  font-weight: 800;
  line-height: 1.18;
  color: #fff;
  margin: 0 0 0.75rem;
  text-shadow: 0 2px 28px rgba(0, 0, 0, 0.4);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  /* Reserve height for exactly 3 lines regardless of actual content —
     prevents layout shift between slides with 2-line vs 3-line titles */
  min-height: calc(1.18em * 3);
}

/* ---------- Description ---------- */
.hero-desc {
  font-size: clamp(0.875rem, 2.5vw, 1.0625rem);
  color: rgba(255, 255, 255, 0.80);
  line-height: 1.68;
  margin: 0 0 1.25rem;
  max-width: 38rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- CTA Buttons ---------- */
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
  margin-bottom: 1.375rem;
}

.btn-hero {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.375rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: hsl(var(--accent-foreground));
  background: linear-gradient(135deg, hsl(var(--accent-glow)) 0%, hsl(var(--accent-dark)) 100%);
  border-radius: 9999px;
  box-shadow: var(--shadow-glow);
  transition: transform 0.28s ease, box-shadow 0.28s ease;
  text-decoration: none;
  white-space: nowrap;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.btn-hero i {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

.btn-hero:hover,
.btn-hero:focus-visible {
  transform: translateY(-3px);
  box-shadow: 0 24px 60px -16px hsl(42 95% 55% / 0.65);
  outline: none;
}

.btn-glass {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.375rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: #fff;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 9999px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background 0.28s ease, border-color 0.28s ease;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.btn-glass i {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

.btn-glass:hover,
.btn-glass:focus-visible {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.38);
  outline: none;
}

/* ---------- Stats ---------- */
.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
}

.hero-stat {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  min-width: 0;
}

.hero-stat-value {
  font-family: 'Be Vietnam Pro', sans-serif;
  font-size: clamp(1.0625rem, 3.5vw, 1.875rem);
  font-weight: 700;
  display: block;
  white-space: nowrap;
}

.hero-stat-label {
  font-size: clamp(0.6875rem, 1.6vw, 0.8125rem);
  color: rgba(255, 255, 255, 0.68);
  line-height: 1.3;
  display: block;
}

/* ---------- Arrow Buttons ---------- */
.hero-arrow {
  position: absolute;
  top: 50%;
  z-index: 20;
  display: none; /* hidden on mobile — swipe instead */
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #fff;
  cursor: pointer;
  transform: translateY(-50%);
  transition: background 0.25s ease, transform 0.25s ease;
  -webkit-tap-highlight-color: transparent;
}

.hero-arrow-prev { left: 1.25rem; }
.hero-arrow-next { right: 1.25rem; }

.hero-arrow:hover,
.hero-arrow:focus-visible {
  background: rgba(255, 255, 255, 0.22);
  transform: translateY(-50%) scale(1.08);
  outline: none;
}

.hero-arrow svg {
  display: block;
  pointer-events: none;
}

/* ---------- Dots Navigation ---------- */
.hero-dots {
  position: absolute;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.875rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.20);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  white-space: nowrap;
}

.hero-dot {
  width: 8px;
  height: 8px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.38);
  border: none;
  cursor: pointer;
  padding: 0;
  transition: width 0.35s ease, background 0.35s ease;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.hero-dot.active {
  width: 24px;
  background: linear-gradient(135deg, hsl(var(--accent-glow)) 0%, hsl(var(--accent-dark)) 100%);
}

.hero-dot:hover:not(.active) {
  background: rgba(255, 255, 255, 0.62);
}

/* ================================================
   RESPONSIVE BREAKPOINTS
   ================================================ */

/* --- Mobile performance: reduce GPU load (≤ 767px) --- */
@media (max-width: 767px) {
  /* Disable Ken Burns on mobile — animated transform on .hero-bg is the
     primary cause of GPU layer promotion conflicts and overlay flickering */
  .hero-slide.active .hero-bg {
    animation: none;
  }

  /* Remove will-change so browser doesn't pre-promote to a GPU layer */
  .hero-bg {
    will-change: auto;
    transform: none;
    -webkit-transform: none;
  }

  /* With .hero-bg no longer on its own layer, overlay doesn't need it either */
  .hero-overlay {
    transform: none;
    -webkit-transform: none;
    backface-visibility: visible;
    -webkit-backface-visibility: visible;
  }

  /* Simplified particles on mobile — single box-shadow only (no multi-layer) */
  .hero-particle {
    box-shadow: 0 0 8px 3px hsl(var(--accent-glow) / 0.70);
  }

  .hero-particle.prt-md {
    box-shadow: 0 0 12px 5px hsl(var(--accent-glow) / 0.75);
  }

  .hero-particle.prt-lg {
    width: 11px;
    height: 11px;
    box-shadow: 0 0 16px 6px hsl(var(--accent-glow) / 0.80);
  }

  /* Remove backdrop-filter — very GPU-heavy on mobile */
  .hero-dots,
  .btn-glass {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .btn-glass {
    background: rgba(255, 255, 255, 0.16);
  }
}

/* --- Extra-small phones (≤ 400px) --- */
@media (max-width: 400px) {
  .hero-inner {
    padding: 1.25rem 1rem calc(3.5rem + env(safe-area-inset-bottom, 0px));
  }

  .hero-title {
    font-size: clamp(1.5rem, 7.5vw, 1.875rem);
    margin-bottom: 0.625rem;
  }

  .hero-desc {
    font-size: 0.875rem;
    margin-bottom: 1rem;
    -webkit-line-clamp: 2;
  }

  .hero-actions {
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.125rem;
  }

  .btn-hero,
  .btn-glass {
    width: 100%;
    justify-content: center;
    padding: 0.8125rem 1rem;
  }

  .hero-stats {
    gap: 0.625rem 1.125rem;
    padding-top: 0.875rem;
  }

  .hero-stat-value { font-size: 1.0625rem; }
  .hero-stat-label { font-size: 0.625rem; }
}

/* --- Small phones (401px – 480px) --- */
@media (min-width: 401px) and (max-width: 480px) {
  .hero-inner {
    padding: 1.5rem 1.25rem calc(3.625rem + env(safe-area-inset-bottom, 0px));
  }

  .hero-actions {
    flex-direction: column;
    gap: 0.5rem;
  }

  .btn-hero,
  .btn-glass {
    width: 100%;
    justify-content: center;
  }
}

/* --- Phones (481px – 767px) --- */
@media (min-width: 481px) and (max-width: 767px) {
  .hero-inner {
    padding: 1.75rem 1.5rem calc(3.75rem + env(safe-area-inset-bottom, 0px));
  }

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

/* --- Tablet portrait (768px+) --- */
@media (min-width: 768px) {
  .hero-body {
    align-items: center;
  }

  .hero-inner {
    padding: 2rem 5rem;
  }

  .hero-content {
    max-width: 48rem;
  }

  .hero-title {
    -webkit-line-clamp: 3;
    margin-bottom: 1rem;
  }

  .hero-desc {
    font-size: clamp(1rem, 2vw, 1.125rem);
    margin-bottom: 1.75rem;
    -webkit-line-clamp: 4;
  }

  .hero-actions {
    margin-bottom: 1.875rem;
    gap: 0.875rem;
  }

  .btn-hero,
  .btn-glass {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
  }

  .hero-stats {
    gap: 1rem 2.25rem;
    padding-top: 1.25rem;
  }

  .hero-stat-value { font-size: clamp(1.25rem, 2.5vw, 1.75rem); }
  .hero-stat-label { font-size: 0.8125rem; }

  /* Show arrows on tablet+ */
  .hero-arrow {
    display: flex;
  }

  .hero-dots {
    bottom: 2.75rem;
  }
}

/* --- Desktop (1024px+) --- */
@media (min-width: 1024px) {
  .hero-body {
    align-items: center;
  }

  .hero-inner {
    /* Percentage padding so content expands proportionally on wide screens */
    padding: 2rem 7vw;
  }

  .hero-content {
    /* Wider cap — ~65% of a 1440px viewport */
    max-width: 60rem;
  }

  .hero-title {
    font-size: clamp(2.75rem, 4vw, 4.5rem);
    margin-bottom: 1.125rem;
    -webkit-line-clamp: 3;
  }

  .hero-desc {
    font-size: 1.125rem;
    margin-bottom: 2rem;
    max-width: 50rem;
  }

  .btn-hero,
  .btn-glass {
    padding: 1rem 2.25rem;
    font-size: 1.0625rem;
  }

  .btn-hero i,
  .btn-glass i {
    width: 1.125rem;
    height: 1.125rem;
  }

  .hero-actions {
    margin-bottom: 2.25rem;
    gap: 1rem;
  }

  .hero-stats {
    gap: 1.25rem 3rem;
    padding-top: 1.5rem;
  }

  .hero-stat-value { font-size: 2rem; }
  .hero-stat-label { font-size: 0.9375rem; }

  .hero-arrow {
    width: 3.25rem;
    height: 3.25rem;
  }

  .hero-arrow-prev { left: 1.75rem; }
  .hero-arrow-next { right: 1.75rem; }
}

/* --- Wide desktop (1440px+) --- */
@media (min-width: 1440px) {
  .hero-inner {
    padding: 2rem 6.5vw;
  }

  .hero-content {
    max-width: 72rem;
  }

  .hero-title {
    font-size: clamp(3.5rem, 4vw, 5rem);
  }

  .hero-stat-value { font-size: 2.25rem; }
}

/* --- Full HD and above (1920px+) --- */
@media (min-width: 1920px) {
  .hero-inner {
    padding: 2rem 6.5vw;
  }

  .hero-content {
    max-width: 80rem;
  }
}

/* --- Landscape phones (height < 500px) --- */
@media (max-height: 500px) and (orientation: landscape) {
  .hero-body {
    align-items: center;
  }

  .hero-inner {
    padding: 1rem 1.5rem 1rem;
    display: flex;
    align-items: center;
  }

  .hero-content {
    max-width: 60vw;
  }

  .hero-title {
    font-size: clamp(1.25rem, 4vw, 1.875rem);
    -webkit-line-clamp: 2;
    min-height: calc(1.18em * 2);
    margin-bottom: 0.5rem;
  }

  .hero-desc {
    font-size: 0.875rem;
    -webkit-line-clamp: 2;
    margin-bottom: 0.875rem;
  }

  .hero-actions {
    flex-direction: row;
    flex-wrap: nowrap;
    margin-bottom: 0.875rem;
  }

  .hero-stats {
    display: none; /* hide stats on landscape phones to save space */
  }

  .hero-arrow {
    display: flex;
    width: 2.5rem;
    height: 2.5rem;
  }
}
