/* ============================================================
   ЦЕНТР КИБЕРБЕЗОПАСНОСТИ — design tokens & base styles
   ============================================================ */

:root {
    --color-bg: #f6f8fa;
    --color-surface: #ffffff;
    --color-surface-alt: #eef1f5;
    --color-text: #16202b;
    --color-text-muted: #525f6e;
    --color-border: #dde3e9;

    --color-primary: #0b2545;      /* глубокий тёмно-синий — шапка, заголовки */
    --color-primary-light: #13335f;
    --color-accent: #0ea5a0;       /* бирюзовый акцент — CTA, ссылки */
    --color-accent-dark: #0b7d79;
    --color-danger: #b3261e;

    --radius: 10px;
    --radius-sm: 6px;
    --shadow-sm: 0 1px 2px rgba(11, 37, 69, 0.06), 0 1px 1px rgba(11, 37, 69, 0.04);
    --shadow-md: 0 4px 16px rgba(11, 37, 69, 0.08);

    --container: 1120px;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --color-bg: #0b1420;
        --color-surface: #101c2c;
        --color-surface-alt: #15233675;
        --color-text: #e7edf3;
        --color-text-muted: #9fb0c2;
        --color-border: #243448;

        --color-primary: #0d2a4d;
        --color-primary-light: #163a68;
        --color-accent: #2dd4ce;
        --color-accent-dark: #19b3ad;
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
        --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
    }
}

:root[data-theme="dark"] {
    --color-bg: #0b1420;
    --color-surface: #101c2c;
    --color-surface-alt: #15233675;
    --color-text: #e7edf3;
    --color-text-muted: #9fb0c2;
    --color-border: #243448;
    --color-primary: #0d2a4d;
    --color-primary-light: #163a68;
    --color-accent: #2dd4ce;
    --color-accent-dark: #19b3ad;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font-sans);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--color-accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 0.6em; color: var(--color-primary); font-weight: 700; }
:root[data-theme="dark"] h1, :root[data-theme="dark"] h2, :root[data-theme="dark"] h3 { color: var(--color-text); }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) h1,
    :root:not([data-theme="light"]) h2,
    :root:not([data-theme="light"]) h3 { color: var(--color-text); }
}

h1 { font-size: clamp(1.9rem, 1.4rem + 2vw, 2.75rem); }
h2 { font-size: clamp(1.4rem, 1.2rem + 1vw, 1.9rem); }
p { margin: 0 0 1em; color: var(--color-text-muted); }

.container { max-width: var(--container); margin: 0 auto; padding: 0 1.25rem; }

