/*
 * hero-fold.css
 * Self-contained styles for the landing page hero section.
 * Partial: public/templates/public/components/hero_fold.html
 *
 * Layout strategy:
 *   Mobile  : single column, countdown hidden, title shown
 *   768px+  : two columns — countdown LEFT, title RIGHT
 *   No CSS `order` tricks. Countdown is DOM-first so it's
 *   naturally column 1 without any reordering.
 * ─────────────────────────────────────────────────────────
 */

/* ── SHELL ─────────────────────────────────────────────── */

.hero-fold {
  position: relative;
  display: flex;
  flex-direction: column;
}

.hero-fold__section {
  position: relative;
  overflow: hidden;
  flex: 1 1 auto;
}

.hero-fold__bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 60% at 15% 50%,  rgba(212,175,55,0.09), transparent 55%),
    radial-gradient(ellipse 55% 50% at 85% 40%,  rgba(120,30,20,0.22),  transparent 55%),
    var(--c-midnight);
  z-index: 0;
}

.hero-fold__vignette {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 60%, rgba(11,11,15,0.85) 100%);
  z-index: 1;
  pointer-events: none;
}

/* ── LAYOUT ────────────────────────────────────────────── */

.hero-fold__layout {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  padding: var(--space-5) var(--space-5) var(--space-5);
  gap: var(--space-5);
  max-width: var(--max-w);
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

/* ── COLUMNS ───────────────────────────────────────────── */

/* Countdown column hidden on mobile — shown at 768px */
.hero-fold__col--countdown {
  display: none;
}

.hero-fold__col--title {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* ── DESKTOP LAYOUT — 768px+ ───────────────────────────── */

@media (min-width: 768px) {

  .hero-fold__layout {
    flex-direction: row;
    align-items: start;
    gap: var(--space-7);
    padding: var(--space-6) var(--space-7) var(--space-5);
  }

  /* Countdown: fixed 400px left column */
  .hero-fold__col--countdown {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    flex: 0 0 400px;
    width: 400px;
  }

  /* Title: fills remaining space */
  .hero-fold__col--title {
    flex: 1 1 0%;
    min-width: 0;
    gap: var(--space-4);
  }
}

@media (min-width: 1024px) {
  .hero-fold__col--countdown {
    flex: 0 0 420px;
    width: 420px;
  }

  .hero-fold__layout {
    padding: var(--space-7) var(--space-7) var(--space-5);
    gap: var(--space-8, 64px);
  }
}

/* ── COUNTDOWN CARD — depth, breathe, race-day / urgent states ── */

@keyframes hfCountdownBreathe {
  0%, 100% {
    box-shadow:
      0 0 0 1px rgba(212, 175, 55, 0.06),
      0 12px 40px rgba(0, 0, 0, 0.35),
      0 0 28px rgba(212, 175, 55, 0.08);
    border-color: rgba(212, 175, 55, 0.32);
  }
  50% {
    box-shadow:
      0 0 0 1px rgba(212, 175, 55, 0.12),
      0 16px 48px rgba(0, 0, 0, 0.42),
      0 0 42px rgba(212, 175, 55, 0.16);
    border-color: rgba(212, 175, 55, 0.48);
  }
}

@keyframes hfCountdownBreatheUrgent {
  0%, 100% {
    box-shadow:
      0 0 0 1px rgba(255, 200, 120, 0.12),
      0 14px 44px rgba(0, 0, 0, 0.4),
      0 0 36px rgba(255, 190, 90, 0.14);
    border-color: rgba(255, 200, 130, 0.45);
  }
  50% {
    box-shadow:
      0 0 0 1px rgba(255, 220, 150, 0.2),
      0 18px 52px rgba(0, 0, 0, 0.48),
      0 0 52px rgba(255, 200, 100, 0.22);
    border-color: rgba(255, 210, 140, 0.6);
  }
}

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

@keyframes hfCdColonPulse {
  0%, 100% { opacity: 1; color: rgba(212, 175, 55, 0.55); }
  50%      { opacity: 0.35; color: rgba(212, 175, 55, 0.2); }
}

@keyframes hfCdDigitFlip {
  0%   { transform: scale(1); }
  40%  { transform: scale(0.88); }
  100% { transform: scale(1); }
}

.hf-countdown {
  position: relative;
  isolation: isolate;
  background: var(--c-navy-card);
  border: 1px solid rgba(212, 175, 55, 0.32);
  border-radius: var(--r-lg);
  padding: var(--space-6) var(--space-5) var(--space-5);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0;
  transform-style: preserve-3d;
  transition: transform 0.14s ease-out;
  animation: hfCountdownBreathe 6.5s ease-in-out infinite;
}

.hf-countdown::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(ellipse 90% 70% at 50% 0%, rgba(212, 175, 55, 0.07), transparent 58%);
  pointer-events: none;
  z-index: 0;
}

.hf-countdown > * {
  position: relative;
  z-index: 1;
}

.hf-countdown--urgent {
  animation: hfCountdownBreatheUrgent 3.2s ease-in-out infinite;
}

.hf-countdown--race-day {
  animation: none;
  border-color: rgba(255, 235, 180, 0.55);
  box-shadow:
    0 0 0 1px rgba(255, 220, 150, 0.15),
    0 18px 56px rgba(0, 0, 0, 0.45),
    0 0 48px rgba(255, 210, 120, 0.2);
}

.hf-countdown--race-day .hf-countdown__label {
  color: rgba(255, 220, 170, 0.75);
  letter-spacing: 0.26em;
}

.hf-countdown__trophy {
  animation: hfTrophyFloat 5s ease-in-out infinite;
}

.hf-countdown__trophy svg {
  width: 72px;
  height: auto;
  display: block;
  margin: 0 auto var(--space-4);
  filter: drop-shadow(0 0 14px rgba(212, 175, 55, 0.42));
}

.hf-countdown__race-name {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  color: var(--c-gold);
  text-decoration: none;
  letter-spacing: 0.02em;
  margin-bottom: var(--space-2);
  display: block;
  transition: opacity 0.2s;
}
.hf-countdown__race-name:hover { opacity: 0.8; }

.hf-countdown__label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: var(--c-text-35);
  text-transform: uppercase;
  display: block;
  margin-bottom: var(--space-4);
}

