/* ==========================================================================
   Teaser countdown — hero section
   Exactly one screen, no internal scroll of its own (the page itself now
   has a second section below it — see lead-form.css — so the PAGE scrolls,
   but this section never does). A bike reveal video, a logo bar, and the
   message/countdown cards, which give way to a "Book Now" CTA once the
   countdown hits zero (see .countdown--revealed below).
   ========================================================================== */

@font-face {
  /* Triumph's brand-approved typeface. Only Regular/Bold are self-hosted —
     the only two weights anything on this page actually sets
     (font-weight: 400 for labels/body, 700 for numerals/headings/CTA). */
  font-family: 'DIN 2014';
  src: url('../fonts/DIN2014-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'DIN 2014';
  src: url('../fonts/DIN2014-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  /* Condensed display face used for the headline, matching the reference
     layout. Self-hosted (rather than linked from Google Fonts) so this
     still renders correctly with no live internet connection. */
  font-family: 'Bebas Neue';
  src: url('../fonts/BebasNeue-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Official "Triumph Red" per the Master Brand Guidelines (Pantone 1807
     Coated / 187 Uncoated). */
  --brand-red: #cd192d;

  --countdown-bg: #010101;
  --countdown-card-bg: #0a0a0a;
  --countdown-card-border: rgba(255, 255, 255, 0.24);
  --countdown-message-color: #c1c1c1;
  --countdown-label-color: #f0f0f0;
  --countdown-number-color: var(--brand-red);
  --countdown-font: 'DIN 2014', Arial, Helvetica, sans-serif;
  --countdown-heading-font: 'Bebas Neue', var(--countdown-font);
}

html,
body {
  margin: 0;
  /* The page now has a second section below the hero (see lead-form.css),
     so it's allowed to grow past one viewport and scroll — only the hero
     section itself (.countdown, height:100dvh below) is still constrained
     to exactly one screen with no internal overflow of its own. */
  background: var(--countdown-bg);
}

/* ---- Section shell: always exactly fills the viewport ------------------ */

.countdown {
  position: relative;
  width: 100%;
  height: 100vh; /* fallback for browsers without dvh */
  height: 100dvh; /* accounts for mobile browser chrome showing/hiding */
  overflow: hidden;
  background-color: var(--countdown-bg);
  box-sizing: border-box;
}

/* ---- Background: the Bonneville reveal video, full-bleed ---------------- */

.countdown__bg {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
}

/* Autoplay/muted/loop video — own motion now, so no synthetic Ken Burns
   zoom on top of it (that was for the old static covered-bike photo; see
   archive/reveal-code/ and git history before this background became a
   video). object-fit is set at runtime by video-bg.js, not fixed here:
   `cover` (full-bleed) crops into the video whenever the section's
   aspect ratio doesn't match the video's own, and `contain` (never
   crops) shows letterbox/pillarbox bars whenever it doesn't — picking
   one as a permanent default always loses on some window shape. The JS
   measures both at runtime and switches between them per-viewport; this
   `cover` is only the pre-JS/no-JS fallback. Loops natively — the clip
   ends on a black Triumph logo card and opens on a near-white title
   card, so each loop has a brief hard cut rather than a seamless blend;
   ask if that's worth smoothing out.

   top/height (not a plain inset:0) leave a gap the height of
   .countdown__logo at the top — that bar sits opaque on top of the video
   (z-index 3 vs this element's z-index: 1 on its parent), and the video
   has on-screen title text ("100% BONNEVILLE") that sits in roughly the
   top third of its own frame, which the bar was partly covering. The
   clamp() here is a static fallback approximating the logo bar's own
   height formula; video-bg.js overwrites both with the bar's *actual*
   measured height at runtime (clamp() and the logo's own sizing can't
   literally reference each other, so this is the best a pure-CSS
   approximation can do without JS). Behind this gap is just
   .countdown's own background-color, the same colour as the logo bar
   itself, so it reads as continuous rather than a visible seam. */
.countdown__covered {
  position: absolute;
  top: clamp(44px, 6.5vh, 64px);
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: calc(100% - clamp(44px, 6.5vh, 64px));
  object-fit: cover;
  /* The box is already shorter than the full section (it starts below
     the header bar, see the comment above), so cover has to zoom in
     further to fill it — by default that crop is split evenly between
     the top and bottom of the source frame (center, 50%). 0% (top) keeps
     the entire top of the source visible and crops only off the bottom —
     that's what overcorrected: with nothing cropped off the top, all the
     empty headroom above the bike stays in frame and pushes the bike
     itself lower in the box. 20% was still too close to that end for the
     same reason. Moving toward 50/center crops more of that headroom off
     the top instead, which is what actually brings the bike higher in
     the frame. */
  object-position: center 38%;
}

/* The source video is a bright, white-studio product shot — this page's
   text (light grey/white, plus red accents) was designed against a dark
   photo and reads poorly directly on white. A flat dark scrim over the
   whole video pulls it back toward the page's own dark palette without
   hiding the bike; the headline's own text-shadow (further down) adds a
   bit more contrast on top of this without a second background layer. */
.countdown__video-scrim {
  position: absolute;
  inset: 0;
  background: rgba(1, 1, 1, 0.5);
  pointer-events: none;
}

.countdown__gradient {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  height: 50%;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0) 0%, #000000 100%);
  pointer-events: none;
}

/* ---- Frame: logo -> content, always fills height ------------------------
   Deliberately NOT its own positioned/z-index box (unlike .countdown__bg
   above) — .countdown__logo and .countdown__content need to sit ABOVE the
   cover/gradient, so each sets its own position/z-index instead of the
   whole frame doing it once. */

.countdown__frame {
  position: relative; /* containing block for .countdown__content's overlay below */
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-sizing: border-box;
  padding: clamp(16px, 3vh, 40px) clamp(16px, 4vw, 32px);
  gap: clamp(8px, 2vh, 24px);
}

/* ---- Logo bar ------------------------------------------------------------
   A dedicated opaque strip across the top, matching the reference site's
   header — not just the logo floating transparently over the photo. The
   negative margins exactly cancel .countdown__frame's own padding (see
   above) to pull this out to the section's true edges, since it can't
   reach them from its normal position inside that padded flex column;
   the padding below then re-establishes the logo's own inset from those
   edges. Still an ordinary flex child otherwise. */

.countdown__logo {
  position: relative;
  z-index: 3;
  flex: 0 0 auto;
  align-self: stretch;
  display: flex;
  align-items: center;
  margin: calc(-1 * clamp(16px, 3vh, 40px)) calc(-1 * clamp(16px, 4vw, 32px)) 0;
  padding: clamp(10px, 1.8vh, 18px) clamp(16px, 4vw, 32px);
  background: var(--countdown-bg);
}

.countdown__logo img {
  display: block;
  width: clamp(100px, 11vh, 170px);
  height: auto;
}

/* ---- Stage: hosts the bike, absorbs whatever height is left ------------- */

/* ---- Content: message + stat cards --------------------------------------
   Floats over the image around the vertical center-lower third of the
   frame rather than sitting flush at the very bottom edge — an absolute
   overlay, positioned independently of .countdown__frame's flex flow.
   Raised from an earlier bottom:14% — that clustered everything low,
   leaving a large empty gulf between the header bar and the content with
   nothing anchoring it. */

.countdown__content {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: calc(1% + 20px);
  transform: translateX(-50%);
  width: 100%;
  max-width: min(100%, 900px);
  padding: 0 clamp(16px, 4vw, 32px);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(10px, 1.6vh, 20px);
}

@media (max-width: 900px) {
  /* On a tall phone the 2x2 card grid (see .countdown__stats below) is
     much shorter than the single-row desktop bar, so this needs its own,
     smaller offset rather than the desktop value above. */
  .countdown__content {
    bottom: calc(0.5% + 20px);
  }
}

.countdown__message {
  position: relative;
  margin: 0;
  width: 100%;
  text-align: center;
  text-transform: uppercase;
  font-family: var(--countdown-heading-font);
  font-weight: 400;
  /* 80% bigger than the original base (clamp(15px, 2.4vh, 27px), which
     this used to share with .stat-box__lbl — no longer tied to that):
     +20%, then +50% more on top of that. Letter-spacing widened to
     match, or the extra size alone just reads as bigger text crammed
     into the same tight tracking rather than text that's actually
     spread out. */
  font-size: clamp(27px, 4.32vh, 48.6px);
  line-height: normal;
  letter-spacing: 4.5px;
  color: var(--countdown-message-color);
  /* Legibility comes from the shadow alone (no background box — see the
     removed ::before below, from when this read as a small, subtle
     label). */
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.95), 0 1px 4px rgba(0, 0, 0, 0.9);
}

