/* Cronologia: panoràmica per èpoques i lectura progressiva de cada fita. */
.timeline-intro { display: grid; grid-template-columns: minmax(0,1fr) 280px; gap: 72px; align-items: center; padding-block: 56px 64px; }
.timeline-intro h1 { font: 500 clamp(2.5rem,4.5vw,4rem)/1.08 var(--sans); letter-spacing: -.05em; margin: 0; }
.timeline-intro .eyebrow { margin-bottom: 20px; }
.timeline-lead { max-width: 62ch; margin: 24px 0; font: 1rem/1.8 var(--sans); color: var(--ink-2); }
.timeline-stats { display: flex; flex-wrap: wrap; gap: 10px 20px; margin: 0; font: .6875rem/1.6 var(--sans); color: var(--ink-2); }
.timeline-stats span + span { border-left: 1px solid var(--rule-2); padding-left: 20px; }
.timeline-intro figure img { display: block; width: 100%; height: auto; aspect-ratio: 1.5; object-fit: cover; border-radius: 8px; }
.timeline-intro figcaption { margin-top: 12px; color: var(--ink-3); font-size: .625rem; line-height: 1.6; }
.timeline-layout { display: grid; grid-template-columns: 240px minmax(0,1fr); gap: clamp(40px,5vw,72px); align-items: start; padding-bottom: 96px; }
.timeline-sidebar { position: sticky; top: calc(var(--bar) + 32px); padding-top: 12px; }
.timeline-nav-label { margin: 0 0 24px; font-size: .6875rem; color: var(--ink-2); }
.timeline-eras { display: grid; gap: 6px; }
.timeline-eras button { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 14px 12px; border: 0; border-radius: 8px; color: var(--ink-2); background: none; text-align: left; font: .8125rem/1.5 var(--sans); cursor: pointer; }
.timeline-eras button:first-child { margin-bottom: 12px; }
.timeline-eras button[aria-pressed="true"] { background: var(--paper-2); color: var(--ink); }
.timeline-eras button[aria-pressed="true"]::before { content: ''; position: absolute; left: 0; top: 17px; bottom: 17px; width: 2px; background: var(--foix); border-radius: 2px; }
.timeline-eras button:hover { background: var(--paper-2); color: var(--ink); }
.timeline-eras b { font-weight: 500; display: block; }
.timeline-eras small { display: block; margin-top: 5px; color: var(--ink-3); font-size: .625rem; }
.timeline-era-number { align-self: flex-start; padding-top: 3px; font-size: .625rem; color: var(--ink-3); }
.timeline-era-count { margin-left: auto; font-size: .625rem; font-variant-numeric: tabular-nums; }
.timeline-note { font-size: .6875rem; color: var(--ink-3); line-height: 1.8; margin: 32px 12px 0; max-width: 28ch; }
.timeline-content { min-width: 0; }
.timeline-tools { position: sticky; top: var(--bar); z-index: 8; padding: 12px 0 0; background: var(--paper); scroll-margin-top: 0; }
.timeline-search-row { display: flex; align-items: stretch; gap: 12px; }
.timeline-search { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; padding: 0 16px; min-height: 48px; border: 1px solid var(--rule); border-radius: 8px; background: var(--paper-2); }
.timeline-search svg { flex-shrink: 0; color: var(--ink-3); }
.timeline-search:focus-within { outline: 2px solid var(--foix); outline-offset: 2px; }
.timeline-search input { font: 16px/1.5 var(--sans); min-width: 0; width: 100%; padding: 12px 0; border: 0; outline: 0; background: none; color: var(--ink); }
.timeline-search input::placeholder { color: var(--ink-3); }
.timeline-source-filter { position: relative; flex: 0 0 auto; }
.timeline-source-filter > summary { display: flex; align-items: center; justify-content: center; gap: 12px; height: 48px; padding: 0 16px; border: 1px solid var(--rule); border-radius: 8px; font: .8125rem var(--sans); cursor: pointer; list-style: none; }
.timeline-source-filter > summary::-webkit-details-marker { display: none; }
.timeline-source-filter[open] > summary, .timeline-source-filter > summary:hover { background: var(--paper-2); }
.timeline-source-filter > div { position: absolute; top: calc(100% + 8px); right: 0; width: 300px; max-width: calc(100vw - 48px); padding: 20px; background: var(--paper); border: 1px solid var(--rule-2); border-radius: 12px; box-shadow: var(--ombra); z-index: 10; }
.timeline-source-filter label { display: flex; align-items: flex-start; gap: 12px; min-height: 44px; font: .875rem/1.6 var(--sans); cursor: pointer; }
.timeline-source-filter input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--foix); flex-shrink: 0; }
.timeline-source-filter p { margin: 12px 0 0; color: var(--ink-2); font-size: .75rem; line-height: 1.7; }
.timeline-filter-dot { width: 5px; height: 5px; background: var(--foix); border-radius: 50%; }
.timeline-results-bar { display: flex; align-items: center; gap: 16px; min-height: 58px; border-bottom: 1px solid var(--rule); font: .6875rem/1.6 var(--sans); }
.timeline-results-bar > p { color: var(--ink-2); margin: 0; }
.timeline-results-bar .filter-reset { font-size: .6875rem; flex-shrink: 0; }
.timeline-expand { margin-left: auto; flex-shrink: 0; padding: 10px 0 10px 12px; min-height: 44px; background: none; border: 0; color: var(--ink-2); font: .6875rem/1.5 var(--sans); cursor: pointer; }
.timeline-expand:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }
.timeline-mobile-era { display: none; }
.timeline-chapter { scroll-margin-top: var(--timeline-tools-height,118px); }
.timeline-chapter + .timeline-chapter { margin-top: 48px; }
.timeline-chapter-header { padding: 32px 0 28px; }
.timeline-chapter-range { display: flex; align-items: center; gap: 20px; margin: 0 0 16px; font: .6875rem/1.6 var(--sans); color: var(--ink-2); }
.timeline-chapter-range span { margin-left: auto; color: var(--ink-3); }
.timeline-chapter h2 { font: 500 clamp(1.75rem,2.8vw,2.5rem)/1.15 var(--sans); letter-spacing: -.04em; margin: 0; }
.timeline-chapter-header > p:last-child { font: .9375rem/1.8 var(--sans); color: var(--ink-2); margin: 16px 0 0; max-width: 65ch; }
.timeline-events { position: relative; }
.timeline-events::before { position: absolute; content: ''; width: 1px; left: 5px; top: 36px; bottom: 36px; background: var(--rule-2); }
.timeline-event { position: relative; margin-left: 28px; border-bottom: 1px solid var(--rule); scroll-margin-top: var(--timeline-tools-height,118px); }
.timeline-event::before { position: absolute; content: ''; left: -26px; top: 32px; width: 7px; height: 7px; border-radius: 50%; background: var(--paper); border: 1px solid var(--ink-3); }
.timeline-event:has(details[open])::before { background: var(--foix); border-color: var(--foix); }
.timeline-event:target { border-bottom-color: var(--foix); }
.timeline-event > details > summary { display: grid; grid-template-columns: 80px minmax(0,1fr) auto; gap: 20px; align-items: start; position: relative; padding: 24px 0; list-style: none; cursor: pointer; border-radius: 4px; }
.timeline-event > details > summary:has(.timeline-thumb) { grid-template-columns: 80px minmax(0,1fr) 88px auto; }
.timeline-event > details > summary::-webkit-details-marker { display: none; }
.timeline-event > details > summary:hover h3 { color: var(--foix); }
.timeline-event-date { padding-top: 3px; font: 500 .8125rem/1.6 var(--sans); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.timeline-event-heading { min-width: 0; }
.timeline-event-heading h3 { font: 500 1.1875rem/1.4 var(--sans); letter-spacing: -.025em; margin: 0; transition: color .15s; }
.timeline-event-preview { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font: .8125rem/1.75 var(--sans); color: var(--ink-3); margin-top: 10px; }
.timeline-document { display: block; font: .625rem/1.5 var(--sans); color: var(--foix); margin-top: 12px; }
.timeline-thumb { display: block; width: 88px; height: 68px; object-fit: cover; border-radius: 6px; background: var(--paper-2); }
.timeline-thumb.is-document { object-fit: contain; }
.timeline-event-toggle { display: grid; place-items: center; width: 24px; height: 28px; font: 300 1.5rem/1 var(--sans); color: var(--ink-2); }
.timeline-event details[open] > summary .timeline-event-toggle { transform: rotate(45deg); }
.timeline-event details[open] > summary .timeline-event-preview, .timeline-event details[open] > summary .timeline-thumb { display: none; }
.timeline-event > details[open] > summary:has(.timeline-thumb) { grid-template-columns: 80px minmax(0,1fr) auto; }
.timeline-event-body { padding: 0 0 32px 100px; max-width: 760px; }
.timeline-event > details[open] > .timeline-event-body { animation: timeline-open .24s ease both; }
@keyframes timeline-open { from { opacity: .4; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.timeline-event-text { font: 1.125rem/1.85 var(--sans); margin: 0 0 24px; }
.timeline-event-body .fitxa-foto { max-width: 520px; margin: 32px 0; }
.timeline-event-body .fitxa-foto img { border-radius: 8px; }
.timeline-event-body .fitxa-foto figcaption { font-size: .6875rem; line-height: 1.75; }
.timeline-event-source { margin-top: 28px; }
.timeline-event-source .prova { margin-top: 0; }
.timeline-event-source .prova-cap { padding-block: 12px; min-height: 60px; }
.timeline-event-source .prova-marc img { max-height: 560px; object-fit: contain; }
.timeline-permalink { display: inline-flex; gap: 16px; align-items: center; min-height: 44px; margin-top: 20px; font: .6875rem/1.5 var(--sans); color: var(--ink-2); }
.timeline-permalink:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }
.timeline-empty { padding: 56px 28px; background: var(--paper-2); margin-top: 28px; border-radius: 12px; }
.timeline-empty h2 { margin: 0; font: 500 1.5rem/1.3 var(--sans); letter-spacing: -.03em; }
.timeline-empty p { font: .9375rem/1.8 var(--sans); color: var(--ink-2); margin: 18px 0 28px; }
.timeline-pagination { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 48px; }
.timeline-pagination button { padding: 20px 0; background: none; border: 0; border-top: 1px solid var(--rule-2); color: var(--ink); text-align: left; cursor: pointer; }
.timeline-pagination button:last-child { text-align: right; }
.timeline-pagination small { display: block; font: .6875rem/1.6 var(--sans); color: var(--ink-2); margin-bottom: 12px; }
.timeline-pagination button span { font: 500 1.125rem/1.5 var(--sans); letter-spacing: -.025em; }
.timeline-pagination a { font-size: .8125rem; padding-block: 12px; }
.timeline-contribute { font: .8125rem/1.8 var(--sans); color: var(--ink-2); padding-top: 32px; margin: 40px 0 0; border-top: 1px solid var(--rule); }
.timeline-contribute a { color: var(--ink); display: inline-flex; gap: 12px; min-height: 44px; align-items: center; }
@media (max-width:1100px) {
  .timeline-layout { grid-template-columns: 210px minmax(0,1fr); gap: 36px; }
  .timeline-intro { grid-template-columns: minmax(0,1fr) 220px; gap: 48px; }
  .timeline-event > details > summary, .timeline-event > details[open] > summary:has(.timeline-thumb) { grid-template-columns: 66px minmax(0,1fr) auto; gap: 16px; }
  .timeline-event > details > summary:has(.timeline-thumb) { grid-template-columns: 66px minmax(0,1fr) auto; }
  .timeline-thumb { display: none; }
  .timeline-event-body { padding-left: 82px; }
}
@media (max-width:900px) {
  .timeline-intro { grid-template-columns: 1fr; padding-block: 40px 36px; }
  .timeline-intro figure { display: none; }
  .timeline-intro h1 { font-size: clamp(2.25rem,7vw,3rem); }
  .timeline-lead { margin-block: 20px; font-size: .9375rem; }
  .timeline-layout { grid-template-columns: minmax(0,1fr); gap: 0; padding-bottom: 64px; }
  .timeline-sidebar { display: none; }
  .timeline-mobile-era { display: flex; align-items: center; gap: 20px; margin-bottom: 10px; font: .75rem/1.5 var(--sans); color: var(--ink-2); }
  .timeline-mobile-era .filter-select { flex: 1; min-width: 0; min-height: 44px; width: 100%; font-size: .8125rem; }
  .timeline-tools { padding-top: 10px; }
  .timeline-results-bar { min-height: 48px; flex-wrap: wrap; gap: 0 12px; }
  .timeline-results-bar > p { max-width: 100%; }
  .timeline-results-bar .filter-reset { margin-left: auto; }
  .timeline-expand { padding-left: 0; }
  .timeline-search { padding-inline: 12px; gap: 8px; }
  .timeline-source-filter > summary { padding-inline: 12px; gap: 8px; }
  .timeline-chapter-header { padding-block: 28px 20px; }
  .timeline-chapter + .timeline-chapter { margin-top: 32px; }
  .timeline-event > details > summary, .timeline-event > details > summary:has(.timeline-thumb), .timeline-event > details[open] > summary:has(.timeline-thumb) { grid-template-columns: minmax(0,1fr) 24px; gap: 10px 12px; }
  .timeline-event-date { grid-column: 1; font-size: .75rem; padding-top: 0; color: var(--foix); }
  .timeline-event-heading { grid-column: 1; }
  .timeline-event-toggle { grid-column: 2; grid-row: 1 / 3; align-self: start; }
  .timeline-event-body { padding-left: 0; }
  .timeline-event-heading h3 { font-size: 1.1875rem; }
  .timeline-event-preview { margin-top: 10px; font-size: .8125rem; }
  .timeline-event-text { font-size: 1.125rem; }
  .timeline-note { display: none; }
  .timeline-event-source .prova-que { overflow-wrap: anywhere; }
  .timeline-pagination { gap: 20px; }
  .timeline-pagination button span { font-size: 1rem; }
}
@media (max-width:500px) {
  .timeline-intro .eyebrow { font-size: .625rem; margin-bottom: 18px; }
  .timeline-stats { font-size: .625rem; gap: 8px 14px; }
  .timeline-stats span + span { padding-left: 14px; }
  .timeline-stats span:last-child { flex-basis: 100%; border: 0; padding-left: 0; }
  .timeline-mobile-era > span { display: none; }
  .timeline-event { margin-left: 20px; }
  .timeline-events::before { left: 3px; }
  .timeline-event::before { left: -20px; }
  .timeline-chapter-header > p:last-child { font-size: .875rem; }
  .timeline-chapter-range { font-size: .625rem; }
  .timeline-event > details > summary { padding-block: 22px; }
  .timeline-source-filter > summary { font-size: .75rem; }
  .timeline-results-bar { font-size: .625rem; }
  .timeline-results-bar .filter-reset, .timeline-expand { font-size: .625rem; }
  .timeline-empty { padding: 32px 24px; }
}
@media (prefers-reduced-motion:reduce) { .timeline-event-heading h3 { transition: none; } .timeline-event > details[open] > .timeline-event-body { animation: none; } }
@media print {
  .timeline-layout { display: block; }
  .timeline-tools, .timeline-sidebar, .timeline-pagination { display: none; }
  .timeline-event details > .timeline-event-body { display: block !important; }
  .timeline-event details::details-content { content-visibility: visible; }
}
