/* ============================================================
   Timeline 3 strates — CSS scoped to .timeline
   Intégrée dans index.html, reprend les tokens existants
   ============================================================ */

/* Fonte manuscrite pour les mémos */
@import url("https://fonts.googleapis.com/css2?family=Caveat:wght@400;500;600&display=swap");

.timeline {
  --col: 22px;
  --gutter-w: 224px;
  --lane-h: 110px;
  --header-h: 56px;
  --tl-border: rgba(14,14,14,0.12);
  --tl-border-soft: rgba(14,14,14,0.05);
  --tl-border-lane: rgba(14,14,14,0.14);
  --tl-ink-3: rgba(14,14,14,0.42);
  --tl-hand: "Caveat", "Bradley Hand", cursive;

  grid-column: 1 / -1;
  margin-top: 16px;
  position: relative;
}

.timeline__main {
  display: grid;
  grid-template-columns: var(--gutter-w) 1fr;
  border-top: 1px solid var(--tl-border);
  border-bottom: 1px solid var(--tl-border);
}

.timeline .gutters {
  display: grid;
  grid-template-rows: var(--header-h) var(--lane-h) var(--lane-h) var(--lane-h);
  border-right: 1px solid var(--tl-border);
  background: var(--bg);
}
.timeline .gutter {
  padding: 18px 28px 18px 0;
  display: flex; flex-direction: column; justify-content: center;
  gap: 2px;
  border-top: 1px solid var(--tl-border-lane);
}
.timeline .gutter--top {
  border-top: none;
  justify-content: flex-end;
  padding-bottom: 12px;
}

.timeline .gutter__eyebrow {
  font-family: var(--sans);
  font-size: 10.5px; font-weight: 500;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--tl-ink-3);
  line-height: 1;
}
.timeline .gutter__name {
  font-family: var(--serif); font-weight: 500;
  font-size: 22px; line-height: 1.08; letter-spacing: -0.012em;
  margin-top: 4px;
  color: var(--ink);
}
.timeline .gutter__rhythm {
  font-size: 12.5px; color: var(--ink-2); line-height: 1.4;
  margin-top: 4px;
}
.timeline .gutter__icon {
  width: 22px; height: 22px;
  min-width: 22px; min-height: 22px;
  flex: none;
  aspect-ratio: 1 / 1;
  color: var(--ink);
  opacity: 0.9;
  margin-bottom: 0;
  display: block;
}

.timeline .viewport {
  position: relative;
  overflow: hidden;
  height: calc(var(--header-h) + var(--lane-h) * 3);
}
.timeline .viewport::before,
.timeline .viewport::after {
  content: "";
  position: absolute; top: 0; bottom: 0; width: 48px;
  z-index: 5; pointer-events: none;
}
.timeline .viewport::before { left: 0; background: linear-gradient(to right, var(--bg), transparent); }
.timeline .viewport::after  { right: 0; background: linear-gradient(to left,  var(--bg), transparent); }

.timeline .track {
  position: absolute; left: 0; top: 0;
  height: 100%;
  will-change: transform;
}

/* Header jours / mois */
.timeline .header {
  position: absolute; left: 0; top: 0;
  height: var(--header-h);
  display: flex;
}
.timeline .header__day {
  width: var(--col); height: 100%;
  display: flex; flex-direction: column; justify-content: flex-end;
  align-items: center;
  padding-bottom: 10px;
  font-family: var(--sans); font-size: 11px; font-weight: 400;
  color: var(--tl-ink-3);
}
.timeline .header__day[data-weekend="1"] { opacity: 0.42; }
.timeline .header__day[data-first="1"] { color: var(--ink); font-weight: 500; }
.timeline .header__month {
  position: absolute;
  bottom: 22px;
  font-family: var(--serif); font-weight: 500;
  font-size: 14px; letter-spacing: -0.005em;
  color: var(--ink);
  white-space: nowrap;
  padding-left: 10px;
}

