/*
 * WM FairVote – public styles.
 * Restrained by design: inherits the theme's font family and colours,
 * only provides layout plus a small accent token that themes can override.
 *
 * Sizing works in two steps. The component root sets its own base size
 * from the plugin settings (16px by default) instead of inheriting the
 * theme's – some themes set 24px on the body or on a page-builder section,
 * which used to multiply through every element and made the cards several
 * times too tall. Everything inside is then relative to that controlled
 * base, so a single setting scales the whole component proportionally.
 *
 * Colours, column width and the number of description lines come from the
 * same settings as CSS custom properties, so a site owner can match the
 * component to their theme without editing any file.
 */

.wmfv-overview {
    /* Room for fixed theme headers when jumping to the overview anchor. */
    scroll-margin-top: 110px;
}

.wmfv-overview,
.wmfv-detail {
    /* Overwritten per site from the settings (see WMFV_Frontend::inline_css). */
    --wmfv-accent: #3152ff;
    --wmfv-accent-dark: #243fd7;
    --wmfv-base: 16px;
    --wmfv-card-min: 270px;
    --wmfv-summary-lines: 3;
    --wmfv-border: rgba(0, 0, 0, 0.12);
    --wmfv-muted: rgba(0, 0, 0, 0.6);
    box-sizing: border-box;

    /* The component sets its own base size instead of inheriting one that
       may be far larger; the sizes below are relative to this value. */
    font-size: var(--wmfv-base);
    line-height: 1.5;
}

.wmfv-overview *,
.wmfv-detail * {
    box-sizing: inherit;
}

/* Filter bar */
.wmfv-filterbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: 0 0 24px;
}

.wmfv-search-wrap {
    position: relative;
    display: flex;
    flex: 1 1 220px;
    min-width: 0;
}

.wmfv-filterbar input[type="search"] {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    padding: 8px 34px 8px 12px;
    border: 1px solid var(--wmfv-border);
    border-radius: 4px;
}

/* Hide the inconsistent native clear control; we bring our own. */
.wmfv-filterbar input[type="search"]::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
}

/* Deliberately heavy-handed: themes style bare <button> elements with
   their own padding/min-height, which turned the circle into an oval. */
button.wmfv-search-clear {
    position: absolute;
    top: 50%;
    right: 7px;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 26px !important;
    height: 26px !important;
    min-width: 26px !important;
    min-height: 26px !important;
    max-width: 26px;
    max-height: 26px;
    margin: 0;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 50% !important;
    background: rgba(0, 0, 0, 0.08) !important;
    box-shadow: none !important;
    color: inherit !important;
    font-size: 15px;
    line-height: 1 !important;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

button.wmfv-search-clear:hover,
button.wmfv-search-clear:focus {
    background: rgba(0, 0, 0, 0.16) !important;
}

.wmfv-filterbar select {
    padding: 8px 12px;
    border: 1px solid var(--wmfv-border);
    border-radius: 4px;
}

/* Buttons */
.wmfv-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 18px;
    border: 0;
    border-radius: 4px;
    background: var(--wmfv-accent);
    color: #fff;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s ease;
}

.wmfv-button:hover,
.wmfv-button:focus {
    background: var(--wmfv-accent-dark);
    color: #fff;
}

.wmfv-button-secondary {
    background: transparent;
    border: 1px solid var(--wmfv-border);
    color: inherit;
}

.wmfv-button-secondary:hover,
.wmfv-button-secondary:focus {
    background: rgba(0, 0, 0, 0.04);
    color: inherit;
}

/* Card grid */
.wmfv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--wmfv-card-min), 1fr));
    gap: 24px;
    margin: 0 0 24px;
}

.wmfv-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    line-height: 1.5;
    border: 1px solid var(--wmfv-border);
    border-radius: 8px;
    background: #fff;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.wmfv-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.wmfv-card-media {
    display: block;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.05);
}

.wmfv-card-media img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    object-fit: cover;
}

.wmfv-card-media-fallback {
    display: block;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(49, 82, 255, 0.12), rgba(49, 82, 255, 0.03));
}

.wmfv-card-body {
    flex: 1 1 auto;
    padding: 16px 18px 0;
}

