/* ============================================================
   Информационный портал для агентов компании — публичная часть
   ============================================================ */

:root {
    --primary: #ea580c;
    --primary-dark: #c2410c;
    --ink: #292524;
    --muted: #78716c;
    --line: #e7e5e4;
    --bg: #fbf6f1;
    --card: #ffffff;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .06);
    --shadow-hover: 0 6px 16px rgba(15, 23, 42, .12), 0 16px 40px rgba(15, 23, 42, .12);
    --maxw: 1180px;
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--ink);
    background: var(--bg);
    line-height: 1.6;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
img { display: block; max-width: 100%; }

.container {
    width: 100%;
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 0 20px;
}

.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0);
    white-space: nowrap; border: 0;
}

/* ---------- Шапка ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--line);
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 24px;
    height: 66px;
}

.brand {
    display: inline-flex;
    align-items: flex-start;
    gap: 0;
    font-weight: 700;
    color: var(--ink);
    white-space: nowrap;
}
.brand:hover { color: var(--ink); }

.brand-mark {
    display: grid;
    place-items: center;
    width: 38px; height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, #fb923c, #ea580c);
    color: #fff;
    font-size: 20px;
    font-weight: 800;
    box-shadow: 0 4px 12px rgba(234, 88, 12, .30);
}
.brand-mark.small { width: 30px; height: 30px; font-size: 16px; border-radius: 8px; }

.brand-name { font-size: 18px; letter-spacing: -.01em; }

/* Логотип компании (внешняя SVG-ссылка) */
.brand-logo { height: 34px; width: auto; display: block; }
.brand-logo.small { height: 26px; }