/* Lanes */
.timeline .lane {
  position: absolute; left: 0;
  height: var(--lane-h);
  border-top: 1px solid var(--tl-border-lane);
}
.timeline .lane--1 { top: var(--header-h); }
.timeline .lane--2 { top: calc(var(--header-h) + var(--lane-h)); }
.timeline .lane--3 { top: calc(var(--header-h) + var(--lane-h) * 2); }

/* Séparateurs semaines / mois */
.timeline .week-grid {
  position: absolute; left: 0; top: 0; bottom: 0;
  background-image: linear-gradient(to right, var(--tl-border-soft) 1px, transparent 1px);
  background-size: calc(var(--col) * 7) 100%;
  pointer-events: none;
}
.timeline .month-sep {
  position: absolute; top: 0; bottom: 0; width: 1px;
  background: var(--tl-border-lane);
  pointer-events: none;
}

/* Ligne « Aujourd'hui » */
.timeline .today {
  position: absolute;
  top: 0; bottom: 0;
  left: 56px;
  width: 1px;
  background: var(--primary);
  z-index: 6;
  pointer-events: none;
}
.timeline .today__cap {
  position: absolute;
  top: -1px; left: -3px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--primary);
}

/* Événements */
.timeline .evt {
  position: absolute;
  transform: translate(-50%, 0);
  width: 16px; height: 16px;
  display: flex; align-items: center; justify-content: center;
  z-index: 3;
  cursor: default;
}
.timeline .evt__dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--primary);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.timeline .evt--milestone .evt__dot {
  width: 10px; height: 10px;
  box-shadow: 0 0 0 3px rgba(15,138,92,0.14);
}
.timeline .evt--pub .evt__dot {
  background: var(--bg);
  border: 1.5px solid var(--primary);
  width: 7px; height: 7px;
}
.timeline .evt:hover { z-index: 10; }
.timeline .evt:hover .evt__dot {
  transform: scale(1.6);
  box-shadow: 0 0 0 4px rgba(15,138,92,0.18);
}

/* Annotations manuscrites */
.timeline .note {
  position: absolute;
  font-family: var(--tl-hand);
  color: #3B2A1C;
  font-size: 22px;
  line-height: 1.05;
  letter-spacing: 0.005em;
  pointer-events: none;
  z-index: 4;
  white-space: pre-line;
  max-width: 240px;
  text-align: left;
}
.timeline .note__arrow {
  position: absolute;
  pointer-events: none;
  overflow: visible;
  z-index: 4;
  color: #3B2A1C;
}
.timeline .note__arrow path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: url(#hand-jitter);
}

/* Tooltip */
.timeline .tooltip {
  position: absolute;
  transform: translate(-50%, calc(-100% - 14px));
  background: var(--ink);
  color: #F4F4EE;
  padding: 10px 13px;
  border-radius: 3px;
  font-size: 13px; line-height: 1.35;
  white-space: nowrap;
  z-index: 50;
  pointer-events: none;
  box-shadow: 0 6px 24px rgba(14,14,14,0.16);
  opacity: 1;
}
.timeline .tooltip strong { font-weight: 500; }
.timeline .tooltip small {
  display: block; color: rgba(244,244,238,0.6);
  font-size: 11px; margin-top: 3px;
  letter-spacing: 0.04em; text-transform: uppercase;
}
.timeline .tooltip::after {
  content: ""; position: absolute;
  left: 50%; bottom: -5px;
  width: 10px; height: 10px;
  background: var(--ink);
  transform: translateX(-50%) rotate(45deg);
  z-index: -1;
}

.timeline .foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px;
  padding: 18px 0 0 0;
  font-size: 12.5px; color: var(--ink-2);
}
.timeline .foot__hint {
  font-family: var(--sans); font-size: 11px;
  color: var(--tl-ink-3); letter-spacing: 0.08em; text-transform: uppercase;
}

