/**
 * Der Herold (Roadmap #68) - Zeitstrahl der Valsera-Chronik-Zusammenfassungen.
 * Geladen auf der Startseite (Teaser in .home-showcase) und auf der eigenstaendigen
 * Archiv-Seite (/herold). Farb-Tokens/Cinzel sind global in layout.css definiert.
 */

/* ── Startseite: Kachelreihe (Features + Status) oben, Herold darunter in voller
   Breite - die Kacheln sind schmal genug, um als eine Zeile ueber dem Herold zu passen. ── */
.home-showcase {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 clamp(1.5rem, 5vw, 5rem) 3rem;
}

.home-side {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
}

.home-side .feature-card,
.home-side .status-card {
    padding: 1rem;
    gap: 0.4rem;
}

.home-side a.feature-card,
.home-side a.status-card {
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.home-side a.feature-card:hover,
.home-side a.status-card:hover {
    border-color: var(--sw-gold);
    background: rgba(201, 166, 92, 0.07);
}

.home-side .feature-card__head {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.home-side .feature-card__icon {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
}

.home-side .feature-card__title,
.home-side .status-card__title {
    font-size: 0.78rem;
    margin: 0;
}

.home-side .feature-card__text {
    font-size: 0.78rem;
    line-height: 1.5;
}

.home-side .status-card__row {
    font-size: 0.8rem;
}

/* Herold + (kuenftig) Charakter-Filter nebeneinander */
.home-herold-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(240px, 300px);
    align-items: start;
    gap: 1.75rem;
}

.home-herold-row .home-herold {
    min-width: 0;
}

@media (max-width: 1100px) {
    .home-side {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .home-herold-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .home-side {
        grid-template-columns: 1fr;
    }
}

/* ── Charakter-Filter (rechts vom Herold) ── */
.herold-filter {
    background: var(--sw-panel-dark);
    border: 1px solid var(--sw-border-gold);
    border-radius: var(--sw-radius);
    padding: 1.25rem;
    align-self: start;
    position: sticky;
    top: 1.5rem;
}

.herold-filter__title {
    font-family: 'Cinzel', Georgia, serif;
    font-size: 0.85rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--sw-gold-bright);
    margin: 0 0 0.9rem;
}

.herold-filter__search {
    position: relative;
}

.herold-filter__input {
    width: 100%;
    background: var(--sw-bg-deep);
    border: 1px solid var(--sw-border-gold);
    border-radius: var(--sw-radius-sm);
    padding: 0.55rem 0.75rem;
    color: var(--sw-text-muted);
    font-size: 0.85rem;
}

.herold-filter__input:focus {
    outline: none;
    border-color: var(--sw-gold);
}

.herold-filter__input::placeholder {
    color: var(--sw-text-muted);
    opacity: 0.55;
}

.herold-filter__results {
    display: none;
    position: absolute;
    top: calc(100% + 0.4rem);
    left: 0;
    right: 0;
    z-index: 20;
    background: #14120e;
    border: 1px solid var(--sw-border-gold);
    border-radius: var(--sw-radius-sm);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
    max-height: 260px;
    overflow-y: auto;
}

.herold-filter__results.is-open {
    display: block;
}

.herold-filter__result {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    border-bottom: 1px solid rgba(201, 166, 92, 0.15);
    padding: 0.55rem 0.75rem;
    color: var(--sw-text-muted);
    font-size: 0.85rem;
    cursor: pointer;
}

.herold-filter__result:last-child {
    border-bottom: none;
}

.herold-filter__result:hover {
    background: rgba(201, 166, 92, 0.1);
    color: var(--sw-gold-bright);
}

.herold-filter__empty {
    padding: 0.65rem 0.75rem;
    font-size: 0.8rem;
    color: var(--sw-text-muted);
    opacity: 0.7;
}

.herold-filter__active {
    margin-top: 1rem;
}

.herold-filter__active:empty {
    margin-top: 0;
}

.herold-filter__active-label {
    display: block;
    font-size: 0.72rem;
    color: var(--sw-text-muted);
    opacity: 0.65;
    margin-bottom: 0.5rem;
}

.herold-filter__chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(201, 166, 92, 0.1);
    border: 1px solid var(--sw-gold);
    border-radius: 999px;
    padding: 0.3rem 0.6rem 0.3rem 0.3rem;
    color: var(--sw-gold-bright);
    font-size: 0.8rem;
    cursor: pointer;
}

.herold-filter__chip:hover {
    background: rgba(201, 166, 92, 0.18);
}

.herold-filter__chip-avatar {
    width: 1.4rem;
    height: 1.4rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Cinzel', Georgia, serif;
    font-size: 0.6rem;
    font-weight: 700;
    color: #1b1710;
    flex-shrink: 0;
}

.herold-filter__chip-close {
    font-size: 1rem;
    line-height: 1;
    opacity: 0.75;
}

@media (max-width: 1100px) {
    .herold-filter {
        position: static;
    }
}

/* ── Kopfbereich (Startseiten-Teaser & Archiv-Seite gemeinsam) ── */
.home-herold__head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--sw-border-gold);
    padding-bottom: 1.1rem;
    margin-bottom: 1.75rem;
}

.home-herold__title {
    font-family: 'Cinzel', Georgia, serif;
    font-size: clamp(1.3rem, 2.4vw, 1.7rem);
    color: #f2e6c8;
    margin: 0;
    text-wrap: balance;
}

.home-herold__sub {
    font-size: 0.82rem;
    color: var(--sw-text-muted);
    opacity: 0.65;
    margin: 0.4rem 0 0;
}

