.timeline-page {
    --timeline-grid-step: 10%;
    --timeline-grid-offset: 0%;
    --timeline-label-width: 250px;
    position: relative;
    z-index: 1;
    max-width: 1180px;
    margin: 0 auto 72px auto;
    color: var(--shell-ink);
}

.timeline-heading,
.timeline-panel,
.timeline-frame {
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.timeline-heading {
    padding: 36px 38px;
    margin-bottom: 18px;
}

.timeline-heading::before {
    content: "Timeline";
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    margin-bottom: 16px;
    border: 0;
    border-bottom: 1px solid var(--shell-line);
    border-radius: 0;
    background: transparent;
    color: var(--shell-muted);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.timeline-heading h1 {
    max-width: 12ch;
    margin: 0 0 16px 0;
    font-size: clamp(2.5rem, 4.8vw, 4rem);
    line-height: 0.95;
    letter-spacing: -0.05em;
}

.timeline-heading p {
    max-width: 68ch;
    margin: 0;
    color: var(--shell-muted);
    font-size: 1rem;
    line-height: 1.65;
}

.timeline-panel {
    padding: 26px 30px 22px 30px;
    margin-bottom: 18px;
    border-top: 1px solid var(--shell-line);
    border-bottom: 1px solid var(--shell-line);
}

.timeline-toolbar {
    display: flex;
    gap: 18px;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
}

.timeline-search,
.timeline-filter-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.timeline-search {
    min-width: min(360px, 100%);
}

.timeline-search span,
.timeline-filter-label,
.timeline-ruler-label {
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--shell-muted);
}

.timeline-search input {
    min-height: 48px;
    padding: 0 16px;
    border: 1px solid var(--shell-line);
    border-radius: 0;
    background: var(--shell-surface);
    color: var(--shell-ink);
}

.timeline-search input::placeholder {
    color: var(--shell-subtle);
}

.timeline-filter-group {
    flex: 1;
    min-width: min(320px, 100%);
}

.timeline-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.timeline-filter {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 14px;
    border: 0;
    border-bottom: 1px solid var(--shell-line);
    border-radius: 0;
    background: transparent;
    color: var(--shell-ink);
    transition: border-color 140ms ease, background-color 140ms ease, color 140ms ease;
}

.timeline-filter:hover,
.timeline-filter:focus-visible {
    border-color: var(--shell-line-strong);
    background: transparent;
}

.timeline-filter.is-active {
    border-color: #202020;
    background: transparent;
    color: #202020;
}

.timeline-filter-count {
    font-size: 0.78rem;
    opacity: 0.72;
}

.timeline-swatch {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex: 0 0 10px;
}

.timeline-summary {
    margin: 18px 0 0 0;
    padding-top: 16px;
    border-top: 1px solid var(--shell-line);
    color: var(--shell-muted);
    font-size: 0.95rem;
    font-weight: 600;
}

.timeline-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
    color: var(--shell-muted);
    font-size: 0.9rem;
}

.timeline-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    padding: 0 12px;
    border: 0;
    border-bottom: 1px solid var(--shell-line);
    border-radius: 0;
    background: transparent;
}

.timeline-legend-mark {
    display: inline-block;
    position: relative;
    width: 34px;
    height: 12px;
    border-radius: 999px;
    background: #4c6474;
}

.timeline-legend-mark--point {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.timeline-legend-mark--open::after {
    content: "";
    position: absolute;
    top: 0;
    right: -1px;
    width: 14px;
    height: 12px;
    border-radius: 0 999px 999px 0;
    clip-path: polygon(0 0, 100% 50%, 0 100%);
    background: inherit;
}

.timeline-frame {
    overflow: hidden;
}

.timeline-ruler {
    position: sticky;
    top: 18px;
    z-index: 5;
    display: grid;
    grid-template-columns: var(--timeline-label-width) 1fr;
    gap: 24px;
    align-items: center;
    padding: 22px 30px 18px 30px;
    border-bottom: 1px solid var(--shell-line);
    background: var(--shell-bg);
}

.timeline-ruler-track,
.timeline-track {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--shell-line);
    border-radius: 0;
    background-color: #fafafa;
    background-image: linear-gradient(to right, rgba(0, 0, 0, 0.08) 1px, transparent 1px);
    background-size: var(--timeline-grid-step) 100%;
    background-position: var(--timeline-grid-offset) 0;
}

.timeline-ruler-track {
    min-height: 40px;
}

.timeline-tick {
    position: absolute;
    top: 10px;
    transform: translateX(-50%);
    white-space: nowrap;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--shell-subtle);
}

.timeline-rows {
    background: transparent;
}

.timeline-row {
    display: grid;
    grid-template-columns: var(--timeline-label-width) 1fr;
    gap: 24px;
    align-items: center;
    padding: 16px 30px;
    border-bottom: 1px solid var(--shell-line);
    text-decoration: none;
}

.timeline-row:last-child {
    border-bottom: 0;
}

.timeline-row:hover,
.timeline-row:focus-visible {
    background: rgba(0, 0, 0, 0.02);
}

.timeline-person {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.timeline-person-name {
    font-size: 1.02rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.timeline-person-dates {
    color: var(--shell-muted);
}

.timeline-person-families {
    color: var(--shell-subtle);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.timeline-track {
    min-height: 28px;
}

.timeline-bar {
    position: absolute;
    top: 5px;
    height: 18px;
    border-radius: 0;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.timeline-bar--point {
    width: 12px !important;
    border-radius: 0;
}

.timeline-bar--open::after {
    content: "";
    position: absolute;
    top: 0;
    right: -1px;
    width: 18px;
    height: 18px;
    clip-path: polygon(0 0, 100% 50%, 0 100%);
    background: inherit;
    filter: brightness(0.95);
}

.timeline-empty {
    padding: 48px 24px;
    color: var(--shell-muted);
    text-align: center;
    border-top: 1px solid var(--shell-line);
    border-bottom: 1px solid var(--shell-line);
}

@media screen and (max-width: 980px) {
    .timeline-page {
        --timeline-label-width: 210px;
    }
}

@media screen and (max-width: 900px) {
    .timeline-page {
        --timeline-label-width: 190px;
    }

    .timeline-heading,
    .timeline-panel,
    .timeline-ruler,
    .timeline-row {
        padding-left: 22px;
        padding-right: 22px;
    }
}

@media screen and (max-width: 680px) {
    .timeline-page {
        --timeline-label-width: 1fr;
    }

    .timeline-heading {
        padding: 28px 20px;
    }

    .timeline-heading h1 {
        max-width: none;
    }

    .timeline-panel {
        padding: 20px;
    }

    .timeline-ruler,
    .timeline-row {
        grid-template-columns: 1fr;
        gap: 12px;
        padding-left: 20px;
        padding-right: 20px;
    }

    .timeline-ruler {
        top: 12px;
    }

    .timeline-ruler-label {
        display: none;
    }
}