.brand-tagline {
    font-size: 12px;
    font-weight: 400;
    color: var(--muted, #78716c);
    line-height: 1.2;
    margin-top: 4px;
    margin-left:6px;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    flex-wrap: wrap;
}
.main-nav a {
    color: var(--muted);
    font-weight: 500;
    padding: 8px 12px;
    border-radius: 8px;
    transition: color .15s, background .15s;
}
.main-nav a:hover { color: var(--ink); background: #ffedd5; }
.main-nav a.active { color: var(--primary); background: #ffedd5; }

/* ---------- Панель фильтров ---------- */
.filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-top: 18px;
    flex-wrap: wrap;
}
.filter-note { color: var(--muted); font-size: 15px; }
.filter-note strong { color: var(--ink); }
.filter-clear {
    font-size: 14px;
    color: var(--primary);
    font-weight: 600;
}

/* ---------- Основная область ---------- */
.site-main { padding: 28px 0 48px; min-height: 60vh; }

/* ---------- Поиск ---------- */
.search-form {
    display: flex;
    gap: 10px;
    margin-bottom: 28px;
    max-width: 560px;
}
.search-form input[type="search"] {
    flex: 1;
    padding: 13px 18px;
    border: 1px solid var(--line);
    border-radius: 11px;
    font-size: 15px;
    background: #fff;
    color: var(--ink);
    outline: none;
    transition: border .15s, box-shadow .15s;
}
.search-form input[type="search"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(234, 88, 12, .15);
}
.search-form button {
    padding: 0 26px;
    border: none;
    border-radius: 11px;
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: background .15s;
}
.search-form button:hover { background: var(--primary-dark); }

/* ---------- Карточки ---------- */
.featured-wrap { margin-bottom: 30px; }

.card {
    background: var(--card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform .18s, box-shadow .18s;
    display: flex;
    flex-direction: column;
    height: 100%;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }

.card-media {
    display: block;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #e7e5e4;
}
.card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .35s ease;
}
.card:hover .card-media img { transform: scale(1.05); }

.no-image {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    color: rgba(255, 255, 255, .92);
    font-weight: 700;
    font-size: 18px;
    letter-spacing: .02em;
}
.no-image.small { font-size: 12px; }
.grad-0 { background: linear-gradient(135deg, #fb923c, #f97316); }
.grad-1 { background: linear-gradient(135deg, #fbbf24, #f59e0b); }
.grad-2 { background: linear-gradient(135deg, #fdba74, #fb923c); }
.grad-3 { background: linear-gradient(135deg, #f59e0b, #ea580c); }
.grad-4 { background: linear-gradient(135deg, #fca5a5, #f97316); }

.card-body {
    padding: 18px 20px 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.card-cat {
    align-self: flex-start;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--primary);
    background: #ffedd5;
    padding: 4px 10px;
    border-radius: 20px;
    margin-bottom: 12px;
}
.card-cat:hover { background: #fed7aa; }

.card-title { font-size: 19px; line-height: 1.35; font-weight: 700; margin-bottom: 10px; }
.card-title a { color: var(--ink); }
.card-title a:hover { color: var(--primary); }

.card-excerpt {
    color: var(--muted);
    font-size: 14.5px;
    flex: 1;
    margin-bottom: 14px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.card-excerpt-featured {
    font-size: 15.5px;
    -webkit-line-clamp: 4;
}

.card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 13px;
    color: var(--muted);
    border-top: 1px solid var(--line);
    padding-top: 14px;
}
.card-readmore { font-weight: 600; color: var(--primary); white-space: nowrap; }

/* Закреплённая новость — индикатор */
.card-pinned .card-media::after {
    content: "📌";
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255, 255, 255, .92);
    border-radius: 50%;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    font-size: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
    pointer-events: none;
    z-index: 2;
}
.card-pinned .card-media {
    position: relative;
}
.pin-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #92400e;
    background: #fef3c7;
    border: 1px solid #fde68a;
    padding: 3px 9px;
    border-radius: 20px;
    margin-bottom: 12px;
}

/* Основная (featured) карточка */
.card-featured { flex-direction: column; }
@media (min-width: 768px) {
    .card-featured { flex-direction: row; min-height: 300px; }
    .card-featured .card-media { aspect-ratio: auto; flex: 1; min-height: 100%; }
    .card-featured .card-body { flex: 1; padding: 30px; }
    .card-featured .card-title { font-size: 30px; line-height: 1.2; }
    .card-featured .no-image { font-size: 22px; }
}

/* ---------- Сетка новостей ---------- */
.news-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 22px;
}

/* ---------- Пустое состояние ---------- */
.empty-state {
    text-align: center;
    padding: 70px 20px;
    color: var(--muted);
}
.empty-icon { font-size: 54px; margin-bottom: 16px; opacity: .6; }
.empty-state h1 { color: var(--ink); font-size: 24px; margin-bottom: 8px; }

/* ---------- Пагинация ---------- */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-top: 34px;
    flex-wrap: wrap;
}
.pg {
    display: inline-grid;
    place-items: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border-radius: 10px;
    background: #fff;
    border: 1px solid var(--line);
    color: var(--ink);
    font-weight: 600;
    font-size: 14px;
}
a.pg:hover { border-color: var(--primary); color: var(--primary); }
span.pg.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.pg.gap { border: none; background: transparent; cursor: default; color: var(--muted); }

/* ---------- Кнопки ---------- */
.btn {
    display: inline-block;
    padding: 11px 22px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 15px;
    text-align: center;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all .15s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }

/* ---------- Страница новости ---------- */
.news-detail {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 34px 38px 40px;
    max-width: 860px;
    margin: 0 auto;
}

.back-link {
    display: inline-block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 22px;
    color: var(--muted);
}
.back-link:hover { color: var(--primary); }

.detail-cat {
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--primary);
    background: #ffedd5;
    padding: 5px 12px;
    border-radius: 20px;
    margin-bottom: 16px;
}

.detail-title { font-size: 34px; line-height: 1.2; font-weight: 800; letter-spacing: -.02em; margin-bottom: 16px; }
.detail-meta { color: var(--muted); font-size: 14px; margin-bottom: 26px; }

.detail-figure { margin: 0 0 28px; border-radius: 12px; overflow: hidden; }
.detail-figure img { width: 100%; }

.detail-body { font-size: 17px; line-height: 1.8; color: #44403c; }

/* ---------- Похожие ---------- */
.related { max-width: 860px; margin: 30px auto 0; }
.related-title { font-size: 22px; font-weight: 700; margin-bottom: 18px; }
.related-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.related-card {
    display: flex;
    gap: 12px;
    align-items: center;
    background: var(--card);
    border-radius: 12px;
    padding: 12px;
    box-shadow: var(--shadow);
    transition: transform .15s, box-shadow .15s;
}
.related-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.related-media {
    flex: 0 0 72px;
    width: 72px;
    height: 72px;
    border-radius: 10px;
    overflow: hidden;
    background: #e7e5e4;
    display: block;
}
.related-media img { width: 100%; height: 100%; object-fit: cover; }
.related-info { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.related-cat { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--primary); }
.related-name { font-size: 14px; font-weight: 600; color: var(--ink); line-height: 1.35; }
.related-card:hover .related-name { color: var(--primary); }

/* ---------- Подвал ---------- */
.site-footer {
    border-top: 1px solid var(--line);
    background: #fff;
    padding: 28px 0;
    margin-top: 20px;
}
.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.footer-brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 700; color: var(--ink); }
.footer-copy { color: var(--muted); font-size: 14px; }

/* Подвал: каналы связи (выводятся справа, без заголовка) */
.footer-left { display: flex; flex-direction: column; gap: 12px; }
.footer-channels {
    list-style: none; margin: 0; padding: 0;
    display: flex; flex-direction: column; gap: 10px;
    margin-left: auto;
}
.footer-channels a, .footer-channels li > span {
    display: inline-flex; flex-direction: column; align-items: flex-start; gap: 3px;
    color: var(--ink); font-size: 14.5px; line-height: 1.3;
    text-decoration: none;
}
.footer-channels a:hover .footer-channel-row,
.footer-channels li > span:hover .footer-channel-row { color: var(--primary); }
.footer-channel-label {
    font-size: 12.5px; font-weight: 600; line-height: 1.2;
    color: var(--muted); letter-spacing: .02em;
    text-transform: uppercase;
}
.footer-channel-row { display: inline-flex; align-items: center; gap: 9px; }
.footer-channel-icon { font-size: 15px; line-height: 1; width: 20px; text-align: center; flex: 0 0 auto; }
.footer-channel-text { word-break: break-word; }

/* ---------- Адаптив ---------- */
@media (max-width: 900px) {
    .news-grid { grid-template-columns: repeat(2, 1fr); }
    .related-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
    .header-inner { height: auto; flex-wrap: wrap; padding-top: 12px; padding-bottom: 12px; gap: 12px; }
    .main-nav { order: 3; width: 100%; margin-left: 0; justify-content: flex-start; }
    .news-grid, .related-grid { grid-template-columns: 1fr; }
    .card-featured { flex-direction: column; }
    .card-featured .card-media { aspect-ratio: 16 / 9; }
    .detail-title { font-size: 26px; }
    .news-detail { padding: 24px 20px 30px; }
    .search-form { flex-direction: column; }
    .search-form button { padding: 12px; }
}
/* ============ Материалы для обучения ============ */
.material-type-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--overlay);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 20px;
    backdrop-filter: blur(6px);
}

/* Закреплённый материал: сдвигаем бейдж типа, чтобы не перекрывать 📌 */
.card-pinned .material-type-badge {
    right: 54px;
}

.material-media {
    position: relative;
}

.material-type-label {
    display: inline-block;
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 8px;
}

.material-detail-desc {
    font-size: 17px;
    line-height: 1.7;
    color: var(--text);
    margin-bottom: 24px;
    padding: 16px 20px;
    background: #f0f6ff;
    border-left: 4px solid var(--accent);
    border-radius: 0 8px 8px 0;
}

/* --- Блок скачивания --- */
.download-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 24px;
    background: #fff;
    border: 2px solid var(--border);
    border-radius: 12px;
    margin: 24px 0;
}

.download-icon {
    font-size: 48px;
    flex-shrink: 0;
}

.download-info {
    flex: 1;
    min-width: 0;
}

.download-filename {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    word-break: break-all;
}

.download-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 12px 24px;
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    font-size: 15px;
    border-radius: 8px;
    text-decoration: none;
    transition: background 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

.download-btn:hover {
    background: var(--accent-dark);
}

/* --- Видео-встроенное --- */
.video-embed-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    margin: 24px 0;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
}

.video-embed-wrap iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* --- Похожие материалы --- */
.material-related {
    margin-top: 48px;
}

.material-related .related-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border);
}

.material-related .related-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.material-related .related-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    text-decoration: none;
    transition: box-shadow 0.2s, transform 0.2s;
}

.material-related .related-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}

.material-related .related-media {
    width: 64px;
    height: 48px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
}

.material-related .related-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.material-related .no-image.small {
    width: 100%;
    height: 100%;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.material-related .related-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.material-related .related-cat {
    font-size: 12px;
    color: var(--accent);
    font-weight: 600;
}

.material-related .related-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}