/* ===== Переменные ===== */
:root {
    --bg: #0b0f19;
    --text: #e8ecf4;
    --muted: #98a2b3;
    --border: rgba(255, 255, 255, .09);
    --accent: #6ea8fe;
    --accent-2: #a78bfa;
    --radius: 18px;
    --container: 1160px;
}

/* ===== База ===== */
*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(60rem 60rem at 12% -12%, rgba(110, 168, 254, .18), transparent 60%),
        radial-gradient(50rem 50rem at 92% -5%, rgba(167, 139, 250, .16), transparent 55%),
        radial-gradient(45rem 45rem at 50% 115%, rgba(52, 211, 153, .10), transparent 60%);
}

img { max-width: 100%; }
a { color: inherit; }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 8px;
}

/* ===== Шапка ===== */
header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(11, 15, 25, .72);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.header-inner {
    position: relative;
    max-width: var(--container);
    margin: 0 auto;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    text-decoration: none;
}

.logo img {
    display: block;
    width: 38px;
    height: 38px;
    border-radius: 11px;
    filter: drop-shadow(0 0 14px rgba(110, 168, 254, .45));
    transition: transform .35s cubic-bezier(.2, .8, .2, 1);
}

.logo:hover img { transform: rotate(-8deg) scale(1.07); }

/* ===== Навигация ===== */
nav ul {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;
}

nav a {
    display: block;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 14.5px;
    font-weight: 500;
    color: var(--muted);
    text-decoration: none;
    white-space: nowrap;
    transition: color .2s, background .2s;
}

nav a:hover {
    color: var(--text);
    background: rgba(255, 255, 255, .06);
}

nav a.active {
    color: #fff;
    background: linear-gradient(135deg, rgba(110, 168, 254, .22), rgba(167, 139, 250, .22));
    box-shadow: inset 0 0 0 1px rgba(110, 168, 254, .35);
}

/* ===== Бургер (скрыт на десктопе) ===== */
.burger {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255, 255, 255, .04);
    cursor: pointer;
    transition: background .2s;
}

.burger:hover { background: rgba(255, 255, 255, .09); }

.burger span {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 2px;
    background: var(--text);
    transition: transform .3s, opacity .3s;
}

.nav-toggle:checked ~ header .burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle:checked ~ header .burger span:nth-child(2) { opacity: 0; }
.nav-toggle:checked ~ header .burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ===== Контент ===== */
.container {
    flex: 1;
    width: 100%;
    max-width: var(--container);
    margin: 0 auto;
    padding: 64px 20px 80px;
}

/* ===== Hero ===== */
.hero {
    text-align: center;
    padding: 8px 0 60px;
    animation: fadeUp .7s ease backwards;
}

.pill {
    display: inline-block;
    margin-bottom: 20px;
    padding: 6px 16px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(255, 255, 255, .04);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
}

.hero h1 {
    margin: 0 0 16px;
    font-size: clamp(2rem, 5.5vw, 3.4rem);
    line-height: 1.1;
    font-weight: 800;
    letter-spacing: -.02em;
    background: linear-gradient(115deg, #ffffff 15%, #9ec1ff 55%, #c4b5fd 90%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hero p {
    margin: 0;
    font-size: clamp(1rem, 2vw, 1.15rem);
    color: var(--muted);
}

/* ===== Заголовок секции ===== */
section h2 {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 0 0 26px;
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -.01em;
}

section h2::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--border), transparent);
}

/* ===== Сетка карточек ===== */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
    gap: 20px;
}

.card {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 26px 24px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: linear-gradient(180deg, rgba(255, 255, 255, .055), rgba(255, 255, 255, .02));
    transition: transform .35s cubic-bezier(.2, .8, .2, 1),
                border-color .35s,
                box-shadow .35s;
    animation: fadeUp .6s ease backwards;
}

.card::before {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    pointer-events: none;
    opacity: 0;
    transition: opacity .35s;
    background: radial-gradient(320px 170px at 50% 0%, rgba(110, 168, 254, .22), transparent 70%);
}

.card:hover {
    transform: translateY(-6px);
    border-color: rgba(110, 168, 254, .45);
    box-shadow: 0 24px 48px -22px rgba(0, 0, 0, .95),
                0 0 0 1px rgba(110, 168, 254, .12);
}

.card:hover::before { opacity: 1; }

.card h3 {
    margin: 0 0 10px;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -.01em;
}

.card p {
    flex: 1;
    margin: 0 0 22px;
    font-size: .95rem;
    color: var(--muted);
}

/* ===== Кнопка ===== */
.btn {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(255, 255, 255, .05);
    font-size: .9rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--text);
    transition: color .25s, background .25s, border-color .25s,
                box-shadow .25s, transform .25s;
}

