/* ============================================================
   timeline.css — a road with sticky notes that appear on scroll
   and fade away as they pass the top.
   ============================================================ */

.timeline {
  position: relative;
  max-width: 1000px;
  margin: 3rem auto 0;
  padding: 2rem var(--container-pad) 4rem;
}

/* The road runs down the centre */
.road {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 46px;
  background:
    linear-gradient(#3a3f38, #2c332a);
  border-radius: 6px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04), 0 10px 30px -20px rgba(0,0,0,0.6);
}
/* dashed centre line */
.road__line {
  position: absolute;
  top: 0; bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 4px;
  background: repeating-linear-gradient(
    to bottom,
    #e8c96b 0, #e8c96b 22px,
    transparent 22px, transparent 44px
  );
  opacity: 0.9;
}

.stops {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: clamp(2.5rem, 7vh, 5.5rem);
}

/* A stop = a connector dot on the road + a sticky note to one side */
.stop {
  position: relative;
  min-height: 90px;
  display: flex;
}
.stop[data-side="left"]  { justify-content: flex-start; }
.stop[data-side="right"] { justify-content: flex-end; }

/* milestone dot on the road */
.stop__dot {
  position: absolute;
  left: 50%;
  top: 26px;
  transform: translate(-50%, 0);
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid #fff;
  box-shadow: 0 0 0 4px rgba(199,157,142,0.35), 0 2px 8px rgba(0,0,0,0.35);
  z-index: 2;
}

/* the sticky note */
.note {
  position: relative;
  width: min(360px, 42%);
  padding: 1.4rem 1.4rem 1.6rem;
  background: #fef4d6;
  color: #4a4636;
  border-radius: 3px;
  box-shadow: 0 14px 30px -14px rgba(44, 51, 42, 0.5);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}
.stop[data-side="left"]  .note { --rot: -1.6deg; margin-left: 1rem; }
.stop[data-side="right"] .note { --rot: 1.8deg; margin-right: 1rem; }
.note { transform: rotate(var(--rot)); }

/* alternating paper tints */
.stop:nth-child(3n)   .note { background: #e9f0e3; }
.stop:nth-child(3n+1) .note { background: #fde8e0; }

/* pushpin */
.note::before {
  content: "";
  position: absolute;
  top: -9px; left: 50%;
  transform: translateX(-50%);
  width: 16px; height: 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #d98a76, #b45f4c);
  box-shadow: 0 3px 6px rgba(0,0,0,0.3);
}
/* little connector line from note toward the road */
.note::after {
  content: "";
  position: absolute;
  top: 30px;
  width: clamp(10px, 4vw, 40px);
  height: 2px;
  background: rgba(44, 51, 42, 0.25);
}
.stop[data-side="left"]  .note::after { right: -1px; transform: translateX(100%); }
.stop[data-side="right"] .note::after { left: -1px; transform: translateX(-100%); }

.note__idx {
  font-family: "Caveat", cursive;
  font-size: 1.15rem;
  color: var(--primary);
  display: block;
  margin-bottom: 0.15rem;
}
.note__title {
  font-family: "Caveat", cursive;
  font-size: 1.9rem;
  line-height: 1.05;
  margin-bottom: 0.5rem;
  color: #3a3730;
}
.note__caption {
  font-family: "Caveat", cursive;
  font-size: 1.15rem;
  line-height: 1.35;
}
.note__coords {
  margin-top: 0.7rem;
  font-family: var(--font-body);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(74, 70, 54, 0.55);
}

/* JS sets --vis (0..1) from scroll position: fade in from below,
   fade out as the note passes the top of the viewport. */
.note { opacity: calc(var(--vis, 0)); }
.stop.enter .note { transform: rotate(var(--rot)) translateY(0); }
.stop:not(.enter) .note { transform: rotate(var(--rot)) translateY(28px); }

@media (max-width: 680px) {
  .road { left: 26px; }
  .road__line { }
  .stop__dot { left: 26px; }
  .stop, .stop[data-side="left"], .stop[data-side="right"] { justify-content: flex-end; }
  .note { width: calc(100% - 60px); }
  .stop[data-side="left"] .note, .stop[data-side="right"] .note { margin-left: 0; margin-right: 0; }
  .note::after { display: none; }
}
