/* ====================================
    Hermes gallery skin (modernised): rounded image cards in a light 12-column rhythm.
    Heights stay driven by the customizer options (tall blocks / mobile height);
    colors by "Action buttons background" and "Votes bottom border".
==================================== */

.fv-contest-theme-hermes {
    --_font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
    --_radius: var(--fv-hermes-radius, 20px);
    --_gap: var(--fv-hermes-gap, 14px);
    --_spring: cubic-bezier(.22, 1, .36, 1);
    -ms-word-wrap: break-word;
    word-wrap: break-word;
}

.fv-contest-theme-hermes *,
.fv-contest-theme-hermes *::before,
.fv-contest-theme-hermes *::after {
    box-sizing: border-box;
}

/* Grid (the items live in the inner wrapper printed by the gallery loop) */
.fv-contest-theme-hermes .fv-contest-photos-container-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--_gap);
    width: 100%;
    margin: 0;
    padding: 0;
}

.fv-contest-theme-hermes .contest-block {
    position: relative;
    float: none;
    display: block;
    width: auto;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none;
}

/* Card */
.hermes-entry {
    position: relative;
    isolation: isolate;
    height: 300px;
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: var(--_radius);
    background-color: #1b1d24;
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .08), 0 14px 28px -18px rgba(15, 23, 42, .5);
    font-family: var(--_font);
    transition: box-shadow .35s var(--_spring), transform .35s var(--_spring);
}

/* The picture again on a layer of its own, so it can zoom without scaling the text */
.hermes-entry::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: inherit;
    transform: scale(1);
    transition: transform .7s var(--_spring);
}

.hermes-entry:hover,
.hermes-entry:focus-within {
    box-shadow: 0 2px 4px rgba(15, 23, 42, .1), 0 24px 40px -20px rgba(15, 23, 42, .6);
    transform: translateY(-3px);
}

.hermes-entry:hover::before,
.hermes-entry:focus-within::before {
    transform: scale(1.06);
}

/* Link over the whole card + gradient scrim */
.hermes-entry > a {
    position: absolute;
    inset: 0;
    z-index: 0;
    display: block;
    border: 0;
    outline-offset: -4px;
}

.hermes-entry > a:focus-visible {
    outline: 3px solid #fff;
    border-radius: var(--_radius);
}

.hermes-overlay {
    position: absolute;
    inset: 0;
    background: var(--fv-hermes-overlay,
        linear-gradient(to top, rgba(8, 9, 13, .78) 0%, rgba(8, 9, 13, .28) 38%, rgba(8, 9, 13, 0) 62%),
        linear-gradient(to bottom, rgba(8, 9, 13, .22) 0%, rgba(8, 9, 13, 0) 24%));
    transition: background .4s ease;
}

.hermes-entry:hover .hermes-overlay,
.hermes-entry:focus-within .hermes-overlay {
    background: var(--fv-hermes-overlay-hover,
        linear-gradient(to top, rgba(8, 9, 13, .9) 0%, rgba(8, 9, 13, .55) 55%, rgba(8, 9, 13, .12) 100%));
}

/* Actions: bigger, clearer, top right */
.hermes-actions {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 8px;
}

