/* ============================================================
   Vileri — спільний дизайн (єдина палітра для всього сайту)
   ============================================================ */

:root {
    /* Палітра "Modern Deep Night" */
    --bg: #0b0f1a;
    --surface: #161e2d;
    --surface-hover: #1e293b;
    --accent: #38bdf8;
    --accent-2: #818cf8;
    --accent-glow: rgba(56, 189, 248, 0.3);
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.08);
    --radius: 16px;
    --ok: #4ade80;
    --danger: #fb7185;
    --warning: #fbbf24;
    --font-main: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* Тема високої контрастності — доступна на всіх сторінках */
[data-theme="high-contrast"] {
    --bg: #000000;
    --surface: #000000;
    --surface-hover: #000000;
    --text: #ffff00;
    --accent: #ffffff;
    --accent-2: #ffffff;
    --border: #ffff00;
    --text-muted: #ffff00;
    --accent-glow: transparent;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font-main);
    background:
        radial-gradient(circle at 12% 0%, rgba(56, 189, 248, 0.14), transparent 30rem),
        radial-gradient(circle at 88% 8%, rgba(129, 140, 248, 0.12), transparent 34rem),
        linear-gradient(180deg, #0b0f1a 0%, #080c15 100%);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
}

[data-theme="high-contrast"] body {
    background: #000;
}

a { color: var(--accent); }

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 4px solid var(--accent);
    outline-offset: 4px;
    border-radius: 4px;
}

.skip-link {
    position: absolute;
    top: -100px;
    left: 10px;
    background: var(--accent);
    color: #000;
    padding: 1rem;
    z-index: 1000;
    text-decoration: none;
    font-weight: bold;
}

.skip-link:focus { top: 10px; }

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* --- Верхня панель і шапка --- */
.top-bar {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-bottom: 1rem;
    padding-top: 1rem;
}

.theme-toggle {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 700;
    font-family: var(--font-main);
}

.theme-toggle:hover { background: var(--surface-hover); }

.site-brand { text-align: center; padding: 2rem 0 1.5rem; }

.site-brand h1 {
    margin: 0;
    font-size: clamp(2rem, 6vw, 2.8rem);
    font-weight: 900;
    letter-spacing: 0.01em;
}

.site-brand h1 a {
    color: var(--text);
    text-decoration: none;
}

.site-brand .tagline {
    margin: 0.5rem auto 0;
    max-width: 760px;
    color: var(--text-muted);
}

/* --- Навігація --- */
nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(11, 15, 26, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    border-top: 1px solid var(--border);
}

[data-theme="high-contrast"] nav { background: #000; }

nav ul {
    display: flex;
    gap: 10px;
    justify-content: center;
    list-style: none;
    padding: 0;
    margin: 0;
    flex-wrap: wrap;
}

nav a {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 12px;
    color: var(--text);
    font-weight: 600;
    text-decoration: none;
}

nav a:hover,
nav a[aria-current="page"] {
    background: var(--surface);
    color: var(--accent);
}

/* --- Основний контент --- */
main {
    padding: 3rem 0;
    min-height: 50vh;
}

main h1 {
    font-size: clamp(1.8rem, 4vw, 2.4rem);
    margin: 0 0 1.2rem;
}

main h2 { font-size: clamp(1.3rem, 3vw, 1.6rem); margin: 1.6rem 0 0.8rem; }
main h3 { font-size: 1.2rem; margin: 1.3rem 0 0.6rem; }

.section-title { margin: 0 0 1.5rem; font-size: clamp(1.6rem, 4vw, 2rem); }

.lead { font-size: 1.08rem; color: var(--text-muted); }

.card {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.01)),
        var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    position: relative;
    overflow: hidden;
}

.card + .card { margin-top: 1.5rem; }

.notice {
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.02);
}

.small { color: var(--text-muted); font-size: 0.95rem; }

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
}

.grid .card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 220px;
    margin-top: 0;
}

.grid .card:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
    box-shadow: 0 18px 55px rgba(0, 0, 0, 0.34);
}

.grid .card > * { position: relative; z-index: 1; }

.grid .card h2, .grid .card h3 { margin-top: 0; }

.grid .card p { color: var(--text-muted); flex-grow: 1; }

/* --- Кнопки --- */
.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
    margin-top: 1rem;
}

.cta-btn,
.secondary-btn {
    text-align: center;
    padding: 12px 14px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    font-family: var(--font-main);
}

.cta-btn {
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    color: #020617;
    flex: 1 1 190px;
    box-shadow: 0 10px 26px rgba(56, 189, 248, 0.22);
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    border: 1px solid var(--border);
    flex: 1 1 150px;
}

.cta-btn:hover, .secondary-btn:hover { filter: brightness(1.05); text-decoration: none; }

[data-theme="high-contrast"] .cta-btn {
    background: var(--accent);
    color: #000;
    box-shadow: none;
}

/* --- Широкий блок --- */
.wide-section {
    margin-top: 4rem;
    padding: 3rem;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01)),
        var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: 0 14px 45px rgba(0, 0, 0, 0.22);
}

.wide-section h2 { margin-top: 0; }
.wide-section p { color: var(--text-muted); }

/* --- Списки --- */
main ul { padding-left: 1.3rem; }
main li { margin: 0.35rem 0; }

/* --- Підвал --- */
footer {
    padding: 4rem 0;
    border-top: 1px solid var(--border);
    text-align: center;
    background: #070a13;
    color: var(--text-muted);
}

[data-theme="high-contrast"] footer { background: #000; }

.footer-links,
.social-links {
    margin: 1.5rem 0 0;
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    padding: 0;
    list-style: none;
}

.footer-links a,
.social-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 700;
}

.footer-links a:hover,
.social-links a:hover { color: var(--accent); }

.social-links a {
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.03);
}

.made-in { margin-top: 2rem; font-size: 0.85rem; }

/* --- Адаптив --- */
@media (max-width: 600px) {
    .grid { grid-template-columns: 1fr; }
    .wide-section { padding: 2rem; }
    .top-bar { justify-content: center; }
    .cta-btn, .secondary-btn { width: 100%; }
    main { padding: 2rem 0; }
}

/* --- Зменшений рух --- */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { transition: none !important; }
    .grid .card:hover { transform: none; }
}