/* Panneau CTA en fin de parcours */
.timeline .cta-panel {
  position: absolute;
  top: 0; bottom: 0;
  display: flex; align-items: center;
  padding: 0 48px 0 56px;
  z-index: 2;
}
.timeline .cta-panel__inner { max-width: 360px; }
.timeline .cta-panel__eyebrow {
  font-family: var(--sans); font-size: 10.5px; font-weight: 500;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--tl-ink-3);
  margin-bottom: 10px;
}
.timeline .cta-panel__title {
  font-family: var(--serif); font-weight: 500;
  font-size: 22px; line-height: 1.15; letter-spacing: -0.01em;
  color: var(--ink); margin-bottom: 18px;
}
.timeline .cta-panel__lede {
  font-family: var(--sans); font-size: 13.5px; line-height: 1.5;
  color: var(--ink-2); margin: -6px 0 20px 0; max-width: 320px;
}
.timeline .cta-panel__btn {
  display: inline-block;
  background: var(--primary); color: var(--bg);
  font-family: var(--sans); font-size: 13px; font-weight: 500;
  letter-spacing: 0.02em;
  padding: 11px 18px; border-radius: 4px;
  text-decoration: none;
}

@media (prefers-reduced-motion: reduce) {
  .timeline .track { transform: translateX(0) !important; }
}
@media (max-width: 900px) {
  .timeline {
    --col: 18px;
    --gutter-w: 132px;
    --lane-h: 76px;
    --header-h: 46px;
  }
  .timeline .gutter { padding: 14px 16px 14px 0; }
  .timeline .gutter__name { font-size: 17px; }
  .timeline .gutter__rhythm { font-size: 11.5px; }
  .timeline .header__month { font-size: 13px; }
  .timeline .note { font-size: 17px; max-width: 160px; }
  .timeline .cta-panel { padding: 0 28px 0 32px; }
  .timeline .cta-panel__inner { max-width: 260px; }
  .timeline .cta-panel__title { font-size: 18px; }
  .timeline .cta-panel__lede { font-size: 12.5px; }
}

@media (max-width: 560px) {
  .timeline {
    --col: 16px;
    --gutter-w: 0px;
    --lane-h: 64px;
    --header-h: 38px;
  }
  .timeline__main { grid-template-columns: 1fr; }
  .timeline .gutters {
    grid-template-rows: none;
    grid-template-columns: repeat(3, 1fr);
    border-right: none;
    border-bottom: 1px solid var(--tl-border);
    gap: 0;
  }
  .timeline .gutter--top { display: none; }
  .timeline .gutter {
    padding: 10px 8px;
    border-top: none;
    border-right: 1px solid var(--tl-border-lane);
    text-align: center;
    align-items: center;
  }
  .timeline .gutter:last-child { border-right: none; }
  .timeline .gutter__icon { width: 18px; height: 18px; min-width: 18px; min-height: 18px; margin: 0 auto 4px; }
  .timeline .gutter__name { font-size: 13px; margin: 0; text-align: center; }
  .timeline .gutter__rhythm { display: none; }
  .timeline .viewport { height: calc(var(--header-h) + var(--lane-h) * 3); }
  .timeline .note { display: none; }
  .timeline .note__arrow { display: none; }
  .timeline .evt__dot { width: 6px; height: 6px; }
  .timeline .evt--milestone .evt__dot { width: 8px; height: 8px; }
  .timeline .header__day { font-size: 9px; padding-bottom: 6px; }
  .timeline .header__month { font-size: 11px; bottom: 16px; }
  .timeline .cta-panel { padding: 0 16px 0 20px; }
  .timeline .cta-panel__inner { max-width: 220px; }
  .timeline .cta-panel__title { font-size: 16px; margin-bottom: 12px; }
  .timeline .cta-panel__lede { font-size: 12px; }
  .timeline .cta-panel__btn { font-size: 12px; padding: 9px 14px; }
  .timeline .foot { padding: 12px 0 0 0; font-size: 11px; }
  .timeline .foot__hint { font-size: 10px; }
}