.hermes-actions__one {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 44px;
    min-width: 44px;
    padding: 0 12px;
    border-radius: 999px;
    background-color: var(--fv-hermes-actions-bg, #D8000C);
    box-shadow: 0 6px 16px -6px rgba(0, 0, 0, .55), inset 0 0 0 1px rgba(255, 255, 255, .22);
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    white-space: nowrap;
    transition: transform .25s var(--_spring), filter .2s ease, box-shadow .2s ease;
}

.hermes-actions__one i {
    display: block;
    font-size: 22px;
    line-height: 1;
}

.hermes-actions__one:hover,
.hermes-actions__one:focus-visible {
    transform: scale(1.06);
    filter: brightness(1.1);
}

.hermes-actions__one:active {
    transform: scale(.96);
}

.hermes-actions__one:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.hermes-actions__vote_text {
    display: inline-block;
    max-width: 0;
    margin-left: 0;
    overflow: hidden;
    opacity: 0;
    font: 700 14px/1 var(--_font);
    letter-spacing: .01em;
    white-space: nowrap;
    transition: max-width .3s var(--_spring), margin-left .3s var(--_spring), opacity .2s ease;
}

.hermes-entry:hover .hermes-actions__vote_text,
.hermes-entry:focus-within .hermes-actions__vote_text {
    max-width: 140px;
    margin-left: 8px;
    opacity: 1;
}

/* Text block */
.hermes-header {
    position: absolute;
    left: 20px;
    right: 20px;
    bottom: 18px;
    z-index: 1;
    pointer-events: none;
}

.fv-contest-theme-hermes .hermes-header,
.fv-contest-theme-hermes .hermes-header a {
    text-align: left;
    color: var(--fv-hermes-title, #fff) !important;
    text-decoration: none !important;
}

.hermes-title {
    margin: 0 0 8px;
    font: 700 clamp(16px, 1.5vw, 19px)/1.25 var(--_font);
    letter-spacing: 0;
    text-transform: none;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .35);
    overflow-wrap: anywhere;
}

.hermes-header__stats {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px 5px;
    border-bottom: 2px solid var(--fv-hermes-stats-line, #ffd800);
    border-radius: 10px 10px 4px 4px;
    background: rgba(255, 255, 255, .14);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    font: 700 13px/1 var(--_font);
    font-variant-numeric: tabular-nums;
}

.hermes-header__stats-votes i {
    margin-right: 3px;
    font-size: 14px;
    vertical-align: -1px;
}

/* Description + author slide in on hover */
.hermes-header__description_wrap {
    display: block;
    max-height: 0;
    margin: 0;
    overflow: hidden;
    opacity: 0;
    font: 400 14px/1.45 var(--_font);
    transition: max-height .45s var(--_spring), opacity .3s ease, margin .45s var(--_spring);
}

.hermes-entry:hover .hermes-header__description_wrap,
.hermes-entry:focus-within .hermes-header__description_wrap {
    max-height: 9em;
    margin-bottom: 10px;
    opacity: .92;
}

.hermes-header__description {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.hermes-header__author {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    font-size: 13px;
}

.hermes-header__author img {
    border-radius: 50%;
}

.hermes-header__author a {
    pointer-events: auto;
}

/* ---------- Rhythm ---------- */

/* Tablet: two columns, the first card runs full width */
@media (min-width: 780px) {
    .fv-contest-theme-hermes .fv-contest-photos-container-inner {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-auto-flow: dense;
    }

    .fv-contest-theme-hermes .contest-block:first-child {
        grid-column: 1 / -1;
    }
}

/* Desktop: 12 columns, two tall cards on top (2/3 + 1/3), then quarter cards with a few halves */
@media (min-width: 992px) {
    .fv-contest-theme-hermes .fv-contest-photos-container-inner {
        grid-template-columns: repeat(12, minmax(0, 1fr));
    }

    .fv-contest-theme-hermes .contest-block {
        grid-column: span 3;
    }

    .fv-contest-theme-hermes .contest-block:first-child {
        grid-column: span 8;
    }

    .fv-contest-theme-hermes .contest-block:nth-child(2) {
        grid-column: span 4;
    }

    /* Second row: three cards instead of four, so they are not tiny */
    .fv-contest-theme-hermes .contest-block:nth-child(3),
    .fv-contest-theme-hermes .contest-block:nth-child(4),
    .fv-contest-theme-hermes .contest-block:nth-child(5) {
        grid-column: span 4;
    }

    /* From the sixth card on: a row of four quarters, a row of two halves, repeating (6, 7, 8, 9 | 10, 11 | 12 ...) */
    .fv-contest-theme-hermes .contest-block:nth-child(6n+4):nth-child(n+10),
    .fv-contest-theme-hermes .contest-block:nth-child(6n+5):nth-child(n+11) {
        grid-column: span 6;
    }

    .hermes-entry {
        height: 288px;
    }

    .fv-contest-theme-hermes .contest-block:first-child > .hermes-entry,
    .fv-contest-theme-hermes .contest-block:nth-child(2) > .hermes-entry {
        height: 320px;
    }

    .fv-contest-theme-hermes .contest-block:first-child .hermes-title,
    .fv-contest-theme-hermes .contest-block:nth-child(2) .hermes-title {
        font-size: 22px;
    }
}

/* Phones */
@media (max-width: 779px) {
    .hermes-entry {
        height: 280px;
    }

    .hermes-actions {
        top: 12px;
        right: 12px;
    }

    .hermes-header {
        left: 16px;
        right: 16px;
        bottom: 16px;
    }
}

/* Touch: no hover, keep the quiet resting state (title + votes); the overlay link opens the photo */
@media (hover: none) {
    .hermes-entry:hover,
    .hermes-entry:focus-within {
        transform: none;
    }

    .hermes-entry:hover::before,
    .hermes-entry:focus-within::before {
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hermes-entry,
    .hermes-entry::before,
    .hermes-overlay,
    .hermes-actions__one,
    .hermes-actions__vote_text,
    .hermes-header__description_wrap {
        transition: none !important;
    }

    .hermes-entry:hover,
    .hermes-entry:focus-within,
    .hermes-entry:hover::before,
    .hermes-entry:focus-within::before,
    .hermes-actions__one:hover {
        transform: none !important;
    }
}

/* Pagination: scrim-coloured pills that echo the vote chip on the cards; the current page takes the palette accent. */
.fv-contest-theme-hermes .fv-pagination {
    --fv-pg-accent: var(--fv-hermes-actions-bg, #d8000c);
    --fv-pg-accent-ink: #fff;
    --fv-pg-ink: #f3f4f7;
    --fv-pg-surface: var(--fv-hermes-scrim, #08090d);
    --fv-pg-border: color-mix(in srgb, #fff 14%, transparent);
    --fv-pg-hover: color-mix(in srgb, var(--fv-hermes-actions-bg, #d8000c) 28%, var(--fv-hermes-scrim, #08090d));
    --fv-pg-radius: 999px;
    --fv-pg-muted: color-mix(in srgb, currentColor 62%, transparent);
    margin-top: calc(var(--_gap) + 8px);
    font-family: var(--_font);
}
.fv-contest-theme-hermes .fv-pagination .fv-pagination-list a,
.fv-contest-theme-hermes .fv-pagination .fv-pagination-list span:not(.pages):not(.current) {
    min-width: 2.4rem;
    padding: 4px 10px;
    font-weight: 600;
    font-size: 1.1rem;
    line-height: 1.5rem;
}
.fv-contest-theme-hermes .fv-pagination .current {
    box-shadow: 0 6px 16px -6px var(--fv-hermes-actions-bg, #d8000c);
}
.fv-contest-theme-hermes .fv-pagination .pages {
    align-self: center;
    padding: 4px 0;
    font-size: .95rem;
    letter-spacing: .02em;
}
