/* ============================================================================
   timeline.css — C8 "Casova os v Biografii"
   Styly pre postupne vylepsenie rocnymi polozkami (js/timeline.js).
   Len farby a rozlozenie — ziadne prepisovanie textu, ziadny layout shift
   pre stranky, ktore timeline neziskaju (triedy sa neaplikuju).
   ==========================================================================*/

/* ---------- zakladny riadok entry ---------------------------------------- */

.tl-active .tl-entry {
  --tl-year-w: 7.5rem;
  position: relative;
  display: grid;
  grid-template-columns: var(--tl-year-w) 1fr;
  gap: 0 1.6rem;
  align-items: start;
  margin: 0 0 1.7rem;
  scroll-margin-top: calc(var(--topbar-h, 58px) + 16px);
}

/* velky rok v lavom stpci, sticky na desktope.
   grid-row: 1/-1 === rok pokryva cele entry, co mu da priestor "putovat"
   (sticky je obmedzeny na svoj grid area — bez toho by nebol kde stat). */
.tl-active .tl-year {
  grid-column: 1;
  grid-row: 1 / -1;
  justify-self: end;
  display: block;
  font-size: var(--fs-2xl);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -.02em;
  text-align: right;
  color: var(--text);
  position: sticky;
  top: calc(var(--topbar-h, 58px) + 18px);
  padding-top: 2px;
}

/* text vpravo */
.tl-active .tl-entry > :not(.tl-year) {
  grid-column: 2;
  min-width: 0;
}
.tl-active .tl-entry > p { margin-top: 0; }
.tl-active .tl-entry > p:first-of-type { margin-top: 0; }

/* tenka vertikalna linka + maly marker pri rocniku */
.tl-active .tl-entry::before {
  content: '';
  position: absolute;
  top: 0.3rem;
  bottom: 0.3rem;
  left: calc(var(--tl-year-w) + 0.75rem);
  width: 1px;
  background: var(--line);
  opacity: 0.9;
}
.tl-active .tl-entry::after {
  content: '';
  position: absolute;
  top: 0.75rem;
  left: calc(var(--tl-year-w) + 0.75rem - 3px);
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

/* Rok, ktory bol oddeleny z prveho riadku paragrafu: prvy <br> za nim
   uz nema zmysel (nic neviditelne nepreskakujeme — <br> nema text, takze
   identita textu ostava 1:1). */
.tl-active .tl-entry > p > br:first-child { display: none; }

/* ---------- decade rail -------------------------------------------------- */

.tl-rail {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1.1rem;
  align-items: baseline;
  margin: 0 0 1.4rem;
  padding: 0.5rem 0 0.55rem;
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-sm);
  letter-spacing: 0.02em;
}
.tl-rail::before {
  content: 'Roky';
  color: var(--text-dim);
  text-transform: uppercase;
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: 0.06em;
}
.tl-rail a {
  color: var(--text-dim);
  text-decoration: none;
  padding: 3px 2px;
  border-radius: 3px;
}
.tl-rail a:hover { color: var(--accent); }
.tl-rail a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* ---------- scroll reveal (len ak ho JS zapne) ---------------------------- */

html.tl-ready .tl-entry.tl-anim {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity var(--dur, 520ms) var(--ease, ease),
              transform var(--dur, 520ms) var(--ease, ease);
}
html.tl-ready .tl-entry.tl-anim.is-inview {
  opacity: 1;
  transform: none;
}
/* pokojny rezim zapnuty Az PO nacitani (calendar/toggle) — okamzite vidit */
html[data-calm='1'] .tl-entry.tl-anim {
  opacity: 1;
  transform: none;
  transition: none;
}
@media (prefers-reduced-motion: reduce) {
  html.tl-ready .tl-entry.tl-anim {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ---------- mobil: rok nad textom ---------------------------------------- */

@media (max-width: 660px) {
  .tl-active .tl-entry {
    grid-template-columns: 1fr;
    gap: 0.25rem 0;
    margin-bottom: 1.5rem;
    padding-left: 0.9rem;
    border-left: 1px solid var(--line);
  }
  .tl-active .tl-year {
    grid-column: 1;
    grid-row: auto;
    justify-self: start;
    text-align: left;
    position: static;
    font-size: var(--fs-xl);
    top: auto;
  }
  .tl-active .tl-entry > :not(.tl-year) { grid-column: 1; }
  .tl-active .tl-entry::before { display: none; }
  .tl-active .tl-entry::after {
    left: -4px;
    top: 0.85rem;
  }
}

/* ---------- tlmy (dotyk) — sticky rok vypnuty ---------------------------- */

@media (hover: none) and (min-width: 661px) {
  .tl-active .tl-year { position: static; }
}

/* ---------- print: obycajny zoznam --------------------------------------- */

@media print {
  .tl-rail { display: none; }
  .tl-active .tl-entry {
    display: block;
    border-left: 0;
    margin-bottom: 0.8em;
  }
  .tl-active .tl-year {
    position: static;
    display: inline;
    font-family: inherit;
    font-size: 1em;
    font-weight: 600;
    text-align: left;
    padding-right: 0.4em;
  }
  .tl-active .tl-entry::before,
  .tl-active .tl-entry::after { display: none; }
  html.tl-ready .tl-entry.tl-anim {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}
/* End of timeline.css */