/* ===== Базовые переменные ===== */
:root {
    --color-bg: #f7f8fa;
    --color-surface: #ffffff;
    --color-text: #1f2937;
    --color-text-muted: #6b7280;
    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-border: #e5e7eb;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.05);
    --container: 1200px;
    --transition: 0.25s ease;
}

/* ===== Сброс ===== */
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: var(--color-text);
    background: var(--color-bg);
    -webkit-font-smoothing: antialiased;
}
a { color: var(--color-primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--color-primary-hover); }
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3, h4 { line-height: 1.3; margin: 0 0 0.75em; }

/* ===== Контейнер ===== */
.container {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 20px;
}

/* ===== Шапка ===== */
.site-header {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    gap: 24px;
}
.site-logo {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-text);
    display: flex;
    align-items: center;
}
.site-logo img { height: 40px; width: auto; }

/* ===== Десктопное меню ===== */
.nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 8px;
}
.nav-link {
    display: block;
    padding: 8px 14px;
    color: var(--color-text);
    border-radius: var(--radius);
    font-weight: 500;
    transition: background var(--transition), color var(--transition);
}
.nav-link:hover {
    background: var(--color-bg);
    color: var(--color-primary);
}
.nav-item--active .nav-link {
    background: var(--color-primary);
    color: #fff;
}

/* ===== Бургер ===== */
.burger {
    display: none;
    width: 40px;
    height: 40px;
    padding: 8px;
    background: transparent;
    border: none;
    cursor: pointer;
    flex-direction: column;
    justify-content: space-around;
}
.burger span {
    display: block;
    height: 2px;
    background: var(--color-text);
    border-radius: 2px;
    transition: transform var(--transition), opacity var(--transition);
}
.burger.active span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.burger.active span:nth-child(2) { opacity: 0; }
.burger.active span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

/* ===== Хлебные крошки ===== */
.breadcrumbs {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 12px 0;
}
.breadcrumbs-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 14px;
}
.breadcrumbs-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--color-text-muted);
}
.breadcrumbs-item:not(:last-child)::after {
    content: "›";
    color: var(--color-text-muted);
}
.breadcrumbs-current { color: var(--color-text); font-weight: 500; }

/* ===== Основной контент ===== */
.site-main {
    padding: 40px 0;
    min-height: 60vh;
}
.page-header { margin-bottom: 32px; }
.page-title { font-size: 36px; margin: 0; }
.page-subtitle { color: var(--color-text-muted); font-size: 18px; margin: 0; }
.page-content {
    background: var(--color-surface);
    padding: 32px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

/* ===== "Шведская" адаптивная сетка (CSS Grid) ===== */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
    margin-top: 32px;
}
.card {
    background: var(--color-surface);
    padding: 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: transform var(--transition), box-shadow var(--transition);
}
.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}

/* ===== Подвал ===== */
.site-footer {
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    padding: 48px 0 24px;
    margin-top: 40px;
}
.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 32px;
    margin-bottom: 32px;
}
.footer-col h4 { margin-bottom: 12px; font-size: 16px; }
.footer-col p { margin: 4px 0; color: var(--color-text-muted); font-size: 14px; }
.footer-bottom {
    border-top: 1px solid var(--color-border);
    padding-top: 20px;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 14px;
}

/* ===== Кнопка ===== */
.btn {
    display: inline-block;
    padding: 12px 24px;
    background: var(--color-primary);
    color: #fff;
    border-radius: var(--radius);
    font-weight: 500;
    transition: background var(--transition);
}
.btn:hover { background: var(--color-primary-hover); color: #fff; }

/* ===== Страница ошибки ===== */
.error-page {
    text-align: center;
    padding: 80px 20px;
}
.error-code {
    font-size: 120px;
    font-weight: 800;
    color: var(--color-primary);
    line-height: 1;
    margin-bottom: 16px;
}

/* ===== АДАПТИВНОСТЬ ===== */
@media (max-width: 768px) {
    /* Показываем бургер */
    .burger { display: flex; }

    /* Мобильное меню */
    .site-nav {
        position: fixed;
        top: 73px;
        left: 0;
        right: 0;
        background: var(--color-surface);
        border-bottom: 1px solid var(--color-border);
        max-height: 0;
        overflow: hidden;
        transition: max-height var(--transition);
        box-shadow: var(--shadow);
    }
    .site-nav.open { max-height: 400px; }
    .nav-list {
        flex-direction: column;
        padding: 16px 20px;
        gap: 4px;
    }
    .nav-link { padding: 12px 16px; }

    .page-title { font-size: 28px; }
    .page-content { padding: 20px; }
    .error-code { font-size: 80px; }
}

/* ===== ШВЕДСКАЯ CSS GRID СЕТКА ===== */

/* Контейнер сетки */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin: 32px 0;
}

/* Карточка сетки */
.card {
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform var(--transition), box-shadow var(--transition);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

/* Изображение карточки */
.card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

/* Контент карточки */
.card-content {
    padding: 20px;
}

.card-title {
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 12px;
    color: var(--color-text);
}

.card-title a {
    color: inherit;
    text-decoration: none;
}

.card-title a:hover {
    color: var(--color-primary);
}

.card-text {
    color: var(--color-text-muted);
    font-size: 14px;
    line-height: 1.6;
    margin: 0 0 16px;
}

/* Кнопка в карточке */
.card-link {
    display: inline-block;
    padding: 8px 16px;
    background: var(--color-primary);
    color: #fff;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: background var(--transition);
}

.card-link:hover {
    background: var(--color-primary-hover);
    color: #fff;
}

/* Вариации сетки */
.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.grid-4 {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

/* Адаптивность */
@media (max-width: 768px) {
    .grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}