:root {
    --accent: #af2f32;
    --accent-dark: #8f2528;
    --accent-soft: rgba(175, 47, 50, 0.12);
    --bg: #ffffff;
    --bg-soft: #f7f7f7;
    --surface: #ffffff;
    --surface-hover: #fafafa;
    --line: #e4e4e4;
    --text: #444444;
    --text-heading: #333333;
    --text-muted: #676767;
    --border: rgba(0, 0, 0, 0.08);
    --shadow: 0 8px 28px rgba(0, 0, 0, 0.08);
    --shadow-search: 0 10px 30px rgba(175, 47, 50, 0.12);
    --radius: 6px;
    --radius-pill: 999px;
    --max-width: 1100px;
    --card-width: 368px;
    --font-body: "Open Sans", "Segoe UI", system-ui, sans-serif;
    --font-heading: "Lato", "Open Sans", sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: var(--font-body);
    color: var(--text);
    background: var(--bg-soft);
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

.site-header,
.site-footer,
.timeline-page,
.timeline-search-bar__inner {
    width: min(calc(100% - 2rem), var(--max-width));
    margin-inline: auto;
}

.site-header {
    padding: 2.5rem 0 1rem;
    text-align: center;
}

.site-eyebrow {
    margin: 0 0 0.5rem;
    color: var(--accent);
    font-family: var(--font-heading);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.site-title {
    margin: 0;
    font-family: var(--font-heading);
    font-size: clamp(2rem, 5vw, 2.8rem);
    font-weight: 700;
    color: var(--text-heading);
}

.site-title a:hover {
    color: var(--accent);
}

.site-subtitle {
    margin: 0.75rem 0 0;
    color: var(--text-muted);
    font-size: 1rem;
}

.timeline-search-bar-wrap {
    position: relative;
    z-index: 1000;
}

.timeline-search-bar {
    padding: 0.85rem 0 1rem;
    background: var(--bg-soft);
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, padding 0.2s ease, background-color 0.2s ease;
}

.timeline-search-bar-wrap.is-pinned .timeline-search-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    padding: 0.65rem 0 0.75rem;
    background: rgba(247, 247, 247, 0.97);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom-color: var(--line);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

.timeline-search-bar-wrap.is-pinned .timeline-search__hint {
    display: none;
}

.timeline-search {
    max-width: 720px;
    margin: 0 auto;
    text-align: left;
}

.timeline-search__label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.timeline-search__field {
    display: flex;
    align-items: stretch;
    gap: 0;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.timeline-search__field:focus-within {
    border-color: var(--accent);
    box-shadow: var(--shadow-search);
}

.timeline-search__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-left: 1.15rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.timeline-search__input {
    flex: 1;
    min-width: 0;
    border: 0;
    background: transparent;
    padding: 1rem 0.75rem;
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--text-heading);
    outline: none;
}

.timeline-search__input::placeholder {
    color: #999999;
}

.timeline-search__clear {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    border: 0;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    flex-shrink: 0;
    transition: color 0.2s ease;
}

.timeline-search__clear:hover {
    color: var(--accent);
}

.timeline-search__submit {
    border: 0;
    background: var(--accent);
    color: #ffffff;
    padding: 0 1.5rem;
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer;
    flex-shrink: 0;
    transition: background-color 0.2s ease;
}

.timeline-search__submit:hover {
    background: var(--accent-dark);
}

.timeline-search__hint {
    margin: 0.65rem 0 0;
    padding-left: 1.15rem;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.timeline-results {
    margin: 0 0 1.25rem;
    padding: 0.85rem 1rem;
    border-left: 3px solid var(--accent);
    background: var(--surface);
    color: var(--text-muted);
    font-size: 0.95rem;
    box-shadow: var(--shadow);
}

.timeline-results strong {
    color: var(--text-heading);
}

.timeline-page {
    padding-bottom: 4rem;
}

.timeline {
    position: relative;
    display: grid;
    gap: 2.5rem;
    padding: 1rem 0 2rem;
}

.timeline::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 2px;
    transform: translateX(-50%);
    background: linear-gradient(180deg, transparent, var(--line) 8%, var(--line) 92%, transparent);
}

.timeline-item {
    position: relative;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 1.25rem;
}

.timeline-item--left .timeline-card {
    grid-column: 1;
    justify-self: end;
}

.timeline-item--left .timeline-marker {
    grid-column: 2;
}

.timeline-item--right .timeline-card {
    grid-column: 3;
    justify-self: start;
}

.timeline-item--right .timeline-marker {
    grid-column: 2;
}

.timeline-marker {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
}

.timeline-dot {
    width: 0.9rem;
    height: 0.9rem;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 5px var(--accent-soft);
}

.timeline-card {
    width: min(100%, var(--card-width));
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.timeline-card:hover {
    transform: translateY(-3px);
    border-color: rgba(175, 47, 50, 0.22);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.1);
}

.timeline-image-link {
    display: block;
    overflow: hidden;
    aspect-ratio: 600 / 403;
    background: var(--bg-soft);
}

.timeline-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.35s ease;
}

.timeline-card:hover .timeline-image {
    transform: scale(1.03);
}

.timeline-content {
    padding: 0.95rem 1rem 1.05rem;
}

.timeline-title {
    margin: 0 0 0.55rem;
    font-family: var(--font-heading);
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.35;
    color: var(--text-heading);
}

.timeline-title a:hover {
    color: var(--accent);
}

.timeline-excerpt {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.76rem;
    line-height: 1.65;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
    overflow: hidden;
}

.timeline-readmore {
    display: inline-flex;
    margin-top: 0.7rem;
    color: var(--accent);
    font-family: var(--font-heading);
    font-size: 0.72rem;
    font-weight: 600;
}

.timeline-readmore::after {
    content: " →";
}

.timeline-readmore:hover {
    text-decoration: underline;
}

.timeline-status {
    text-align: center;
    color: var(--text-muted);
    min-height: 3rem;
}

.timeline-hint,
.timeline-end,
.timeline-error-message,
.timeline-empty {
    margin: 0;
}

.timeline-loader {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1.1rem;
    border-radius: var(--radius-pill);
    background: var(--surface);
    border: 1px solid var(--line);
    color: var(--text);
    box-shadow: var(--shadow);
}

.timeline-spinner {
    width: 1rem;
    height: 1rem;
    border: 2px solid #dddddd;
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.timeline-error {
    padding: 1.25rem 1.5rem;
    border-radius: var(--radius);
    background: #fff5f5;
    border: 1px solid rgba(175, 47, 50, 0.25);
    color: var(--accent-dark);
}

.site-footer {
    padding: 1.5rem 0 3rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.92rem;
}

.site-footer a {
    color: var(--accent);
}

.site-footer a:hover {
    text-decoration: underline;
}

#scroll-sentinel,
#search-stick-sentinel {
    width: 100%;
    height: 1px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 860px) {
    .timeline::before {
        left: 1.1rem;
        transform: none;
    }

    .timeline-item,
    .timeline-item--left,
    .timeline-item--right {
        grid-template-columns: auto 1fr;
        gap: 1rem;
    }

    .timeline-item--left .timeline-card,
    .timeline-item--right .timeline-card {
        grid-column: 2;
        justify-self: stretch;
        width: 100%;
    }

    .timeline-item--left .timeline-marker,
    .timeline-item--right .timeline-marker {
        grid-column: 1;
    }

    .timeline-search__submit {
        padding: 0 1.1rem;
    }
}

@media (max-width: 560px) {
    .timeline-search__field {
        border-radius: var(--radius);
        flex-wrap: wrap;
    }

    .timeline-search__icon {
        padding-left: 0.9rem;
    }

    .timeline-search__input {
        width: calc(100% - 3rem);
        padding: 0.9rem 0.5rem;
    }

    .timeline-search__clear {
        margin-right: 0.25rem;
    }

    .timeline-search__submit {
        width: 100%;
        padding: 0.85rem 1rem;
        border-top: 1px solid var(--line);
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .timeline-card,
    .timeline-image,
    .timeline-spinner,
    .timeline-search__field {
        transition: none;
        animation: none;
    }
}