/**
 * Club Timeline — Alternating Card Layout
 *
 * Cards alternate left / right of a centre spine.
 * Year badge sits on the spine. Cards scroll-animate in from their side.
 *
 * @package SurbitonSportsClub
 */


/* =============================================================================
   Outer wrapper
   ============================================================================= */

.ssc-timeline {
  position: relative;
  padding: 1.5rem 0 4rem;
}


/* =============================================================================
   Centre spine
   ============================================================================= */

.ssc-timeline__spine-track {
  position: absolute;
  left: calc(50% - 1px); /* centred on the 100px badge column */
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--ssc-green);
  opacity: 0.1;
  border-radius: 1px;
  pointer-events: none;
}

/* Coloured fill — height driven by JS scroll progress */
.ssc-timeline__spine-fill {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 0;
  background: linear-gradient(
    to bottom,
    var(--ssc-gold),
    var(--ssc-green-mid)
  );
  opacity: 0.55;
  border-radius: 1px;
  transition: height 0.1s linear;
}


/* =============================================================================
   Row grid: [card] [80px badge column] [card]
   ============================================================================= */

.ssc-timeline__item {
  display: grid;
  grid-template-columns: 1fr 100px 1fr;
  align-items: start;
  margin-bottom: 2.75rem;

  /* Scroll-in: items slide in from their side */
  opacity: 0;
  transition:
    opacity  0.55s ease var(--stagger, 0s),
    transform 0.55s ease var(--stagger, 0s);
}

.ssc-timeline__item--left  { transform: translateX(-28px); }
.ssc-timeline__item--right { transform: translateX( 28px); }

.ssc-timeline__item.is-visible {
  opacity: 1;
  transform: translateX(0);
}


/* =============================================================================
   Badge (year label on the spine)
   ============================================================================= */

.ssc-timeline__node {
  display: flex;
  justify-content: center;
  position: relative;
  z-index: 2;
  padding-top: 0.85rem; /* align badge centre with card top area */
}

.ssc-timeline__badge {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--ssc-gold);
  color: var(--ssc-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.02em;
  font-weight: 700;
  box-shadow:
    0 2px 10px rgba(0,0,0,0.14),
    0 0 0 4px rgba(212, 160, 23, 0.18);
  transition: transform 0.3s ease, box-shadow 0.3s ease;

  /* Hidden until item animates in */
  opacity: 0;
  transform: scale(0.5);
}

.ssc-timeline__item.is-visible .ssc-timeline__badge {
  animation: badge-pop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1)
             calc(var(--stagger, 0s) + 0.1s) both;
}

@keyframes badge-pop {
  from { opacity: 0; transform: scale(0.4); }
  to   { opacity: 1; transform: scale(1);   }
}

/* Milestone badge — larger, green */
.ssc-timeline__item--highlight .ssc-timeline__badge {
  width: 94px;
  height: 94px;
  background: var(--ssc-green);
  color: #fff;
  font-size: 1.05rem;
  box-shadow:
    0 4px 18px rgba(26,71,49,0.3),
    0 0 0 4px rgba(26,71,49,0.15);
}


/* =============================================================================
   Card wraps — padding pulls cards away from the badge
   ============================================================================= */

.ssc-timeline__card-wrap--left  { padding-right: 1.25rem; text-align: right; }
.ssc-timeline__card-wrap--right { padding-left:  1.25rem; text-align: left;  }

.ssc-timeline__spacer { /* intentionally empty opposite cell */ }


/* =============================================================================
   Card
   ============================================================================= */