.wmfv-card-category {
    display: inline-block;
    margin-bottom: 6px;
    color: var(--wmfv-accent);
    font-size: 0.78em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.wmfv-card-title {
    margin: 0 0 6px;
    font-size: 1.1em;
    line-height: 1.35;
    /* Two lines maximum, so every card in a row starts its text at the
       same height instead of following the longest headline. */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.wmfv-card-title a {
    color: inherit;
    text-decoration: none;
}

.wmfv-card-title a:hover {
    color: var(--wmfv-accent);
}

.wmfv-card-meta {
    margin: 0 0 8px;
    color: var(--wmfv-muted);
    font-size: 0.88em;
    line-height: 1.4;
    /* Organization and place fit on one line; the full text stays in the
       title attribute and on the detail page. */
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.wmfv-card-summary {
    margin: 0 0 4px;
    font-size: 0.94em;
    line-height: 1.5;
    /* Three lines: enough to understand the project, short enough to keep
       the grid calm. The full text is on the detail page. */
    display: -webkit-box;
    -webkit-line-clamp: var(--wmfv-summary-lines);
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.wmfv-card-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 16px 18px;
}

/* Chip and button share one height so the row reads as a unit. */
.wmfv-card-foot .wmfv-stat--sm,
.wmfv-card-cta {
    min-height: 42px;
    box-sizing: border-box;
}

/* The grid button stays compact and never pushes the chip out of the row. */
.wmfv-card-cta {
    flex: 0 0 auto;
    padding: 9px 18px;
    white-space: nowrap;
}

@media (max-width: 480px) {
    .wmfv-card-foot {
        padding: 14px 16px;
    }
}

/* Pagination */
.wmfv-pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 12px;
}

.wmfv-page {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    padding: 7px 10px;
    border: 1px solid var(--wmfv-border);
    border-radius: 4px;
    color: inherit;
    text-decoration: none;
}

.wmfv-page:hover {
    border-color: var(--wmfv-accent);
    color: var(--wmfv-accent);
}

.wmfv-page.current {
    border-color: var(--wmfv-accent);
    background: var(--wmfv-accent);
    color: #fff;
}

.wmfv-note {
    padding: 12px 16px;
    border: 1px solid var(--wmfv-border);
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.03);
}

/* Detail layout.
   The aside stretches to full row height so the sticky column can travel
   alongside the content on desktop. */
.wmfv-detail {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
    gap: 32px;
    /* Themes rarely leave room between their header/footer and the content
       of a custom post type, so the block brings its own. */
    margin: 2.5em 0 3.5em;
}

.wmfv-detail-sticky {
    position: sticky;
    /* Overridden from the settings, or measured from the theme header. */
    top: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    /* Never taller than the free viewport, so a long column can still be
       scrolled through instead of getting stuck under the header. */
    max-height: calc(100vh - 48px);
    overflow-y: auto;
}

@media (max-width: 781px) {
    .wmfv-detail {
        grid-template-columns: minmax(0, 1fr);
    }

    .wmfv-detail-sticky {
        position: static;
        max-height: none;
        overflow-y: visible;
    }
}

/* Back to overview */
.wmfv-back-wrap {
    margin: 0 0 18px;
}

.wmfv-back-wrap--bottom {
    margin: 28px 0 0;
}

.wmfv-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: inherit;
    font-weight: 600;
    text-decoration: none;
}

.wmfv-back:hover {
    color: var(--wmfv-accent);
}

/* Media: video and gallery */
.wmfv-media {
    display: flex;
    flex-direction: column;
    gap: 20px;
    /* Sits above the description – the space belongs underneath. */
    margin: 0 0 1.75em;
}

.wmfv-video {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.85);
}

.wmfv-video video,
.wmfv-video iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}

.wmfv-video-consent {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 24px;
    color: #fff;
    text-align: center;
}

.wmfv-video-consent p {
    max-width: 420px;
    margin: 0;
    font-size: 0.9em;
    line-height: 1.5;
}

.wmfv-gallery-stage img {
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
    border-radius: 8px;
}

.wmfv-gallery-thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.wmfv-gallery-thumb {
    padding: 0;
    border: 2px solid transparent;
    border-radius: 6px;
    background: none;
    line-height: 0;
    cursor: pointer;
    overflow: hidden;
}

.wmfv-gallery-thumb img {
    display: block;
    width: 76px;
    height: 76px;
    object-fit: cover;
}

.wmfv-gallery-thumb.is-active,
.wmfv-gallery-thumb:hover {
    border-color: var(--wmfv-accent);
}

/* Framed stat chips: score and rank, in the card and in the grid */
.wmfv-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 16px;
}

.wmfv-stat {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 13px;
    border: 1px solid var(--wmfv-border);
    border-radius: 10px;
    background: #fff;
    font-size: 0.86em;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
}

.wmfv-stat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(49, 82, 255, 0.1);
    color: var(--wmfv-accent);
}

.wmfv-stat.is-leading .wmfv-stat-icon {
    background: rgba(219, 166, 23, 0.18);
    color: #8a6100;
}

.wmfv-stat--sm {
    gap: 7px;
    padding: 5px 14px;
    font-size: 0.82em;
}

.wmfv-stat--sm .wmfv-stat-icon {
    width: 20px;
    height: 20px;
}

/* Conditions of participation */
.wmfv-vote-terms {
    margin: 0 0 12px;
    font-size: 0.86em;
    line-height: 1.5;
}

