/* ═══════════════════════════════════════════════════════════════
   Herodotus Pro - Frontend Styles
   ═══════════════════════════════════════════════════════════════ */



/* ─── Priority (Featured) Events ────────────────────────────── */

.herodotus-card.herodotus-is-priority {
    background-color: #f7f7f7;
    border: 1px solid #e2e2e2;
}

/* Text layout has no card chrome - a filled box would look like a stray
   frame, so priority is marked with a left accent bar instead. */
.herodotus-layout-text .herodotus-card.herodotus-is-priority {
    background-color: transparent;
    border: 0;
    border-bottom: 1px solid #EEF0F3;
    border-left: 3px solid #0552BA;
    padding-left: 12px;
}

.herodotus-layout-text .herodotus-card.herodotus-is-priority:last-child {
    border-bottom: 0;
}

.herodotus-layout-compact .herodotus-card__body {
    padding: 0px 12px;
}

.herodotus-layout-compact .herodotus-card__title {
    padding-top: 5px;
}
/* ─── Source credit ─────────────────────────────────────────── */

.herodotus-source {
    margin-top: 10px;
    font-size: 13px;
    line-height: 1.5;
    color: #6B7280;
}

.herodotus-source__label {
    font-weight: 600;
}

.herodotus-source__link {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.herodotus-source__link:hover,
.herodotus-source__link:focus {
    color: #0552BA;
}

/* On the single event page the line sits under the text, not inside a
   card, so it needs a rule of its own to read as a footnote. */
.herodotus-single__meta ~ .herodotus-source,
.entry-content > .herodotus-source {
    margin-top: 24px;
    padding-top: 12px;
    border-top: 1px solid #EEF0F3;
}

/* ─── Location ──────────────────────────────────────────────── */

/* Same rules as .herodotus-card__category-label and __tag-label in free -
   the place sits between those two and must not read as a third style. */
.herodotus-location {
    display: inline;
    font-size: 0.8rem;
    font-weight: 600;
}

.herodotus-location svg {
    display: inline-block;
    vertical-align: -2px;
    margin-right: 3px;
}

.herodotus-location__name {
    font-size: 0.8rem !important;
    font-weight: 600 !important;
    color: #0552BA !important;
    text-decoration: none !important;
}

.herodotus-location__name:hover {
    color: #888 !important;
    text-decoration: underline !important;
}

/* ─── Grid layout ───────────────────────────────────────────── */

/* Matches grid, grid-2, grid-3 and grid-4 alike. */
[class*="herodotus-layout-grid"] .herodotus-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}

.herodotus-layout-grid-2 .herodotus-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.herodotus-layout-grid-4 .herodotus-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

/* Every count collapses the same way as the screen narrows: four goes to two
   before it goes to one, so a card never becomes a sliver. */
@media (max-width: 1024px) {
    [class*="herodotus-layout-grid"] .herodotus-grid,
    .herodotus-layout-grid-4 .herodotus-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    [class*="herodotus-layout-grid"] .herodotus-grid,
    .herodotus-layout-grid-2 .herodotus-grid,
    .herodotus-layout-grid-4 .herodotus-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* A date heading belongs to the whole row, not to one cell. */
[class*="herodotus-layout-grid"] .herodotus-date-separator {
    grid-column: 1 / -1;
}

/* The card turns from a row into a column: image on top, text below. */
[class*="herodotus-layout-grid"] .herodotus-card {
    flex-direction: column;
}

[class*="herodotus-layout-grid"] .herodotus-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

[class*="herodotus-layout-grid"] .herodotus-card__image-link,
[class*="herodotus-layout-grid"] .herodotus-card__image-wrap {
    width: 100% !important;
    height: 170px !important;
}

/* Without this the theme's own heading size applies, and in a narrow column a
   long title takes four lines and pushes everything else out of sight. */
[class*="herodotus-layout-grid"] .herodotus-card .herodotus-card__title {
    margin: 0 0 8px !important;
    font-size: 1rem;
    line-height: 1.3;
    text-align: left !important;
}

[class*="herodotus-layout-grid"] .herodotus-card__title a {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

[class*="herodotus-layout-grid"] .herodotus-card__body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    padding: 14px;
}

/* Pushes the footer down so cards of unequal text still line up. */
[class*="herodotus-layout-grid"] .herodotus-card__footer {
    margin-top: auto;
    /* The meta stacks line by line, and the link stays on the right, level
       with the last of those lines rather than starting a new one. */
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 10px;
    padding-right: 0;
    padding-top: 10px;
    border-top: 1px solid #EEF0F3;
}

[class*="herodotus-layout-grid"] .herodotus-card__read-more {
    white-space: nowrap;
    flex-shrink: 0;
}

[class*="herodotus-layout-grid"] .herodotus-card__footer-left {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
    padding-left: 0;
    min-width: 0;
}
/* ─── Year badge in the new layouts ─────────────────────────── */

/* The free CSS only pins the badge in the list layout; anywhere else it sits
   in the flow inside the image box and is clipped out of sight. */
/* The badge sits on the picture. A card without one has nothing to sit on,
   and the badge used to land on top of the title; there it stays in the line
   of text, which is what the free stylesheet asks for. */
[class*="herodotus-layout-grid"] .herodotus-card:not(.herodotus-card--no-image) .herodotus-year-badge,
[class*="herodotus-layout-carousel"] .herodotus-card:not(.herodotus-card--no-image) .herodotus-year-badge,
.herodotus-layout-timeline .herodotus-card:not(.herodotus-card--no-image) .herodotus-year-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 1;
    margin: 0;
}