/* Once countdown.js splits the text into one <span> per character and
   marks the element [data-split], those spans lay out as normal inline
   text — no flex/justify needed, since the base letter-spacing above
   already applies per character and a real space character (not a
   non-breaking one) still gives the browser a valid line-break
   opportunity. That's what lets this line render as a single line on
   wide viewports but reflow to two on narrow ones. */

/* A staggered rise-in every time the message's content is (re)split, using
   the per-letter spans the split already builds. Each span's --i (a
   continuous index across every segment — see splitMessage() in
   countdown.js) staggers its delay so the letters settle in left-to-right
   rather than the heading just appearing all at once. */
.countdown__message[data-split] > span {
  opacity: 0;
  transform: translateY(8px);
  animation: message-letter-rise 520ms ease forwards;
  animation-delay: calc(var(--i, 0) * 22ms);
}

@keyframes message-letter-rise {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .countdown__message[data-split] > span {
    opacity: 1;
    transform: none;
    animation: none;
  }
}

/* Base (all-four-visible) state renders as one continuous bar — dark fill,
   a hairline border, thin dividers between each stat, and a glowing red
   accent bracketing the far left/right edges — rather than four separate
   floating cards. */
.countdown__stats {
  position: relative;
  display: grid;
  /* max-content (via minmax(0, ...) so it can still shrink rather than
     forcing overflow) rather than a vw-based floor — a 3-digit Days count
     (once the countdown is past 99 days) is wider than the 2-digit
     Hours/Mins/Secs columns and needs to grow to fit instead of clipping.
     A vw-based minimum here previously caused real overflow: it keeps
     growing with viewport width even after .countdown__content's own
     max-width:900px caps the space actually available to this grid, so at
     wide viewports the 4 columns' combined floor could exceed the space
     they're centered within, pushing the outer two visibly off-centre
     within their own boxes. Sizing purely off each column's own content
     (padding + digits + label, all already sized via clamp() on
     .stat-box/.stat-box__val/.stat-box__lbl) can't run into that
     mismatch, since there's no competing width formula to disagree with
     the container's actual size. */
  grid-template-columns: repeat(4, minmax(0, max-content));
  justify-content: center;
  gap: 0;
  width: auto;
  max-width: 100%;
  background: var(--countdown-card-bg);
  border: 1px solid var(--countdown-card-border);
  border-radius: 14px;
  box-sizing: border-box;
}

