/*
 Theme Name:   WikiNews Theme
 Theme URI:    https://wikinews.online
 Description:  Professional Ukrainian news portal theme with breaking news ticker, category grid, trending sidebar, dark mode
 Author:       WikiNews
 Version:      1.0.0
 Text Domain:  wikinews-theme
 License:      GPL v2 or later
*/

/* ─── Reset & Base ─── */
:root {
    --wn-primary: #d32f2f;
    --wn-primary-dark: #b71c1c;
    --wn-accent: #1565c0;
    --wn-dark: #1a1a2e;
    --wn-gray: #f5f5f5;
    --wn-text: #212121;
    --wn-text-secondary: #757575;
    --wn-border: #e0e0e0;
    --wn-white: #ffffff;
    --wn-shadow: 0 2px 8px rgba(0,0,0,.08);
    --wn-radius: 8px;
    --wn-max-width: 1280px;
    --wn-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
[data-theme="dark"] {
    --wn-dark: #0d1117;
    --wn-gray: #161b22;
    --wn-text: #e6edf3;
    --wn-text-secondary: #8b949e;
    --wn-border: #30363d;
    --wn-white: #0d1117;
    --wn-shadow: 0 2px 8px rgba(0,0,0,.3);
}

* { box-sizing: border-box; }

body {
    font-family: var(--wn-font);
    color: var(--wn-text);
    background: var(--wn-gray);
    margin: 0;
    line-height: 1.6;
}

a { color: var(--wn-accent); text-decoration: none; transition: color .2s; }
a:hover { color: var(--wn-primary); }

img { max-width: 100%; height: auto; }

.wn-container {
    max-width: var(--wn-max-width);
    margin: 0 auto;
    padding: 0 20px;
}

/* ─── Header ─── */
.wn-header {
    background: var(--wn-dark);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,.2);
}
.wn-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    max-width: var(--wn-max-width);
    margin: 0 auto;
}
.wn-logo {
    font-size: 28px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -1px;
}
.wn-logo span { color: var(--wn-primary); }

.wn-nav {
    display: flex;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
}
.wn-nav a {
    color: rgba(255,255,255,.85);
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: all .2s;
}
.wn-nav a:hover, .wn-nav a.current { background: rgba(255,255,255,.1); color: #fff; }

.wn-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}
.wn-search-toggle, .wn-dark-toggle {
    background: none;
    border: none;
    color: rgba(255,255,255,.7);
    cursor: pointer;
    font-size: 20px;
    padding: 6px;
    border-radius: 50%;
    transition: all .2s;
}
.wn-search-toggle:hover, .wn-dark-toggle:hover {
    color: #fff;
    background: rgba(255,255,255,.1);
}

/* ─── Mobile menu ─── */
.wn-menu-toggle { display: none; background: none; border: none; color: #fff; font-size: 24px; cursor: pointer; padding: 6px; }
@media (max-width: 768px) {
    .wn-menu-toggle { display: block; }
    .wn-nav { display: none; flex-direction: column; position: absolute; top: 100%; left: 0; right: 0; background: var(--wn-dark); padding: 10px; }
    .wn-nav.active { display: flex; }
}

/* ─── Search overlay ─── */
.wn-search-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.8);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}
.wn-search-overlay.active { display: flex; }
.wn-search-overlay form {
    width: 90%;
    max-width: 600px;
}
.wn-search-overlay input {
    width: 100%;
    padding: 18px 24px;
    font-size: 20px;
    border: none;
    border-radius: 12px;
    outline: none;
}
.wn-search-close {
    position: absolute;
    top: 30px;
    right: 30px;
    background: none;
    border: none;
    color: #fff;
    font-size: 36px;
    cursor: pointer;
}

