/* Загальні змінні (Світла/Темна тема) */
:root {
    color-scheme: light dark;
    --bg-base: light-dark(#f8fafc, #0f172a);
    --bg-surface: light-dark(#ffffff, #1e293b);
    --text-main: light-dark(#0f172a, #f1f5f9);
    --text-muted: light-dark(#475569, #94a3b8);
    --accent: light-dark(#2563eb, #3b82f6);
    --mountain: light-dark(#166534, #22c55e);
    --border: light-dark(#e2e8f0, #334155);
    --shadow: light-dark(rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.3));
}

/* Базові стилі */
body {
    font-family: system-ui, -apple-system, sans-serif;
    background-color: var(--bg-base);
    color: var(--text-main);
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    line-height: 1.6;
}

footer {
    background-color: var(--bg-surface);
    border-top: 1px solid var(--border);
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    margin-top: auto;
}

/* Анімація завантаження */
#loader {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem;
    color: var(--accent);
    gap: 1rem;
    font-weight: 500;
    text-align: center;
    font-size: 1.2rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin { 
    to { transform: rotate(360deg); } 
}

/* ===== СТИЛІ ГОЛОВНОЇ СТОРІНКИ (index.html) ===== */
.home-header {
    background: linear-gradient(135deg, var(--bg-surface) 0%, var(--bg-base) 100%);
    border-bottom: 1px solid var(--border);
    padding: 4rem 1rem;
    text-align: center;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.home-header .radio-waves {
    position: absolute;
    bottom: -50px;
    width: 100%;
    height: 200px;
    opacity: 0.03;
    pointer-events: none;
    background-image: repeating-radial-gradient(circle at 50% 100%, transparent, transparent 20px, var(--accent) 21px, var(--accent) 22px);
}

.home-header .badge {
    background-color: var(--mountain);
    color: white;
    padding: 0.25rem 1rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1.5rem;
    z-index: 1;
}

.home-header h1 {
    margin: 0;
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800;
    letter-spacing: -0.05em;
    display: flex;
    align-items: center;
    gap: 1rem;
    z-index: 1;
}

.home-header h1 svg {
    width: 48px;
    height: 48px;
    fill: none;
    stroke: var(--accent);
}

.home-header p {
    font-size: 1.2rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 1rem auto 0;
    z-index: 1;
}

.main-home {
    flex: 1;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem 3rem 1rem;
    box-sizing: border-box;
}

.nav-container {
    display: flex;
    gap: 0.75rem;
    padding: 0 0 1.5rem 0;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.nav-container::-webkit-scrollbar {
    display: none;
}

.nav-item {
    background-color: var(--bg-surface);
    color: var(--text-muted);
    border: 1px solid var(--border);
    padding: 0.5rem 1.25rem;
    border-radius: 9999px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    font-family: inherit;
}

.nav-item:hover {
    border-color: var(--accent);
    color: var(--text-main);
}

.nav-item.active {
    background-color: var(--accent);
    color: white;
    border-color: var(--accent);
}

.section-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
}

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

#content article {
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px var(--shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#content article:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 20px var(--shadow);
    border-color: var(--accent);
}

#content article .cover-image {
    width: calc(100% + 3rem);
    margin: -1.5rem -1.5rem 1.5rem -1.5rem;
    height: auto; 
    max-height: 400px; 
    object-fit: contain;
    border-bottom: 1px solid var(--border);
    background-color: var(--bg-base);
}

#content article h2 {
    color: var(--text-main);
    margin: 0 0 0.5rem 0;
    font-size: 1.25rem;
}

#content article .meta {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#content article .body {
    flex-grow: 1;
    color: var(--text-muted);
}

/* ===== СТИЛІ СТОРІНКИ СТАТТІ (article.html) ===== */
.article-header {
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    padding: 1rem;
    text-align: center;
}

.article-header a {
    color: var(--text-main);
    text-decoration: none;
    font-weight: bold;
    font-size: 1.25rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.main-article {
    flex: 1;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem 4rem 1rem;
    box-sizing: border-box;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    text-decoration: none;
    margin-bottom: 2rem;
    font-weight: 500;
    transition: color 0.2s;
}

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

#article-container article .cover-image {
    width: 100%;
    height: auto;
    max-height: 500px;
    object-fit: cover;
    border-radius: 16px;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px var(--shadow);
}

#article-container h1 {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    margin: 0 0 1rem 0;
    line-height: 1.2;
}

#article-container .meta {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 1rem;
}

.category-badge {
    background-color: var(--accent);
    color: white;
    padding: 0.1rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.content {
    font-size: 1.1rem;
    color: var(--text-main);
}

.content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1rem 0;
}

.content p {
    margin-bottom: 1.5rem;
}