/* Retriggered by countdown.js at the exact moment a card drops
   (Days->Hrs->Mins->Secs) — a quick settle punch so that transition reads
   as a deliberate beat rather than a silent instant relayout (the cards
   themselves use display:none to drop, which can't be transitioned, so
   this gives the moment some weight without touching that mechanism). */
@keyframes stats-settle {
  0% {
    transform: scale(1.05);
    filter: brightness(1.35);
  }
  100% {
    transform: scale(1);
    filter: brightness(1);
  }
}

.countdown__stats--settle {
  animation: stats-settle 380ms cubic-bezier(0.22, 0.8, 0.24, 1);
}

@media (prefers-reduced-motion: reduce) {
  .countdown__stats--settle {
    animation: none;
  }
}

.countdown__stats::before,
.countdown__stats::after {
  content: '';
  position: absolute;
  top: -1px;
  bottom: -1px;
  width: 4px;
  border-radius: 2px;
  background: var(--brand-red);
  box-shadow: 0 0 26px 4px rgba(205, 25, 45, 0.7);
  pointer-events: none;
  /* A slow breathing pulse so the bar reads as carrying live current
     rather than a static graphic — this is the state visible for the
     longest stretch (the full "Days" bar), so it's the highest-value spot
     for ambient life. */
  animation: countdown-edge-pulse 3400ms ease-in-out infinite;
}