.btn:hover {
    transform: translateX(3px);
    color: #08101f;
    border-color: transparent;
    background: linear-gradient(135deg, #8ab8ff, #c4b5fd);
    box-shadow: 0 12px 26px -12px rgba(138, 184, 255, .8);
}

/* Задержки появления карточек на главной */
.card:nth-child(1) { animation-delay: .05s; }
.card:nth-child(2) { animation-delay: .10s; }
.card:nth-child(3) { animation-delay: .15s; }
.card:nth-child(4) { animation-delay: .20s; }
.card:nth-child(5) { animation-delay: .25s; }
.card:nth-child(6) { animation-delay: .30s; }

/* ===== Подвал ===== */
footer {
    padding: 26px 20px;
    text-align: center;
    font-size: .875rem;
    color: var(--muted);
    background: rgba(255, 255, 255, .015);
    border-top: 1px solid var(--border);
}

footer p { margin: 0; }

/* ===== Анимации ===== */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: none; }
}

/* ===== Адаптив ===== */
@media (max-width: 900px) {
    .burger { display: flex; }

    nav {
        display: none;
        position: absolute;
        top: calc(100% + 10px);
        left: 16px;
        right: 16px;
        padding: 10px;
        border: 1px solid var(--border);
        border-radius: 16px;
        background: rgba(15, 20, 32, .97);
        box-shadow: 0 28px 55px -22px #000;
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
    }

    .nav-toggle:checked ~ header nav { display: block; }

    nav ul { flex-direction: column; align-items: stretch; gap: 2px; }

    nav a { padding: 11px 14px; border-radius: 10px; font-size: 15px; }
}

@media (max-width: 560px) {
    .container { padding: 44px 16px 60px; }
    .hero { padding-bottom: 44px; }
    .grid { grid-template-columns: 1fr; gap: 16px; }
    .card { padding: 22px 20px; }
}

/* ===== Уважение к настройкам пользователя ===== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ============================================================
   ВНУТРЕННИЕ СТРАНИЦЫ
   ============================================================ */

/* Заголовок внутренних страниц — обычный цвет, БЕЗ градиента */
main.container > h1,
#protected-content > h1 {
    margin: 0 0 10px;
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 800;
    letter-spacing: -.02em;
    line-height: 1.15;
    color: var(--text);
}

main.container > h1 + p,
#protected-content > h1 + p {
    margin: 0 0 40px;
    font-size: 1.05rem;
    color: var(--muted);
    max-width: 780px;
}

/* Градиент — ТОЛЬКО на тексте, эмодзи остаются вне градиента */
main.container > h1 .grad,
#protected-content > h1 .grad {
    background: linear-gradient(115deg, #ffffff 15%, #9ec1ff 55%, #c4b5fd 90%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

section + section { margin-top: 48px; }

section > p {
    margin: 0 0 20px;
    color: var(--muted);
    max-width: 780px;
}

/* Списки на внутренних страницах */
.content-list {
    margin: 20px 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.content-list li {
    position: relative;
    padding: 14px 18px 14px 46px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.015));
    color: var(--text);
    font-size: .95rem;
    transition: border-color .2s, transform .2s;
}

.content-list li::before {
    content: "→";
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--accent);
    font-weight: 700;
}

.content-list li:hover {
    border-color: rgba(110, 168, 254, .35);
    transform: translateX(3px);
}

/* Спойлеры (details/summary) */
details {
    margin-top: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.015));
    overflow: hidden;
    transition: border-color .25s;
}

details[open] { border-color: rgba(110, 168, 254, .35); }

summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 22px;
    cursor: pointer;
    font-weight: 600;
    font-size: .95rem;
    color: var(--text);
    background: rgba(255,255,255,.03);
    list-style: none;
    transition: background .2s;
}

summary::-webkit-details-marker { display: none; }
summary:hover { background: rgba(255,255,255,.06); }

summary::after {
    content: "+";
    font-size: 1.3rem;
    line-height: 1;
    color: var(--accent);
    transition: transform .25s;
    font-weight: 400;
}

details[open] summary::after { transform: rotate(45deg); }

.spoiler-content {
    padding: 18px 22px 22px;
    border-top: 1px solid var(--border);
}

.spoiler-content p { margin: 0 0 12px; }

.spoiler-content ol,
.spoiler-content ul {
    margin: 0 0 16px;
    padding-left: 22px;
    color: var(--muted);
}

.spoiler-content ol li,
.spoiler-content ul li { margin-bottom: 6px; }
.spoiler-content strong { color: var(--text); }

/* Блоки кода */
pre {
    position: relative;
    margin: 16px 0;
    padding: 18px 56px 18px 18px;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(0, 0, 0, .35);
    color: #cdd6e8;
    font-family: "JetBrains Mono", "Consolas", "Monaco", monospace;
    font-size: .88rem;
    line-height: 1.6;
}

pre code {
    font-family: inherit;
    white-space: pre;
}

.copy-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(255,255,255,.04);
    color: var(--muted);
    cursor: pointer;
    transition: all .2s;
}

.copy-btn:hover {
    color: var(--text);
    background: rgba(255,255,255,.09);
    border-color: rgba(110,168,254,.4);
}

.copy-btn svg { width: 16px; height: 16px; fill: currentColor; }

.copy-btn.success {
    color: #7ee0a3;
    border-color: rgba(126, 224, 163, .4);
    background: rgba(126, 224, 163, .1);
}

.copy-btn.error {
    color: #ff8a8a;
    border-color: rgba(255, 138, 138, .4);
    background: rgba(255, 138, 138, .1);
}

.hint-text {
    display: block;
    margin-top: 10px;
    font-size: .82rem;
    color: var(--muted);
}