/* ─── Breaking News Ticker ─── */
.wn-ticker {
    background: var(--wn-primary);
    color: #fff;
    padding: 8px 0;
    font-size: 13px;
    font-weight: 600;
    overflow: hidden;
    white-space: nowrap;
}
.wn-ticker-inner {
    display: flex;
    align-items: center;
    max-width: var(--wn-max-width);
    margin: 0 auto;
    padding: 0 20px;
}
.wn-ticker-label {
    background: #fff;
    color: var(--wn-primary);
    padding: 3px 12px;
    border-radius: 4px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-right: 16px;
    flex-shrink: 0;
}
.wn-ticker-track {
    overflow: hidden;
    flex: 1;
    position: relative;
}
.wn-ticker-items {
    display: flex;
    animation: ticker-scroll 30s linear infinite;
    gap: 60px;
}
.wn-ticker-items a { color: #fff; }
@keyframes ticker-scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* ─── Main Content Layout ─── */
.wn-main {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 30px;
    padding: 30px 0;
}
@media (max-width: 960px) {
    .wn-main { grid-template-columns: 1fr; }
}

/* ─── Hero / Featured Post ─── */
.wn-hero {
    position: relative;
    border-radius: var(--wn-radius);
    overflow: hidden;
    margin-bottom: 30px;
    background: var(--wn-dark);
    min-height: 400px;
}
.wn-hero img {
    width: 100%;
    height: 400px;
    object-fit: cover;
    display: block;
}
.wn-hero-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 40px 30px 30px;
    background: linear-gradient(transparent, rgba(0,0,0,.85));
    color: #fff;
}
.wn-hero-cat {
    display: inline-block;
    background: var(--wn-primary);
    color: #fff;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 10px;
}
.wn-hero h2 {
    font-size: 28px;
    line-height: 1.3;
    margin: 0 0 8px;
}
.wn-hero h2 a { color: #fff; }
.wn-hero-meta {
    font-size: 13px;
    color: rgba(255,255,255,.7);
}

/* ─── Post Cards Grid ─── */
.wn-posts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}
@media (max-width: 600px) {
    .wn-posts-grid { grid-template-columns: 1fr; }
}

.wn-card {
    background: var(--wn-white);
    border-radius: var(--wn-radius);
    overflow: hidden;
    box-shadow: var(--wn-shadow);
    transition: transform .2s, box-shadow .2s;
}
.wn-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,.12);
}
.wn-card-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}
.wn-card-body { padding: 16px 20px 20px; }
.wn-card-cat {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--wn-primary);
    margin-bottom: 6px;
}
.wn-card h3 {
    font-size: 17px;
    line-height: 1.4;
    margin: 0 0 8px;
}
.wn-card h3 a { color: var(--wn-text); }
.wn-card h3 a:hover { color: var(--wn-primary); }
.wn-card-excerpt {
    font-size: 14px;
    color: var(--wn-text-secondary);
    line-height: 1.5;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.wn-card-meta {
    font-size: 12px;
    color: var(--wn-text-secondary);
    display: flex;
    gap: 12px;
}

/* ─── Sidebar ─── */
.wn-sidebar {}
.wn-widget {
    background: var(--wn-white);
    border-radius: var(--wn-radius);
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: var(--wn-shadow);
}
.wn-widget-title {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--wn-primary);
}

/* Trending widget */
.wn-trending-list {
    list-style: none;
    margin: 0;
    padding: 0;
    counter-reset: trending;
}
.wn-trending-item {
    counter-increment: trending;
    display: flex;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--wn-border);
}
.wn-trending-item:last-child { border-bottom: none; }
.wn-trending-item::before {
    content: counter(trending);
    font-size: 24px;
    font-weight: 800;
    color: var(--wn-primary);
    opacity: .3;
    min-width: 30px;
}
.wn-trending-item a {
    font-size: 14px;
    font-weight: 600;
    color: var(--wn-text);
    line-height: 1.4;
}
.wn-trending-item a:hover { color: var(--wn-primary); }
.wn-trending-date {
    font-size: 12px;
    color: var(--wn-text-secondary);
    margin-top: 4px;
}

/* Categories widget */
.wn-cat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.wn-cat-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: var(--wn-gray);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--wn-text);
    transition: all .2s;
}
.wn-cat-link:hover {
    background: var(--wn-primary);
    color: #fff;
}
.wn-cat-count {
    background: rgba(0,0,0,.06);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
}

