/* ============================================================
   NBC Vote — голосование фестиваля «Родина борща» (/vote/, /fest_itog/)
   Фирменные цвета: красный #B83519, крем #EFE4D2 — как у /fest/
   ============================================================ */

/* Шрифт заголовков — Despair Display (в теме: land/fonts/) */
@font-face {
    font-family: 'Despair Display';
    src: url('../../land/fonts/despairdisplay-bold.woff2') format('woff2'),
         url('../../land/fonts/despairdisplay-bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* На страницах голосования общая шапка и футер сайта скрыты */
body.nbc-vote-page #site-header,
body.nbc-vote-page #nbc-header,
body.nbc-vote-page #site-footer,
body.nbc-vote-page .nbc-footer,
body.nbc-vote-page .page-header,
body.nbc-vote-page h1.entry-title {
    display: none !important;
}

body.nbc-vote-page {
    background: #EFE4D2 !important;
    overflow-x: hidden;
    overflow-x: clip;
}

/* Лого прижат к верхнему краю: гасим верхние отступы контентной обёртки темы */
body.nbc-vote-page #page,
body.nbc-vote-page #content,
body.nbc-vote-page .site-main,
body.nbc-vote-page .entry-content,
body.nbc-vote-page .page-content {
    padding-top: 0 !important;
    margin-top: 0 !important;
}

.nbc-vote {
    --nv-red: #B83519;
    --nv-red-dark: #8f2812;
    --nv-cream: #EFE4D2;
    --nv-cream-light: #f7f0e4;
    --nv-ink: #2b1a12;
    --nv-muted: #8a7360;

    min-height: 100vh;
    box-sizing: border-box;
    margin: 0 calc(50% - 50vw);
    padding: 0 20px 56px;
    text-align: center;
    font-family: 'Montserrat', Arial, sans-serif;
    color: var(--nv-ink);
    background-color: var(--nv-cream);
    /* Паттерн: красные точки в шахматном порядке (как на лендинге /fest/) */
    background-image:
        radial-gradient(circle, rgba(184, 53, 25, .05) 4px, rgba(184, 53, 25, 0) 4.5px),
        radial-gradient(circle, rgba(184, 53, 25, .05) 4px, rgba(184, 53, 25, 0) 4.5px);
    background-size: 32px 32px;
    background-position: 0 0, 16px 16px;
}

.nbc-vote p,
.nbc-vote span,
.nbc-vote a,
.nbc-vote button,
.nbc-vote h1,
.nbc-vote h2,
.nbc-vote-modal,
.nbc-vote-modal p,
.nbc-vote-modal span,
.nbc-vote-modal a,
.nbc-vote-modal button,
.nbc-vote-modal h2 {
    font-family: 'Montserrat', Arial, sans-serif !important;
}

/* ── Шапка страницы ────────────────────────────────────── */

.nbc-vote-head {
    max-width: 720px;
    margin: 0 auto;
    padding: 12px 0 6px;
}

.nbc-vote-logo {
    display: inline-block;
    margin-bottom: 8px;
}

.nbc-vote-logo img {
    height: clamp(96px, 14vw, 140px);
    width: auto;
    display: block;
}

.nbc-vote .nbc-vote-title {
    margin: 0 0 4px;
    font-family: 'Despair Display', 'Montserrat', Arial, sans-serif !important;
    font-size: clamp(34px, 6vw, 58px);
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: uppercase;
    line-height: 1.05;
    color: var(--nv-red);
}

/* «НАРОДНОЕ» + «ГОЛОСОВАНИЕ» — двумя строками одним кеглем,
   на 3px меньше прежнего размера «Голосования» (двойной класс —
   обойти общий Montserrat !important на span, как у .nbc-fest2-final-line) */
.nbc-vote .nbc-vote-title-top,
.nbc-vote .nbc-vote-title-main {
    display: block;
    font-family: 'Despair Display', 'Montserrat', Arial, sans-serif !important;
    font-size: clamp(31px, 6vw, 55px);
    line-height: 1.05;
}

.nbc-vote .nbc-vote-title-main {
    margin-top: 2px;
}

.nbc-vote .nbc-vote-note {
    margin: 4px auto 0;
    max-width: 560px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--nv-muted);
}

/* ── Кнопки номинаций ──────────────────────────────────── */

.nbc-vote-cats {
    max-width: 860px;
    margin: 28px auto 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.nbc-vote-cat-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-height: 108px;
    padding: 22px 22px 18px;
    border: 2px solid var(--nv-red);
    border-radius: 20px;
    background: var(--nv-red);
    color: var(--nv-cream-light);
    cursor: pointer;
    transition: background .2s ease, color .2s ease, border-color .2s ease, transform .15s ease;
}

.nbc-vote-cat-btn:hover,
.nbc-vote-cat-btn:focus-visible {
    background: var(--nv-red-dark);
    border-color: var(--nv-red-dark);
    color: #fff;
    transform: translateY(-2px);
}

.nbc-vote .nbc-vote-cat-name {
    font-size: clamp(15px, 2vw, 19px);
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
    line-height: 1.25;
}

.nbc-vote .nbc-vote-cat-state {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    opacity: .75;
}

/* Голос в номинации отдан: кнопка «инвертируется» */
.nbc-vote-cat-btn.is-voted {
    background: var(--nv-cream-light);
    border-color: var(--nv-red);
    color: var(--nv-red);
    cursor: pointer;
}

.nbc-vote-cat-btn.is-voted:hover,
.nbc-vote-cat-btn.is-voted:focus-visible {
    background: #fff;
    color: var(--nv-red-dark);
    transform: none;
}

.nbc-vote-cat-btn.is-voted .nbc-vote-cat-state {
    opacity: 1;
    font-weight: 700;
}

/* ── Плашка «все голоса отданы» + ссылки ───────────────── */

.nbc-vote-alldone {
    display: inline-block;
    margin: 26px auto 0;
    padding: 12px 22px;
    border-radius: 14px;
    background: var(--nv-red);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
}

.nbc-vote-alldone[hidden] {
    display: none;
}

/* ── Модалка голосования ───────────────────────────────── */

.nbc-vote-modal {
    --nv-red: #B83519;
    --nv-red-dark: #8f2812;
    --nv-cream: #EFE4D2;
    --nv-cream-light: #f7f0e4;
    --nv-ink: #2b1a12;

    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 4vh 16px;
    background: rgba(43, 26, 18, .65);
    overflow-y: auto;
    font-family: 'Montserrat', Arial, sans-serif;
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease, visibility .25s ease;
}

.nbc-vote-modal.is-open {
    opacity: 1;
    visibility: visible;
}

.nbc-vote-modal-box {
    position: relative;
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    background: var(--nv-cream);
    border-radius: 20px;
    padding: 30px 26px 26px;
    text-align: left;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
    overflow: hidden;
    transform: translateY(14px) scale(.97);
    transition: transform .25s ease;
}

.nbc-vote-modal.is-open .nbc-vote-modal-box {
    transform: none;
}

/* Точечный паттерн внизу бокса — как у модалок /fest/ */
.nbc-vote-modal-box::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 200px;
    z-index: 0;
    pointer-events: none;
    background-image:
        radial-gradient(circle, rgba(184, 53, 25, .12) 4px, rgba(184, 53, 25, 0) 4.5px),
        radial-gradient(circle, rgba(184, 53, 25, .12) 4px, rgba(184, 53, 25, 0) 4.5px);
    background-size: 32px 32px;
    background-position: 0 0, 16px 16px;
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 100%);
    mask-image: linear-gradient(to bottom, transparent 0%, #000 100%);
}