.ssc-timeline__card {
  display: inline-block; /* shrink-wrap to content width on wider screens */
  width: 100%;
  background: #fff;
  border: 1px solid var(--ssc-border);
  border-radius: var(--ssc-radius-lg);
  padding: 1.2rem 1.4rem;
  box-shadow: var(--ssc-shadow-sm);
  position: relative;
  text-align: left;
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.ssc-timeline__card:hover {
  box-shadow: var(--ssc-shadow);
  transform: translateY(-2px);
}

/* Arrow pointing right (left-side card → badge) */
.ssc-timeline__card-wrap--left .ssc-timeline__card::after,
.ssc-timeline__card-wrap--left .ssc-timeline__card::before {
  content: '';
  position: absolute;
  top: 22px;
  right: -9px;
  width: 0;
  height: 0;
  border-style: solid;
  border-top:    9px solid transparent;
  border-bottom: 9px solid transparent;
}

.ssc-timeline__card-wrap--left .ssc-timeline__card::before {
  border-left: 9px solid var(--ssc-border);
  right: -10px;
}

.ssc-timeline__card-wrap--left .ssc-timeline__card::after {
  border-left: 9px solid #fff;
}

/* Arrow pointing left (right-side card → badge) */
.ssc-timeline__card-wrap--right .ssc-timeline__card::after,
.ssc-timeline__card-wrap--right .ssc-timeline__card::before {
  content: '';
  position: absolute;
  top: 22px;
  left: -9px;
  width: 0;
  height: 0;
  border-style: solid;
  border-top:    9px solid transparent;
  border-bottom: 9px solid transparent;
}

.ssc-timeline__card-wrap--right .ssc-timeline__card::before {
  border-right: 9px solid var(--ssc-border);
  left: -10px;
}

.ssc-timeline__card-wrap--right .ssc-timeline__card::after {
  border-right: 9px solid #fff;
}

/* Milestone card — top border accent */
.ssc-timeline__item--highlight .ssc-timeline__card {
  border-top: 3px solid var(--ssc-gold);
}


/* =============================================================================
   Card content
   ============================================================================= */

.ssc-timeline__card p,
.ssc-timeline__summary {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--ssc-text);
}


/* =============================================================================
   Expand / collapse
   ============================================================================= */

.ssc-timeline__details {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.4s ease;
}

.ssc-timeline__details.is-open {
  max-height: 800px;
}

.ssc-timeline__details ul {
  list-style: none;
  margin: 0.65rem 0 0;
  padding: 0;
}

.ssc-timeline__details li {
  position: relative;
  padding-left: 1rem;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--ssc-text);
}

.ssc-timeline__details li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.63em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ssc-gold);
  opacity: 0.75;
}

/* Toggle button */
.ssc-timeline__toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.6rem;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.78rem;
  font-family: var(--font-body);
  font-weight: 700;
  color: var(--ssc-green);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: color 0.2s ease;
}

.ssc-timeline__toggle:hover { color: var(--ssc-gold); }

.ssc-timeline__toggle-icon {
  display: inline-block;
  font-style: normal;
  font-size: 1.1rem;
  line-height: 1;
  font-weight: 400;
  transition: transform 0.3s ease;
}

.ssc-timeline__toggle[aria-expanded="true"] .ssc-timeline__toggle-icon {
  transform: rotate(45deg);
}

.ssc-timeline__toggle-less { display: none; }
.ssc-timeline__toggle[aria-expanded="true"] .ssc-timeline__toggle-more { display: none; }
.ssc-timeline__toggle[aria-expanded="true"] .ssc-timeline__toggle-less { display: inline; }


/* =============================================================================
   Responsive — below 700px: flex row, badge always first via order
   ============================================================================= */

@media (max-width: 700px) {

  /* Less top breathing room on mobile */
  .ssc-timeline {
    padding-top: 1rem;
  }

  /* Hide spine — too much complexity on small screens */
  .ssc-timeline__spine-track { display: none; }

  /* Flex row — badge | card, regardless of DOM order */
  .ssc-timeline__item,
  .ssc-timeline__item--left,
  .ssc-timeline__item--right {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 0.875rem;
    margin-bottom: 1.75rem;
    transform: translateY(12px); /* slide up on enter */
  }

  .ssc-timeline__item.is-visible {
    transform: translateY(0);
  }

  /* Badge column always comes first */
  .ssc-timeline__node {
    order: -1;
    flex-shrink: 0;
    position: static;
    padding-top: 0;
    width: auto;
    justify-content: flex-start;
  }

  .ssc-timeline__badge {
    width: 52px;
    height: 52px;
    font-size: 0.72rem;
  }

  .ssc-timeline__item--highlight .ssc-timeline__badge {
    width: 60px;
    height: 60px;
    font-size: 0.76rem;
  }

  /* Card always fills remaining space */
  .ssc-timeline__card-wrap--left,
  .ssc-timeline__card-wrap--right {
    order: 1;
    flex: 1;
    min-width: 0;
    padding: 0;
    text-align: left;
  }

  /* Empty spacer cells hidden */
  .ssc-timeline__spacer { display: none; }

  /* Hide speech-bubble arrows — no room on mobile */
  .ssc-timeline__card::before,
  .ssc-timeline__card::after { display: none; }
}