/* Digits row */
.hf-countdown__digits {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-bottom: var(--space-3);
}

.hf-cd-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 8px 8px;
  border-radius: 10px;
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.07) 0%, rgba(255, 255, 255, 0.02) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 4px 14px rgba(0, 0, 0, 0.25);
}

.hf-cd-num {
  display: block;
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 900;
  line-height: 1;
  min-width: 44px;
  text-align: center;
  color: var(--c-gold);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
  transform-origin: center center;
}

@supports (-webkit-background-clip: text) or (background-clip: text) {
  .hf-cd-num {
    background: linear-gradient(185deg, #fff8e0 0%, #e8c96a 42%, #a67c1c 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: none;
  }

  .hf-countdown--race-day .hf-cd-num {
    background: linear-gradient(185deg, #ffffff 0%, #ffe9a8 40%, #d4af37 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
  }
}

.hf-cd-num--flip {
  animation: hfCdDigitFlip 0.32s cubic-bezier(0.34, 1.2, 0.64, 1);
}

.hf-cd-lbl {
  display: block;
  font-size: 9px;
  color: rgba(245, 240, 230, 0.42);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 4px;
}

.hf-cd-sep {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  margin-top: 6px;
  align-self: flex-start;
  animation: hfCdColonPulse 1s ease-in-out infinite;
}

.hf-countdown__sub {
  font-size: 10px;
  color: var(--c-text-35);
  margin-bottom: var(--space-4);
  display: block;
}

.hf-countdown__cta {
  width: 100%;
  justify-content: center;
  min-height: 44px;
}

@media (prefers-reduced-motion: reduce) {
  .hf-countdown,
  .hf-countdown--urgent {
    animation: none;
  }

  .hf-countdown__trophy {
    animation: none;
  }

  .hf-cd-sep {
    animation: none;
    color: rgba(212, 175, 55, 0.4);
  }

  .hf-cd-num--flip {
    animation: none;
  }

  .hf-countdown {
    transition: none;
  }
}

/* ── STAT GRID ─────────────────────────────────────────── */

.hf-stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.hf-stat-box {
  background: var(--c-navy-raised);
  border: 1px solid var(--c-border-md);
  border-radius: var(--r-md);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s;
}
.hf-stat-box--link:hover { border-color: rgba(212,175,55,0.4); }

.hf-stat-num {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 900;
  color: var(--c-text-100);
  line-height: 1;
}

.hf-stat-lbl {
  font-size: 10px;
  color: var(--c-text-35);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
}

/* ── FAV CARD ──────────────────────────────────────────── */

.hf-fav-card {
  background: rgba(192,57,43,0.08);
  border: 1px solid rgba(192,57,43,0.22);
  border-radius: var(--r-md);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hf-fav-card__label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--c-red);
  opacity: 0.8;
}

.hf-fav-card__horse {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--c-text-100);
  margin-top: 4px;
}

