:root {
    --bg-color: #ffffff;
    --text-color: #333333;
    --header-bg: #f8f9fa;
    --header-border: #e5e5e5;
    --article-bg: #ffffff;
    --article-border: #e5e5e5;
    --article-hover-shadow: rgba(0, 0, 0, 0.1);
    --footer-bg: #f8f9fa;
    --footer-border: #e5e5e5;
    --link-color: #3498db;
    --placeholder-bg: #f5f5f5;
    --pagination-bg: #ffffff;
    --pagination-border: #e5e5e5;
    --pagination-current-bg: #333333;
    --pagination-current-color: #ffffff;
    --meta-color: #999999;
}

[data-theme="dark"] {
    --bg-color: #1a1a1a;
    --text-color: #ffffff;
    --header-bg: #2d2d2d;
    --header-border: #404040;
    --article-bg: #252525;
    --article-border: #404040;
    --article-hover-shadow: rgba(0, 0, 0, 0.5);
    --footer-bg: #2d2d2d;
    --footer-border: #404040;
    --link-color: #5dade2;
    --placeholder-bg: #333333;
    --pagination-bg: #252525;
    --pagination-border: #404040;
    --pagination-current-bg: #5dade2;
    --pagination-current-color: #ffffff;
    --meta-color: #ffffff;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.page-article .container {
    max-width: 900px;
}

header {
    background: var(--header-bg);
    border-bottom: 1px solid var(--header-border);
    padding: 30px 0;
    text-align: center;
    position: relative;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.logo {
    max-width: 200px;
    height: auto;
    margin: 0;
    transition: filter 0.3s ease;
}

[data-theme="dark"] .logo {
    filter: brightness(0) invert(1);
}

.header-brand {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
    text-decoration: none;
}

.header-tagline {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--text-color);
    text-transform: uppercase;
    line-height: 1;
    white-space: nowrap;
}

.theme-toggle-wrapper {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.theme-icon {
    width: 20px;
    height: 20px;
    color: var(--text-color);
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.theme-icon svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
}

.theme-toggle {
    position: relative;
    width: 50px;
    height: 30px;
    background: #ccc;
    border-radius: 15px;
    cursor: pointer;
    transition: background 0.3s ease;
    border: none;
    outline: none;
    padding: 0;
}

[data-theme="dark"] .theme-toggle {
    background: #4CAF50;
}

.theme-toggle::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 24px;
    height: 24px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .theme-toggle::before {
    transform: translateX(20px);
}

main {
    padding: 40px 0;
    min-height: 60vh;
}

footer {
    background: var(--footer-bg);
    border-top: 1px solid var(--footer-border);
    padding: 30px 0;
    margin-top: 60px;
    text-align: center;
    color: var(--text-color);
    font-size: 14px;
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

footer a {
    color: var(--link-color);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

footer i {
    font-style: italic;
}

.articles-list {
    display: grid;
    gap: 30px;
}

.article-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background: var(--placeholder-bg);
}

.article-link {
    display: block;
    width: 100%;
    height: 100%;
    position: relative;
    text-decoration: none;
    color: inherit;
}

.article-card {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: transform 0.5s ease;
}

.article-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0) 45%, rgba(0,0,0,0.95) 100%);
}

.article-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 18px 32px rgba(0,0,0,0.25);
}

.article-overlay {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 20px;
    color: #fff;
    z-index: 2;
}

.article-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 10px;
    line-height: 1.3;
}

.article-overlay .article-title {
    color: #fff;
}

.article-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    opacity: 0.85;
}

.article-overlay .article-meta {
    color: rgba(255,255,255,0.85);
}

.article-date {
    display: flex;
    align-items: center;
    gap: 6px;
}

.article-media-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 2;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    letter-spacing: 0.5px;
    background: rgba(0,0,0,0.65);
    color: #fff;
    backdrop-filter: blur(4px);
}

.article-item.no-media .article-card {
    background: linear-gradient(135deg, #1f1f1f, #3c3c3c);
}

.article-item.video-card .article-card::after {
    background: linear-gradient(180deg, rgba(0,0,0,0.25) 0%, rgba(0,0,0,0.95) 100%);
}

.play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.45);
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
    backdrop-filter: blur(4px);
    z-index: 2;
}

.play-icon::after {
    content: '';
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 12px 0 12px 18px;
    border-color: transparent transparent transparent white;
    margin-left: 6px;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-color);
    opacity: 0.8;
}

.page-home .articles-list {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

.page-home .article-item {
    grid-column: span 6;
    height: 320px;
}

.page-home .article-item.layout-half {
    grid-column: span 3;
}

.page-home .article-item.layout-third {
    grid-column: span 2;
}

.page-home .pagination {
    margin-top: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.page-home .pagination a,
.page-home .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--pagination-border);
    border-radius: 6px;
    text-decoration: none;
    color: var(--text-color);
    background: var(--pagination-bg);
    transition: all 0.3s ease;
    text-align: center;
    font-size: 14px;
}

.page-home .pagination a:not(.pagination-nav),
.page-home .pagination span.current {
    width: 40px;
    padding: 0;
}

.page-home .pagination-nav {
    width: auto;
    min-width: auto;
}

.page-home .pagination a:hover {
    background: var(--placeholder-bg);
    border-color: var(--pagination-border);
}

.page-home .pagination .current {
    background: var(--pagination-current-bg);
    color: var(--pagination-current-color);
    border-color: var(--pagination-current-bg);
}

