/*
=======================================
THE TIMELINE — the long memory of Ederia
timeline.css
=======================================

A centre rule with events alternating either side of it, and a band
across it whenever a reign begins or ends.

Shape and colour follow BRANDING.md: square, 1px gold hairlines, gold
for structure, crimson for the current thing, parchment for speech.
Eras are told apart by the filter above, not by a colour — the court
palette has no era colours, and the ones this file used to carry were
the main site's blue and purple.
*/

.timeline-page { overflow-x: hidden; }

/*
Timeline controls
*/
.timeline-controls {
    margin-bottom: 30px;
    padding: 16px 18px;
    background: var(--court-raised);
    border: 1px solid var(--court-line);
}

.timeline-controls .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px 18px;
    max-width: 100%;
    padding: 0;
}

.era-navigation {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.era-button {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--line);
    border-radius: 2px;
    color: var(--ink);
    font-family: 'Cinzel', Georgia, serif;
    font-size: 12px;
    letter-spacing: .12em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background .18s ease, border-color .18s ease, color .18s ease;
}

.era-button:hover {
    background: var(--court-hover);
    border-color: var(--court-border);
}

.era-button.active {
    background: var(--crimson-dark);
    border-color: var(--crimson-blood);
    color: var(--parchment);
    box-shadow: none;
}

.timeline-search {
    display: flex;
    position: relative;
    margin-left: auto;
}

.timeline-search input {
    width: 230px;
    height: 40px;
    padding: 10px 40px 10px 12px;
    background: var(--court-surface);
    border: 1px solid var(--court-border);
    border-radius: 2px;
    color: var(--parchment);
    font: 17px 'EB Garamond', Georgia, serif;
    transition: border-color .18s ease;
}

.timeline-search input:focus {
    border-color: var(--royal-gold);
    outline: none;
}

.timeline-search input::placeholder { color: var(--court-secondary); }

.timeline-search button {
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    width: 38px;
    background: transparent;
    border: none;
    color: var(--royal-gold);
    cursor: pointer;
}

/*
Main timeline structure
*/
.timeline-section {
    position: relative;
    padding: 0;
    overflow: visible;
}

.timeline-section .container {
    max-width: 100%;
    padding: 0;
}

.timeline {
    position: relative;
    padding: 8px 0 20px;
    margin: 0 auto;
    max-width: 100%;
}

.timeline-center-line {
    position: absolute;
    top: 10px;
    bottom: 0;
    left: 50%;
    width: 1px;
    background: var(--court-border);
    transform: translateX(-50%);
    box-shadow: none;
    z-index: 1;
}

.timeline-content {
    position: relative;
    z-index: 2;
}

/*
Timeline events
*/
.timeline-event {
    position: relative;
    margin-bottom: 40px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity .5s ease, transform .5s ease;
    width: 100%;
    clear: both;
}

.timeline-event.visible {
    opacity: 1;
    transform: translateY(0);
}

/*
The event a link asked for. Gold down both edges of the card, matching the way
a linked-to NPC is marked, and dropped again by js/timeline.js after a few
seconds.

The mark goes on .timeline-event-content rather than .timeline-event, because
the outer element is the positioning wrapper - it carries the left/right
alternation and the opacity the observer animates, and a border there would
sit around empty column space rather than around the card.
*/
.timeline-event.timeline-targeted .timeline-event-content {
    border-color: var(--royal-gold);
    box-shadow: inset 3px 0 0 var(--royal-gold), inset -3px 0 0 var(--royal-gold);
}

.timeline-event.fade-out {
    opacity: 0;
    transform: translateY(0);
    transition: opacity .2s ease;
}

.timeline-event.right {
    float: right;
    padding-left: calc(50% + 30px);
    padding-right: 0;
    text-align: left;
}

.timeline-event.left {
    float: left;
    padding-right: calc(50% + 30px);
    padding-left: 0;
    text-align: right;
}

/* Event box */
.timeline-event-content {
    position: relative;
    max-width: 100%;
    margin-bottom: 0;
    padding: 22px 24px;
    background: var(--court-raised);
    border: 1px solid var(--court-border);
    border-left: 2px solid var(--court-border);
    border-radius: 0;
    box-shadow: none;
    transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}

