/* ==========================================================================
   Block: timeline-carousel — centred heading, then a looping centre-mode card carousel of phases on a dashed
   rail (src/blocks/timeline-carousel.html, js/blocks/timeline-carousel.js).
   Figma "Search Engine Optimisation" 4641:2 at 1920 (page y):
     eyebrow  centred, y5921 (20px)            title  centred, y5966, 80px Blauer Nue Medium, 76 tall
     intro    centred, y6061, 559 wide, 20px, 2 lines (bottom 6111)
     rail     labels y6180 (69 under the intro), 40px Blauer Nue Medium (1.01 → 40 tall), centred over their
              cards; dashed 1px white line at 36% (5 on / 5 off) through their middle (y6200), broken ≈24px
              either side of each label
     cards    y6255 (35 under the labels), 499 × 589, pitch 723 (224 gaps), the active one centred (x710)
     in card  photo 215 × 164 at +28,+31 · numeral 32px, top +34, right edge 28 in · title 48px (1.1) at
              +42,+271, 381 wide · bullets 20px (1.6 = 32px lines) from +402: 5px dots at +42, text at +58
     arrows   61 × 36 pills, 10 apart, centred, y6882 (38 under the cards)
   Card contents are sized in cqi (1% of the card's width — the slide is the size container: 499px = 100cqi),
   so a card keeps the Figma's proportions at any width.
   Section padding: 87 above (the scroll-stack before it pads 134 under its last rule; Figma gap 221),
   160 below (arrows' bottom 6918 → the case-study eyebrow 7122 minus that block's 44 top padding).
   Without JS the row is a horizontal scroll-snap list (first card green); js adds .is-ready → transform mode.
   ========================================================================== */