.page-home .pagination .disabled {
    color: var(--text-color);
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.search-info {
    margin-bottom: 30px;
    padding: 20px;
    background: var(--placeholder-bg);
    border-radius: 8px;
    transition: background-color 0.3s ease;
}

.search-info h2 {
    font-size: 20px;
    margin-bottom: 10px;
    color: var(--text-color);
}

.hashtag {
    color: #3498db;
    font-weight: 600;
    text-decoration: none;
}

.hashtag:hover {
    text-decoration: underline;
}

.back-link {
    display: inline-block;
    margin-top: 30px;
    padding: 12px 24px;
    background: var(--placeholder-bg);
    color: var(--text-color);
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-size: 15px;
}

.back-link:hover {
    background: var(--article-border);
    transform: translateX(-3px);
}

.page-search .articles-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
}

.page-search .article-item {
    height: 280px;
}

.page-search .article-title {
    font-size: 18px;
    margin-bottom: 8px;
}

.page-search .article-meta {
    gap: 8px;
}

.page-article main {
    padding-bottom: 0;
}

.page-article .article-header {
    margin-bottom: 30px;
}

.page-article .article-title {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 15px;
    line-height: 1.3;
}

.page-article .article-meta {
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 14px;
    color: var(--meta-color);
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--article-border);
}

.article-image-container {
    margin-bottom: 30px;
    text-align: center;
}

.article-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.article-image-placeholder,
.article-video-placeholder {
    width: 100%;
    max-width: 600px;
    height: 400px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--meta-color);
    font-size: 16px;
    margin: 0 auto;
}

.article-image-placeholder {
    background: var(--placeholder-bg);
}

.article-video-placeholder {
    background: #34495e;
    color: #fff;
    text-align: center;
}

.article-video {
    width: 100%;
    max-width: 800px;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    margin: 0 auto;
    display: block;
}

.article-content {
    font-size: 18px;
    line-height: 1.8;
    color: var(--text-color);
    margin-bottom: 40px;
}

.article-content p {
    margin-bottom: 20px;
}

.article-actions {
    margin-top: 30px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.share-block {
    padding: 16px 20px;
    border: 1px solid var(--article-border);
    border-radius: 12px;
    background: var(--article-bg);
    min-width: 260px;
    margin-left: auto;
}

.article-actions .back-link {
    margin-top: 0;
}

.share-title {
    font-size: 12px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    margin-bottom: 16px;
    color: var(--meta-color);
}

.share-icons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.share-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    color: #ffffff;
    border: 1px solid #0a0a0a;
    background: #0f0f0f;
}

.share-icon svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

.share-icon:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.25);
    background: #1c1c1c;
}

.telegram-source {
    margin-top: 12px;
    font-size: 13px;
    color: var(--meta-color);
}

.telegram-source a {
    color: var(--link-color);
    text-decoration: none;
}

.telegram-source a:hover {
    text-decoration: underline;
}

.similar-articles {
    margin-top: 60px;
    padding-top: 40px;
    border-top: 2px solid var(--article-border);
}

.similar-articles h2 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 30px;
}

.similar-articles-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.similar-articles-list.single-item {
    grid-template-columns: 1fr;
    justify-items: start;
}

.similar-articles-list.single-item .similar-article-item {
    max-width: calc(33.333% - 14px);
}

.similar-article-item {
    background: var(--header-bg);
    border: 1px solid var(--article-border);
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    width: 100%;
}

.similar-article-item:hover {
    box-shadow: 0 4px 12px var(--article-hover-shadow);
    transform: translateY(-2px);
}

.similar-article-item a {
    display: block;
    text-decoration: none;
    color: inherit;
}

.similar-article-image,
.similar-article-image-placeholder {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.similar-article-image-placeholder {
    background: var(--placeholder-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-color);
    opacity: 0.6;
    font-size: 14px;
}

.similar-article-content {
    padding: 15px;
}

.similar-article-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 8px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.similar-article-meta {
    font-size: 12px;
    color: var(--text-color);
    opacity: 0.8;
}

@media (max-width: 1024px) {
    .page-home .articles-list,
    .page-search .articles-list {
        grid-template-columns: 1fr;
    }

    .page-home .article-item,
    .page-home .article-item.layout-half,
    .page-home .article-item.layout-third,
    .page-search .article-item {
        grid-column: span 1;
        height: 280px;
    }

    .page-article .similar-articles-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .page-home .pagination a,
    .page-home .pagination span {
        min-width: auto;
        height: 34px;
        padding: 0 12px;
        font-size: 13px;
    }

    .page-home .pagination a:not(.pagination-nav),
    .page-home .pagination span.current {
        width: 34px;
        padding: 0;
    }

    .page-home .pagination-nav {
        width: auto;
        min-width: auto;
        padding: 0 14px;
        font-size: 12px;
    }

    .header-brand {
        flex-direction: column;
    }

    .header-tagline {
        font-size: 20px;
        letter-spacing: 0.05em;
    }

    .page-article .article-title {
        font-size: 24px;
    }

    .page-article .article-content {
        font-size: 16px;
    }

    .page-article .similar-articles-list {
        grid-template-columns: 1fr;
    }

    .article-actions {
        flex-direction: column;
    }

    .share-block {
        width: 100%;
    }
}

@media (max-width: 640px) {
    .page-search .article-item {
        height: 230px;
    }

    .page-search .article-title {
        font-size: 16px;
    }
}