/* A gold diamond on the centre rule — the court's section mark. */
.timeline-event-content::after {
    content: '';
    position: absolute;
    top: 30px;
    width: 9px;
    height: 9px;
    background: var(--royal-gold);
    transform: rotate(45deg);
    box-shadow: none;
    z-index: 10;
}

/* A hairline connecting the box to that diamond. */
.timeline-event-content::before {
    content: '';
    position: absolute;
    top: 34px;
    width: 20px;
    height: 1px;
    background: var(--court-border);
    border: 0;
    z-index: 2;
}

.timeline-event.right .timeline-event-content::after  { left: -35px; }
.timeline-event.right .timeline-event-content::before { left: -21px; }
.timeline-event.left  .timeline-event-content::after  { right: -35px; }
.timeline-event.left  .timeline-event-content::before { right: -21px; }

.timeline-event-content:hover {
    border-color: var(--royal-gold);
    box-shadow: none;
    transform: translateY(-4px);
}

/* Date. Sits on its own line above the title, and mirrors with the card. */
.timeline-date {
    display: block;
    width: fit-content;
    margin-bottom: 14px;
    padding: 5px 12px;
    background: var(--court-surface);
    border: 1px solid var(--court-line);
    border-radius: 2px;
    color: var(--royal-gold);
    font-family: 'Cinzel', Georgia, serif;
    font-size: 12px;
    letter-spacing: .1em;
}

.timeline-month,
.timeline-day {
    display: inline;
    margin-right: 4px;
    color: var(--court-secondary);
}

.timeline-year {
    display: inline;
    color: var(--royal-gold);
}

/* Event title */
.timeline-title {
    font-family: 'Cinzel', Georgia, serif;
    color: var(--royal-gold-light);
    font-size: 21px;
    margin-bottom: 10px;
    letter-spacing: 0;
    position: relative;
    display: inline-block;
}

.timeline-title::after {
    content: '';
    position: absolute;
    bottom: -5px;
    width: 0;
    height: 1px;
    background: var(--royal-gold);
    transition: width .4s ease;
}

.timeline-event.right .timeline-title::after { left: 0; }
.timeline-event.left  .timeline-title::after { right: 0; }

.timeline-event.left .timeline-date { margin-left: auto; }

.timeline-event-content:hover .timeline-title::after { width: 100%; }

/* Location */
.timeline-location {
    color: var(--court-secondary);
    font-family: 'EB Garamond', Georgia, serif;
    font-style: italic;
    font-size: 16px;
    margin-bottom: 14px;
}

.timeline-event.left .timeline-location i {
    margin-right: 0;
    margin-left: 5px;
}

/* Description */
.timeline-description {
    color: var(--parchment);
    font-family: 'EB Garamond', Georgia, serif;
    font-size: 19px;
    line-height: 1.7;
    margin-bottom: 14px;
}

.timeline-description p { margin-bottom: 10px; }

/* Image */
.timeline-image {
    margin-top: 20px;
    border-radius: 0;
    overflow: hidden;
    border: 1px solid var(--court-line);
    transition: border-color .18s ease;
}

.timeline-image img {
    width: 100%;
    display: block;
}

.timeline-event-content:hover .timeline-image { border-color: var(--court-border); }

/*
Reign markers
*/
.timeline-break {
    position: relative;
    width: 100%;
    text-align: center;
    margin: 50px 0;
    opacity: 0;
    transform: translateY(16px);
    transition: opacity .5s ease, transform .5s ease;
    z-index: 10;
    clear: both;
}

.timeline-break.visible {
    opacity: 1;
    transform: translateY(0);
}

.timeline-break-content {
    display: inline-block;
    max-width: 80%;
    padding: 22px 40px;
    position: relative;
    background: var(--court-surface);
    border: 1px solid var(--court-border);
    border-radius: 0;
    box-shadow: none;
}

/* Gold when a reign begins, crimson when one ends. */
.timeline-break.reign-beginning .timeline-break-content { border-top: 2px solid var(--royal-gold); }