.nbc-vote-modal-box > * {
    position: relative;
    z-index: 1;
}

/* Крестик: красный круг, кремовый × */
.nbc-vote-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 0 3px;
    border: none;
    border-radius: 50%;
    background: var(--nv-red);
    color: var(--nv-cream-light);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    transition: background .2s ease, transform .15s ease;
}

.nbc-vote-modal-close:hover {
    background: var(--nv-red-dark);
    transform: scale(1.07);
}

.nbc-vote-modal .nbc-vote-modal-title {
    margin: 0 44px 4px 0;
    font-family: 'Despair Display', 'Montserrat', Arial, sans-serif !important;
    font-size: clamp(20px, 3.4vw, 30px);
    font-weight: 700;
    letter-spacing: .02em;
    text-transform: uppercase;
    line-height: 1.1;
    color: var(--nv-red);
}

.nbc-vote-modal .nbc-vote-modal-sub {
    margin: 0 0 14px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .03em;
    text-transform: uppercase;
    color: var(--nv-muted);
}

.nbc-vote-modal .nbc-vote-modal-done {
    margin: 0 0 14px;
    padding: 14px 16px;
    border-radius: 12px;
    background: var(--nv-red);
    color: #fff;
    font-size: 14px;
    line-height: 1.5;
    text-align: center;
}

.nbc-vote-modal-done[hidden] {
    display: none;
}

.nbc-vote-modal-done b {
    font-size: 16px;
}

/* ── Список заведений: 2 столбца на десктопе, 1 на мобиле ── */

.nbc-vote-list {
    flex: 1 1 auto;
    overflow-y: auto;
    margin: 0 -6px 6px 0;
    padding-right: 6px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    align-content: start;
    scrollbar-width: thin;
    scrollbar-color: var(--nv-red) transparent;
}

.nbc-vote-list::-webkit-scrollbar {
    width: 6px;
}

