/* Peru history timeline (/culture/peru-history-timeline/ and its es, pt-br versions).
   Loaded after concept2.css and uses its tokens, so dark mode follows the site theme.
   Without JavaScript: era links, the proportional ribbon, the era scales, every event, fact and person still work. */

/* Event themes. Each colour passes 4.5:1 as text on --paper and --card, in both themes. */
:root { --c-politics: #35589a; --c-conflict: #7a4a9a; --c-disaster: #b3302a; --c-culture: #8a6514; --c-society: #2f6b66; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) { --c-politics: #93acea; --c-conflict: #c9a5e6; --c-disaster: #f38c80; --c-culture: #d9b25a; --c-society: #7cc2b9; }
}
:root[data-theme=dark] { --c-politics: #93acea; --c-conflict: #c9a5e6; --c-disaster: #f38c80; --c-culture: #d9b25a; --c-society: #7cc2b9; }
[data-cat="politics"] { --c: var(--c-politics); }
[data-cat="conflict"] { --c: var(--c-conflict); }
[data-cat="disaster"] { --c: var(--c-disaster); }
[data-cat="culture"] { --c: var(--c-culture); }
[data-cat="society"] { --c: var(--c-society); }

.tl-sticky { position: sticky; top: 0; z-index: 20; background: var(--paper); border-bottom: 1px solid var(--rule); margin: 18px 0 14px; padding: 8px 0 6px; }
.tl-jump { position: relative; display: flex; gap: 8px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding: 2px 0 8px; }
.tl-jump::-webkit-scrollbar { display: none; }
.tl-jump a { flex: 0 0 auto; padding: 7px 13px; border-radius: 99px; border: 1px solid var(--rule); background: var(--card); color: var(--ink); text-decoration: none; font-family: var(--f-ui); font-size: .875rem; font-weight: 700; min-height: 36px; display: inline-flex; align-items: center; white-space: nowrap; }
.tl-jump a:hover, .tl-jump a:focus-visible { border-color: var(--accent); color: var(--accent); }
.tl-jump a[aria-current="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* The ribbon: one segment per era, width proportional to its length in years. */
.tl-ribbon { position: relative; display: flex; gap: 2px; align-items: center; height: 14px; }
.tl-seg { flex: 1 1 0; min-width: 5px; height: 6px; border-radius: 3px; background: var(--rule); cursor: pointer; }
.tl-seg.is-active { background: var(--accent); height: 8px; }
.tl-marker { position: absolute; top: 0; left: 0; width: 4px; height: 14px; margin-left: -2px; border-radius: 2px; background: var(--ink); pointer-events: none; }
.tl-scale { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin: 2px 0 0; font-family: var(--f-ui); font-size: .75rem; color: var(--ink-2); }
.tl-now { font-size: .8125rem; font-weight: 700; color: var(--ink); text-align: center; font-variant-numeric: tabular-nums; }

/* The lens: the era in view on its own scale, one tick per event. */
.tl-lens { display: flex; align-items: flex-end; gap: 8px; margin-top: 4px; font-family: var(--f-ui); font-size: .75rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.tl-lens[hidden] { display: none; }
.tl-lens-a, .tl-lens-b { flex: 0 0 auto; white-space: nowrap; }
.tl-lens-track { position: relative; flex: 1 1 auto; height: 18px; border-bottom: 2px solid var(--rule); }
.tl-lens-tick { position: absolute; bottom: 0; width: 12px; height: 18px; margin-left: -6px; cursor: pointer; }
.tl-lens-tick::after { content: ""; position: absolute; left: 4px; bottom: 0; width: 4px; height: 9px; border-radius: 2px; background: var(--c, var(--ink-2)); }
.tl-lens-tick:hover::after { background: var(--accent); }
.tl-lens-tick.is-on::after { background: var(--accent); height: 16px; }

/* Tools: search, filters, zoom */
.tl-tools { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; margin: 0 0 10px; font-family: var(--f-ui); }
.tl-tools[hidden] { display: none; }
.tl-search { display: flex; flex-direction: column; gap: 4px; margin: 0; flex: 1 1 240px; }
.tl-search label { font-size: .8125rem; font-weight: 700; color: var(--ink-2); }
.tl-search input { font: inherit; font-size: 1rem; padding: 9px 12px; min-height: 44px; border-radius: 10px; border: 1px solid var(--field-rule); background: var(--card); color: var(--ink); width: 100%; box-sizing: border-box; }
.tl-search input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.tl-show { display: flex; flex-wrap: wrap; gap: 6px; }
.tl-show button, .tl-zoom button, .tl-focusbar button, .tl-focus { font-family: var(--f-ui); font-size: .875rem; font-weight: 700; padding: 8px 13px; min-height: 40px; border-radius: 99px; border: 1px solid var(--rule); background: var(--card); color: var(--ink); cursor: pointer; }
.tl-show button:hover, .tl-show button:focus-visible, .tl-zoom button:hover, .tl-zoom button:focus-visible,
.tl-focusbar button:hover, .tl-focusbar button:focus-visible, .tl-focus:hover, .tl-focus:focus-visible { border-color: var(--teal); }
.tl-show button[aria-pressed="true"] { background: var(--teal); border-color: var(--teal); color: var(--paper); }
.tl-zoom { display: inline-flex; align-items: center; gap: 6px; }
.tl-zoom button { width: 44px; min-height: 44px; padding: 0; font-size: 1.25rem; line-height: 1; }
.tl-zoom button:disabled, .tl-focusbar button:disabled { opacity: .4; cursor: default; }
.tl-zname { font-size: .8125rem; font-weight: 700; color: var(--ink-2); margin-right: 2px; }
.tl-zlabel { min-width: 7.5em; text-align: center; font-size: .875rem; font-weight: 700; }
.tl-count { flex: 1 1 100%; margin: 0; font-size: .875rem; color: var(--ink-2); min-height: 1.2em; }
.tl-theme { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; flex: 1 1 100%; }
.tl-theme button, .tl-nav button, .tl-copy { font-family: var(--f-ui); font-size: .875rem; font-weight: 700; padding: 8px 13px; min-height: 40px; border-radius: 99px; border: 1px solid var(--rule); background: var(--card); color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.tl-theme button i { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.tl-theme .tl-n { font-weight: 400; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.tl-theme button:hover, .tl-theme button:focus-visible, .tl-nav button:hover, .tl-nav button:focus-visible, .tl-copy:hover, .tl-copy:focus-visible { border-color: var(--c, var(--teal)); }
.tl-theme button[aria-pressed="true"] { background: var(--c, var(--teal)); border-color: var(--c, var(--teal)); color: var(--paper); }
.tl-theme button[aria-pressed="true"] i { background: var(--paper); }
.tl-theme button[aria-pressed="true"] .tl-n { color: var(--paper); }
.tl-nav { display: flex; flex-wrap: wrap; gap: 6px; }
.tl-help { flex: 1 1 100%; margin: -6px 0 0; font-size: .75rem; color: var(--ink-2); }
@media (hover: none) { .tl-help { display: none; } }

/* One era zoomed in */
.tl-focusbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 16px; margin: 8px 0 2px; padding: 6px 10px; border-radius: var(--r); background: var(--answer-bg); font-family: var(--f-ui); }
.tl-focusbar[hidden] { display: none; }
.tl-focusbar p { margin: 0; }
.tl[data-focus] .tl-era:not(.is-focus) { display: none; }
.tl[data-focus] .tl-step, .tl[data-focus] .tl-focus { display: none; }

/* Eras and events */
.tl-era { scroll-margin-top: var(--tl-top, 170px); margin: 0 0 8px; }
.tl-era > h2 { margin: 40px 0 6px; }
.tl-span { display: block; margin-top: 4px; font-family: var(--f-ui); font-size: .875rem; font-weight: 700; letter-spacing: .02em; color: var(--gold-ink); }
.tl-intro { color: var(--ink-2); }
.tl-era-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 0 0 6px; font-family: var(--f-ui); font-size: .875rem; color: var(--ink-2); }
.tl-focus[hidden] { display: none; }
.tl-events { list-style: none; margin: 18px 0 0; padding: 0 0 0 24px; border-left: 2px solid var(--rule); }
.tl-ev { position: relative; margin: 0 0 24px; scroll-margin-top: calc(var(--tl-top, 170px) + 10px); }
.tl-ev::before { content: ""; position: absolute; left: -33px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--paper); border: 2px solid var(--c, var(--ink-2)); }
.tl-ev.has-story::before { background: var(--c, var(--accent)); border-color: var(--c, var(--accent)); }
.tl-ev h3 { margin: 2px 0 4px; }
.tl-ev p { margin: 0 0 6px; }
.tl-date { font-family: var(--f-ui); font-size: .875rem; font-weight: 700; letter-spacing: .01em; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.tl-tag { display: inline-block; margin-left: 6px; padding: 0 8px; border-radius: 99px; border: 1px solid var(--c); color: var(--c); font-size: .75rem; line-height: 1.5; vertical-align: 1px; }
.tl-ago { display: inline-block; margin-left: 8px; font-weight: 400; }
.tl-copy { min-height: 32px; padding: 4px 11px; font-size: .8125rem; font-weight: 400; color: var(--ink-2); margin: 2px 0 0; }
.tl-links { font-size: .9375rem; }
.tl-links span { color: var(--ink-2); }
.tl-ev:target, .tl-person:target, .is-hit { outline: 2px solid var(--gold); outline-offset: 6px; border-radius: 6px; }
.tl-ev:focus, .tl-person:focus, .tl-era:focus { outline: none; }
.tl-ev.is-hit, .tl-person.is-hit { outline: 2px solid var(--gold); }
.tl-step { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; margin: 0; padding-top: 4px; font-size: .9375rem; }
.tl-step .tl-later { margin-left: auto; }

/* Zoom in on an event: more facts */
.tl-more { margin: 4px 0 8px; }
.tl-more > summary { cursor: pointer; font-family: var(--f-ui); font-size: .875rem; font-weight: 700; color: var(--teal); padding: 6px 0; min-height: 32px; }
.tl-more > summary:hover { text-decoration: underline; }
.tl-more ul { margin: 4px 0 0; padding: 10px 14px 10px 30px; border-left: 3px solid var(--teal); background: var(--answer-bg); border-radius: 0 8px 8px 0; }
.tl-more li { margin: 0 0 6px; }
.tl-more li:last-child { margin-bottom: 0; }

/* The era on its own scale */
.tl-zoomview { margin: 10px 0 6px; padding: 0 0 4px; }
.tl-zoomview > summary { cursor: pointer; font-family: var(--f-ui); font-size: .875rem; font-weight: 700; color: var(--teal); padding: 6px 0; min-height: 32px; }
.tl-chart { position: relative; margin: 8px 0 4px; padding: 26px 4px 8px; border-radius: var(--r); background: var(--card); border: 1px solid var(--rule); overflow: hidden; }
.tl-axis { position: absolute; top: 6px; left: 4px; right: 4px; height: 16px; font-family: var(--f-ui); font-size: .6875rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.tl-axis span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
.tl-axis .tl-axis-a { left: 0; transform: none; }
.tl-axis .tl-axis-b { right: 0; left: auto; transform: none; }
.tl-dots { position: relative; list-style: none; margin: 8px 0 6px; padding: 0; height: 26px; border-top: 2px solid var(--rule); }
.tl-dots li { position: absolute; top: -15px; margin: 0; transform: translateX(-50%); }
.tl-dots a { display: block; width: 28px; height: 28px; border-radius: 50%; }  /* 28px tap target, 12px dot */
.tl-dots a::after { content: ""; position: absolute; left: 8px; top: 8px; width: 12px; height: 12px; border-radius: 50%; background: var(--c, var(--accent)); border: 2px solid var(--card); box-sizing: border-box; }
.tl-dots a:hover::after, .tl-dots a:focus-visible::after { background: var(--ink); }
.tl-bars { list-style: none; margin: 4px 0 0; padding: 0; }
.tl-bars li { margin: 0 0 4px; }
.tl-bar { position: relative; display: block; height: 20px; min-width: 6px; border-radius: 4px; background: var(--rule); background: color-mix(in srgb, var(--teal) 30%, var(--card)); text-decoration: none; color: var(--ink); }
.tl-bar:hover, .tl-bar:focus-visible { background: var(--teal); }
.tl-bar span { position: absolute; left: 100%; top: 0; margin-left: 6px; white-space: nowrap; font-family: var(--f-ui); font-size: .75rem; line-height: 20px; }
.tl-bar.lab-l span { left: auto; right: 100%; margin: 0 6px 0 0; }
.tl-bar.lab-in span { left: 8px; right: 8px; margin: 0; overflow: hidden; text-overflow: ellipsis; }
.tl-bar.cut-b.lab-in span { text-align: right; }
.tl-bar.cut-a { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.tl-bar.cut-b { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.tl-chart-note { margin: 4px 0 0; font-family: var(--f-ui); font-size: .8125rem; color: var(--ink-2); }
.sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* People */
.tl-people-wrap { margin: 8px 0 16px; }
.tl-people-h { margin: 8px 0 10px; font-size: 1.0625rem; }
.tl-people { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.tl-person { margin: 0; scroll-margin-top: calc(var(--tl-top, 170px) + 10px); border: 1px solid var(--rule); border-radius: var(--r); background: var(--card); }
.tl-person[data-pres] { border-left: 4px solid var(--gold); }
.tl-person summary { cursor: pointer; padding: 10px 12px; list-style-position: inside; }
.tl-pn { font-weight: 700; }
.tl-life, .tl-role { display: block; font-family: var(--f-ui); font-size: .8125rem; color: var(--ink-2); }
.tl-role { color: var(--gold-ink); }
.tl-person details > p { margin: 0 12px 10px; }
.tl-person details > p.tl-links { font-size: .875rem; }

/* Zoom levels (set by JavaScript; with it off, everything shows) */
.tl[data-zoom="1"] .tl-events, .tl[data-zoom="1"] .tl-people-wrap, .tl[data-zoom="1"] .tl-zoomview { display: none; }
.tl[data-zoom="1"] .tl-era > h2 { margin-top: 22px; }
.tl[data-zoom="1"] .tl-era { padding-bottom: 6px; border-bottom: 1px solid var(--rule); }
.is-out { display: none !important; }
.tl.is-filtered .tl-step { display: none; }

/* Presidents since 1980 */
.tl-pres { scroll-margin-top: var(--tl-top, 170px); margin: 40px 0 20px; }
.tl-pres-bar { display: flex; gap: 2px; height: 36px; margin: 14px 0 4px; }
.tl-pseg { flex: 1 1 0; min-width: 4px; overflow: hidden; border-radius: 4px; background: var(--teal); color: var(--paper); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.tl-pseg.alt { background: var(--gold); color: #2a1d17; }
.tl-pseg:hover { outline: 2px solid var(--ink); outline-offset: 1px; }
.tl-pseg b { font-family: var(--f-ui); font-size: .6875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 3px; }
.tl-pres-scale { position: relative; height: 1.4em; margin-right: 2.5em; font-family: var(--f-ui); font-size: .75rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.tl-pres-scale span { position: absolute; top: 0; transform: translateX(-50%); }
.tl-pres-scale span:first-child { transform: none; }
.tl-pres-scale .tl-pres-now { left: auto; right: -2.5em; transform: none; }
.tl-pres-list { columns: 2 260px; column-gap: 28px; margin: 16px 0 0; padding-left: 2.2em; }
.tl-pres-list li { break-inside: avoid; margin: 0 0 6px; }
.tl-pres-list span { display: block; font-family: var(--f-ui); font-size: .8125rem; color: var(--ink-2); }

@media (max-width: 520px) {
  .tl-people { grid-template-columns: 1fr; }
  .tl-show button, .tl-theme button, .tl-nav button { padding: 7px 10px; }
}

@media (prefers-reduced-motion: no-preference) {
  .tl-marker { transition: left .25s ease-out; }
}

@media (max-width: 520px) {
  .tl-focusbar { font-size: .8125rem; }
  .tl-focusbar button { padding: 6px 10px; min-height: 36px; font-size: .8125rem; }
}