/* Newsletter widget */
.wn-newsletter-form input[type="email"] {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--wn-border);
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 10px;
    background: var(--wn-white);
    color: var(--wn-text);
}
.wn-newsletter-form button {
    width: 100%;
    padding: 10px;
    background: var(--wn-primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s;
}
.wn-newsletter-form button:hover { background: var(--wn-primary-dark); }

/* ─── Single Article ─── */
.wn-article {
    background: var(--wn-white);
    border-radius: var(--wn-radius);
    padding: 30px 40px 40px;
    box-shadow: var(--wn-shadow);
}
@media (max-width: 600px) { .wn-article { padding: 20px; } }
.wn-article-header { margin-bottom: 24px; }
.wn-article-header .wn-card-cat { margin-bottom: 10px; }
.wn-article h1 {
    font-size: 32px;
    line-height: 1.25;
    margin: 0 0 16px;
}
.wn-article-meta {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--wn-text-secondary);
    flex-wrap: wrap;
}
.wn-article-content {
    font-size: 17px;
    line-height: 1.8;
}
.wn-article-content p { margin: 0 0 16px; }
.wn-article-content h2 { font-size: 22px; margin: 32px 0 12px; }
.wn-article-content blockquote {
    border-left: 4px solid var(--wn-primary);
    padding: 12px 20px;
    margin: 16px 0;
    background: var(--wn-gray);
    border-radius: 0 var(--wn-radius) var(--wn-radius) 0;
}
.wn-article-content img {
    border-radius: var(--wn-radius);
    margin: 16px 0;
}

/* Tags */
.wn-tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0; }
.wn-tag {
    padding: 4px 12px;
    background: var(--wn-gray);
    border-radius: 20px;
    font-size: 13px;
    color: var(--wn-text-secondary);
    transition: all .2s;
}
.wn-tag:hover { background: var(--wn-primary); color: #fff; }

/* Share buttons */
.wn-share {
    display: flex;
    gap: 10px;
    margin: 24px 0;
    padding-top: 20px;
    border-top: 1px solid var(--wn-border);
}
.wn-share-btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: opacity .2s;
}
.wn-share-btn:hover { opacity: .85; color: #fff; }
.wn-share-telegram { background: #0088cc; }
.wn-share-twitter { background: #1da1f2; }
.wn-share-facebook { background: #1877f2; }

/* Related articles */
.wn-related {
    margin-top: 40px;
}
.wn-related h3 {
    font-size: 20px;
    margin: 0 0 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--wn-primary);
}
.wn-related-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}
@media (max-width: 768px) {
    .wn-related-grid { grid-template-columns: 1fr; }
}

/* ─── Pagination ─── */
.wn-pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin: 30px 0;
}
.wn-pagination a, .wn-pagination span {
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
}
.wn-pagination a {
    background: var(--wn-white);
    color: var(--wn-text);
    box-shadow: var(--wn-shadow);
}
.wn-pagination a:hover { background: var(--wn-primary); color: #fff; }
.wn-pagination .current {
    background: var(--wn-primary);
    color: #fff;
}

/* ─── Footer ─── */
.wn-footer {
    background: var(--wn-dark);
    color: rgba(255,255,255,.7);
    padding: 40px 0 20px;
    margin-top: 40px;
}
.wn-footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 30px;
    max-width: var(--wn-max-width);
    margin: 0 auto;
    padding: 0 20px;
}
@media (max-width: 768px) {
    .wn-footer-grid { grid-template-columns: 1fr 1fr; }
}
.wn-footer h4 {
    color: #fff;
    font-size: 16px;
    margin: 0 0 16px;
}
.wn-footer p { font-size: 14px; line-height: 1.7; }
.wn-footer ul { list-style: none; margin: 0; padding: 0; }
.wn-footer li { margin-bottom: 8px; }
.wn-footer a { color: rgba(255,255,255,.7); font-size: 14px; }
.wn-footer a:hover { color: #fff; }
.wn-footer-bottom {
    border-top: 1px solid rgba(255,255,255,.1);
    padding: 20px 0 0;
    margin-top: 30px;
    text-align: center;
    font-size: 13px;
    max-width: var(--wn-max-width);
    margin: 30px auto 0;
    padding: 20px 20px 0;
}