/* ─── Carousel layout ───────────────────────────────────────── */

[class*="herodotus-layout-carousel"] .herodotus-grid {
    display: flex;
    flex-direction: row;
    gap: 20px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: 10px;
    /* The arrows and a swipe still move the strip; only the bar is gone. */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

[class*="herodotus-layout-carousel"] .herodotus-grid::-webkit-scrollbar {
    display: none;
}

/* A fixed width is what makes the strip scrollable at all - with flexible
   widths the cards would simply squeeze to fit and nothing would move. The
   count in the layout name decides how many are on screen, gaps included. */
[class*="herodotus-layout-carousel"] .herodotus-carousel-cell {
    flex: 0 0 calc((100% - 64px) / 4);
    /*
     * Without this a cell refuses to go narrower than the card inside it, so
     * three and four across came out at the card's own width and the last one
     * was cut off by the edge of the strip.
     */
    min-width: 0;
}

[class*="herodotus-layout-carousel"] .herodotus-card {
    flex-direction: column;
    scroll-snap-align: start;
}

.herodotus-layout-carousel-1 .herodotus-carousel-cell {
    flex-basis: calc(100% - 2px);
}

.herodotus-layout-carousel-2 .herodotus-carousel-cell {
    flex-basis: calc((100% - 22px) / 2);
}

.herodotus-layout-carousel-3 .herodotus-carousel-cell {
    flex-basis: calc((100% - 43px) / 3);
}

@media (max-width: 1024px) {
    [class*="herodotus-layout-carousel"] .herodotus-carousel-cell {
        flex-basis: calc((100% - 22px) / 2);
    }
}

@media (max-width: 640px) {
    [class*="herodotus-layout-carousel"] .herodotus-carousel-cell {
        flex-basis: 85%;
    }
}

[class*="herodotus-layout-carousel"] .herodotus-card__image-link,
[class*="herodotus-layout-carousel"] .herodotus-card__image-wrap {
    width: 100% !important;
    height: 150px !important;
}

[class*="herodotus-layout-carousel"] .herodotus-card__body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    padding: 14px;
}

[class*="herodotus-layout-carousel"] .herodotus-card .herodotus-card__title {
    margin: 0 0 8px !important;
    font-size: 1rem;
    line-height: 1.3;
    text-align: left !important;
}