.timeline-break.reign-end .timeline-break-content { border-top: 2px solid var(--crimson-blood); }

.timeline-break .crown-icon {
    font-size: 24px;
    margin-bottom: 10px;
    filter: none;
}

.timeline-break.reign-beginning .crown-icon { color: var(--royal-gold); }

.timeline-break.reign-end .crown-icon { color: var(--crimson-light); }

.timeline-break h3 {
    font-family: 'Cinzel', Georgia, serif;
    font-size: 22px;
    margin-bottom: 8px;
    color: var(--royal-gold-light);
    text-shadow: none;
}

.timeline-break .timeline-date {
    margin: 10px auto 0;
    padding: 5px 14px;
    font-size: 13px;
}

.timeline-break .timeline-month,
.timeline-break .timeline-day { color: var(--court-secondary); }

.timeline-break .timeline-year { color: var(--royal-gold); }

/*
Loading indicators
*/
.loading-indicator {
    text-align: center;
    padding: 30px;
    font-family: 'EB Garamond', Georgia, serif;
    font-style: italic;
    font-size: 18px;
    color: var(--court-secondary);
    opacity: 0;
    transition: opacity .4s ease;
}

.loading-indicator.active { opacity: 1; }

.spinner-d20 {
    width: 44px;
    height: 44px;
    margin: 0 auto 14px;
    position: relative;
}

.spinner-inner {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid var(--court-line);
    border-top-color: var(--royal-gold);
    animation: spin 1.5s ease-in-out infinite;
}

.top-loader { margin-bottom: 26px; }

.bottom-loader { margin-top: 26px; }

/*
No results
*/
.no-results-message {
    text-align: center;
    padding: 40px;
    margin: 26px auto;
    max-width: 540px;
    background: var(--court-raised);
    border: 1px solid var(--court-border);
    border-radius: 0;
    clear: both;
}

.no-results-message i {
    font-size: 34px;
    color: var(--royal-gold);
    margin-bottom: 16px;
}

.no-results-message h3 {
    color: var(--royal-gold-light);
    margin-bottom: 14px;
}

.no-results-message p {
    color: var(--parchment);
    font-family: 'EB Garamond', Georgia, serif;
    font-size: 18px;
    margin-bottom: 22px;
}

.clear-search-btn {
    padding: 10px 20px;
    background: var(--crimson-dark);
    border: 1px solid var(--crimson-blood);
    border-radius: 2px;
    color: var(--parchment);
    font-family: 'Cinzel', Georgia, serif;
    font-size: 12px;
    letter-spacing: .12em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background .18s ease;
}

.clear-search-btn:hover { background: var(--crimson-blood); }

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

/*
Responsive
*/
@media (max-width: 992px) {
    .timeline-center-line { left: 20px; }

    .timeline-event.right,
    .timeline-event.left {
        float: none;
        padding-left: 52px;
        padding-right: 0;
        text-align: left;
    }

    .timeline-event.left .timeline-event-content::after,
    .timeline-event.right .timeline-event-content::after {
        left: -37px;
        right: auto;
    }

    .timeline-event.left .timeline-event-content::before,
    .timeline-event.right .timeline-event-content::before {
        left: -23px;
        right: auto;
    }

    .timeline-event.left .timeline-title::after {
        left: 0;
        right: auto;
    }

    .timeline-event.left .timeline-date { margin-left: 0; }

    .timeline-event.left .timeline-location i {
        margin-right: 5px;
        margin-left: 0;
    }

    .timeline-controls .container {
        flex-direction: column;
        align-items: stretch;
    }

    .era-navigation { justify-content: flex-start; }

    .timeline-search {
        width: 100%;
        margin-left: 0;
    }

    .timeline-search input { width: 100%; }
}

@media (max-width: 576px) {
    .timeline-event-content { padding: 18px; }

    .timeline-description { font-size: 18px; }

    .timeline-break-content {
        padding: 18px;
        max-width: 100%;
    }

    .timeline-break h3 { font-size: 19px; }
}

/* First item sits flush with the top of the list. */
.timeline-event:first-child,
.timeline-break:first-child { margin-top: 0; }