.hf-fav-card__horse-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,0.15);
  transition: border-color 0.2s;
}
.hf-fav-card__horse-link:hover { border-color: var(--c-text-55); }

.hf-fav-card__odds {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 900;
  color: var(--c-red);
}

.hf-fav-card__note {
  font-size: 11px;
  color: var(--c-text-35);
}

/* ── GAMBLE AWARE ──────────────────────────────────────── */

.hf-gamble-aware {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--c-text-35);
  text-decoration: none;
  transition: color 0.2s;
}
.hf-gamble-aware:hover { color: var(--c-text-55); }

/* Mobile shows mobile version, desktop shows desktop version */
.hf-gamble-aware--desktop { display: none; }
.hf-gamble-aware--mobile  { display: flex; }

@media (min-width: 768px) {
  .hf-gamble-aware--desktop { display: flex; }
  .hf-gamble-aware--mobile  { display: none; }
}

/* ── RACE REVEAL ───────────────────────────────────────── */

.hf-race-reveal__eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--c-text-35);
  margin-bottom: var(--space-3);
}

.hf-race-reveal__dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--c-gold);
  flex-shrink: 0;
  animation: blink 1.4s ease-in-out infinite;
}

.hf-race-reveal__name {
  font-family: var(--font-display);
  font-size: clamp(22px, 5vw, 42px);
  font-weight: 900;
  color: var(--c-gold);
  letter-spacing: -0.01em;
  line-height: 1.05;
  margin-bottom: var(--space-3);
}

.hf-race-reveal__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--c-text-55);
  margin-bottom: var(--space-4);
}

.hf-race-reveal__sep { color: var(--c-text-35); }

.hf-race-reveal__time {
  color: var(--c-text-55);
  text-decoration: none;
  transition: color 0.2s;
}
.hf-race-reveal__time:hover { color: var(--c-gold); }

.hf-race-reveal__status { font-weight: 600; color: var(--c-text-75); }
.hf-race-reveal__status--today { color: var(--c-gold); }

/* ── TITLE ─────────────────────────────────────────────── */

.hf-title {
  line-height: 0.95;
  margin: 0;
}

.hf-title__small {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(22px, 5vw, 42px);
  font-weight: 700;
  font-style: italic;
  color: var(--c-text-75);
  letter-spacing: -0.01em;
}

.hf-title__main {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(48px, 11vw, 96px);
  font-weight: 900;
  color: var(--c-gold);
  letter-spacing: -0.03em;
  line-height: 0.9;
}

/* ── SUBTITLE ──────────────────────────────────────────── */

.hf-subtitle {
  font-size: 15px;
  line-height: 1.65;
  color: var(--c-text-55);
  max-width: 560px;
}

/* ── CTAs ──────────────────────────────────────────────── */

.hf-ctas {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

@media (min-width: 600px) {
  .hf-ctas {
    flex-direction: row;
    flex-wrap: wrap;
  }
}

/* ── TICKER ────────────────────────────────────────────── */

/* On mobile the ticker-bar--hero-foot is fixed at the bottom
   On tablet+ it flows naturally at the base of the hero fold  */
.page-landing .ticker-bar--hero-foot {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 40;
  height: calc(40px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  flex: 0 0 auto;
  border-top: 1px solid rgba(212,175,55,0.16);
  box-shadow: 0 -12px 32px rgba(0,0,0,0.35);
}

.page-landing {
  padding-bottom: calc(40px + env(safe-area-inset-bottom));
}

@media (min-width: 768px) {
  .page-landing .ticker-bar--hero-foot {
    position: relative;
    left: auto; right: auto; bottom: auto;
    height: 40px;
    box-shadow: none;
  }
  .page-landing { padding-bottom: 0; }
}
