/* ============================================
   PATH OF EXCELLENCE - HOME PAGE STYLES
   ============================================ */

/* Hero section gradient */
.hero-section {
  background: linear-gradient(135deg, var(--primary-red) 0%, var(--dark-red) 100%);
  position: relative;
  overflow: hidden;
}

.hero-wallpaper {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 0;
  border: none !important;
  outline: none !important;
}

.hero-image {
  width: 100%;
  height: auto;
  max-height: 500px;
  object-fit: cover;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  border: none !important;
  outline: none !important;
  padding: 0;
  margin: 0;
  display: block;
}

/* Section Headers */
.section-header {
  max-width: 720px;
  margin: 0 auto 3rem auto;
}

.section-eyebrow {
  display: inline-block;
  text-transform: uppercase;
  letter-spacing: 0.18rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary-red);
  background: rgba(220, 53, 69, 0.08);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  margin-bottom: 1rem;
}

.section-title {
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 800;
  color: #212529;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
}

.section-subtitle {
  color: #6c757d;
  font-size: 1.05rem;
  line-height: 1.6;
  margin: 0 auto;
  max-width: 620px;
}

/* Popular Courses Carousel */
.popular-courses-section {
  background: linear-gradient(135deg, rgba(220,53,69,0.05) 0%, rgba(255,255,255,0.95) 100%);
}

.popular-carousel {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.popular-carousel-window {
  overflow: hidden;
  flex: 1;
}

.popular-carousel-track {
  display: grid;
  grid-auto-flow: column;
  transition: transform 0.4s ease;
  will-change: transform;
}

/* Mobile: one card per view - full width, no gap */
.popular-carousel-track {
  grid-auto-columns: 100%;
  gap: 0;
}

/* Tablet: two cards */
@media (min-width: 768px) {
  .popular-carousel-track {
    grid-auto-columns: calc(50% - 0.75rem);
    gap: 1.5rem;
  }
}
/* Desktop: three cards */
@media (min-width: 992px) {
  .popular-carousel-track {
    grid-auto-columns: calc(33.333% - 1rem);
    gap: 1.5rem;
  }
}

.popular-carousel-track.dragging {
  cursor: grabbing;
}

.popular-carousel-track.no-transition {
  transition: none;
}

.carousel-nav {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: white;
  box-shadow: 0 10px 25px rgba(0,0,0,0.12);
  color: var(--primary-red);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.carousel-nav:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 25px rgba(220,53,69,0.2);
}

.carousel-nav:disabled {
  opacity: 0.4;
  cursor: default;
  transform: none;
  box-shadow: none;
}

.popular-course-card {
  background: white;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.08);
  border: 1px solid rgba(220,53,69,0.08);
  display: flex;
  flex-direction: column;
  min-height: 100%;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.popular-course-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 18px 40px rgba(220,53,69,0.12);
}

.popular-thumb {
  position: relative;
  height: 180px;
  overflow: hidden;
}

.popular-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
  /* Reserve space to prevent CLS if image loads late */
  aspect-ratio: 16 / 9;
}

.popular-course-card:hover .popular-thumb img {
  transform: scale(1.05);
}

.popular-pill {
  position: absolute;
  bottom: 12px;
  left: 12px;
  background: rgba(0,0,0,0.7);
  color: white;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.popular-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.popular-title {
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
  color: #212529;
}

.popular-description {
  color: #6c757d;
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 1rem;
  flex: 1;
}

.popular-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  font-size: 0.85rem;
  color: #495057;
}

.popular-meta span i {
  color: var(--primary-red);
  margin-right: 0.35rem;
}

.popular-body .btn {
  font-weight: 600;
  border-radius: 999px;
}

.popular-body .btn-light {
  background: rgba(255,255,255,0.85);
  border: 1px solid rgba(0,0,0,0.05);
}

.popular-body .btn-light:hover {
  background: white;
  border-color: rgba(0,0,0,0.1);
}

/* Force green buttons for all Start/Continue Learning buttons, red on hover */
#courses .card .btn-success,
#courses .card .btn-primary,
.popular-body .btn-success,
.popular-body .btn-primary {
  background-color: #198754 !important;
  border-color: #198754 !important;
  color: white !important;
}