.nbc-vote-list::-webkit-scrollbar-thumb {
    background: var(--nv-red);
    border-radius: 3px;
}

.nbc-vote-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 46px;
    padding: 10px 14px;
    border: 2px solid rgba(184, 53, 25, .35);
    border-radius: 12px;
    background: var(--nv-cream-light);
    color: var(--nv-ink);
    text-align: left;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease, color .15s ease;
}

.nbc-vote-item:hover,
.nbc-vote-item:focus-visible {
    border-color: var(--nv-red);
}

.nbc-vote .nbc-vote-item-name {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
}

/* Выбранное заведение — заливка красным */
.nbc-vote-item.is-selected {
    background: var(--nv-red);
    border-color: var(--nv-red);
    color: var(--nv-cream-light);
}

/* Заведение, за которое уже отдан голос */
.nbc-vote-item.is-chosen {
    background: var(--nv-red);
    border-color: var(--nv-red);
    color: var(--nv-cream-light);
    cursor: default;
}

/* Галочка: скрыта, видна у выбранного/проголосованного */
.nbc-vote-item-check {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    opacity: 0;
}

.nbc-vote-item.is-selected .nbc-vote-item-check,
.nbc-vote-item.is-chosen .nbc-vote-item-check {
    opacity: 1;
}

/* Гость уже голосовал в номинации — список неактивен */
.nbc-vote-item.is-disabled {
    opacity: .45;
    cursor: default;
}

.nbc-vote-item.is-disabled:hover {
    border-color: rgba(184, 53, 25, .35);
}

.nbc-vote-item.is-disabled.is-chosen {
    opacity: 1;
}

.nbc-vote-modal .nbc-vote-modal-msg {
    min-height: 20px;
    margin: 4px 0;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
}

.nbc-vote-modal-msg.is-err {
    color: var(--nv-red);
}

.nbc-vote-submit {
    flex: 0 0 auto;
    margin-top: 8px;
    padding: 13px 28px;
    border: none;
    border-radius: 20px;
    background: var(--nv-red);
    color: var(--nv-cream-light);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background .2s ease;
}

.nbc-vote-submit:hover,
.nbc-vote-submit:focus-visible {
    background: var(--nv-red-dark);
}

.nbc-vote-submit[disabled] {
    opacity: .45;
    cursor: not-allowed;
}

.nbc-vote-submit.is-busy {
    opacity: .6;
    cursor: wait;
}

/* ── Страница итогов /fest_itog/ ────────────────────────── */

.nbc-vi-cat {
    max-width: 680px;
    margin: 34px auto 0;
    padding: 24px 24px 20px;
    background: var(--nv-cream-light);
    border: 2px dashed var(--nv-red);
    border-radius: 20px;
    text-align: left;
}

.nbc-vote .nbc-vi-title {
    margin: 0 0 4px;
    font-family: 'Despair Display', 'Montserrat', Arial, sans-serif !important;
    font-size: clamp(20px, 3.2vw, 28px);
    font-weight: 700;
    letter-spacing: .02em;
    text-transform: uppercase;
    line-height: 1.15;
    color: var(--nv-red);
}

.nbc-vote .nbc-vi-total {
    margin: 0 0 14px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .03em;
    text-transform: uppercase;
    color: var(--nv-muted);
}

.nbc-vi-total b {
    color: var(--nv-red);
}

.nbc-vi-empty {
    margin: 6px 0 2px;
    font-size: 14px;
    color: var(--nv-muted);
}

.nbc-vi-empty-all {
    max-width: 680px;
    margin: 30px auto 0;
    text-align: center;
}

.nbc-vi-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Строка: место | название / полоса | голоса */
.nbc-vi-row {
    display: grid;
    grid-template-columns: 34px 1fr 56px;
    grid-template-rows: auto auto;
    column-gap: 10px;
    row-gap: 5px;
    align-items: center;
    padding: 8px 0;
}

.nbc-vi-row + .nbc-vi-row {
    border-top: 1px dashed rgba(184, 53, 25, .22);
}

.nbc-vi-rank {
    grid-column: 1;
    grid-row: 1 / 3;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(184, 53, 25, .3);
    border-radius: 50%;
    font-size: 13px;
    font-weight: 700;
    color: var(--nv-muted);
}

/* Тройка лидеров — красные кружки */
.nbc-vi-row.is-top .nbc-vi-rank {
    border-color: var(--nv-red);
    background: var(--nv-red);
    color: var(--nv-cream-light);
}

.nbc-vi-top1 .nbc-vi-rank {
    background: var(--nv-red-dark);
    border-color: var(--nv-red-dark);
}

.nbc-vote .nbc-vi-name {
    grid-column: 2;
    grid-row: 1;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
}