.home-herold__sub svg {
    width: 0.85rem;
    height: 0.85rem;
    vertical-align: -0.1rem;
    margin-right: 0.3rem;
    color: var(--sw-gold);
}

.home-herold__all {
    font-size: 0.82rem;
    letter-spacing: 0.04em;
    color: var(--sw-gold);
    text-decoration: none;
    white-space: nowrap;
    padding-bottom: 0.3rem;
}

.home-herold__all:hover { text-decoration: underline; }

/* Zeitstrahl: Tage sind die Knoten, jeder Tag kann 1-n Ereignisse buendeln */
.herold-timeline {
    display: flex;
    flex-direction: column;
    gap: 2.25rem;
}

.herold-day {
    position: relative;
    padding-left: 2rem;
}

.herold-day:not(:last-child)::after {
    content: '';
    position: absolute;
    left: calc(1rem - 1px);
    top: 1.5rem;
    bottom: -2.25rem;
    width: 2px;
    background: var(--sw-border-gold);
}

.herold-day__node {
    position: absolute;
    left: 0.6rem;
    top: 0.35rem;
    width: 0.8rem;
    height: 0.8rem;
    border-radius: 50%;
    background: var(--sw-bg-deep);
    border: 2px solid var(--sw-gold);
}

.herold-day__date {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.herold-day__date-num {
    font-family: 'Cinzel', Georgia, serif;
    font-size: 1.02rem;
    letter-spacing: 0.02em;
    color: #f2e6c8;
}

.herold-day__count {
    font-size: 0.75rem;
    color: var(--sw-gold);
    opacity: 0.85;
}

.herold-day__entries {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-top: 0.85rem;
}

.herold-entry {
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
    background: var(--sw-panel-dark);
    border: 1px solid var(--sw-border-gold);
    border-radius: var(--sw-radius-sm);
    padding: 1.15rem 1.4rem;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.herold-entry:hover {
    border-color: var(--sw-gold);
    background: rgba(201, 166, 92, 0.07);
}

.herold-entry__body {
    flex: 1;
    min-width: 0;
}

.herold-entry__title {
    font-family: 'Cinzel', Georgia, serif;
    font-size: 1.02rem;
    color: var(--sw-gold-bright);
    margin: 0 0 0.4rem;
    text-wrap: balance;
}

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

.herold-entry__excerpt.is-expanded {
    -webkit-line-clamp: unset;
    overflow: visible;
}

.herold-entry__more {
    display: inline-block;
    margin-top: 0.5rem;
    background: none;
    border: none;
    padding: 0;
    color: var(--sw-gold);
    font-size: 0.78rem;
    letter-spacing: 0.03em;
    cursor: pointer;
}

.herold-entry__more:hover {
    color: var(--sw-gold-bright);
    text-decoration: underline;
}

.herold-avatars {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    padding-top: 0.1rem;
}

.herold-avatars .avatar {
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 50%;
    border: 1.5px solid #171410;
    margin-left: -0.42rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Cinzel', Georgia, serif;
    font-size: 0.6rem;
    font-weight: 700;
    color: #1b1710;
    padding: 0;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.herold-avatars .avatar:first-child { margin-left: 0; }

.herold-avatars button.avatar:hover,
.herold-avatars button.avatar:focus-visible {
    transform: translateY(-2px);
    outline: none;
    box-shadow: 0 0 0 2px var(--sw-gold);
}

.herold-avatars .avatar--more {
    background: #2c2820;
    color: var(--sw-gold);
    font-size: 0.56rem;
    cursor: default;
}

.home-herold__empty {
    color: var(--sw-text-muted);
    opacity: 0.7;
    font-size: 0.9rem;
    padding: 1.5rem 0;
}

@media (max-width: 900px) {
    .home-herold__head {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 560px) {
    .herold-entry {
        flex-direction: column;
    }

    .herold-avatars {
        padding-top: 0;
    }
}

/* ── Archiv-Seite (/herold) ── */
.herold-archive__month {
    font-size: 0.82rem;
    color: var(--sw-gold);
    opacity: 0.85;
    margin: 0 0 1.75rem;
}

.herold-load-more {
    display: flex;
    justify-content: center;
    margin-top: 2.5rem;
}

.herold-load-more.is-hidden {
    display: none;
}

/* ── Charakter-Modal (Klick auf einen Teilnehmer-Avatar) ── */
.herold-modal__body {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.herold-modal__portrait {
    flex-shrink: 0;
    width: 96px;
    height: 96px;
    border-radius: 50%;
    border: 2px solid var(--sw-gold);
    background-size: cover;
    background-position: center top;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Cinzel', Georgia, serif;
    font-size: 2.2rem;
    font-weight: 700;
    color: #1b1710;
}

.herold-modal__name {
    font-family: 'Cinzel', Georgia, serif;
    font-size: 1.25rem;
    color: var(--sw-gold-bright);
    margin: 0 0 0.4rem;
}

.herold-modal__meta {
    font-size: 0.82rem;
    color: var(--sw-text-muted);
    margin: 0 0 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0 0.6rem;
}

.herold-modal__meta span:not(:last-child)::after {
    content: '·';
    margin-left: 0.6rem;
    color: var(--sw-border-gold);
}

.herold-modal__bio {
    font-size: 0.85rem;
    line-height: 1.65;
    color: var(--sw-text-muted);
    margin: 0;
    max-height: 40vh;
    overflow-y: auto;
    white-space: pre-line;
}

.herold-modal__status {
    color: var(--sw-text-muted);
    opacity: 0.75;
    font-size: 0.88rem;
    text-align: center;
    padding: 1.5rem 0;
}

@media (max-width: 480px) {
    .herold-modal__body {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .herold-modal__meta {
        justify-content: center;
    }
}