.countdown__stats::before {
  left: -1px;
}

.countdown__stats::after {
  right: -1px;
}

@keyframes countdown-edge-pulse {
  0%,
  100% {
    opacity: 0.75;
    box-shadow: 0 0 20px 3px rgba(205, 25, 45, 0.55);
  }
  50% {
    opacity: 1;
    box-shadow: 0 0 32px 5px rgba(205, 25, 45, 0.85);
  }
}

@media (prefers-reduced-motion: reduce) {
  .countdown__stats::before,
  .countdown__stats::after {
    animation: none;
  }
}

@media (max-width: 420px) {
  /* Wraps to two rows below this width — the single-bar treatment (side
     dividers/edge glow) doesn't read cleanly across a wrap, so fall back
     to four separate cards with their own chrome, same as before. */
  .countdown__stats {
    grid-template-columns: repeat(2, 1fr);
    width: 80%;
    gap: 6px;
    background: none;
    border: none;
    border-radius: 0;
  }
  .countdown__stats::before,
  .countdown__stats::after {
    content: none;
  }
}

.stat-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(3px, 0.75vh, 7.5px);
  height: clamp(69px, 12.75vh, 165px);
  padding: clamp(6px, 1.5vh, 21px) clamp(9px, 2.1vw, 30px);
  box-sizing: border-box;
  border-left: 1px solid var(--countdown-card-border);
}

.stat-box:first-child {
  border-left: none;
}

@media (min-width: 901px) {
  /* Widens the bar ~30% on desktop by growing each box's own horizontal
     padding (part of the max-content width the grid track sizes off —
     see .countdown__stats) rather than reintroducing a competing
     vw-based minimum on the grid track itself, which is what overflowed
     the container before. The ceiling here (58px) is chosen so 4 boxes'
     worth of padding plus their content can never exceed
     .countdown__content's own max-width:900px cap. */
  .stat-box {
    padding-left: clamp(22px, 3.5vw, 58px);
    padding-right: clamp(22px, 3.5vw, 58px);
  }
}

@media (max-width: 420px) {
  /* Cards shrunk 50% (and their text 30%, see .stat-box__val/__lbl below)
     so the covered-bike backdrop reads through more clearly on phones
     instead of the card grid dominating the frame. */
  .stat-box {
    height: clamp(42px, 10.5vh, 57px);
    gap: 4.5px;
    padding: 6px;
    background: var(--countdown-card-bg);
    border: 1px solid var(--countdown-card-border);
    border-radius: 6px;
  }
}

.stat-box__val {
  font-family: var(--countdown-font);
  font-weight: 700;
  font-size: clamp(36px, 8.1vh, 105px);
  line-height: 1;
  color: var(--countdown-number-color);
  font-variant-numeric: tabular-nums;
  display: inline-block; /* transform below needs a box of its own */
}

@media (max-width: 420px) {
  .stat-box__val {
    font-size: clamp(23px, 6.8vw, 29px);
  }
}

/* A quick punch + glow flash retriggered by countdown.js every time a
   unit's displayed number actually changes — most visibly the seconds
   digit, once a second, so the countdown reads as live and ticking rather
   than a static number that happens to update. */
@keyframes digit-tick {
  0% {
    transform: scale(1);
    text-shadow: 0 0 0 rgba(205, 25, 45, 0);
  }
  35% {
    transform: scale(1.16);
    text-shadow: 0 0 22px rgba(205, 25, 45, 0.85);
  }
  100% {
    transform: scale(1);
    text-shadow: 0 0 0 rgba(205, 25, 45, 0);
  }
}

.stat-box__val--tick {
  animation: digit-tick 320ms cubic-bezier(0.22, 0.8, 0.24, 1);
}

@media (prefers-reduced-motion: reduce) {
  .stat-box__val--tick {
    animation: none;
  }
}

.stat-box__lbl {
  font-family: var(--countdown-font);
  font-weight: 400;
  font-size: clamp(15px, 2.4vh, 27px);
  line-height: normal;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--countdown-label-color);
  white-space: nowrap;
}

