/* Timeline — impegno nel tempo */

.tl-hero {
  text-align: center;
  padding-bottom: 1.5rem;
}

.tl-hero__sub {
  margin: 0.85rem auto 0;
  max-width: 42ch;
  color: var(--ink-soft);
  font-size: 1.05rem;
  line-height: 1.55;
}

/* —— Year navigator —— */
.tl-years {
  position: sticky;
  /* sotto header sticky; JS sincronizza --tl-sticky-top */
  top: var(--tl-sticky-top, 7.5rem);
  z-index: 30;
  background: rgba(246, 241, 230, 0.97);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
  padding: 1.55rem 0 1.1rem;
  box-shadow: 0 8px 18px rgba(42, 36, 28, 0.06);
}

.tl-years__track {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: center;
  gap: 0.85rem 0.55rem;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0.35rem 1.25rem 0;
}

.tl-years__line {
  display: none;
}

.tl-years__dot {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  min-width: 3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  text-decoration: none;
  color: var(--ink-soft);
  padding: 0 0.15rem;
}

@media (min-width: 900px) {
  .tl-years__track {
    flex-wrap: nowrap;
    justify-content: space-between;
    gap: 0.35rem;
    padding: 0.35rem 1.5rem 0;
    overflow-x: auto;
    scrollbar-width: thin;
  }

  .tl-years__line {
    display: block;
    position: absolute;
    left: 1.5rem;
    right: 1.5rem;
    top: 0.85rem;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--gold-soft) 8%, var(--gold-soft) 92%, transparent);
    pointer-events: none;
  }

  .tl-years__dot {
    flex: 1 0 auto;
    min-width: 3.25rem;
    scroll-snap-align: center;
  }
}

.tl-years__point {
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--gold);
  box-shadow: 0 0 0 3px var(--cream);
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.tl-years__label {
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--green);
}

.tl-years__dot:hover .tl-years__point,
.tl-years__dot.is-active .tl-years__point {
  background: var(--gold);
  border-color: var(--gold);
  transform: scale(1.2);
}

.tl-years__dot.is-active .tl-years__label {
  color: var(--green-deep);
}

.tl-years__dot:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

@media (max-width: 699px) {
  .tl-years {
    display: none;
  }
}

/* —— Timeline list —— */
.tl-section {
  padding: 2rem 0 3.5rem;
  background: var(--cream);
}

.tl-wrap {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.tl-empty {
  text-align: center;
  color: var(--ink-soft);
  padding: 2rem 0;
}

.tl-list {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
}

.tl-list::before {
  content: "";
  position: absolute;
  left: 0.55rem;
  top: 0.35rem;
  bottom: 0.35rem;
  width: 2px;
  background: linear-gradient(180deg, var(--gold-soft), rgba(201, 162, 39, 0.25));
}

@media (min-width: 700px) {
  .tl-list::before {
    left: 50%;
    margin-left: -1px;
  }
}

.tl-item {
  position: relative;
  display: grid;
  grid-template-columns: 1.3rem 1fr;
  gap: 1rem 1.15rem;
  margin-bottom: 2.75rem;
  scroll-margin-top: 11.5rem;
  opacity: 0;
  transform: translateY(16px);
  animation: tl-rise 0.7s ease forwards;
}

.tl-item:nth-child(1) { animation-delay: 0.05s; }
.tl-item:nth-child(2) { animation-delay: 0.1s; }
.tl-item:nth-child(3) { animation-delay: 0.15s; }
.tl-item:nth-child(n + 4) { animation-delay: 0.18s; }

@keyframes tl-rise {
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tl-item {
    opacity: 1;
    transform: none;
    animation: none;
  }
}

@media (min-width: 700px) {
  .tl-item {
    grid-template-columns: 1fr 1.3rem 1fr;
    gap: 0 1.5rem;
  }

  .tl-item:nth-child(odd) .tl-item__body {
    grid-column: 1;
    grid-row: 1;
    text-align: right;
  }

  .tl-item:nth-child(odd) .tl-item__rail {
    grid-column: 2;
    grid-row: 1;
  }

  .tl-item:nth-child(even) .tl-item__rail {
    grid-column: 2;
    grid-row: 1;
  }

  .tl-item:nth-child(even) .tl-item__body {
    grid-column: 3;
    grid-row: 1;
    text-align: left;
  }
}

.tl-item__rail {
  position: relative;
  display: flex;
  justify-content: center;
  padding-top: 0.35rem;
}

.tl-item__dot {
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 50%;
  background: var(--cream);
  border: 2px solid var(--gold);
  box-shadow: 0 0 0 4px rgba(246, 241, 230, 0.95);
  z-index: 1;
}

.tl-item__body {
  min-width: 0;
}

.tl-item__year {
  margin: 0 0 0.55rem;
  font-family: var(--font-display);
  font-style: italic;
  color: var(--gold);
  font-size: 1.25rem;
}

.tl-item__media {
  appearance: none;
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 1px solid var(--rule);
  background: var(--paper);
  cursor: zoom-in;
  position: relative;
  overflow: hidden;
  text-align: left;
}

.tl-item__media img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 420px;
  object-fit: cover;
  transition: transform 0.45s ease;
}

