/* ============================================
   Глобальные стили
   ============================================ */

* {
    box-sizing: border-box;
}

ul,
ol {
    list-style: none;
    padding: 0;
}

body {
    margin: 0;
    font-family: 'Inter',
    'Segoe UI',
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    sans-serif;
    background: #f8fafc;
    color: #0f172a;
}

a {
    color: inherit;
    text-decoration: none;
}

/* ============================================
   Layout
   ============================================ */

.page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 24px;
    gap: 32px;
}

.content {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

/* Header & Footer */
.site-header,
.site-footer {
    flex-wrap: wrap;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 24px 32px;
    border-radius: 24px;
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.08);
}

.brand {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.brand-mark {
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.brand-caption {
    margin: 0;
    color: #475569;
    font-size: 0.9rem;
}

.site-nav {
    display: flex;
    gap: 18px;
    font-size: 0.95rem;
}

.site-nav a {
    padding: 8px 0;
    color: #475569;
}

.site-nav a:hover {
    color: #111827;
}

.site-nav a.active {
    font-weight: 600;
}

.search {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f1f5f9;
    border-radius: 999px;
    padding: 6px;
    border: 1px solid rgba(15, 23, 42, 0.08);
}

.search input {
    background: transparent;
    border: none;
    color: #0f172a;
    padding: 8px 12px;
    min-width: 220px;
}

.search input::placeholder {
    color: #94a3b8;
}

.search button {
    border: none;
    border-radius: 999px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    font-weight: 600;
    cursor: pointer;
}

.footer-links {
    display: flex;
    gap: 16px;
}

.footer-links a {
    color: #4338ca;
    font-weight: 500;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* ============================================
   Утилиты
   ============================================ */
.media-asset img {
    max-width: 100%;
    height: auto;
}

.pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    background: var(--bg, rgba(226, 232, 240, 0.8));
    color: #0f172a;
}

.pill-outline {
    border: 1px solid rgba(99, 102, 241, 0.4);
    background: transparent;
    color: #4338ca;
}

.pill.small {
    font-size: 0.7rem;
    padding: 3px 10px;
}

.muted {
    color: #64748b;
    font-size: 0.85rem;
}

.see-all {
    color: #4338ca;
    font-size: 0.85rem;
}

.back-link {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    font-size: 0.9rem;
    color: #4338ca;
    margin-bottom: 12px;
    text-decoration: none;
}

.meta {
    display: flex;
    gap: 12px;
    color: #64748b;
    font-size: 0.9rem;
    margin-top: 16px;
}

.description {
    color: #475569;
    line-height: 1.6;
}

.excerpt {
    margin: 0;
    color: #475569;
    line-height: 1.4;
}

/* Buttons */
.btn {
    border-radius: 999px;
    padding: 12px 26px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    transition: opacity 0.2s ease;
}

.load-more {
    display: flex;
}

.load-more-btn {
    margin: 0 auto;
    display: inline-flex;
    justify-content: center;
    min-width: 220px;
}

.btn.primary {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    display: inline-flex;
    justify-content: center;
}

.btn.ghost {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #e2e8f0;
}

/* Loader & Spinner */
.loader,
.empty {
    display: flex;
    gap: 12px;
    align-items: center;
    color: #475569;
}

.empty {
    justify-content: center;
}

.spinner {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid rgba(15, 23, 42, 0.2);
    border-top-color: #4338ca;
    animation: spin 0.6s linear infinite;
}

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

.empty-state {
    padding: 48px;
    text-align: center;
    border-radius: 24px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: #fff;
}

.empty-state a {
    color: #4338ca;
}

/* ============================================
   Главная страница
   ============================================ */

.hero {
    display: grid;
    grid-template-columns: 2fr 1.2fr;
    gap: 32px;
    padding: 40px;
    border-radius: 32px;
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    border: 1px solid rgba(15, 23, 42, 0.08);
}

.hero-main {
    display: flex;
    flex-direction: column;
    gap: 64px;
}

.hero-media {
    display: block;
    width: 100%;
    border-radius: 24px;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    background: rgba(15, 23, 42, 0.08);
}

.hero-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.hero-feature + .hero-feature {
    display: none;
}

.hero-feature h1 {
    font-size: clamp(1.6rem, 2.5vw, 2.4rem);
    margin: 12px 0;
}

.hero-feature .lead {
    color: #475569;
    font-size: 1.05rem;
    line-height: 1.6;
}

.hero-bullets {
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.hero-bullet {
    display: flex;
    gap: 8px;
    color: #475569;
    align-items: center;
}

.hero-side {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.side-heading h2 {
    margin: 4px 0 0;
}

.highlight-stack {
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 24px;
    background: #fff;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.04);
    overflow: hidden;
    list-style: none;
    margin: 0;
    padding: 0;
}

.highlight-card {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    background: transparent;
    border-radius: 0;
    box-shadow: none;
}

.highlight-card:last-child {
    border-bottom: none;
}

.highlight-card h3 {
    margin: 12px 0 8px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
}

.category-card {
    padding: 28px;
    border-radius: 28px;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.08);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.category-lead h3 {
    margin: 0 0 8px;
    font-size: 1.2rem;
}

.category-lead p {
    margin: 0 0 12px;
    color: #475569;
}

.category-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.category-list li {
    padding-top: 12px;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
}

/* ============================================
   Страница поиска
   ============================================ */

.search-page {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.search-header h1 {
    margin: 6px 0;
}

.search-results {
    display: block;
}

.search-results ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.search-item {
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 16px;
    background: #fff;
    transition: border-color 0.2s ease,
    box-shadow 0.2s ease;
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.04);
}

.search-item:hover {
    border-color: rgba(15, 23, 42, 0.2);
    box-shadow: 0 16px 32px rgba(15, 23, 42, 0.08);
}

.search-item a {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 20px;
    color: inherit;
    text-decoration: none;
}

.item-main h3 {
    margin: 0 0 6px;
    font-size: 1.05rem;
}

.item-main p {
    margin: 0;
    color: #475569;
}

.item-meta {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 6px;
    color: #64748b;
    font-size: 0.85rem;
    text-align: right;
}

/* ============================================
   Страница статьи
   ============================================ */

.article-header {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 32px;
    padding: 40px;
    border-radius: 32px;
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    border: 1px solid rgba(15, 23, 42, 0.08);
}

.header-text h1 {
    margin: 12px 0;
    font-size: clamp(1.9rem, 3vw, 2.8rem);
}

.header-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 24px;
}

.article-body {
    margin-top: 32px;
}

.read-more {
    color: #4338ca;
    font-size: 0.85rem;
}

/* ============================================
   Страница категории
   ============================================ */

.category-page {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.category-hero {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 32px;
    padding: 40px;
    border-radius: 32px;
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    border: 1px solid rgba(15, 23, 42, 0.08);
}

.hero-copy h1 {
    margin: 8px 0 12px;
    font-size: clamp(1.8rem, 3vw, 2.6rem);
}

.hero-copy .lead {
    color: #475569;
    line-height: 1.5;
}

.hero-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 24px;
}

.hero-copy .btn {
    margin-top: 16px;
}

.article-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 24px;
}

.article-card {
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.9);
    overflow: hidden;
    transition: transform 0.2s ease,
    border-color 0.2s ease;
}

.article-card:hover {
    transform: translateY(-4px);
    border-color: rgba(15, 23, 42, 0.2);
}

.article-card a {
    display: flex;
    flex-direction: column;
    height: 100%;
    color: inherit;
    text-decoration: none;
}

.cover img {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.card-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.card-body h3 {
    margin: 0;
    font-size: 1.1rem;
}

/* ============================================
   Страница ошибки
   ============================================ */

.error {
    width: 100%;
    min-height: 70vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    padding: 40px 0 80px;
    background: #f7f8fb;
}

.error .panel {
    width: min(840px, 100%);
    padding: 48px;
    border-radius: 32px;
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 25px 60px rgba(15, 23, 42, 0.12);
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 32px;
    color: #0f172a;
}

.error .badge {
    align-self: flex-start;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: rgba(15, 23, 42, 0.08);
    color: #0f172a;
}

.error .heading h1 {
    margin: 6px 0;
    font-size: clamp(3rem, 15vw, 6rem);
    color: #0f172a;
}

.error .lead {
    color: #475569;
    font-size: 1.1rem;
}

.error .grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.error .card {
    padding: 24px;
    border-radius: 20px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: rgba(15, 23, 42, 0.04);
    color: #0f172a;
}

.error .card ul {
    margin: 12px 0 0;
    padding-left: 20px;
    color: #475569;
    line-height: 1.6;
}

.error .actions {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.error .btn {
    border-radius: 999px;
    padding: 12px 26px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    transition: opacity 0.2s ease;
    background: #2563eb;
    color: #ffffff;
}

.error .btn.secondary {
    background: #e2e8f0;
    color: #0f172a;
}

.error .btn:hover {
    opacity: 0.85;
}

.error .glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    z-index: 0;
}

.error .glow-1 {
    width: 320px;
    height: 320px;
    background: rgba(37, 99, 235, 0.15);
    top: 0;
    left: 10%;
}

.error .glow-2 {
    width: 280px;
    height: 280px;
    background: rgba(59, 130, 246, 0.12);
    bottom: 10%;
    right: 5%;
}

/* ============================================
   Блоки контента
   ============================================ */

.blocks-stack {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.rich-text-block {
    padding: 28px;
    border-radius: 20px;
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.08);
    line-height: 1.7;
    color: #0f172a;
}

.rich-text-block h1,
.rich-text-block h2,
.rich-text-block h3 {
    margin: 16px 0 8px;
}

.rich-text-block code {
    background: rgba(99, 102, 241, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
}

.placeholder-block {
    padding: 32px;
    border-radius: 20px;
    border: 1px dashed rgba(15, 23, 42, 0.2);
    color: #475569;
    text-align: center;
    background: rgba(248, 250, 252, 0.8);
}

/* ============================================
   Медиа-запросы
   ============================================ */

@media (max-width: 1200px) {
    .grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .site-header,
    .site-footer {
        flex-direction: column;
        align-items: flex-start;
    }

    .hero {
        grid-template-columns: 1fr;
    }

    .grid {
        grid-template-columns: 1fr;
    }

    .error .panel {
        padding: 32px;
    }

    .error .grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .search-item a {
        flex-direction: column;
    }

    .item-meta {
        flex-direction: row;
        justify-content: flex-start;
        text-align: left;
    }
}

@media (max-width: 600px) {
    .site-nav {
        flex-wrap: wrap;
    }

    .hero {
        padding: 24px;
    }

    .category-card {
        padding: 20px;
    }

    .article-header {
        padding: 28px;
    }

    .category-hero {
        padding: 24px;
    }

    .error .panel {
        padding: 24px;
        border-radius: 24px;
    }
}
