/* ================================
   Root & Defaults
   ================================ */
.shtl {
  --shtl-accent: #FF9400;    /* orange accent (dots/progress) */
  --shtl-gap: 30px;
  --shtl-img-h: 190px;       /* default image height if used */
  color: inherit;
  position: relative;
}

.shtl__heading {
  text-align: center;
  margin: 0 0 22px;
  line-height: 1.2;
}

/* ================================
   Viewport / Track (no scroll)
   ================================ */
.shtl__viewport {
  position: relative;
  padding: 6px 0 0 0;         /* no arrow gutters (no scroll) */
  overflow-x: hidden;          /* prevent horizontal overflow */
  overflow-y: visible;         /* let box-shadows show */
  -webkit-overflow-scrolling: touch;
}

.shtl__track {
  display: grid;               /* desktop/tablet: JS sets repeat(5, 1fr) */
  gap: var(--shtl-gap);
  transition: transform 400ms ease;
  will-change: transform;
  padding-bottom: 30px;        /* room for shadow fade */
  overflow: visible;           /* do not clip shadows */
}

/* ================================
   Cards
   ================================ */
.shtl__card {
  min-width: 0;                /* allow shrink in grid */
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,.08);
  overflow: hidden;            /* keep rounded media corners */
  display: flex;
  flex-direction: column;
}