.tl-item__media:hover img,
.tl-item__media:focus-visible img {
  transform: scale(1.03);
}

.tl-item__zoom {
  position: absolute;
  right: 0.75rem;
  bottom: 0.75rem;
  padding: 0.35rem 0.65rem;
  background: rgba(18, 38, 27, 0.78);
  color: var(--gold-soft);
  font-family: var(--font-display);
  font-size: 0.85rem;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.tl-item__media:hover .tl-item__zoom,
.tl-item__media:focus-visible .tl-item__zoom {
  opacity: 1;
  transform: none;
}

.tl-item__media:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

.tl-item__caption {
  margin: 0.7rem 0 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--green-deep);
  line-height: 1.4;
}

/* —— Lightbox gallery —— */
.tl-lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(18, 38, 27, 0.9);
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.tl-lightbox[hidden] {
  display: none !important;
}

.tl-lightbox__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2.6rem;
  height: 2.6rem;
  border: 1px solid rgba(224, 201, 122, 0.45);
  background: transparent;
  color: #f3eee0;
  font-size: 1.7rem;
  line-height: 1;
  cursor: pointer;
}

.tl-lightbox__close:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.tl-lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid rgba(224, 201, 122, 0.4);
  background: rgba(18, 38, 27, 0.45);
  color: #f3eee0;
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
}

.tl-lightbox__nav--prev { left: 0.75rem; }
.tl-lightbox__nav--next { right: 0.75rem; }

.tl-lightbox__nav:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.tl-lightbox__figure {
  margin: 0;
  max-width: min(920px, 100%);
  max-height: calc(100vh - 3rem);
  display: grid;
  gap: 0.75rem;
  justify-items: center;
}

.tl-lightbox__figure img {
  max-width: 100%;
  max-height: calc(100vh - 8rem);
  width: auto;
  height: auto;
  object-fit: contain;
  background: #111;
  border: 1px solid rgba(224, 201, 122, 0.3);
}

.tl-lightbox__figure figcaption {
  text-align: center;
  color: #f3eee0;
  font-family: var(--font-display);
}

.tl-lightbox__figure strong {
  display: block;
  font-size: 1.2rem;
  font-weight: 500;
}

.tl-lightbox__figure span {
  color: var(--gold-soft);
  font-size: 0.95rem;
  font-style: italic;
}

@media (max-width: 699px) {
  .tl-lightbox__nav {
    top: auto;
    bottom: 1rem;
    transform: none;
  }
  .tl-lightbox__nav--prev { left: calc(50% - 3.5rem); }
  .tl-lightbox__nav--next { right: calc(50% - 3.5rem); }
}