.block-timeline-carousel {
  --tl-card: min(25.9896vw, 499px);          /* card width */
  --tl-gap: min(11.6667vw, 224px);           /* 723 pitch at 1920 */
  --tl-label: clamp(22px, 2.0833vw, 40px);   /* rail label size */
  --tl-label-gap: min(1.25vw, 24px);         /* rail line break either side of a label */
  --tl-cream: var(--cream, #fcfcf1);
  --tl-ease: cubic-bezier(.7, 0, .2, 1);     /* slow in, slow out: the glide between phases */
  padding: min(4.5313vw, 87px) 0 min(8.3333vw, 160px);
}

/* ---- Head (centred) --------------------------------------------------------- */
.block-timeline-carousel__head { text-align: center; }
.block-timeline-carousel__eyebrow { justify-content: center; }
.block-timeline-carousel__title {
  margin-top: 20px;                          /* eyebrow box bottom 5946 → title 5966 */
  font-size: var(--fs-h1);                   /* 80 at 1920 */
}
.block-timeline-carousel__head > :first-child { margin-top: 0; }   /* no eyebrow: the title leads */
.block-timeline-carousel__intro {
  max-width: 559px;
  margin: 19px auto 0;                       /* title bottom 6042 → intro 6061 */
  font-size: var(--fs-body);
  line-height: var(--lh-body);
}

/* ---- Stage ------------------------------------------------------------------ */
.block-timeline-carousel__stage { margin-top: min(3.6146vw, 69.4px); }   /* intro's last line 6110.6 → labels 6180 */

.block-timeline-carousel__viewport {
  overflow-x: auto;                          /* no JS: a swipeable scroll-snap row */
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.block-timeline-carousel__viewport::-webkit-scrollbar { display: none; }

.block-timeline-carousel__track {
  position: relative;                        /* offsetParent for the script; anchors the rail line */
  display: flex;
  align-items: stretch;                      /* every card as tall as the tallest */
  gap: var(--tl-gap);
  width: max-content;
  padding-inline: calc((100% - var(--tl-card)) / 2);   /* no JS: the first and last cards can centre */
}
/* The rail: one dashed hairline along the whole track, behind the labels (each label's page-coloured
   background breaks it, like the Figma's Line 76 / 77). */
.block-timeline-carousel__track::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: calc(var(--tl-label) * 0.505);        /* the label row's middle (y6200) */
  height: 1px;
  background: repeating-linear-gradient(90deg, rgba(255, 255, 255, .36) 0 5px, transparent 5px 10px);
  pointer-events: none;
}

.block-timeline-carousel__slide {
  container-type: inline-size;               /* cqi below = % of the card width */
  display: flex;
  flex-direction: column;
  flex: 0 0 var(--tl-card);
  width: var(--tl-card);
  scroll-snap-align: center;
}

/* ---- Rail label ------------------------------------------------------------- */
.block-timeline-carousel__phase {
  position: relative;
  display: flex;
  justify-content: center;
  height: calc(var(--tl-label) * 1.01);
  margin-bottom: min(1.8229vw, 35px);        /* label box bottom 6220 → card 6255 */
  white-space: nowrap;
}
.block-timeline-carousel__phase-label {
  padding-inline: var(--tl-label-gap);
  background: var(--bg);
  color: var(--tl-cream);
  font-family: var(--font-display);
  font-weight: 500;                          /* Blauer Nue Medium */
  font-size: var(--tl-label);
  line-height: 1.01;
  text-transform: uppercase;
  transition: color .7s ease;
}
.block-timeline-carousel__slide.is-active .block-timeline-carousel__phase-label { color: var(--accent); }

/* ---- Card ------------------------------------------------------------------- */
.block-timeline-carousel__card {
  flex: 1 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: minmax(32.87cqi, auto) auto auto 1fr;   /* the photo row keeps its height without a photo */
  grid-template-areas:
    "media  num"
    "name   name"
    "points points"
    ".      .";
  min-height: calc(100cqi * 589 / 499);      /* the Figma's 499 × 589; longer copy makes every card taller */
  padding: 6.21cqi 5.61cqi 5.41cqi;          /* 31 · 28 · 27 (bottom under five bullets) · 28 */
  background: var(--tl-cream);
  color: var(--black);
  transition: background-color .7s ease;
}
.block-timeline-carousel__slide.is-active .block-timeline-carousel__card { background: var(--accent); }

.block-timeline-carousel__media {
  grid-area: media;
  width: 43.09cqi;                           /* 215 */
  height: auto;
  aspect-ratio: 215 / 164;
  object-fit: cover;
  -webkit-user-drag: none;
}
.block-timeline-carousel__num {
  grid-area: num;
  align-self: start;
  margin: 0.6cqi 0 0 16px;                   /* top +34 (the card pads 31) */
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(20px, 6.413cqi, 32px);
  line-height: 1.22;
}
.block-timeline-carousel__name {
  grid-area: name;
  max-width: 76.35cqi;                       /* 381 */
  min-height: 26.25cqi;                      /* +271 → the list at +402 for a 1–2 line title */
  margin: 15.23cqi 0 0 2.81cqi;              /* photo bottom +195 → +271; text at +42 */
  padding-bottom: 5.09cqi;                   /* ≥ 25 above the list (a 3-line title pushes it down) */
  font-family: var(--font-display);
  font-weight: 500;                          /* Blauer Nue Medium */
  font-size: clamp(22px, 9.619cqi, 48px);
  line-height: 1.1;
}
.block-timeline-carousel__points {
  grid-area: points;
  margin-left: 2.81cqi;                      /* dots at +42 */
  font-size: clamp(16px, 4.008cqi, 20px);
  line-height: 1.6;
}
.block-timeline-carousel__points li {
  position: relative;
  padding-left: max(3.21cqi, 14px);          /* text at +58 */
}
.block-timeline-carousel__points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.6em;                                /* the Figma's list dot: 5px, centred on the x-height */
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

/* ---- Arrows ------------------------------------------------------------------ */
.block-timeline-carousel__nav {
  display: none;                             /* shown once the script runs (.is-ready) */
  justify-content: center;
  gap: 10px;
  margin-top: 38px;                          /* card bottom 6844 → pills 6882 */
}
.block-timeline-carousel__arrow {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 61px;
  height: 36px;
  border-radius: 46px;
  box-shadow: inset 0 0 0 2px var(--fg);
  color: var(--fg);
  transition: background-color .25s ease, color .25s ease;
}
.block-timeline-carousel__arrow::before { content: ""; position: absolute; inset: -4px 0; }   /* 44px tap height */
.block-timeline-carousel__arrow svg { width: 36px; height: 15px; }
.block-timeline-carousel__arrow:hover { background: var(--fg); color: var(--bg); }

/* ---- Script mode (js/blocks/timeline-carousel.js adds .is-ready) -------------- */
.block-timeline-carousel.is-ready .block-timeline-carousel__viewport {
  overflow: hidden;
  scroll-snap-type: none;
  touch-action: pan-y;                       /* horizontal drags go to the script, vertical ones scroll the page */
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
}
.block-timeline-carousel.is-ready .block-timeline-carousel__track {
  padding-inline: 0;
  transition: transform .9s var(--tl-ease);
  will-change: transform;
}
.block-timeline-carousel.is-ready .block-timeline-carousel__nav { display: flex; }
.block-timeline-carousel.is-single .block-timeline-carousel__nav { display: none; }
.block-timeline-carousel.is-dragging .block-timeline-carousel__viewport { cursor: grabbing; }
.block-timeline-carousel.is-dragging .block-timeline-carousel__track { transition: none; }
.block-timeline-carousel.is-jumping .block-timeline-carousel__track,
.block-timeline-carousel.is-jumping .block-timeline-carousel__card,
.block-timeline-carousel.is-jumping .block-timeline-carousel__phase-label { transition: none; }

/* ---- Tablet: cards 60vw ------------------------------------------------------- */
@media (max-width: 1024px) {
  .block-timeline-carousel {
    --tl-card: 60vw;
    --tl-gap: 6vw;
    --tl-label: 32px;
    --tl-label-gap: 20px;
    padding: 72px 0 104px;
  }
  .block-timeline-carousel__stage { margin-top: 56px; }
  .block-timeline-carousel__phase { margin-bottom: 28px; }
}

/* ---- Mobile (no Figma: Mobile Category 4148:2776 language) ---------------------
   eyebrow 16px, title 46px, intro 20px; one card 84vw centred, neighbours peeking 16px each side (gap 8vw − 16),
   its 24px phase label 20 above it on the dashed rail, card contents scaled with the card (title ≈32px, list
   16px), the pills 28 under the cards (44px tap height). */
@media (max-width: 640px) {
  .block-timeline-carousel {
    --tl-card: 84vw;
    --tl-gap: max(10px, calc(8vw - 16px));
    --tl-label: 24px;
    --tl-label-gap: 14px;
    padding: 46px 0 56px;
  }
  .block-timeline-carousel__title { margin-top: 12px; font-size: 46px; line-height: 1; }
  .block-timeline-carousel__intro { margin-top: 20px; }
  .block-timeline-carousel__stage { margin-top: 40px; }
  .block-timeline-carousel__phase { margin-bottom: 20px; }
  .block-timeline-carousel__card { padding: 6.21cqi 5.61cqi 6.5cqi; }
  .block-timeline-carousel__points { line-height: 1.5; }
  .block-timeline-carousel__nav { margin-top: 28px; }
}
