/*
 * Avalist Theme — base styles
 * Reset + типографіка + базові примітиви. Не визначає бренд-значення —
 * усі кольори/розміри беруться з --av-* токенів у av-tokens.css.
 */

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    -moz-tab-size: 4;
    tab-size: 4;
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    font-family: var(--av-font);
    font-size: var(--av-size-body);
    font-weight: var(--av-fw-regular);
    line-height: var(--av-lh-relaxed);
    color: var(--av-text-body);
    background: var(--av-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

img,
svg,
video,
canvas {
    display: block;
    max-width: 100%;
    height: auto;
}

a {
    color: var(--av-green);
    text-decoration: none;
    transition: color var(--av-duration-fast) var(--av-ease);
}

a:hover {
    color: var(--av-green-hover);
}

/* Підкреслення тільки у власне текстових контекстах (абзаци, списки, prose),
   не в інтерактивних блочках/картках. Картки мають свій hover у av-components.css. */
:where(p, li, blockquote, .av-prose, .av-foot-list, .av-footer-links) a:not([class*="btn"]):not([class*="-cta"]):not([role="button"]):hover {
    text-decoration: underline;
    text-underline-offset: 0.18em;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--av-green);
    outline-offset: 2px;
    border-radius: var(--av-radius-xs);
}

h1, h2, h3, h4, h5, h6 {
    font-weight: var(--av-fw-semibold);
    line-height: var(--av-lh-heading);
    color: var(--av-text);
    letter-spacing: var(--av-ls-heading);
}

h1 { font-size: var(--av-size-h1); }
h2 { font-size: var(--av-size-h2); }
h3 { font-size: var(--av-size-h3); }
h4 {
    font-size: var(--av-size-h4);
    font-weight: var(--av-fw-bold);
    letter-spacing: var(--av-ls-label);
    text-transform: uppercase;
}

p {
    margin: 0;
}

p + p {
    margin-top: var(--av-space-md);
}

small {
    font-size: var(--av-size-small);
    color: var(--av-text-muted);
}

ul, ol {
    list-style: none;
}

strong, b {
    font-weight: var(--av-fw-semibold);
    color: var(--av-text);
}

code, kbd, samp, pre {
    font-family: ui-monospace, 'Cascadia Mono', 'JetBrains Mono', Menlo, Consolas, monospace;
    font-size: 0.92em;
}

button {
    font-family: inherit;
    font-size: inherit;
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
}