.shtl__media { background: #f6f7f8; }
.shtl__img {
  width: 100%;
  height: var(--shtl-img-h);
  object-fit: cover;
  display: block;
}

.shtl__body {
  padding: clamp(12px, 1.3vw, 18px) clamp(12px, 1.3vw, 18px) clamp(14px, 1.5vw, 20px);
  text-align: center;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;     /* center content vertically */
  flex: 1;
}

.shtl__title {
  margin: 0 0 8px;
  font-size: clamp(0.9rem, 1.1vw, 1.2rem);
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.shtl__title a { color: inherit; text-decoration: none; }
.shtl__title a:hover { text-decoration: underline; }

.shtl__excerpt {
  margin: 0 0 10px;
  color: #555;
  font-size: clamp(0.8rem, 0.9vw, 0.9rem);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

/* Card date – hidden on desktop/tablet, shown on mobile */
.shtl__meta {
  font-size: clamp(0.7rem, 0.8vw, 0.9rem);
  color: #888;
}
@media (min-width: 769px) {
  .shtl .shtl__meta { display: none; }
}

/* Hide media area when no featured image */
.shtl__card.no-thumb .shtl__media { display: none; }

/* ================================
   Timeline bar (rail + dots + progress)
   ================================ */
.shtl__bar { position: relative; margin-top: 0; padding: 0; }
.shtl__bar-inner { position: relative; height: 84px; }

/* Real rail (gray) and progress (orange) */
.shtl__line,
.shtl__progress {
  position: absolute;
  left: 0; right: 0;
  height: 4px;
  top: clamp(20px, 1.4vw, 26px);
  border-radius: 999px;
}
.shtl__line {
  background: rgba(0,0,0,.15);   /* consistent gray */
  z-index: 0;
  /* Animate the TRUE rail (no ::after overlay) */
  transform-origin: left center;
  transform: scaleX(0);
  transition: transform 800ms ease;
}
.shtl.is-inview:not(.vertical-timeline) .shtl__line {
  transform: scaleX(1);          /* horizontal grow on desktop */
}
.shtl__progress {
  background: var(--shtl-accent);
  width: 0%;
  transition: width 400ms ease;
  z-index: 1;                    /* keep below dots, above rail if needed */
  pointer-events: none;
}

/* Dots (desktop/tablet = grid; mobile = absolute pins) */
.shtl__dots-viewport {
  overflow-x: hidden;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
}
.shtl__dots {
  list-style: none;
  padding: 0 24px;               /* match track gutters for center alignment */
  margin: 0;
  display: grid;                 /* JS mirrors card grid columns */
  grid-template-columns: repeat(5, 1fr);
  align-items: start;
  justify-items: center;
  overflow: visible;
}
.shtl__dot {
  text-align: center;
  position: relative;
  user-select: none;
  cursor: pointer;
  min-width: 0;
}
.shtl__dot-circle {
  display: inline-grid;
  place-items: center;
  width: clamp(28px, 2.1vw, 44px);
  height: clamp(28px, 2.1vw, 44px);
  background: var(--shtl-accent);
  color: #fff;
  border-radius: 999px;
  box-shadow: 0 8px 20px rgb(255 148 0 / 35%);
  border: 3px solid #fff;
}
.shtl__dot.is-active .shtl__dot-circle { transform: translateY(-2px); }
.shtl__dot-date {
  display: block;
  margin-top: clamp(8px, 0.8vw, 14px);
  font-weight: 600;
  font-size: clamp(0.75rem, 0.9vw, 0.95rem);
}
.shtl__dot-sub { display: block; color: #666; font-size: clamp(0.7rem, 0.8vw, 0.9rem); }

/* ================================
   Mobile (vertical timeline with left rail)
   ================================ */
@media (max-width: 768px) {
  .shtl.vertical-timeline {
    display: grid;
    grid-template-columns: 56px 1fr;  /* left rail | right cards */
    column-gap: 16px;
    align-items: start;
  }

  .shtl.vertical-timeline .shtl__bar {
    grid-column: 1 / 2;
    grid-row: 1 / 2;
    position: relative;
    padding: 0;
    margin: 0;
    height: 100%;
  }
  .shtl.vertical-timeline .shtl__bar-inner {
    position: relative;
    height: 100%;
    isolation: isolate;                /* iOS stacking safety */
  }

  /* Vertical rail (animate REAL rail) */
  .shtl.vertical-timeline .shtl__line,
  .shtl.vertical-timeline .shtl__progress {
    left: 50%;
    right: auto;
    width: 4px;
    margin-left: -2px;                 /* center 4px width w/out transform */
    top: 0;
    bottom: 0;
    height: auto;
    border-radius: 999px;
    transform: none;                   /* progress never scales */
  }
  .shtl.vertical-timeline .shtl__line {
    transform-origin: top center;
    transform: scaleY(0);
    transition: transform 800ms ease;
    z-index: 0;
  }
  .shtl.is-inview.vertical-timeline .shtl__line {
    transform: scaleY(1);              /* vertical grow on mobile */
  }
  .shtl.vertical-timeline .shtl__progress { z-index: 1; }

  /* Dots container becomes positioning context; pins are absolute */
  .shtl.vertical-timeline .shtl__dots-viewport { overflow: visible; }
  .shtl.vertical-timeline .shtl__dots {
    position: relative;
    padding: 0;
    margin: 0;
    display: block;
    grid-template-columns: none;
    z-index: 2;
    overflow: visible;
  }
  .shtl.vertical-timeline .shtl__dot {
    position: absolute;                /* JS sets top/left */
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 3;                        /* pins above rail */
  }
  .shtl.vertical-timeline .shtl__dot-circle {
    position: relative;
    z-index: 3;
    -webkit-transform: translateZ(0);  /* iOS compositing */
    transform: translateZ(0);
    will-change: transform;
  }

  /* Hide dot-date under pins on mobile; show date inside card */
  .shtl.vertical-timeline .shtl__dot-date { display: none; }
  .shtl.vertical-timeline .shtl__meta { display: block; }

  /* Right column: cards stack */
  .shtl.vertical-timeline .shtl__viewport {
    grid-column: 2 / 3;
    grid-row: 1 / 2;
    overflow-x: hidden;
  }
  .shtl.vertical-timeline .shtl__track {
    display: flex;
    flex-direction: column;
    gap: 18px;
  }

  /* Tighter gutters on small screens */
  .shtl__viewport { padding: 6px 0; }
  .shtl__bar { padding: 0 8px; }
  .shtl__dot-sub { display: none; }
}

/* ================================
   Responsive minor tightening
   ================================ */
@media (max-width: 1700px) {
  .shtl { --shtl-gap: 20px; }
}

/* ================================
   Misc / Guards
   ================================ */
.shtl__track,
.shtl__dots {
  padding-left: 24px;
  padding-right: 24px;
}

.entry-content .shtl { overflow: visible !important; }

.shtl.vertical-timeline .shtl__bar,
.shtl.vertical-timeline .shtl__bar-inner,
.shtl.vertical-timeline .shtl__dots-viewport,
.shtl.vertical-timeline .shtl__dots {
  overflow: visible;                 /* do not clip pins */
}

/* ================================
   Reveal-on-scroll animations
   ================================ */
.shtl [data-animate] {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 600ms ease, transform 600ms ease;
}
.shtl.is-inview [data-animate] {
  opacity: 1;
  transform: none;
}
.shtl .shtl__dot-circle {
  transition: transform 500ms ease, opacity 500ms ease;
  transform: scale(0.8);
  opacity: 0;
}
.shtl.is-inview .shtl__dot-circle {
  transform: scale(1);
  opacity: 1;
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .shtl [data-animate],
  .shtl .shtl__dot-circle,
  .shtl .shtl__line {
    transition: none !important;
    transform: none !important;
    opacity: 1 !important;
  }
}