.nbc-vote .nbc-vi-count {
    grid-column: 3;
    grid-row: 1 / 3;
    font-family: 'Despair Display', 'Montserrat', Arial, sans-serif !important;
    font-size: 22px;
    font-weight: 700;
    color: var(--nv-red);
    text-align: right;
}

.nbc-vi-bar {
    grid-column: 2;
    grid-row: 2;
    height: 8px;
    border-radius: 4px;
    background: rgba(184, 53, 25, .12);
    overflow: hidden;
}

.nbc-vi-fill {
    display: block;
    height: 100%;
    border-radius: 4px;
    background: var(--nv-red);
}

.nbc-vi-grand {
    margin: 34px 0 0;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: .02em;
    text-transform: uppercase;
    color: var(--nv-ink);
}

.nbc-vi-grand b {
    color: var(--nv-red);
}

/* ── Форма пароля на закрытой странице итогов ────────────
   (шорткод за паролем не рендерится — контейнера .nbc-vote нет,
   поэтому цвета literals, не переменные) */
body.nbc-vote-page .post-password-form {
    max-width: 460px;
    margin: 90px auto 160px;
    padding: 34px 28px 30px;
    background: #f7f0e4;
    border: 2px dashed #B83519;
    border-radius: 20px;
    font-family: 'Montserrat', Arial, sans-serif;
    text-align: center;
}

body.nbc-vote-page .post-password-form p {
    color: #2b1a12;
    font-size: 15px;
    line-height: 1.5;
}

body.nbc-vote-page .post-password-form input[type="password"] {
    padding: 11px 14px;
    border: 2px solid rgba(184, 53, 25, .4);
    border-radius: 12px;
    background: #fff;
    font: inherit;
    box-sizing: border-box;
}

body.nbc-vote-page .post-password-form input[type="password"]:focus {
    outline: none;
    border-color: #B83519;
}

body.nbc-vote-page .post-password-form input[type="submit"] {
    padding: 11px 24px;
    border: none;
    border-radius: 20px;
    background: #B83519;
    color: #f7f0e4;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    cursor: pointer;
}

body.nbc-vote-page .post-password-form input[type="submit"]:hover {
    background: #8f2812;
}

/* ── Адаптив ───────────────────────────────────────────── */

@media (max-width: 720px) {
    .nbc-vote {
        padding: 0 12px 40px;
    }

    /* Шапка предельно компактная: лого прижат к верху */
    .nbc-vote-head {
        padding: 8px 0 2px;
    }

    .nbc-vote-logo {
        margin-bottom: 6px;
    }

    .nbc-vote-logo img {
        height: clamp(64px, 18vw, 84px);
    }

    .nbc-vote-title {
        font-size: clamp(24px, 7vw, 34px);
    }

    /* Обе строки заголовка — одинаково, на 3px меньше «Голосования» */
    .nbc-vote .nbc-vote-title-top,
    .nbc-vote .nbc-vote-title-main {
        font-size: clamp(21px, 7vw, 31px);
    }

    .nbc-vote-title-main {
        margin-top: 1px;
    }

    .nbc-vote-note {
        font-size: 11.5px;
        line-height: 1.45;
    }

    /* Номинации — 2 плитки в ряд: все 4 варианта на одном экране */
    .nbc-vote-cats {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        margin-top: 16px;
    }

    .nbc-vote-cat-btn {
        min-height: 0;
        padding: 14px 10px 12px;
        gap: 6px;
    }

    .nbc-vote-cat-btn:hover,
    .nbc-vote-cat-btn:focus-visible {
        transform: none; /* тап на телефоне — без сдвига */
    }

    .nbc-vote-cat-btn .nbc-vote-cat-name {
        font-size: clamp(11px, 2.9vw, 13.5px);
        letter-spacing: .02em;
    }

    .nbc-vote-cat-btn .nbc-vote-cat-state {
        font-size: 10px;
    }

    .nbc-vote-alldone {
        margin: 16px auto 0;
        padding: 10px 16px;
        font-size: 12.5px;
    }

    /* Список заведений в модалке — в один столбец */
    .nbc-vote-list {
        grid-template-columns: 1fr;
    }

    .nbc-vote-modal-box {
        padding: 24px 16px 20px;
        max-height: 92vh;
    }

    .nbc-vi-cat {
        padding: 18px 14px 16px;
    }

    .nbc-vi-row {
        grid-template-columns: 30px 1fr 48px;
    }

    .nbc-vi-rank {
        width: 26px;
        height: 26px;
        font-size: 12px;
    }
}

/* Уважение к настройке «уменьшить движение» */
@media (prefers-reduced-motion: reduce) {
    .nbc-vote-modal,
    .nbc-vote-modal-box,
    .nbc-vote-cat-btn,
    .nbc-vote-submit {
        transition: none !important;
    }
}