input,
textarea,
select {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

/* ── Select — Avalist dark style (глобально для всіх сторінок теми) ── */
select {
    appearance: none;
    -webkit-appearance: none;
    padding: 8px 32px 8px 10px;
    background-color: var(--av-card-2);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 10'%3E%3Cpath d='M1 1l7 8 7-8' fill='none' stroke='%23ffffff' stroke-opacity='.4' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px;
    border: 1px solid var(--av-border);
    border-radius: var(--av-radius-sm);
    color: var(--av-text);
    font-family: var(--av-font);
    font-size: 13px;
    cursor: pointer;
    transition:
        border-color var(--av-duration-normal) var(--av-ease),
        box-shadow var(--av-duration-normal) var(--av-ease);
}

select:hover:not(:disabled) {
    border-color: var(--av-border-strong);
}

select:focus {
    outline: none;
    border-color: var(--av-green);
    box-shadow: 0 0 0 3px var(--av-green-soft);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 10'%3E%3Cpath d='M1 1l7 8 7-8' fill='none' stroke='%2373ae20' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

select option {
    background: var(--av-card);
    color: var(--av-text);
}

select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Non-home page main — centers at 1400px, same as header/footer */
#av-main {
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
}

/* Generic page content padding (index.php, search.php, etc.) */
.av-page-content {
    padding-top: var(--av-space-3xl);
    padding-bottom: var(--av-space-3xl);
}

/* Plugin SPA pages — no top padding (plugin renders its own hero) */
body:has(.sda-shell) .av-page-content,
body:has(.sda-img-shell) .av-page-content,
body:has(.ta-shell) .av-page-content,
body:has(.ave-cal-root) .av-page-content,
body:has(.ave-event-root) .av-page-content,
body:has(.av-kb-root) .av-page-content,
body:has(#docflow2-root) .av-page-content,
body:has(#av-support-root) .av-page-content,
body.avalist-rating-page .av-page-content,
body.avalist-profile-page .av-page-content,
body:has(#qrpga-app) .av-page-content {
    padding-top: 0;
    padding-bottom: 0;
}

body:has(#qrpga-app) .av-page-content > article > header {
    display: none;
}

body:has(#av-support-root) .av-page-content > article > header,
body.avalist-rating-page .av-page-content > article > header,
body.avalist-profile-page .av-page-content > article > header {
    display: none;
}

body:has(#av-support-root) .entry-content,
body.avalist-rating-page .entry-content,
body.avalist-profile-page .entry-content {
    max-width: none;
    margin: 0;
    padding: 0;
}

/* Full-bleed plugin shells must stay transparent so global ambient remains visible. */
body:has(#docflow2-root) #docflow2-root,
body:has(.sda-img-shell) .sda-img-shell,
body:has(.av-kb-root) .av-kb-root,
body.av-page-edit .sda-form--pdf-text .sda-panel--result,
body.av-page-edit .sda-form--pdf-text .sda-pdf-text-editor,
body.av-page-edit .sda-form--pdf-text .sda-pdf-text-main {
    background: transparent !important;
}

/* QR — add back top spacing (QR has no full-bleed hero like other plugins) */
body:has(#qrpga-app) .av-page-content {
    padding-top: 24px;
    padding-bottom: 24px;
}

/* Events — plugin renders its own prototype headers/subnav. */
body:has(.ave-events-shell) .av-page-content > article > header,
body:has(.ave-cal-root) .av-page-content > article > header {
    display: none;
}
body:has(.ave-events-shell) .entry-content {
    max-width: none;
    margin: 0;
    padding: 0;
}
body:has(.ave-events-shell) .av-page-content {
    max-width: none;
    padding-top: 0;
    padding-right: 0;
    padding-bottom: 0;
    padding-left: 0;
}
body:has(.ave-events-shell) {
    overflow-x: hidden;
}

/* Translator — aligned to 1400px grid, no floating card appearance */
body:has(.ta-shell) .ta-shell {
    width: 100%;
    max-width: none;
    margin: 0;
    padding-left: 0;
    padding-right: 0;
    padding-top: 28px;
    padding-bottom: 28px;
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    overflow: visible;
}

/* Container + skip link для accessibility (s. header.php використовує). */
.av-container {
    width: 100%;
    max-width: var(--av-container-max);
    margin-left: auto;
    margin-right: auto;
    padding-left: 28px;
    padding-right: 28px;
}

.av-skip-link {
    position: absolute;
    top: -100px;
    left: var(--av-space-base);
    z-index: var(--av-z-modal);
    padding: var(--av-space-sm) var(--av-space-base);
    background: var(--av-green);
    color: #fff;
    font-weight: var(--av-fw-semibold);
    border-radius: var(--av-radius-base);
}

.av-skip-link:focus {
    top: var(--av-space-base);
}

/* Hide visually but keep for screen readers. */
.av-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ══ FOOTER ══ */
.av-footer {
    background: var(--av-bg, #0b1a07);
    border-top: 1px solid var(--av-border, rgba(255,255,255,.08));
    color: rgba(255,255,255,.55);
    font-family: var(--av-font, 'Exo 2', sans-serif);
}
.av-foot-w {
    max-width: 1400px;
    margin: 0 auto;
    padding: 48px 28px 20px;
}
.av-foot-g {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 48px;
    margin-bottom: 24px;
}
/* Brand column */
.av-foot-brand-col {}
.av-foot-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.av-foot-brand img {
    height: 36px;
    width: 36px;
    object-fit: contain;
    border-radius: 50%;
    background: rgba(255,255,255,.08);
    padding: 3px;
    display: block;
}
.av-foot-org {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    letter-spacing: .01em;
}
.av-foot-desc {
    font-size: 14px;
    line-height: 1.7;
    margin-bottom: 14px;
    color: rgba(255,255,255,.6);
}
.av-foot-email {
    font-size: 14px;
    color: var(--av-green, #73AE20);
    text-decoration: none;
    font-weight: 600;
}
.av-foot-email:hover { text-decoration: underline; }

/* Nav columns */
.av-foot-nav {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
}
.av-foot-col-title,
.av-foot-col .av-footer-widget-title,
.av-foot-col .widgettitle {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: rgba(115,174,32,.75);
    margin-bottom: 14px;
    display: block;
}
.av-foot-menu,
.av-foot-col ul {
    list-style: none;
    margin: 0;
    padding: 0;
}
.av-foot-menu li,
.av-foot-col ul li { margin-bottom: 10px; }
.av-foot-menu a,
.av-foot-col ul li a {
    display: block;
    font-size: 14px;
    color: rgba(255,255,255,.55);
    text-decoration: none;
    font-weight: 400;
    transition: color .14s;
}
.av-foot-menu a:hover,
.av-foot-col ul li a:hover { color: var(--av-green, #73AE20); }
.av-foot-col--wide { grid-column: 1 / -1; }

/* Widget area wrappers */
.av-footer-widget { margin: 0; }

/* Bottom bar */
.av-foot-b {
    border-top: 1px solid rgba(255,255,255,.06);
    padding: 18px 28px;
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}
.av-foot-copy,
.av-foot-note {
    font-size: 13px;
    color: rgba(255,255,255,.35);
}
.av-foot-sep {
    color: rgba(255,255,255,.18);
    font-size: 13px;
}

/* Responsive */
@media (max-width: 900px) {
    .av-foot-g { grid-template-columns: 1fr; gap: 28px; }
    .av-foot-nav { grid-template-columns: repeat(2, 1fr); gap: 20px; }
}
@media (max-width: 600px) {
    .av-foot-nav { grid-template-columns: 1fr; gap: 16px; }
    .av-foot-b { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