.wmfv-vote-terms label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    cursor: pointer;
}

.wmfv-vote-terms input {
    flex: 0 0 auto;
    margin-top: 2px;
}

.wmfv-required {
    color: #d63638;
}

/* Shared look for every collapsible block (share, privacy, weighting) */
.wmfv-disclosure-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    list-style: none;
}

.wmfv-disclosure-summary::-webkit-details-marker {
    display: none;
}

.wmfv-disclosure-summary::after {
    content: "";
    flex: 0 0 auto;
    width: 8px;
    height: 8px;
    margin-left: auto;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg) translate(-2px, -2px);
    opacity: 0.55;
    transition: transform 0.15s ease;
}

.wmfv-disclosure[open] > .wmfv-disclosure-summary::after {
    transform: rotate(-135deg) translate(-2px, -2px);
}

.wmfv-disclosure-summary:hover,
.wmfv-disclosure-summary:focus-visible {
    color: var(--wmfv-accent);
}

.wmfv-disclosure-icon {
    flex: 0 0 auto;
    opacity: 0.75;
}

/* Share block */
.wmfv-share {
    padding: 16px 20px;
    border: 1px solid var(--wmfv-border);
    border-radius: 8px;
    background: #fff;
}

.wmfv-share[open] {
    padding-bottom: 20px;
}

.wmfv-share-title {
    margin: 0;
    font-size: 1em;
    font-weight: 700;
}

.wmfv-share[open] .wmfv-share-title {
    margin-bottom: 14px;
}

.wmfv-share-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.wmfv-share-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--wmfv-border);
    border-radius: 8px;
    background: #fff;
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.12s ease;
}

.wmfv-share-button:hover,
.wmfv-share-button:focus {
    border-color: var(--wmfv-accent);
    background: var(--wmfv-accent);
    color: #fff;
}

.wmfv-share-button--native {
    width: auto;
    padding: 0 14px;
    font-size: 0.85em;
    font-weight: 600;
}

.wmfv-share-feedback {
    min-height: 1.2em;
    margin: 10px 0 0;
    color: #006b19;
    font-size: 0.82em;
    font-weight: 600;
}

.wmfv-share-hint {
    margin: 6px 0 0;
    color: var(--wmfv-muted);
    font-size: 0.78em;
    line-height: 1.5;
}

/* Social channels card */
.wmfv-social-card {
    padding: 20px 24px;
    border: 1px solid var(--wmfv-border);
    border-radius: 8px;
    background: #fff;
}

.wmfv-social-card-title {
    margin: 0 0 12px;
    font-size: 1em;
}

.wmfv-social-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.wmfv-social-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    max-width: 100%;
    padding: 6px 12px;
    border: 1px solid var(--wmfv-border);
    border-radius: 16px;
    color: inherit;
    font-size: 0.85em;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all 0.12s ease;
}

.wmfv-social-link:hover {
    border-color: var(--wmfv-accent);
    color: var(--wmfv-accent);
}

/* Facts */
.wmfv-detail-main > p:first-of-type {
    margin-top: 0;
}

.wmfv-facts {
    margin-top: 2em;
}

.wmfv-facts-title {
    margin: 0 0 12px;
    font-size: 1.2em;
}

.wmfv-facts-list {
    margin: 0;
    border-top: 1px solid var(--wmfv-border);
}

.wmfv-fact {
    display: grid;
    grid-template-columns: minmax(120px, 200px) minmax(0, 1fr);
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--wmfv-border);
}

.wmfv-fact dt {
    margin: 0;
    color: var(--wmfv-muted);
    font-weight: 600;
}

.wmfv-fact dd {
    margin: 0;
    overflow-wrap: anywhere;
}

/* Voting card */
.wmfv-vote-card {
    padding: 22px 24px;
    border: 1px solid var(--wmfv-border);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
}


.wmfv-vote-campaign {
    margin: 0 0 12px;
    color: var(--wmfv-muted);
    font-size: 0.9em;
}


.wmfv-vote-button {
    width: 100%;
    padding: 12px 18px;
    font-size: 1.02em;
}

.wmfv-vote-button[disabled] {
    opacity: 0.6;
    cursor: wait;
}

.wmfv-vote-status {
    margin: 0 0 8px;
    color: var(--wmfv-muted);
}

.wmfv-vote-field {
    margin: 0 0 12px;
}

.wmfv-vote-field label {
    display: block;
    margin-bottom: 4px;
    font-size: 0.88em;
    font-weight: 600;
}

.wmfv-vote-field input {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--wmfv-border);
    border-radius: 4px;
}

.wmfv-confirm-notice {
    margin: 0 0 16px;
    padding: 12px 16px;
    border-radius: 6px;
    font-weight: 600;
}

.wmfv-confirm-notice--success {
    background: rgba(0, 138, 32, 0.1);
    color: #006b19;
}

