/* Hero story tabs: three tabs with a timed progress bar, a one-line caption and a play/pause button.
   hero-tabs.js adds .ht-on and only toggles state classes; every movement here is a CSS animation or transition.
   Moves: transform, opacity, clip-path only. Hover/focus 0.25 s, caption swap 0.4 s, fill 6 s linear (--ht-dur; 4 x 6 = 24 s is deliberately not a multiple of the ~21 s video loop, so tab changes never line up with video cuts). */

/* ---- Fallback (no JS): the original three plain links ---- */
.hero-tabs { position: relative; z-index: 2; display: flex; flex-wrap: wrap; gap: 14px 36px; padding-block: 22px; border-top: 1px solid rgba(255,255,255,.22); }
.hero-tabs .ht-tab { display: block; }
.hero-tabs .ht-label { font: 500 .88rem/1 var(--font); text-decoration: none; color: rgba(255,255,255,.8); padding-bottom: 8px; border-bottom: 2px solid transparent; transition: color .25s, border-color .25s; }
.hero-tabs .ht-label:hover { color: #fff; border-color: var(--cyan); }
.hero-tabs .ht-cap, .hero-tabs .ht-play { display: none; }

/* ---- Enhanced ---- */
.hero-tabs.ht-on {
  --ht-dur: 6s;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) 36px; column-gap: 28px; align-items: start;
  padding-block: 0 26px; border-top: 0;
}
.ht-on .ht-cap, .ht-on .ht-play { display: block; }
.ht-on .ht-tab { display: flex; flex-direction: column; min-width: 0; }

/* Tab (button): bar on its top edge, label below */
.ht-on .ht-label {
  position: relative; display: block; width: 100%; margin: 0; padding: 18px 0 10px; border: 0; border-radius: 0; background: none;
  font: 500 .95rem/1.2 var(--font); text-align: left; white-space: nowrap; text-decoration: none;
  color: rgba(255,255,255,.62); cursor: pointer; transition: color .25s;
}
.ht-on .ht-label:hover, .ht-on .is-active .ht-label { color: #fff; }
/* track: faint segment on every tab; bar: the cyan fill on the active one */
.ht-on .ht-label::before, .ht-on .ht-bar { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px; }
.ht-on .ht-label::before { background: rgba(255,255,255,.22); transition: background-color .25s; }
.ht-on .ht-label:hover::before { background: rgba(255,255,255,.45); }
.ht-on .ht-bar { background: var(--cyan); transform: scaleX(0); transform-origin: 0 50%; will-change: transform; }
.ht-on .is-run .ht-bar { animation: ht-fill var(--ht-dur) linear both; animation-delay: calc(var(--ht-p, 0) * var(--ht-dur) * -1); }
.ht-on.ht-paused .is-run .ht-bar { animation-play-state: paused; }

/* Caption: masked slide-up + fade. Height is reserved so nothing shifts when stories change. */
.ht-on .ht-cap { margin: 0; width: 0; min-width: 100%; min-height: 3.2em; font-size: .85rem; line-height: 1.6; clip-path: inset(0); }   /* wraps inside its tab's column (under its time bar), two lines reserved */
@media (min-width: 641px) and (max-width: 1199px) { .hero-tabs.ht-on { padding-bottom: 14px; } .ht-on .ht-cap { min-height: 4.5em; font-size: .8rem; line-height: 1.5; } }   /* narrower columns: up to three lines */
.ht-on .ht-cap-link {
  display: block; white-space: normal; color: rgba(255,255,255,.85); text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 3px;
  opacity: 0; transform: translateY(100%); transition: color .25s, text-decoration-color .25s;
}
.ht-on .ht-cap-link:hover { color: #fff; text-decoration-color: rgba(255,255,255,.7); }
.ht-on .is-active .ht-cap-link { animation: ht-cap-in .4s cubic-bezier(.22,.61,.36,1) both; }
.ht-on .is-leaving .ht-cap-link { animation: ht-cap-out .4s cubic-bezier(.22,.61,.36,1) both; }
.ht-on.ht-instant .ht-cap-link { animation-duration: 0s !important; }

/* Play / pause */
.ht-on .ht-play {
  grid-column: 4; justify-self: end; margin-top: 8px; width: 36px; height: 36px; padding: 0; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.7); background: transparent; color: #fff; cursor: pointer;
  transition: background-color .25s, border-color .25s;
}
.ht-on .ht-play:hover { background: rgba(255,255,255,.14); border-color: #fff; }
.ht-play svg { display: block; width: 14px; height: 14px; margin: auto; fill: currentColor; }
.ht-play .i-play, .ht-paused .ht-play .i-pause { display: none; }
.ht-paused .ht-play .i-play { display: block; }

/* Focus ring */
.ht-label:focus-visible, .ht-cap-link:focus-visible, .ht-play:focus-visible { outline: 2px solid #5fd0f5; outline-offset: 3px; }
.ht-cap-link:focus-visible { outline-offset: 1px; }

@keyframes ht-fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes ht-cap-in  { from { opacity: 0; transform: translateY(100%); } to { opacity: 1; transform: none; } }
@keyframes ht-cap-out { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(-100%); } }

/* Long label on desktop, short one on phones */
.ht-short { display: none; }
@media (max-width: 640px) { .ht-long { display: none; } .ht-short { display: inline; } .ht-on .ht-tab:first-child .ht-label { white-space: nowrap; } }

/* Phones: tabs on one line, caption on its own line under them, button at its right */
@media (max-width: 640px) {
  .hero-tabs.ht-on { grid-template-columns: repeat(4, max-content); justify-content: space-between; column-gap: 10px; padding-bottom: 20px; }
  .ht-on .ht-tab { display: contents; }                       /* label and caption become grid items */
  .ht-on .ht-label { width: auto; padding: 16px 0 9px; font-size: clamp(.64rem, 3vw, .74rem); grid-row: 1; }
  .ht-on .ht-tab:nth-child(1) .ht-label { grid-column: 1; }
  .ht-on .ht-tab:nth-child(2) .ht-label { grid-column: 2; }
  .ht-on .ht-tab:nth-child(3) .ht-label { grid-column: 3; }
  .ht-on .ht-tab:nth-child(4) .ht-label { grid-column: 4; }
  .ht-on .ht-cap { grid-row: 2; grid-column: 1 / -1; padding-right: 52px; min-height: 3.2em; }   /* two lines reserved (Hungarian wraps) */
  .ht-on .ht-cap-link { white-space: normal; }
  .ht-on .ht-play { position: absolute; right: 0; bottom: 20px; margin: 0; }
}

/* Reduced motion: no rotation, no fill, first story and its caption shown; button hidden */
@media (prefers-reduced-motion: reduce) {
  .ht-on .ht-bar { animation: none !important; transform: none; }
  .ht-on .ht-cap-link { animation: none !important; opacity: 1; transform: none; }
  .ht-on .ht-tab:not(.is-active) .ht-cap-link { opacity: 0; }
  .ht-on .ht-play { display: none; }
  .ht-on .ht-bar { display: none; }
  .ht-on .is-active .ht-bar { display: block; }
}