#courses .card .btn-success:hover,
#courses .card .btn-primary:hover,
.popular-body .btn-success:hover,
.popular-body .btn-primary:hover {
  background-color: #dc3545 !important;
  border-color: #dc3545 !important;
  color: white !important;
}

/* Avoid non-composited animations (color/border-color/background-color) on buttons.
   Lighthouse flags Bootstrap's default .btn transitions; disable them on this page. */
.popular-courses-section .btn,
.feature-card .btn,
.hero-section .btn,
.card .btn {
  transition: none !important;
}
.popular-courses-section .btn:hover,
.feature-card .btn:hover,
.hero-section .btn:hover,
.card .btn:hover,
.popular-courses-section .btn:focus,
.feature-card .btn:focus,
.hero-section .btn:focus,
.card .btn:focus {
  transition: none !important;
}

/* Respect reduced-motion preference globally for home page */
@media (prefers-reduced-motion: reduce) {
  * , *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ============================================
   FEATURE CARD FLIP ANIMATION
   ============================================ */

.feature-card {
  perspective: 1000px;
  height: 250px;
}

.feature-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  transition: transform 0.6s ease;
  transform-style: preserve-3d;
}

.feature-card:hover .feature-card-inner {
  transform: rotateY(180deg);
}

.feature-card-front, .feature-card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 2rem;
  border-radius: 1rem;
  box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.feature-card-front {
  background: white;
  border: 2px solid #f8f9fa;
}

.feature-card-back {
  background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
  color: white;
  transform: rotateY(180deg);
}

.feature-card-back h4 {
  color: white !important;
}

.feature-card-back p {
  color: rgba(255,255,255,0.9) !important;
}

.feature-card-back .feature-icon {
  background: rgba(255,255,255,0.2) !important;
  color: white !important;
}

/* ============================================
   HOW IT WORKS ANIMATIONS
   ============================================ */

.how-it-works-section { overflow: hidden; }

/* Reduce CLS: only fade in, no layout-moving transforms */
.step-item { opacity: 0; animation: fadeIn 0.6s ease forwards; }

.step-item:nth-child(1) { animation-delay: 0.2s; }
.step-item:nth-child(2) { animation-delay: 0.4s; }
.step-item:nth-child(3) { animation-delay: 0.6s; }
.step-item:nth-child(4) { animation-delay: 0.8s; }

@keyframes fadeIn { to { opacity: 1; } }

.step-circle {
  transition: all 0.3s ease;
  cursor: pointer;
}

.step-circle:hover {
  transform: scale(1.1) rotate(10deg);
  box-shadow: 0 15px 30px rgba(0,0,0,0.2);
}