/* ---------- Header ---------- */
.site-header {
    background: var(--color-primary);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 40;
    box-shadow: var(--shadow-sm);
}
.site-header .bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1.25rem;
    max-width: var(--container);
    margin: 0 auto;
}
.logo {
    display: flex;
    flex-direction: column;
    color: #fff;
    font-weight: 800;
    letter-spacing: 0.02em;
    font-size: 1.05rem;
    line-height: 1.2;
}
.logo:hover { text-decoration: none; opacity: 0.9; }
.logo small { font-weight: 400; font-size: 0.72rem; color: #a9c3dc; letter-spacing: 0.04em; }

.main-nav { display: flex; flex-wrap: wrap; gap: 0.25rem; align-items: center; }
.main-nav a {
    color: #d7e3ee;
    font-size: 0.92rem;
    padding: 0.5rem 0.7rem;
    border-radius: var(--radius-sm);
    white-space: nowrap;
}
.main-nav a:hover { background: rgba(255,255,255,0.08); color: #fff; text-decoration: none; }
.main-nav a.accent { background: var(--color-accent); color: #04221f; font-weight: 600; }
.main-nav a.accent:hover { background: var(--color-accent-dark); color: #fff; }

.nav-dropdown { position: relative; }
.nav-dropdown summary {
    list-style: none;
    cursor: pointer;
    color: #d7e3ee;
    font-size: 0.92rem;
    padding: 0.5rem 0.7rem;
    border-radius: var(--radius-sm);
}
.nav-dropdown summary::-webkit-details-marker { display: none; }
.nav-dropdown summary:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-dropdown summary::after { content: ' ▾'; font-size: 0.7em; }
.nav-dropdown[open] summary { background: rgba(255,255,255,0.1); color: #fff; }
.nav-dropdown .dropdown-menu {
    position: absolute;
    top: calc(100% + 0.4rem);
    left: 0;
    min-width: 15rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    padding: 0.4rem;
    display: flex;
    flex-direction: column;
    z-index: 50;
}
.nav-dropdown .dropdown-menu a {
    color: var(--color-text);
    padding: 0.55rem 0.7rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    white-space: normal;
}
.nav-dropdown .dropdown-menu a:hover { background: var(--color-surface-alt); text-decoration: none; }

.nav-toggle { display: none; }

@media (max-width: 860px) {
    .nav-dropdown .dropdown-menu {
        position: static;
        box-shadow: none;
        border: none;
        background: transparent;
        padding: 0 0 0 0.7rem;
    }
    .nav-dropdown .dropdown-menu a { color: #d7e3ee; }
    .nav-dropdown .dropdown-menu a:hover { background: rgba(255,255,255,0.08); color: #fff; }
}

@media (max-width: 860px) {
    .site-header .bar { flex-wrap: wrap; }
    .main-nav {
        display: none;
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        order: 3;
        flex-basis: 100%;
        padding: 0.5rem 1.25rem 1rem;
        background: var(--color-primary-light);
    }
    .main-nav.open { display: flex; }
    .main-nav a { padding: 0.65rem 0.5rem; }
    .nav-toggle {
        display: inline-flex;
        align-items: center;
        gap: 0.4rem;
        background: none;
        border: 1px solid rgba(255,255,255,0.3);
        color: #fff;
        border-radius: var(--radius-sm);
        padding: 0.45rem 0.7rem;
        font-size: 0.9rem;
        cursor: pointer;
    }
}

/* ---------- Hero ---------- */
.hero {
    position: relative;
    overflow: hidden;
    background: linear-gradient(160deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
    color: #fff;
    padding: 4.5rem 0 4rem;
}
.hero-network {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    pointer-events: none;
}
.hero .container { position: relative; z-index: 1; max-width: var(--container); }

.page-banner { padding: 2.75rem 0; }
.page-banner h1 { font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2.1rem); margin-bottom: 0.3em; }
.page-banner .lead { font-size: 1rem; margin-bottom: 0; }
.page-banner .eyebrow {
    color: var(--color-accent);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.5rem;
}
.page-banner a { color: #cdeceb; }
.page-banner a:hover { color: #fff; }
.hero h1 { color: #fff; max-width: 42rem; }
.hero p.lead { color: #c3d4e5; font-size: 1.15rem; max-width: 38rem; }
.hero-actions { display: flex; gap: 0.9rem; flex-wrap: wrap; margin-top: 1.6rem; }

.btn {
    display: inline-block;
    padding: 0.75rem 1.35rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.95rem;
    border: 1px solid transparent;
    cursor: pointer;
}
.btn:hover { text-decoration: none; }
.btn-accent { background: var(--color-accent); color: #04221f; }
.btn-accent:hover { background: var(--color-accent-dark); color: #fff; }
.btn-ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,0.4); }
.btn-ghost:hover { background: rgba(255,255,255,0.08); }

.hero-badges { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 2.2rem; }
.badge {
    font-size: 0.78rem;
    color: #c3d4e5;
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 999px;
    padding: 0.3rem 0.75rem;
}

/* ---------- Sections / cards ---------- */
.section { position: relative; overflow: hidden; padding: 3.5rem 0; }
.section-alt { background: var(--color-surface-alt); }
.section-head { max-width: 42rem; margin-bottom: 2rem; }
.section-head p { font-size: 1.05rem; }
.section > .container { position: relative; z-index: 1; }

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

.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.card h3 { font-size: 1.05rem; margin-bottom: 0.5rem; }
.card h3 a { color: var(--color-primary); }
:root[data-theme="dark"] .card h3 a { color: var(--color-text); }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .card h3 a { color: var(--color-text); }
}
.card p { font-size: 0.93rem; margin-bottom: 0; }
.card .icon {
    width: 2.6rem; height: 2.6rem;
    border-radius: var(--radius-sm);
    background: var(--color-surface-alt);
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 1rem;
    color: var(--color-accent-dark);
    font-weight: 700;
}

/* ---------- Page / article ---------- */
.page, article.page-article { position: relative; overflow: hidden; padding: 3rem 0; }
.page > .container { position: relative; z-index: 1; }
.page h1, article.page-article h1 { margin-bottom: 0.3em; }
.subtitle { color: var(--color-text-muted); font-size: 1.1rem; margin-bottom: 1.5rem; }
.body { font-size: 1rem; }
.body p { color: var(--color-text); }

/* ---------- Lists: news, services, org_info ---------- */
.item-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
.item-list li {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.1rem 1.3rem;
}
.item-list time { display: block; font-size: 0.82rem; color: var(--color-text-muted); margin-bottom: 0.25rem; }
.item-list a { font-weight: 600; color: var(--color-primary); font-size: 1.02rem; }
:root[data-theme="dark"] .item-list a { color: var(--color-text); }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .item-list a { color: var(--color-text); }
}

ol.section-list { list-style: none; counter-reset: sec; margin: 0; padding: 0; display: grid; gap: 0.6rem; max-width: 44rem; }
ol.section-list li {
    counter-increment: sec;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 0.85rem 1rem;
}
ol.section-list li::before {
    content: counter(sec);
    display: inline-flex;
    width: 1.6rem; height: 1.6rem;
    align-items: center; justify-content: center;
    background: var(--color-accent);
    color: #04221f;
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: 700;
    margin-right: 0.7rem;
}

/* тёмный вариант — для размещения поверх hero/анимированного фона.
   Селектор с ol.section-list, чтобы специфичность была не ниже базового правила. */
ol.section-list.section-list--dark li {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.18);
}
ol.section-list.section-list--dark li a { color: #fff; }
ol.section-list.section-list--dark li:hover { background: rgba(255, 255, 255, 0.12); }

.obuchenie-hero { padding-bottom: 4rem; }
.obuchenie-hero h2 { color: #fff; margin-top: 0; }
.obuchenie-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.18);
    margin: 2.5rem 0 2rem;
    max-width: 44rem;
}

ul.document-list { list-style: none; margin: 1rem 0; padding: 0; display: grid; gap: 0.5rem; }
ul.document-list li {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 0.7rem 1rem;
    background: var(--color-surface);
}
ul.document-list .date { color: var(--color-text-muted); font-size: 0.85rem; }
ul.document-list .sig-link {
    font-size: 0.8rem;
    color: var(--color-accent-dark);
    margin-left: 0.35rem;
}

table.program-table {
    border-collapse: collapse;
    width: 100%;
    margin: 1rem 0;
    background: var(--color-surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
table.program-table th {
    background: var(--color-surface-alt);
    text-align: left;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--color-text-muted);
}
table.program-table th, table.program-table td {
    border-bottom: 1px solid var(--color-border);
    padding: 0.7rem 0.9rem;
    font-size: 0.92rem;
}
table.program-table tr:last-child td { border-bottom: none; }

/* ---------- Footer ---------- */
.site-footer {
    background: var(--color-primary);
    color: #c3d4e5;
    padding: 2.5rem 0;
    margin-top: 3rem;
    font-size: 0.88rem;
}
.site-footer .container {
    display: grid;
    gap: 0.4rem;
}
.site-footer a { color: #e7edf3; }
.site-footer .footer-links { display: flex; gap: 1rem; margin-top: 0.5rem; }
.site-footer strong { color: #fff; }
.site-footer .footer-group {
    margin-top: 0.6rem;
    padding-top: 0.6rem;
    border-top: 1px solid rgba(255, 255, 255, 0.14);
}
.site-footer .footer-group a { font-weight: 600; color: var(--color-accent); }
.site-footer .footer-group a:hover { color: #fff; }

@media (max-width: 640px) {
    .hero { padding: 3rem 0 2.5rem; }
    .section { padding: 2.5rem 0; }
}

/* ---------- Text zoom (hover / в центре экрана при прокрутке) ----------
   Плавное приближение, которое держится пока курсор на тексте (или текст
   в центре вьюпорта), и плавно возвращается при выходе. Только transform —
   текст не перерастеризуется, остаётся чётким. */
@media (prefers-reduced-motion: no-preference) {
    .fx-text {
        transform: scale(1) translate3d(0, 0, 0);
        transform-origin: center;
        backface-visibility: hidden;
        transition: transform 0.7s cubic-bezier(.22, 1, .36, 1);
        will-change: transform;
    }
    .fx-text.fx-active {
        transform: scale(1.045) translate3d(0, 0, 0);
    }
}