.wmfv-confirm-notice--info {
    background: rgba(49, 82, 255, 0.1);
}

.wmfv-confirm-notice--error {
    background: rgba(214, 54, 56, 0.1);
    color: #a32224;
}


.wmfv-vote-status-done {
    color: #008a20;
    font-weight: 600;
}

.wmfv-vote-feedback {
    min-height: 1.2em;
    margin: 10px 0 0;
    font-weight: 600;
}

.wmfv-vote-feedback.wmfv-success {
    color: #008a20;
}

.wmfv-vote-feedback.wmfv-error {
    color: #d63638;
}

.wmfv-vote-privacy {
    margin: 12px 0 0;
    color: var(--wmfv-muted);
    font-size: 0.8em;
    line-height: 1.5;
}

.wmfv-vote-privacy > .wmfv-disclosure-summary {
    font-weight: 600;
}

.wmfv-vote-privacy p {
    margin: 8px 0 0;
}

/* Countdown to the start or end of the voting period */
.wmfv-countdown {
    margin: 16px 0 0;
    padding: 14px 16px 12px;
    border: 1px solid var(--wmfv-border);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.02);
    text-align: center;
}

.wmfv-countdown-label {
    margin: 0 0 10px;
    color: var(--wmfv-muted);
    font-size: 0.78em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.wmfv-countdown-units {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.wmfv-countdown-unit {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 8px 2px 6px;
    border-radius: 6px;
    background: #fff;
    border: 1px solid var(--wmfv-border);
}

.wmfv-countdown-value {
    font-size: 1.35em;
    font-weight: 700;
    line-height: 1.1;
    /* Digits keep their column so the number does not jitter each second. */
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}

.wmfv-countdown-name {
    color: var(--wmfv-muted);
    font-size: 0.66em;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.wmfv-countdown.is-soon .wmfv-countdown-value {
    color: var(--wmfv-accent);
}

.wmfv-countdown-date {
    margin: 10px 0 0;
    color: var(--wmfv-muted);
    font-size: 0.78em;
}

.wmfv-countdown-over {
    margin: 0;
    font-size: 0.85em;
    font-weight: 600;
}

/* Weighting explanation under the stat chips */
.wmfv-weighting-note {
    margin: -6px 0 14px;
    font-size: 0.84em;
    line-height: 1.55;
}

.wmfv-weighting-note summary {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--wmfv-muted);
    cursor: pointer;
    font-weight: 600;
    list-style: none;
}

.wmfv-weighting-note summary::-webkit-details-marker {
    display: none;
}

.wmfv-weighting-note summary::after {
    content: "";
    width: 7px;
    height: 7px;
    margin-left: auto;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg) translate(-2px, -2px);
    opacity: 0.55;
    transition: transform 0.15s ease;
}

.wmfv-weighting-note[open] summary::after {
    transform: rotate(-135deg) translate(-2px, -2px);
}

.wmfv-weighting-note summary:hover {
    color: var(--wmfv-accent);
}

.wmfv-weighting-note p {
    margin: 8px 0 6px;
}

.wmfv-weighting-note ul {
    margin: 0 0 6px 18px;
    padding: 0;
    list-style: disc;
}

.wmfv-weighting-raw {
    color: var(--wmfv-muted);
}

/* ---------------------------------------------------------------------
 * Theme-proof typography
 *
 * Page builders style headings globally with selectors that outrank a
 * single class – Elementor's global kit ships `.elementor-kit-N h2
 * { font-size: 50px }`, which turned "Share this project" into a display
 * heading. The rules below restate the component's own sizes with three
 * classes, so they win regardless of stylesheet order, without resorting
 * to !important.
 * ------------------------------------------------------------------ */
.wmfv-overview .wmfv-card .wmfv-card-title {
    font-size: 1.1em;
    line-height: 1.35;
    font-weight: 700;
}

.wmfv-detail .wmfv-detail-main .wmfv-facts-title,
.wmfv-detail .wmfv-detail-side .wmfv-share-title,
.wmfv-detail .wmfv-detail-side .wmfv-social-card-title {
    margin: 0 0 12px;
    font-size: 1.05em;
    line-height: 1.35;
    font-weight: 700;
    letter-spacing: normal;
    text-transform: none;
}

.wmfv-detail .wmfv-facts .wmfv-fact dt,
.wmfv-detail .wmfv-facts .wmfv-fact dd {
    font-size: 0.95em;
    line-height: 1.5;
}

/* The detail column keeps a readable rhythm even when the theme sets a
   large base size on the surrounding section. */
.wmfv-detail .wmfv-detail-side .wmfv-vote-card,
.wmfv-detail .wmfv-detail-side .wmfv-share,
.wmfv-detail .wmfv-detail-side .wmfv-social-card {
    font-size: 1em;
    line-height: 1.5;
}
