/* experience.css — "Experience.": a horizontal timeline (date pill above, dot on the line, text below; line draws left → right, last part yellow; "Now" = yellow pulsing dot), scrollable on tablets, vertical newest-first on phones. "Tools & skills" rows under it */

.experience .glow--5 { bottom: -260px; left: -200px; opacity: 0.15; }

.experience { padding: 120px 0; --band: linear-gradient(var(--brown), var(--charcoal)); }

.experience__title { font-size: clamp(28px, 3vw, 40px); font-weight: 700; line-height: 1.15; letter-spacing: -0.5px; color: var(--heading); }

/* ---------- Horizontal timeline: date pill above the line, dot ON the line, text below ---------- */
.timeline-wrap { margin-top: 48px; }

.timeline {
  --line-y: 46px;                     /* where the line runs = center of the dots */
  position: relative;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));   /* equal columns over the full container width */
}

/* "reveal" on the <ol> is only a trigger here: the list itself never fades, its parts animate below */
.timeline.reveal { opacity: 1; transform: none; }

/* The line: grey from the first dot to the 4th, then yellow to "Now". Draws left → right (grey first, then yellow) */
.timeline::before,
.timeline::after {
  content: '';
  position: absolute;
  top: calc(var(--line-y) - 1px);
  height: 2px;
  transform: scaleX(0);
  transform-origin: left;
}
.timeline::before { left: 10%; right: 30%; background: var(--line); transition: transform 0.75s ease-in; }
.timeline::after { left: 70%; right: 10%; background: var(--yellow); transition: transform 0.25s ease-out 0.75s; }
.timeline.is-visible::before,
.timeline.is-visible::after { transform: none; }

/* One stop. They fade in one after another, 0.15s apart (--i = 0…4 in the HTML) */
.timeline__item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 12px;
  text-align: center;
  opacity: 0;
  translate: 0 10px;
  transition: opacity 0.4s ease calc(var(--i) * 0.15s), translate 0.4s ease calc(var(--i) * 0.15s);
}
.timeline.is-visible .timeline__item { opacity: 1; translate: none; }

/* Hollow dot (it hides the line behind it) */
.timeline__dot {
  position: relative;
  z-index: 1;
  flex: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--charcoal);
  box-shadow: inset 0 0 0 2px var(--muted);
}

/* "Now": yellow dot with a soft pulse */
.timeline__item--now .timeline__dot { background: var(--yellow); box-shadow: none; }
.timeline__item--now .timeline__dot::after {
  content: '';
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 2px solid var(--yellow);
  opacity: 0;
  animation: timeline-pulse 2.4s ease-out infinite;
}
@keyframes timeline-pulse {
  0%   { transform: scale(0.6); opacity: 0.7; }
  100% { transform: scale(1.5); opacity: 0; }
}

/* Education: a small graduation-cap icon instead of the dot (negative margins keep its center on the line) */
.timeline__dot--icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin: -7px 0;
  color: var(--heading);
  box-shadow: inset 0 0 0 1px var(--line);
}
.timeline__dot--icon svg { width: 14px; height: 14px; }

/* Date pill above the line: 24px tall + 15px gap → the dot's center lands on --line-y (46px) */
.timeline__date {
  display: inline-flex;
  align-items: center;
  height: 24px;
  margin-bottom: 15px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line);
}
.timeline__date--now { font-weight: 600; color: var(--yellow); box-shadow: inset 0 0 0 1px var(--yellow-a50); }

.timeline__role { margin-top: 16px; font-size: 15px; font-weight: 600; line-height: 1.35; color: var(--heading); }
.timeline__org { margin-top: 2px; font-size: 13px; color: var(--muted); }
.timeline__text { margin-top: 6px; font-size: 13px; line-height: 1.5; color: var(--muted); }

/* ---------- Tools & skills (under the timeline) ---------- */
.tools { max-width: 760px; margin-top: 64px; padding-top: 32px; border-top: 1px solid var(--line); }
.tools__title { margin-bottom: 12px; font-size: 16px; font-weight: 600; color: var(--heading); }

.tools__row { display: grid; grid-template-columns: 120px 1fr; align-items: start; gap: 12px; padding: 8px 0; }
.tools__label { padding-top: 4px; font-size: 13px; font-weight: 600; color: var(--muted); }

.tools__pills { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.tools__pills li {
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line);
}

@media (max-width: 1000px) {
  /* Tablet: the timeline scrolls sideways and snaps to each stop */
  .timeline-wrap { overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 12px; scrollbar-width: thin; }
  .timeline { grid-template-columns: repeat(5, 210px); width: max-content; }
  .timeline__item { scroll-snap-align: start; }
}

@media (max-width: 760px) {
  .experience { padding: 88px 0; }
}

@media (max-width: 560px) {
  /* Phone: a vertical list with the line on the left, newest first (column-reverse) */
  .timeline-wrap { overflow: visible; padding-bottom: 0; }
  .timeline { display: flex; flex-direction: column-reverse; width: auto; }
  .timeline__item { align-items: flex-start; padding: 0 0 32px 34px; text-align: left; }
  .timeline__date { margin-bottom: 8px; }
  .timeline__dot { position: absolute; top: 5px; left: 0; }
  .timeline__dot--icon { top: -2px; left: -7px; margin: 0; }
  .timeline__role { margin-top: 0; }

  /* Newest first, so the fade also goes top → bottom */
  .timeline__item { transition-delay: calc((4 - var(--i)) * 0.15s); }

  /* The line = one short piece per stop, from its dot down to the next dot (the oldest stop, at the bottom, has none) */
  .timeline::before, .timeline::after { display: none; }
  .timeline__item:not(:first-child)::before { content: ''; position: absolute; top: 12px; bottom: -12px; left: 6px; width: 2px; background: var(--line); }
  .timeline__item--now::before { background: var(--yellow); }   /* the yellow part: "Now" → the job before it */

  .tools__row { grid-template-columns: 1fr; gap: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  .timeline::before, .timeline::after { transform: none; transition: none; }
  .timeline__item { opacity: 1; translate: none; transition: none; }
  .timeline__item--now .timeline__dot::after { animation: none; }
}
