/* section-home.css - Styles for the #home section (hero area) */

/* ===== HERO SECTION BASE ===== */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 0;
  background-color: var(--cream);
  position: relative;
  overflow: hidden;
  border-bottom: none;
  background-image: repeating-linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.04) 0 12px,
    transparent 12px 24px
  );
}

/* ===== DESKTOP LAYOUT ===== */
.hero-desktop-layout {
  display: grid;
  grid-template-columns: 300px 1fr 300px;
  align-items: start;
  gap: 20px;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.hero-card-side {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 20px;
}

.hero-card-side .hero-card-logo {
  max-width: 280px;
  width: 100%;
  height: auto;
  object-fit: contain;
}

.hero-content-side {
  display: flex;
  flex-direction: column;
  gap: 20px;
  text-align: center;
  padding-left: 10px;
  justify-content: flex-start;
}

.hero-countdown-side {
  display: flex;
  align-items: flex-start;
  padding-top: 40px;
}

.hero-title-section {
  text-align: center;
  margin-bottom: 10px;
}

.hero-title-section h2.cyclocross-subtitle {
  margin-top: 1.5rem;
  text-align: center;
  margin-left: 0;
}

.hero-title-section p.location {
  text-align: center;
  margin-left: 0;
}

/* ===== MOBILE LAYOUT ===== */
.hero-mobile-layout {
  display: none;
}

/* ===== TYPOGRAPHY ===== */
h2.cyclocross-subtitle {
  margin-top: 1.5rem;
  text-align: center;
  margin-left: 0;
}

/* ===== COUNTDOWN SECTION ===== */
.hero-countdown-section {
  width: 100%;
  max-width: 1200px;
  margin: 40px auto 0;
  padding: 0 20px;
}

/* Base countdown container styles */
.countdown-container {
  background: linear-gradient(135deg, var(--color-secondary), #1e40af, var(--color-secondary));
  background-size: 200% 200%;
  color: white;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.countdown-date {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 4px;
  color: white !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.countdown-title {
  font-size: 0.75rem;
  margin-bottom: 6px;
  color: white !important;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.countdown-timer {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin-bottom: 8px;
}

.countdown-item {
  background: rgba(255, 255, 255, 0.2);
  padding: 4px 3px;
  border-radius: 4px;
  text-align: center;
}

.countdown-number {
  display: block;
  font-size: 1rem;
  font-weight: bold;
  color: white !important;
}

.countdown-timer span {
  color: white !important;
}

.countdown-label {
  display: block;
  font-size: 0.6rem;
  color: white !important;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Desktop countdown specific styles */
.hero-desktop-layout .countdown-container {
  padding: 8px;
  border-radius: 8px;
  margin-top: 0;
}

.hero-desktop-layout .hero-register-button {
  padding: 8px 16px;
  font-size: 0.9rem;
  margin: 8px 0;
  border-radius: 20px;
}

.hero-desktop-layout .hero-register-note {
  font-size: 0.7rem;
  margin-top: 6px;
}

/* ===== RESPONSIVE STYLES ===== */

/* Tablet adjustments (max-width: 900px) */
@media (max-width: 900px) {
  .hero-desktop-layout {
    grid-template-columns: 250px 1fr 200px;
    gap: 15px;
    max-width: 1000px;
  }

  .hero-card-side .hero-card-logo {
    max-width: 230px;
  }

  .hero-content-side {
    text-align: left;
  }

  .hero-title-section {
    text-align: center;
  }

  .countdown-item {
    padding: 4px 2px;
  }

  .countdown-number {
    font-size: 0.9rem;
  }

  .countdown-label {
    font-size: 0.5rem;
  }
}

/* Mobile layout (max-width: 768px) */
@media (max-width: 768px) {
  .hero {
    padding: 25px 0;
    min-height: auto;
    margin-left: 3vw !important;
    margin-right: 3vw !important;
    width: auto !important;
    max-width: none !important;
    box-sizing: border-box !important;
    overflow: visible !important;
  }

  /* Hide desktop layout on mobile */
  .hero-desktop-layout {
    display: none;
  }

  /* Show mobile layout */
  .hero-mobile-layout {
    display: flex;
    flex-direction: column;
    gap: 25px;
    width: 100%;
  }

  .hero-mobile-card {
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .hero-mobile-title {
    text-align: center;
  }

  .hero-mobile-title h2.cyclocross-subtitle {
    margin-top: 1.5rem;
  }

  .hero-mobile-copy {
    text-align: center;
  }

  .hero-mobile-countdown {
    margin-top: 20px;
    padding: 0 10px;
  }

  /* Mobile countdown specific styles */
  .hero-mobile-countdown .countdown-container {
    padding: 10px;
    border-radius: 12px;
  }

  .hero-mobile-countdown .hero-register-button {
    padding: 10px 20px;
    font-size: 1rem;
    margin: 8px 0;
    border-radius: 25px;
  }

  .hero-mobile-countdown .hero-register-note {
    font-size: 0.8rem;
    margin-top: 6px;
  }
}

/* ===== BACKGROUND ELEMENTS ===== */
.hero-bg-side {
  flex: 1 1 50%;
  min-width: 0;
  background: url('../../images/Prologue-Banner-Transparent.png') center center no-repeat;
  background-size: contain;
  background-color: var(--cream);
  min-height: 280px;
  align-self: stretch;
  margin-left: 20px;
}

@media (max-width: 900px) {
  .hero-bg-side {
    min-height: 180px;
    width: 100%;
    flex-basis: auto;
  }
}

/* ===== ANIMATIONS ===== */
.hero-copy-side {
  position: relative;
}

.hero-copy-side::after {
  content: var(--back-forth-suit, '♠');
  color: var(--back-forth-color, '#000000');
  filter: drop-shadow(0 0 8px var(--back-forth-color, '#000000'));
  position: absolute;
  font-size: 1.5rem;
  opacity: 0;
  pointer-events: none;
  z-index: 1;
  transition: opacity 0.5s ease;
  font-weight: bold;
  bottom: -30px;
  left: 0;
  width: 1.5rem;
  height: 1.5rem;
}

.hero.loaded .hero-copy-side::after {
  opacity: 0.7;
  animation: back-and-forth 3s ease-in-out infinite;
}

@keyframes back-and-forth {
  0% {
    transform: translateX(0);
  }
  50% {
    transform: translateX(var(--text-animation-width, 200px));
  }
  100% {
    transform: translateX(0);
  }
}

/* Mobile responsive back-and-forth */
@media (max-width: 768px) {
  .hero-copy-side::after {
    font-size: 1.2rem;
    bottom: -25px;
    width: 1.2rem;
    height: 1.2rem;
  }

  @keyframes back-and-forth {
    0% {
      transform: translateX(0);
    }
    50% {
      transform: translateX(var(--text-animation-width, 120px));
    }
    100% {
      transform: translateX(0);
    }
  }
}

/* ===== HERO CONTENT ANIMATIONS ===== */
.hero h1,
.hero h2,
.hero p.location,
.hero .cta-button {
  margin: 0;
  opacity: 0;
  transform: translateY(15px);
  transition:
    opacity 0.4s ease-out,
    transform 0.4s ease-out;
  position: relative;
  z-index: 3;
}

.hero.loaded h1 {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.1s;
}

.hero.loaded h2 {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.25s;
}

.hero.loaded p.location {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.4s;
}

.hero.loaded .cta-button {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.55s;
}

/* ===== HERO TYPOGRAPHY ===== */
.hero h1 {
  font-family: 'Cinzel', serif, 'Montserrat', 'Arial', sans-serif !important;
  font-size: clamp(2.8rem, 6.5vw, 4.2rem);
  color: var(--theme-red);
  text-transform: uppercase;
  text-align: center;
  line-height: 1.1;
  position: relative;
  perspective: 1000px;
}

/* Letter flip animation for PROLOGUE */
.hero h1.prologue-card-title {
  display: inline-block;
  letter-spacing: 0.1em;
}

.flip-letter {
  display: inline-block;
  position: relative;
  transform-style: preserve-3d;
  animation: letter-flip 4s ease-in-out infinite;
  margin: 0 2px;
  min-width: 0.8em;
  text-align: center;
}

.flip-letter .letter-front,
.flip-letter .letter-back {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.flip-letter .letter-back {
  transform: rotateY(180deg);
  color: var(--theme-red);
  font-size: 1.2em;
}

/* Stagger animation delays for each letter */
.flip-letter:nth-child(1) {
  animation-delay: 0s;
}
.flip-letter:nth-child(2) {
  animation-delay: 0.2s;
}
.flip-letter:nth-child(3) {
  animation-delay: 0.4s;
}
.flip-letter:nth-child(4) {
  animation-delay: 0.6s;
}
.flip-letter:nth-child(5) {
  animation-delay: 0.8s;
}
.flip-letter:nth-child(6) {
  animation-delay: 1s;
}
.flip-letter:nth-child(7) {
  animation-delay: 1.2s;
}
.flip-letter:nth-child(8) {
  animation-delay: 1.4s;
}

@keyframes letter-flip {
  0%,
  70% {
    transform: rotateY(0deg);
  }
  85% {
    transform: rotateY(180deg);
  }
  100% {
    transform: rotateY(360deg);
  }
}

.hero h2 {
  font-size: clamp(1.1rem, 2.8vw, 1.6rem);
  color: var(--theme-dark-grey);
  font-weight: bold;
  background-color: transparent;
  padding: 3px 10px;
  display: inline-block;
  text-align: center;
  margin-bottom: 5px;
  line-height: 1.3;
}

.hero p.location {
  font-size: clamp(0.95rem, 2.3vw, 1.25rem);
  color: var(--theme-red);
  font-weight: bold;
  margin-bottom: 12px;
  line-height: 1.4;
}

/* ===== BUTTON STYLES ===== */
.cta-button {
  display: inline-flex;
  align-items: center;
  background: var(--mud-brown);
  color: var(--cream);
  padding: 12px 25px;
  text-decoration: none;
  border-radius: 6px;
  font-size: clamp(0.85rem, 1.8vw, 1rem);
  font-weight: bold;
  text-transform: uppercase;
  transition:
    transform 0.2s ease-out,
    box-shadow 0.2s ease-out,
    background-color 0.2s ease-out;
  gap: 8px;
  border: 2px solid var(--theme-accent-gold);
  box-shadow: 0 4px 16px rgba(211, 84, 0, 0.13);
  letter-spacing: 1.2px;
}

.cta-button:hover,
.cta-button:focus {
  background: var(--autumn-orange);
  color: var(--cream);
  border-color: var(--cream);
  transform: translateY(-3px);
  box-shadow: 0 6px 24px rgba(211, 84, 0, 0.22);
}

.cta-button:active {
  transform: translateY(0px) scale(0.96);
  box-shadow:
    0 0 0 3px var(--theme-dark-grey),
    0 3px 8px rgba(0, 0, 0, 0.2);
  background-color: var(--theme-dark-grey);
}

.cta-button .icon {
  font-size: 1em;
}

/* Hero Registration CTA */
.hero-register-cta {
  margin-top: 1rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero-register-button {
  display: flex !important;
  align-items: center;
  gap: 0.5rem;
  flex-direction: row !important;
  background: linear-gradient(135deg, var(--theme-red), #d62d20);
  color: white;
  padding: 8px 12px !important;
  border-radius: 50px;
  text-decoration: none;
  font-weight: 600;
  font-size: 1.1rem;
  margin: 1rem auto;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(214, 45, 32, 0.3);
  border: 2px solid transparent;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  width: fit-content;
  justify-content: center;
}

.hero-register-button:hover {
  background: linear-gradient(135deg, #d62d20, var(--theme-red));
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(214, 45, 32, 0.4);
  border-color: rgba(255, 255, 255, 0.3);
}

.hero-register-button:active {
  transform: translateY(0);
  box-shadow: 0 2px 10px rgba(214, 45, 32, 0.3);
}

.hero-register-button .register-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  line-height: 1.1;
}

.hero-register-button i {
  flex-shrink: 0;
  font-size: 1rem;
}

/* Registration note styling */
.hero .hero-register-note,
.hero-register-cta .hero-register-note,
.hero-bottom-section .hero-register-note,
.hero .hero-register-cta .hero-register-note {
  font-size: 0.85rem;
  color: white !important;
  margin-top: 0.75rem;
  font-style: italic;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  background-color: rgba(0, 0, 0, 0.1);
  padding: 2px 8px;
  border-radius: 4px;
}

.register-deadline {
  display: block;
  font-size: 0.65rem;
  font-weight: normal;
  margin-top: 1px;
  opacity: 0.9;
  text-align: center;
  line-height: 1;
}

/* ===== HERO LEAD TEXT ===== */
.hero-lead p {
  color: var(--color-dark) !important;
  text-align: justify;
  max-width: 750px;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 1.2em;
  font-family: var(--font-main) !important;
  font-size: 1rem;
  line-height: 1.6;
  font-weight: normal;
}

.hero-content-side .hero-lead p {
  text-align: left;
  margin-left: 0;
  margin-right: 0;
}

/* Mobile responsive text alignment for hero lead */
@media (max-width: 768px) {
  .hero-lead p {
    text-align: left;
    padding: 0 4%;
  }

  .hero-mobile-copy .hero-lead p {
    text-align: center;
    padding: 0 2%;
  }
}