[class*="herodotus-layout-carousel"] .herodotus-card__title a {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

[class*="herodotus-layout-carousel"] .herodotus-card__footer {
    margin-top: auto;
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 10px;
    padding-right: 0;
    padding-top: 10px;
    border-top: 1px solid #EEF0F3;
}

[class*="herodotus-layout-carousel"] .herodotus-card__footer-left {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
    padding-left: 0;
    min-width: 0;
}

[class*="herodotus-layout-carousel"] .herodotus-card__read-more {
    white-space: nowrap;
    flex-shrink: 0;
}

/* ─── Carousel cells and their date headings ────────────────── */

/* The width now lives on the cell, and the card fills it. */
[class*="herodotus-layout-carousel"] .herodotus-carousel-cell {
    display: flex;
    flex-direction: column;
    scroll-snap-align: start;
}

[class*="herodotus-layout-carousel"] .herodotus-carousel-cell .herodotus-card {
    flex: 1 1 auto;
    width: 100%;
}

[class*="herodotus-layout-carousel"] .herodotus-carousel-date {
    /*
     * Kept even when empty, so cards of neighbouring dates stay level. The
     * line height is fixed as well: left to the theme, a line of text came
     * out taller than the empty box and those cards sank a few pixels.
     */
    min-height: 22px;
    line-height: 22px;
    margin-bottom: 6px;
    font-size: 0.85rem;
    font-weight: 700;
    color: #0552BA;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

/* ─── Carousel arrows ───────────────────────────────────────── */

/* Under the strip and aligned right, rather than floating over the cards and
   covering the images. */
.herodotus-carousel-nav-row {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 6px;
}

.herodotus-carousel-nav {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid #e2e2e2;
    border-radius: 6px;
    background: #ffffff;
    color: #555;
    cursor: pointer;
    box-shadow: none;
}

.herodotus-carousel-nav:hover {
    background: #f5f6f8;
    color: #0552BA;
    border-color: #d5d8dd;
}
/* ─── Timeline layout ───────────────────────────────────────── */

.herodotus-layout-timeline .herodotus-grid {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 26px;
}

/* The spine everything hangs from. */
.herodotus-layout-timeline .herodotus-grid::before {
    content: "";
    position: absolute;
    top: 10px;
    bottom: 10px;
    left: 50%;
    width: 2px;
    margin-left: -1px;
    background: #E3E6EB;
}

/* The date is on the line now, so the heading would only repeat it. */
.herodotus-layout-timeline .herodotus-date-separator {
    display: none;
}

/* One row holds a year and its card. The middle column is the corridor the
   line runs through, so cards never touch it. */
.herodotus-layout-timeline .herodotus-timeline-row {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 76px 1fr;
    align-items: start;
}

.herodotus-layout-timeline .herodotus-timeline-row .herodotus-card {
    grid-column: 1;
}

.herodotus-layout-timeline .herodotus-timeline-row--right .herodotus-card {
    grid-column: 3;
}

/* The year is a disc sitting on the line, the same for every row. */
.herodotus-layout-timeline .herodotus-timeline-year {
    grid-column: 2;
    grid-row: 1;
    align-self: start;
    justify-self: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: #ffffff;
    border: 2px solid #0552BA;
    box-shadow: 0 0 0 6px #ffffff;
    line-height: 1.05;
    z-index: 1;
}

/* Second and later events of the same date: a marker, not a repeat. */
.herodotus-layout-timeline .herodotus-timeline-year--dot {
    width: 14px;
    height: 14px;
    border-width: 3px;
    background: #0552BA;
    margin-top: 20px;
    box-shadow: 0 0 0 5px #ffffff;
}

.herodotus-layout-timeline .herodotus-timeline-year__value {
    font-size: 1.15rem;
    font-weight: 700;
    color: #0552BA;
}

.herodotus-layout-timeline .herodotus-timeline-year__era {
    font-size: 0.7rem;
    font-weight: 700;
    color: #0552BA;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* A short arm from the disc to the card it belongs to. */
.herodotus-layout-timeline .herodotus-timeline-row::before {
    content: "";
    position: absolute;
    top: 34px;
    width: 18px;
    height: 2px;
    background: #E3E6EB;
    left: calc(50% - 27px - 18px);
}

.herodotus-layout-timeline .herodotus-timeline-row--right::before {
    left: calc(50% + 27px);
}


/* Too narrow to stand two cards apart: the line moves to the left edge and
   every card lines up behind it. */
@media (max-width: 782px) {
    .herodotus-layout-timeline .herodotus-grid::before {
        left: 36px;
        margin-left: 0;
    }

    .herodotus-layout-timeline .herodotus-timeline-row,
    .herodotus-layout-timeline .herodotus-timeline-row--right {
        grid-template-columns: 76px 1fr;
    }

    .herodotus-layout-timeline .herodotus-timeline-row .herodotus-card,
    .herodotus-layout-timeline .herodotus-timeline-row--right .herodotus-card {
        grid-column: 2;
    }

    .herodotus-layout-timeline .herodotus-timeline-year {
        grid-column: 1;
        width: 50px;
        height: 50px;
    }

    .herodotus-layout-timeline .herodotus-timeline-row::before,
    .herodotus-layout-timeline .herodotus-timeline-row--right::before {
        display: none;
    }


}
/* ─── Timeline cards ────────────────────────────────────────── */

/* The free stylesheet dresses the card only for the list layout, so here the
   text sat straight against the image and the heading kept the theme's size. */
.herodotus-layout-timeline .herodotus-card__body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 0;
    padding: 14px 16px;
}

.herodotus-layout-timeline .herodotus-card .herodotus-card__title {
    margin: 0 0 8px !important;
    font-size: 1rem;
    line-height: 1.3;
    text-align: left !important;
}

.herodotus-layout-timeline .herodotus-card__title a {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.herodotus-layout-timeline .herodotus-card__excerpt {
    margin: 0 0 10px;
    font-size: 0.88rem;
    line-height: 1.5;
}

.herodotus-layout-timeline .herodotus-card__footer {
    margin-top: auto;
    padding-right: 0;
    padding-top: 10px;
    border-top: 1px solid #EEF0F3;
}

.herodotus-layout-timeline .herodotus-card__footer-left {
    padding-left: 0;
}
