/**
 * Anniversary timeline — must load AFTER dist/css/timeline.min.css (enqueue dep: samia-timeline).
 * Fixes: (1) Samia colors/line/dots win over the library stylesheet. (2) Library fades items with
 * .animated { opacity: 0 } until scroll — we show dots/cards immediately on the anniversary page.
 */

.page-anniversary .timeline {
    opacity: 1 !important;
    overflow: visible;
}

.page-anniversary .page-section--timeline .timeline {
    min-height: 160px;
}

.page-anniversary .timeline--horizontal .timeline__wrap {
    overflow: visible;
}

.page-anniversary .timeline__item.animated {
    opacity: 1 !important;
    animation: none !important;
}

.page-anniversary .timeline__item.fadeIn {
    opacity: 1 !important;
}

/* Vertical spine */
.timeline:not(.timeline--horizontal):before {
    background: linear-gradient(to bottom, var(--anniv-timeline-spine, var(--red)), var(--secondary));
    width: 3px;
    margin-left: -1.5px;
    z-index: 1;
}

/* Dots on the spine */
.timeline__item:after {
    background: var(--anniv-timeline-dot, var(--red));
    border: 3px solid var(--white);
    box-shadow: 0 0 0 1px var(--red-30), 0 2px 8px rgba(0, 0, 0, 0.15);
    height: 22px;
    width: 22px;
    right: -11px;
    z-index: 3;
}

.timeline__item--right:after {
    left: -11px;
}

/* Content cards */
.timeline__content {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--red-25);
    border-radius: 8px;
    color: var(--text);
    padding: 1.25rem 1.5rem;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.timeline__content:hover {
    border-color: var(--red-45);
    box-shadow: 0 4px 16px var(--red-08);
}

.timeline__content h2 {
    font-family: 'Aleo', serif;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--red);
    margin-bottom: 0.5rem;
}

.timeline__content p {
    font-size: 0.95rem;
    line-height: 1.65;
    color: var(--gray);
    margin-bottom: 0.75rem;
}

.timeline__content p:last-child {
    margin-bottom: 0;
}

/* Rich HTML bodies (repeater) use .bilingual-rich instead of raw <p> */
.timeline__content .bilingual-rich,
.timeline__content .bilingual-rich p {
    font-size: 0.95rem;
    line-height: 1.65;
    color: var(--gray);
}

.timeline__content .bilingual-rich p:last-child {
    margin-bottom: 0;
}

/* Content arrows (vertical mode) */
.timeline__item--left .timeline__content:before {
    border-left-color: var(--red-25);
}

.timeline__item--left .timeline__content:after {
    border-left-color: rgba(255, 255, 255, 0.95);
}

.timeline__item--right .timeline__content:before {
    border-right-color: var(--red-25);
}

.timeline__item--right .timeline__content:after {
    border-right-color: rgba(255, 255, 255, 0.95);
}

.timeline__content img {
    display: block;
    width: 100%;
    max-width: 220px;
    height: auto;
    margin-top: 1rem;
    margin-left: auto;
    margin-right: auto;
    border-radius: 6px;
    border: 2px solid var(--red-20);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08),
        inset 0 0 0 1px rgba(232, 221, 208, 0.6);
    object-fit: cover;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Figure + lightbox link: no extra block reserved when caption is absent */
.timeline__figure {
    margin: 1rem 0 0;
    padding: 0;
    text-align: center;
}

.timeline__figure .gallery-item {
    display: contents;
    max-width: 100%;
}

.timeline__figure .gallery-item img {
    margin-top: 0;
}

.timeline__figure .image-caption {
    margin-top: 0.45rem;
    font-size: 0.82rem;
    line-height: 1.4;
    color: var(--gray);
    text-align: center;
    font-style: italic;
    border-left: none;
    padding-left: 0;
}

.timeline__content:hover img {
    border-color: var(--red-35);
    box-shadow: 0 4px 12px var(--red-12),
        inset 0 0 0 1px rgba(232, 221, 208, 0.6);
}

/* Horizontal timeline */
.timeline--horizontal .timeline-divider {
    background: linear-gradient(to right, transparent, var(--anniv-timeline-spine, var(--red)), var(--anniv-timeline-spine, var(--secondary)), transparent);
    height: 3px;
}

.timeline--horizontal .timeline__item:after {
    background: var(--anniv-timeline-dot, var(--red));
    border: 3px solid var(--white);
    box-shadow: 0 0 0 1px var(--red-30), 0 2px 8px rgba(0, 0, 0, 0.15);
}

.timeline--horizontal .timeline__item .timeline__content:before {
    border-top-color: var(--red-25);
}

.timeline--horizontal .timeline__item .timeline__content:after {
    border-top-color: rgba(255, 255, 255, 0.95);
}

.timeline--horizontal .timeline__item--bottom .timeline__content:before {
    border-bottom-color: var(--red-25);
}

.timeline--horizontal .timeline__item--bottom .timeline__content:after {
    border-bottom-color: rgba(255, 255, 255, 0.95);
}

.timeline-nav-button {
    background: var(--white);
    border: 2px solid var(--red-40);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.timeline-nav-button:hover:not(:disabled) {
    background: var(--red);
    border-color: var(--red);
}

.timeline-nav-button:before {
    filter: brightness(0) saturate(100%);
}

.timeline-nav-button:hover:not(:disabled):before {
    filter: brightness(0) invert(1);
}

.timeline--mobile:before {
    background: linear-gradient(to bottom, var(--anniv-timeline-spine, var(--red)), var(--leather-mid));
}

.timeline--mobile .timeline__item .timeline__content:before {
    border-right-color: var(--red-25);
}

.timeline--mobile .timeline__item .timeline__content:after {
    border-right-color: rgba(255, 255, 255, 0.95);
}

/* Justified body copy on anniversary timeline cards (headings/captions stay centered). */
body.page-anniversary .timeline__content p,
body.page-anniversary-hybrid .timeline__content p,
body.page-anniversary-experimental .timeline__content p,
body.page-anniversary .timeline__content .bilingual-rich,
body.page-anniversary-hybrid .timeline__content .bilingual-rich,
body.page-anniversary-experimental .timeline__content .bilingual-rich,
body.page-anniversary .timeline__content .bilingual-rich p,
body.page-anniversary-hybrid .timeline__content .bilingual-rich p,
body.page-anniversary-experimental .timeline__content .bilingual-rich p {
    text-align: justify;
    text-justify: inter-word;
    -webkit-text-justify: inter-word;
}