@media (max-width: 420px) {
  .stat-box__lbl {
    font-size: 13px;
  }

  /* 20% bigger than .stat-box__lbl's own 13px below this breakpoint —
     no longer tied to it, see the base rule above. */
  .countdown__message {
    font-size: 23.4px;
  }
}

/* ---- Dropping a card (Days -> Hours -> Minutes, in that order) as each
   hits zero. Deliberately NOT a separate "individual boxed card" style —
   that was tried and looked like a different widget bolted onto the
   4-card bar. Instead the dropped box is simply display:none'd and
   everything else (the single continuous bar: shared background, hairline
   dividers, glowing red edges, .stat-box/.stat-box__val/.stat-box__lbl
   sizing, the <420px compact override) is untouched — same CSS renders
   every state, 4 cards down to 1, so the bar's own look and each card's
   size never change, only how many segments it has. */

.countdown--hide-days .stat-box--days {
  display: none;
}

.countdown--hide-hours .stat-box--hours {
  display: none;
}

.countdown--hide-minutes .stat-box--minutes {
  display: none;
}

/* The base .stat-box:first-child rule only ever matches the Days box (the
   true DOM first-child), so once Days (or Days+Hours) is hidden, the new
   leftmost VISIBLE box would otherwise keep its border-left divider,
   showing a redundant hairline right next to the bar's own outer border.
   Explicitly drop it on whichever box is now leftmost in each state. */
.countdown--hide-days .stat-box--hours,
.countdown--hide-hours .stat-box--minutes,
.countdown--hide-minutes .stat-box--seconds {
  border-left: none;
}

/* On desktop this needs nothing further: grid-template-columns stays
   repeat(4, ...), a display:none item just isn't placed, so the remaining
   items fill the leftmost tracks and the bar (width:auto, centered via
   .countdown__content) shrinks to fit them automatically — same bar, same
   card size, fewer segments.
   Below 420px the base state switches to a 2-column wrapping grid (see
   the max-width:420px override on .countdown__stats above) because 4
   individual chip-cards don't fit one row at phone width — but 3, 2 or 1
   of them do, so force a single non-wrapping row here instead of
   inheriting that wrap. Gap values match what was already confirmed
   correct on mobile. */
@media (max-width: 420px) {
  .countdown--hide-days .countdown__stats {
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    gap: clamp(9px, 4.5vw, 42px);
  }

  .countdown--hide-hours .countdown__stats {
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    gap: clamp(18px, 7.5vw, 48px);
  }

  .countdown--hide-minutes .countdown__stats {
    display: flex;
    justify-content: center;
  }
}

/* ---- Reveal: once the target time passes, countdown.js adds
   countdown--revealed (alongside the three hide-* classes it already
   sets). The frozen "00 Secs" card would just read as a leftover once
   there's nothing left to count down, so it's dropped in favour of the
   CTA below. */

.countdown--revealed .countdown__stats {
  display: none;
}

.countdown__cta {
  flex: 0 0 auto;
  appearance: none;
  font-family: var(--countdown-font);
  font-weight: 700;
  font-size: clamp(14px, 2vh, 19px);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #ffffff;
  background: var(--brand-red);
  border: none;
  border-radius: 999px;
  padding: 0 clamp(28px, 4vw, 44px);
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 0 26px rgba(205, 25, 45, 0.55);
  /* Collapsed to a zero footprint (not just invisible) until reveal —
     otherwise this sits there reserving its own height plus the flex
     gap in front of it for the entire time the countdown is still
     running, which is most of the page's life. margin-top cancels
     .countdown__content's gap, which would otherwise still open up in
     front of a zero-height box. */
  max-height: 0;
  margin-top: calc(-1 * clamp(10px, 1.6vh, 20px));
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 400ms ease, max-height 400ms ease, margin-top 400ms ease, padding 400ms ease;
}

.countdown--revealed .countdown__cta {
  max-height: 90px;
  margin-top: 0;
  padding: clamp(12px, 2vh, 17px) clamp(28px, 4vw, 44px);
  opacity: 1;
  pointer-events: auto;
}

.countdown__cta:hover {
  background: #e2233a;
}

@media (prefers-reduced-motion: reduce) {
  .countdown__cta {
    transition: opacity 1ms;
  }
}