.step-circle.pulse {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.step-title { transition: opacity 0.3s ease; opacity: 0; animation: fadeIn 0.6s ease forwards; }

.step-item:nth-child(1) .step-title { animation-delay: 0.4s; }
.step-item:nth-child(2) .step-title { animation-delay: 0.6s; }
.step-item:nth-child(3) .step-title { animation-delay: 0.8s; }
.step-item:nth-child(4) .step-title { animation-delay: 1.0s; }

/* slideInLeft removed in favor of fadeIn */

.step-description { transition: opacity 0.3s ease; opacity: 0; animation: fadeIn 0.6s ease forwards; }

.step-item:nth-child(1) .step-description { animation-delay: 0.6s; }
.step-item:nth-child(2) .step-description { animation-delay: 0.8s; }
.step-item:nth-child(3) .step-description { animation-delay: 1.0s; }
.step-item:nth-child(4) .step-description { animation-delay: 1.2s; }

/* slideInRight removed in favor of fadeIn */

/* Floating animation for circles */
/* Keep subtle float but not on first paint */
.step-circle.float { animation: float 3s ease-in-out infinite; animation-delay: 1.2s; }

.step-item:nth-child(1) .step-circle.float { animation-delay: 0s; }
.step-item:nth-child(2) .step-circle.float { animation-delay: 0.5s; }
.step-item:nth-child(3) .step-circle.float { animation-delay: 1s; }
.step-item:nth-child(4) .step-circle.float { animation-delay: 1.5s; }

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

/* Connecting lines animation */
.step-connector {
  position: absolute;
  top: 40px;
  left: 50%;
  width: 0;
  height: 3px;
  background: linear-gradient(90deg, #dc3545, #28a745, #ffc107, #17a2b8);
  transform: translateX(-50%);
  animation: drawLine 2s ease forwards;
  animation-delay: 1.5s;
}

@keyframes drawLine {
  to { width: 75%; }
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 768px) {
  .hero-section {
    min-height: 520px !important;
    text-align: center;
    padding-top: 3rem;
  }

  .hero-section .display-3 {
    font-size: 2.5rem;
  }

  .hero-section .lead {
    font-size: 1.05rem;
  }

  .feature-card {
    height: auto;
  }
  
  .feature-card-inner,
  .feature-card-front,
  .feature-card-back {
    position: static;
    transform: none !important;
    height: auto;
    box-shadow: none;
    padding: 1.75rem;
  }

  .feature-card-back {
    display: none;
  }
  
  .step-connector {
    display: none !important;
  }

  .step-item {
    margin-bottom: 1.5rem;
  }

  .popular-carousel {
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
  }

  .popular-carousel-window {
    width: 100%;
    overflow: hidden;
  }

  .popular-carousel-track {
    grid-auto-columns: 100% !important;
    gap: 0 !important;
  }
  
  .carousel-nav {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
  }
}

@media (max-width: 576px) {
  .hero-section {
    padding-bottom: 3rem;
  }

  .hero-section .display-3 {
    font-size: 2.1rem;
  }

  .hero-section .lead {
    font-size: 1rem;
  }

  .hero-section .d-flex {
    justify-content: center;
    gap: 0.75rem;
  }

  .feature-card-front {
    border: 1px solid rgba(0,0,0,0.05);
    box-shadow: 0 10px 25px rgba(0,0,0,0.08);
  }

  .step-item {
    text-align: center;
  }

  .step-circle {
    margin: 0 auto;
  }

  .step-title,
  .step-description {
    transform: none !important;
    opacity: 1 !important;
    animation: none !important;
  }

  #courses .card {
    border-radius: 1rem;
  }

  #courses .card-body {
    padding: 1.25rem;
  }

  .section-title {
    font-size: 2rem;
  }

  .section-subtitle {
    font-size: 0.95rem;
  }

  .popular-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
}

/* Optional hero wallpaper on the right */
.hero-wallpaper {
  width: 100%;
  height: 360px;
  border-radius: 1rem;
  background: url('/images/hero.jpg') center/cover no-repeat;
}
@media (min-width: 992px) {
  .hero-wallpaper { height: 420px; }
}

/* Featured courses cards look-and-feel */
#courses .card {
  border-radius: 18px;
  border: 1px solid rgba(220,53,69,0.08);
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
  transition: transform .2s ease, box-shadow .2s ease;
}
#courses .card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 32px rgba(0,0,0,0.12);
}
#courses .badge.bg-success {
  border-radius: 999px;
}

.category-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.filter-pill {
  border: 1px solid rgba(220, 53, 69, 0.4);
  color: #dc3545;
  border-radius: 999px;
  padding: 0.4rem 1rem;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  transition: all 0.2s ease;
  background: rgba(220, 53, 69, 0.08);
}

.filter-pill:hover,
.filter-pill.active {
  background: #dc3545;
  color: #fff;
  border-color: #dc3545;
}

.category-chip {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #dc3545;
  background: rgba(220, 53, 69, 0.12);
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  margin-bottom: 0.5rem;
}

@media (min-width: 992px) {
  .hero-wallpaper { height: 420px; }
}

/* Featured courses cards look-and-feel */
#courses .card {
  border-radius: 18px;
  border: 1px solid rgba(220,53,69,0.08);
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
  transition: transform .2s ease, box-shadow .2s ease;
}
#courses .card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 32px rgba(0,0,0,0.12);
}
#courses .badge.bg-success {
  border-radius: 999px;
}
