:root {
    --color-primary: #2b5b84;
    --color-primary-dark: #1a3a55;
    --color-accent: #ffd43b;
    --color-green: #4caf7a;
    --color-text-light: #f1f6fb;
    --gradient-scene: linear-gradient(135deg, #14304a, #2b5b84 55%, #1f6f54);
    --gradient-warm: linear-gradient(135deg, #ffd43b, #ff7a59);
    --gradient-cool: linear-gradient(135deg, #4caf7a, #36c2e0);
    --glass-bg: rgba(255, 255, 255, 0.14);
    --glass-border: rgba(255, 255, 255, 0.35);
    --glass-blur: 12px;
    --glass-shadow: 0 0.5rem 2rem rgba(0, 0, 0, 0.25);
    --radius: 0.75rem;
    --duration: 0.35s;
    --content-width: 900px;
    --page-pad: 24px;
    --grid-gap: 24px;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 90px;
}

body {
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    margin: 0;
    color: #222;
    background: #fafafa;

    display: grid;
    grid-template-columns: 1fr minmax(0, calc(var(--content-width) + var(--page-pad) * 2)) 1fr;
    grid-template-rows: auto 1fr auto;
    grid-template-areas:
        "header header header"
        ". main ."
        "footer footer footer";
    min-height: 100vh;
}

/* Тип-селекторы для заголовков */
h1,
h2,
h3 {
    color: #2b5b84;
}

main {
    grid-area: main;
    min-width: 0;
    padding: 0 var(--page-pad) 40px;
}

.home-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    column-gap: var(--grid-gap);
    grid-template-areas:
        "title title title"
        "lead lead lead"
        "news news news"
        "sections sections top"
        "notes notes aside"
        "cards cards cards";
    align-items: start;
}

.home-grid>h1 {
    grid-area: title;
}

.home-grid>.lead {
    grid-area: lead;
}

#news-section {
    grid-area: news;
    min-width: 0;
}

#sections-section {
    grid-area: sections;
}

#top-languages-section {
    grid-area: top;
}

#notes-section {
    grid-area: notes;
}

.home-grid>.side-panel {
    grid-area: aside;
}

#cards-section {
    grid-area: cards;
}

/* ===== Шапка сайта ===== */
/* Класс-селектор */
.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    padding: 16px 24px;
    background: #2b5b84;
    color: #fff;

    grid-area: header;
    position: sticky;
    top: 0;
    z-index: 10;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    text-decoration: none;
    font-weight: bold;
    font-size: 1.1em;

    position: relative;
    top: 1px;
    margin-right: auto;
}

.logo:visited {
    color: #fff;
}

.main-nav {
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 12px;
    padding: 12px;
    background-color: rgba(255, 255, 255, 0.178);
    box-shadow: 0 3px 5px rgba(0, 0, 0, 0.3);
    position: relative;
}

/* Дочерний селектор (>): только прямые li внутри ul меню */
.main-nav>ul {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 16px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.main-nav a {
    color: #fff;
    text-decoration: none;
    padding: 4px 6px;
    border-radius: 4px;
}

/* Псевдоклассы для пунктов меню */
.main-nav a:visited {
    color: #d9e6f2;
}

.main-nav a:hover {
    background: #ffd43b;
    color: #2b5b84;
}

.main-nav a:active {
    background: #d4a900;
}

/* ===== Секции ===== */

/* Соседний селектор: абзац сразу после h2 выделяем курсивом */
section h2+p {
    color: #555;
    font-style: italic;
}

/* Общий (следующий) селектор ~: все p после h3 внутри примеров кода */
.code-example h3~p {
    margin: 6px 0;
}

/* ===== Карточки языков ===== */
.lang-desc-row,
.news-row {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 8px;
}


/* Класс-селектор + дочерний селектор */
.lang-desc-row>figure {
    flex-shrink: 0;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 12px;
    width: 220px;
}

.news-row {
    position: relative;
    isolation: isolate;
    padding: clamp(1.75rem, 4vw, 2.5rem);
    background: var(--gradient-scene);
    border-radius: var(--radius);
}

.news-row::before,
.news-row::after {
    content: "";
    position: absolute;
    z-index: -1;
    border-radius: 50%;
    pointer-events: none;
}

.news-row::before {
    top: 8%;
    left: 6%;
    width: clamp(6rem, 22vw, 12rem);
    aspect-ratio: 1;
    background: var(--gradient-warm);
}

.news-row::after {
    right: 8%;
    bottom: 6%;
    width: clamp(7rem, 26vw, 15rem);
    aspect-ratio: 1;
    background: var(--gradient-cool);
}

.news-element {
    --square-size: 2.5rem;
    box-sizing: border-box;
    flex: 0 0 min(500px, 85vw);
    display: flex;
    align-items: flex-start;

    gap: 12px;
    padding: 12px;
    color: var(--color-text-light);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow: var(--glass-shadow);
    -webkit-backdrop-filter: blur(var(--glass-blur));
    backdrop-filter: blur(var(--glass-blur));
    transition: transform var(--duration), background var(--duration);

    position: relative;
}

.news-element::before,
.news-element::after {
    content: "";
    position: absolute;
    width: var(--square-size);
    aspect-ratio: 1;
    background: rgba(255, 255, 255, 0.22);
    border: 1px solid var(--glass-border);
    border-radius: 0.5rem;
    box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.2);
    pointer-events: none;
}

.news-element::before {
    top: calc(var(--square-size) / -3);
    left: calc(var(--square-size) / -3);
}

.news-element::after {
    --square-size: 1.75rem;
    right: calc(var(--square-size) / -3);
    bottom: calc(var(--square-size) / -3);
}

.news-element:hover {
    transform: translateY(-4px);
    background: rgba(255, 255, 255, 0.2);
}

.news-element:hover::before {
    animation: square-float 3s ease-in-out infinite;
}

.news-element:hover::after {
    animation: square-float 3s ease-in-out infinite reverse;
}

@keyframes square-float {

    0%,
    100% {
        transform: translate(0, 0) rotate(0deg);
    }

    25% {
        transform: translate(0.75rem, -0.5rem) rotate(15deg);
    }

    50% {
        transform: translate(1.25rem, 0.5rem) rotate(-10deg);
    }

    75% {
        transform: translate(-0.5rem, 0.75rem) rotate(8deg);
    }
}

.news-element img {
    display: block;
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}

.news-element>.badge {
    position: absolute;
    top: 8px;
    right: 8px;

    border-radius: 20px;
    background-color: rgba(255, 0, 0, 0.445);

    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;

    font-size: 0.7rem;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Дочерний селектор: заголовок и текст новости идут сверху вниз внутри обёртки */
.news-text>h3 {
    margin: 0 0 4px;
    color: #fff;
}

.news-text>p {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 5;
    line-clamp: 5;
    overflow: hidden;
    margin: 0;
}

pre {
    background: #f4f4f4;
    border-left: 4px solid #2b5b84;
    padding: 12px;
    overflow-x: auto;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-size: 0.9rem;
}

.code-example {
    box-sizing: border-box;
    max-width: 100%;
    margin-bottom: 16px;
    padding: 4px 16px 12px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
}

.code-example pre {
    margin: 8px 0;
    border-radius: 4px;
}

blockquote {
    border-left: 3px solid #ffd43b;
    margin-left: 0;
    padding-left: 16px;
    color: #555;
    font-style: italic;
}

/* ===== Боковая панель (факт) ===== */
.fact-box {
    margin-top: 16px;
    padding: 12px 16px;
    background: #fff7d6;
    border: 1px solid #ffd43b;
    border-radius: 8px;
}

.side-panel {
    margin: 0;
    box-sizing: border-box;
}

.side-panel h3 {
    margin: 0 0 8px;
    font-size: 1em;
}

.side-panel ul {
    margin: 0;
    padding-left: 20px;
}

/* ===== Термины ===== */
dt {
    font-weight: bold;
    margin-top: 8px;
}

/* ===== Ногер ===== */
footer {
    grid-area: footer;
    position: relative;
    display: grid;
    grid-template-columns: 2fr 1fr 1.5fr;
    grid-template-areas:
        "nav contacts social"
        "copy copy copy";
    gap: 8px var(--grid-gap);
    margin-top: 40px;
    padding: 28px max(var(--page-pad), calc((100% - var(--content-width)) / 2)) 20px;
    font-size: 0.9em;
    background: #f4f4f4;
}

footer::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-green), var(--color-accent));
}

.footer-nav {
    grid-area: nav;
}

.footer-contacts {
    grid-area: contacts;
}

.footer-social {
    grid-area: social;
}

.footer-copy {
    grid-area: copy;
    margin: 8px 0 0;
    padding-top: 12px;
    border-top: 1px solid #ddd;
}

.footer-title {
    margin: 0 0 10px;
    font-weight: 700;
    color: var(--color-primary);
}

.footer-contacts p:not(.footer-title) {
    margin: 0 0 8px;
}

.footer-nav a,
.footer-contacts a {
    position: relative;
    display: inline-block;
    text-decoration: none;
    transition: transform var(--duration), color var(--duration);
}

.footer-nav a::after,
.footer-contacts a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -2px;
    width: 100%;
    height: 2px;
    background: var(--color-accent);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--duration);
}

.footer-nav a:hover,
.footer-contacts a:hover {
    color: var(--color-primary);
    transform: translateY(-2px);
}

.footer-nav a:hover::after,
.footer-contacts a:hover::after {
    transform: scaleX(1);
}

.footer-anchors a {
    margin-right: 16px;
}

.social-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.social-btn {
    --social-gradient: linear-gradient(135deg, var(--color-primary), var(--color-green));
    position: relative;
    isolation: isolate;
    overflow: hidden;
    display: inline-block;
    padding: 0.6em 1.4em;
    font-weight: 600;
    color: var(--color-primary);
    text-decoration: none;
    background: #fff;
    border-radius: 2em;
    box-shadow: inset 0 0 0 2px var(--color-primary);
    transition: color var(--duration), transform var(--duration);
}

.social-btn:visited {
    color: var(--color-primary);
}

.social-btn::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: var(--social-gradient);
    transform: translateY(-100%);
    transition: transform var(--duration) ease-out;
}

.social-vk {
    --social-gradient: linear-gradient(135deg, #0077ff, #00c6ff);
}

.social-tg {
    --social-gradient: linear-gradient(135deg, #229ed9, #6dd5fa);
}

.social-gh {
    --social-gradient: linear-gradient(135deg, #24292f, #6e5494);
}

.social-btn:hover,
.social-btn:focus-visible {
    cursor: pointer;
    color: #fff;
    transform: translateY(-2px);
}

.social-btn:hover::before,
.social-btn:focus-visible::before {
    transform: translateY(0);
}

address {
    font-style: normal;
    margin: 12px 0;
}

a {
    color: #2b5b84;
}

/* Псевдоклассы для обычных ссылок на странице */
a:visited {
    color: #6a4c93;
}


/* Кнопочка поднятия вверх :) */
.to-top {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #2b5b84;
    color: #fff;
    border-radius: 50%;
    text-decoration: none;
    font-size: 1.4em;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s;
}

.to-top.visible {
    opacity: 1;
    pointer-events: auto;
}

.to-top,
.to-top:visited {
    color: #fff;
}

.to-top:hover {
    background: #ffd43b;
    color: #2b5b84;
    box-shadow: 0 0 0 4px #d9e6f2;
}

/* ===== Форма ===== */

.form-scene {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    padding: clamp(1.5rem, 6vw, 4rem) clamp(0.75rem, 5vw, 3.5rem);
    background: var(--gradient-scene);
    border-radius: var(--radius);
}

.form-scene::before,
.form-scene::after {
    content: "";
    position: absolute;
    z-index: -1;
    aspect-ratio: 1;
    border-radius: 50%;
    pointer-events: none;
}

.form-scene::before {
    top: -5%;
    left: 10%;
    width: clamp(10rem, 40vw, 22rem);
    background: var(--gradient-warm);
}

.form-scene::after {
    right: 5%;
    bottom: -8%;
    width: clamp(12rem, 45vw, 26rem);
    background: var(--gradient-cool);
}

.form-square {
    --unit: clamp(0.6rem, 1.6vw, 1rem);
    position: absolute;
    z-index: 2;
    top: var(--y);
    left: var(--x);
    width: calc(var(--size) * var(--unit));
    aspect-ratio: 1;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid var(--glass-border);
    border-radius: 0.6rem;
    box-shadow: 0 0.4rem 1.2rem rgba(0, 0, 0, 0.2);
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    pointer-events: none;
    animation: square-wander 12s ease-in-out infinite;
    animation-delay: calc(var(--i) * -2.4s);
}

@keyframes square-wander {

    0%,
    100% {
        transform: translate(0, 0) rotate(0deg) scale(1);
    }

    25% {
        transform: translate(calc(var(--dx) * 1px), calc(var(--dy) * 1px)) rotate(45deg) scale(1.1);
    }

    50% {
        transform: translate(calc(var(--dx) * -0.6px), calc(var(--dy) * 1.4px)) rotate(90deg) scale(0.9);
    }

    75% {
        transform: translate(calc(var(--dx) * -1px), calc(var(--dy) * -0.8px)) rotate(135deg) scale(1.05);
    }
}

.feedback-form {
    position: relative;
    z-index: 1;
    max-width: 100%;
    padding: clamp(1rem, 3vw, 2rem);
    color: var(--color-text-light);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow: var(--glass-shadow);
    -webkit-backdrop-filter: blur(var(--glass-blur));
    backdrop-filter: blur(var(--glass-blur));
}

.feedback-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
}

.feedback-form>fieldset:first-of-type,
.feedback-form>fieldset:last-of-type,
.feedback-form>p,
.feedback-form>.form-buttons {
    grid-column: 1 / -1;
}

.feedback-form>fieldset:first-of-type {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 1.25rem;
}

.feedback-form>p {
    margin: 0;
}

.feedback-form fieldset {
    min-width: 0;
    margin: 0;
    transition: transform var(--duration), background var(--duration), border-color var(--duration);
    padding: 0.75em 1em 1em;
    border: 1px solid var(--glass-border);
    border-radius: 0.5rem;
    background: rgba(255, 255, 255, 0.08);
}

.feedback-form legend {
    padding: 0.15em 0.8em;
    font-weight: bold;
    color: var(--color-accent);
    background: var(--color-primary-dark);
    border-radius: 1em;
}

.feedback-form p {
    margin: 0.75em 0;
}

.feedback-form label {
    display: inline-block;
    margin-right: 0.5em;
    font-weight: 600;
}

/* Звёздочка у обязательных полей: */
.feedback-form label:has(+ [required])::after {
    content: " *";
    color: #ff9b9b;
}

/* Поля ввода */
.feedback-form input[type="text"],
.feedback-form input[type="tel"],
.feedback-form input[type="email"],
.feedback-form input[type="password"],
.feedback-form input[type="datetime-local"],
.feedback-form select,
.feedback-form textarea {
    box-sizing: border-box;
    width: 100%;
    max-width: 28rem;
    margin-top: 0.3em;
    padding: 0.6em 0.8em;
    font: inherit;
    background: #fafcff;
    border: 2px solid #b8c7d6;
    border-radius: 0.4rem;
    transition: border-color var(--duration), background var(--duration), box-shadow var(--duration), transform var(--duration);
    scroll-margin-top: 300px;
}

.feedback-form fieldset:hover,
.feedback-form fieldset:focus-within {
    transform: translateY(-3px);
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.6);
}

.feedback-form input:hover,
.feedback-form select:hover,
.feedback-form textarea:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.4rem 0.8rem rgba(0, 0, 0, 0.2);
}

/* Стиль поля в фокусе */
.feedback-form input:focus,
.feedback-form select:focus,
.feedback-form textarea:focus {
    outline: none;
    background: #fffbe6;
    border-color: var(--color-accent);
    transform: scale(1.02);
    box-shadow: 0 0 0 4px rgba(255, 212, 59, 0.35);
}

/* Подсказка placeholder */
.feedback-form ::placeholder {
    color: #8aa0b5;
    font-style: italic;
    opacity: 1;
}

.feedback-form input:focus::placeholder,
.feedback-form textarea:focus::placeholder {
    color: #c9b25a;
}

/* Подсветка некорректного значения (только после ввода) */
.feedback-form input:not(:placeholder-shown):invalid,
.feedback-form textarea:not(:placeholder-shown):invalid {
    border-color: #d62828;
}

.feedback-form textarea {
    resize: vertical;
}

.feedback-form input[type="radio"],
.feedback-form input[type="checkbox"] {
    accent-color: #2b5b84;
    margin-right: 0.4em;
}

/* Кнопки */
.form-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.feedback-form button,
.feedback-form input[type="submit"] {
    padding: 0.7em 1.4em;
    font: inherit;
    font-weight: bold;
    color: #fff;
    background: #2b5b84;
    border: none;
    border-radius: 0.4rem;
    cursor: pointer;
    transition: background var(--duration), color var(--duration), transform var(--duration);
}

.feedback-form button:hover,
.feedback-form input[type="submit"]:hover {
    background: var(--color-accent);
    color: var(--color-primary);
    transform: translateY(-3px) scale(1.04);
}

.feedback-form button[type="reset"] {
    background: #8a97a3;
}

/* ===== Карта и видео ===== */
.embed-map,
.embed-video {
    display: block;
    width: 100%;
    border: 0;
    border-radius: 0.75rem;
    box-shadow: 0 0.2rem 0.6rem rgba(0, 0, 0, 0.25);
    margin-bottom: 1.5rem;
}

.embed-video {
    aspect-ratio: 16 / 9;
}

h1 {
    font-size: clamp(1.5rem, 5vw, 2rem);
}

.burger-toggle {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.burger {
    display: none;
    position: relative;
    width: 28px;
    height: 20px;
    cursor: pointer;
}

.burger::before,
.burger::after,
.burger span {
    content: "";
    position: absolute;
    left: 0;
    width: 100%;
    height: 3px;
    background: #fff;
    border-radius: 2px;
    transition: transform 0.3s, opacity 0.3s;
}

.burger::before {
    top: 0;
}

.burger span {
    top: 8.5px;
}

.burger::after {
    top: 17px;
}

.burger-toggle:checked+.burger::before {
    transform: translateY(8.5px) rotate(45deg);
}

.burger-toggle:checked+.burger::after {
    transform: translateY(-8.5px) rotate(-45deg);
}

.burger-toggle:checked+.burger span {
    opacity: 0;
}

.burger-toggle:focus-visible+.burger {
    outline: 2px solid #ffd43b;
    outline-offset: 4px;
}

.notify {
    position: relative;
}

.notify-btn {
    position: relative;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: #fff;
    font-size: 1.3rem;
    cursor: pointer;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
    transition: transform 0.25s;
}

.notify:hover .notify-btn,
.notify:focus-within .notify-btn {
    transform: scale(1.1) rotate(-12deg);
}

.notify-count {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    background: #ff3366;
    color: #fff;
    font-size: 0.75rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.notify-list {
    position: absolute;
    top: 100%;
    right: 0;
    width: 280px;
    padding-top: 12px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity 0.25s, transform 0.25s, visibility 0s linear 0.25s;
}

.notify:hover .notify-list,
.notify:focus-within .notify-list {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition-delay: 0s;
}

.notify-list ul {
    list-style: none;
    margin: 0;
    padding: 8px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.notify-list a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    color: #333;
    text-decoration: none;
    transition: background 0.2s, color 0.2s, transform 0.2s;
}

.notify-list a:visited {
    color: #333;
}

.notify-list a:hover {
    background: #2b5b84;
    color: #fff;
    transform: scale(1.04);
}

.notify-list .num {
    flex: none;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #2b5b84;
    color: #fff;
    font-size: 0.8rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}

.notify-list a:hover .num {
    background: #ffd43b;
    color: #2b5b84;
}

.cards-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
}

.card {
    position: relative;
    flex: 1 1 200px;
    max-width: 260px;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: transform var(--duration), box-shadow var(--duration), filter var(--duration);
}

.card img {
    width: 55%;
    height: auto;
    filter: grayscale(0.7) drop-shadow(0 0.25rem 0.4rem rgba(0, 0, 0, 0.25));
    transition: transform 0.4s, filter 0.4s;
}

.cards-row:has(.card:hover, .card:focus-within) .card:not(:hover, :focus-within) {
    filter: blur(2px) brightness(0.85);
    transform: scale(0.96);
}

.card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(160deg, rgba(43, 91, 132, 0.95), rgba(76, 175, 122, 0.95));
    opacity: 0;
    transition: opacity 0.35s;
}

.card-body {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 16px;
    color: #fff;
    transform: translateY(100%);
    transition: transform 0.35s;
}

.card-body h3 {
    margin: 0 0 6px;
    color: #fff;
}

.card-body p {
    margin: 0 0 12px;
    font-size: 0.9rem;
}

.card-link {
    display: inline-block;
    padding: 6px 14px;
    background: #fff;
    color: #2b5b84;
    border-radius: 4px;
    text-decoration: none;
    font-weight: bold;
    font-size: 0.85rem;
}

.card-link:visited {
    color: #2b5b84;
}

.card:hover,
.card:focus-within {
    transform: translateY(-6px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.35);
    outline: none;
}

.card:hover::before,
.card:focus-within::before {
    opacity: 1;
}

.card:hover img,
.card:focus-within img {
    filter: grayscale(0) drop-shadow(0 0.5rem 0.8rem rgba(0, 0, 0, 0.45));
    transform: translateY(-35%) scale(0.8);
}

.card:hover .card-body,
.card:focus-within .card-body {
    transform: none;
}

.btn {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    padding: 0.8em 1.6em;
    font: inherit;
    font-weight: bold;
    color: #2b5b84;
    background: #fff;
    border: 2px solid #2b5b84;
    border-radius: 8px;
    cursor: pointer;
    transition: color 0.3s, background 0.3s, border-color 0.3s, transform 0.3s, box-shadow 0.3s;
}

.btn-lift {
    color: #fff;
    background: #2b5b84;
    box-shadow: 0 4px 0 #1a3a55;
}

.btn-lift:visited {
    color: white;
}

.btn-lift::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 6px;
    width: 0;
    height: 2px;
    background: #ffd43b;
    transform: translateX(-50%);
    transition: width 0.3s;
}

.btn-lift:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 8px 0 #1a3a55, 0 14px 20px rgba(0, 0, 0, 0.3);
}

.btn-lift:hover::after {
    width: 60%;
}

.btn-lift:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 #1a3a55;
}

.map-wrap {
    max-width: 100%;
    overflow-x: auto;
}

.map-wrap img {
    display: block;
}

.video-card {
    position: relative;
    margin: 0 0 1.5rem;
    padding: clamp(10px, 4%, 40px);
    overflow: hidden;
    background: #222a35;
    border-radius: 0.75rem;
}

.video-card .embed-video {
    margin: 0;
    border-radius: 0.4rem;
    box-shadow: none;
}

.video-card::before {
    content: "";
    position: absolute;
    top: 8%;
    left: 4%;
    width: 75%;
    height: 55%;
    background: rgba(0, 0, 0, 0.88);
    opacity: 0;
    transform: translateX(-12%) scale(0.9);
    transition: opacity 0.4s, transform 0.4s;
    pointer-events: none;
}

.video-caption {
    position: absolute;
    top: 8%;
    left: 4%;
    box-sizing: border-box;
    width: 75%;
    height: 55%;
    padding: 4%;
    overflow: hidden;
    color: #fff;
    font-size: clamp(0.7rem, 2.2vw, 1rem);
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.4s, transform 0.4s;
    pointer-events: none;
}

.video-caption h3 {
    margin: 0 0 6px;
    color: #fff;
}

.video-caption p {
    margin: 0;
}

.video-card:hover::before {
    opacity: 1;
    transform: none;
}

.video-card:hover .video-caption {
    opacity: 1;
    transform: none;
}

/* ===== Курсовая работа: многостраничная версия ===== */

/* Атрибут hidden должен скрывать элемент даже при заданном display */
[hidden] {
    display: none !important;
}

/* Ссылка для пропуска меню (доступна с клавиатуры) */
.skip-link {
    position: absolute;
    left: 8px;
    top: -60px;
    z-index: 100;
    padding: 8px 12px;
    background: #ffd43b;
    color: #2b5b84;
    border-radius: 4px;
}

.skip-link:focus {
    top: 8px;
}

/* Активный пункт меню (текущая страница) */
.main-nav a[aria-current="page"] {
    background: #fff;
    color: #2b5b84;
    font-weight: bold;
}

.notify-list a.is-read {
    opacity: 0.55;
}

/* Навигационная цепочка */
.breadcrumbs {
    margin-top: 16px;
    font-size: 0.9em;
    color: #555;
}

.breadcrumbs a {
    text-decoration: none;
}

.lead {
    font-size: 1.1em;
    color: #444;
}

/* Подвал: меню разделов */
.footer-nav ul {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
    gap: 8px 20px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.sections-list li {
    margin-bottom: 6px;
}

/* Новость с раскрытым текстом */
.news-element.expanded .news-text>p {
    display: block;
    -webkit-line-clamp: unset;
    line-clamp: none;
}

.news-more {
    margin-top: 6px;
    padding: 0;
    font: inherit;
    font-size: 0.9em;
    font-weight: 600;
    color: var(--color-accent);
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: underline;
}

/* ===== Страница «Языки» ===== */
.filter-panel {
    margin: 16px 0;
    padding: 16px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
}

.filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.filter-btn,
.tab-list [role="tab"] {
    padding: 0.45em 1em;
    font: inherit;
    font-weight: 600;
    color: #2b5b84;
    background: #fff;
    border: 2px solid #2b5b84;
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.filter-btn:hover,
.tab-list [role="tab"]:hover {
    background: #ffd43b;
    border-color: #ffd43b;
}

.filter-btn[aria-pressed="true"],
.tab-list [role="tab"][aria-selected="true"] {
    color: #fff;
    background: #2b5b84;
    border-color: #2b5b84;
}

.search-label {
    display: block;
    font-weight: 600;
}

.search-label input {
    box-sizing: border-box;
    display: block;
    width: 100%;
    max-width: 28rem;
    margin-top: 0.3em;
    padding: 0.6em 0.8em;
    font: inherit;
    border: 2px solid #b8c7d6;
    border-radius: 0.4rem;
}

.search-label input:focus {
    outline: none;
    border-color: #ffd43b;
    background: #fffbe6;
}

.filter-status {
    margin: 8px 0 0;
    color: #555;
}

.lang-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 16px;
}

.lang-card {
    --ray-width: 3px;
    position: relative;
    isolation: isolate;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 16px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    scroll-margin-top: 90px;
    transition: box-shadow var(--duration), transform var(--duration), filter var(--duration), border-color var(--duration);
}

.lang-card::before {
    content: "";
    position: absolute;
    inset: -100%;
    z-index: -2;
    background: conic-gradient(transparent 0deg 60deg, var(--color-accent) 90deg, transparent 120deg 240deg, var(--color-primary) 270deg, transparent 300deg);
    opacity: 0;
    transition: opacity var(--duration);
}

.lang-card::after {
    content: "";
    position: absolute;
    inset: var(--ray-width);
    z-index: -1;
    background: #fff;
    border-radius: calc(8px - var(--ray-width) / 2);
}

.lang-card:hover {
    border-color: transparent;
    filter: brightness(1.08) saturate(1.2);
    transform: translateY(-6px);
    box-shadow: 0 0.75rem 1.5rem rgba(43, 91, 132, 0.3);
}

.lang-card:hover::after {
    background: #fffdf3;
}

.lang-card:hover::before {
    opacity: 1;
    animation: rays-spin 3s linear infinite;
}

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

.lang-card:target {
    border-color: #ffd43b;
    box-shadow: 0 0 0 3px #ffd43b;
}

.lang-card h3 {
    margin: 8px 0 4px;
}

.lang-facts {
    margin: 8px 0;
    font-size: 0.9em;
}

.lang-facts div {
    display: flex;
    gap: 6px;
}

.lang-facts dt {
    margin: 0;
}

.lang-facts dt::after {
    content: ":";
}

.lang-facts dd {
    margin: 0;
}

.lang-link {
    margin-top: auto;
    font-weight: 600;
}

/* ===== Страница «Примеры кода» ===== */
.tab-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.code-wrap {
    position: relative;
}

.code-wrap pre {
    padding-right: 110px;
    white-space: pre;
}

.copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 4px 10px;
    font: inherit;
    font-size: 0.8rem;
    color: #fff;
    background: #2b5b84;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.copy-btn:hover {
    background: #ffd43b;
    color: #2b5b84;
}

/* ===== Страница «Термины» ===== */
.terms-search {
    margin-bottom: 16px;
}

.terms-list .term {
    padding: 8px 0;
    border-bottom: 1px solid #e3e3e3;
}

.terms-list dd {
    margin-left: 24px;
}

mark {
    background: #ffd43b;
    border-radius: 2px;
}

/* ===== Страница «Тест» ===== */
.quiz-question {
    margin: 0 0 16px;
    padding: 12px 16px;
    background: #fff;
    border: 2px solid #c5d8ea;
    border-radius: 8px;
}

.quiz-question legend {
    padding: 0 6px;
    font-weight: bold;
    color: #2b5b84;
}

.quiz-question label {
    display: block;
    margin: 6px 0;
    cursor: pointer;
}

.quiz-question input {
    accent-color: #2b5b84;
    margin-right: 6px;
}

.quiz-question.correct {
    border-color: #4caf7a;
    background: #eefaf2;
}

.quiz-question.wrong {
    border-color: #d62828;
    background: #fdeeee;
}

.quiz-result,
.form-success {
    margin-top: 16px;
    padding: 12px 16px;
    font-weight: 600;
    background: #eefaf2;
    border: 1px solid #4caf7a;
    border-radius: 8px;
}

/* ===== Страница «Обратная связь» ===== */
.field-error {
    display: block;
    margin-top: 4px;
    font-size: 0.85em;
    color: #ffb3b3;
}

.feedback-form .invalid {
    border-color: #d62828 !important;
    background: #fff5f5 !important;
}

.char-counter {
    display: block;
    font-size: 0.85em;
    color: #c9d8e6;
}

.not-found {
    text-align: center;
}

.not-found .btn {
    display: inline-block;
    text-decoration: none;
}

.spheres-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-auto-rows: minmax(8rem, auto);
    gap: var(--grid-gap);
    grid-template-areas:
        "web web data mobile"
        "games enterprise enterprise system"
        "games scripts scripts system";
}

.sphere-card {
    --sphere-color: var(--color-primary);
    padding: 1rem 1.25rem;
    color: #fff;
    background: linear-gradient(145deg, var(--sphere-color), var(--color-primary-dark));
    border-radius: var(--radius);
    box-shadow: 0 0.3rem 0.8rem rgba(0, 0, 0, 0.2);
    transition: transform var(--duration), box-shadow var(--duration);
}

.sphere-card h3 {
    margin: 0 0 0.5rem;
    color: #fff;
    transition: transform var(--duration);
}

.sphere-card p {
    margin: 0;
    font-size: 0.95em;
}

.sphere-card:hover {
    transform: translateY(-6px) scale(1.03);
    box-shadow: 0 0.8rem 1.6rem rgba(0, 0, 0, 0.3);
}

.sphere-card:hover h3 {
    transform: translateX(6px);
}

.sphere-web {
    grid-area: web;
    --sphere-color: #2b8bd6;
}

.sphere-data {
    grid-area: data;
    --sphere-color: #4caf7a;
}

.sphere-mobile {
    grid-area: mobile;
    --sphere-color: #8e5bd6;
}

.sphere-games {
    grid-area: games;
    --sphere-color: #e0573e;
}

.sphere-enterprise {
    grid-area: enterprise;
    --sphere-color: #c28a00;
}

.sphere-system {
    grid-area: system;
    --sphere-color: #546e7a;
}

.sphere-scripts {
    grid-area: scripts;
    --sphere-color: #1f9e9e;
}

@media (max-width: 1000px) {
    footer {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-areas:
            "nav nav"
            "contacts social"
            "copy copy";
    }
}

@media (max-width: 960px) {
    .home-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-areas:
            "title title"
            "lead lead"
            "news news"
            "sections top"
            "notes notes"
            "aside aside"
            "cards cards";
    }

    .spheres-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-areas:
            "web web"
            "data mobile"
            "games enterprise"
            "games system"
            "scripts scripts";
    }

    .burger {
        display: block;
    }

    .main-nav {
        position: absolute;
        top: 100%;
        left: 12px;
        right: 12px;
        margin-top: 8px;
        background-color: #2b5b84;
        opacity: 0;
        visibility: hidden;
        transform: translateY(-10px);
        transition: opacity 0.3s, transform 0.3s, visibility 0.3s;
    }

    .burger-toggle:checked~.main-nav {
        opacity: 1;
        visibility: visible;
        transform: none;
    }

    .main-nav>ul {
        flex-direction: column;
        gap: 4px;
    }

    .main-nav a {
        display: block;
        padding: 10px 12px;
    }

    .notify {
        position: static;
    }

    .notify-list {
        left: 12px;
        right: 12px;
        width: auto;
    }
}

@media (max-width: 700px) {
    .home-grid {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "title"
            "lead"
            "news"
            "sections"
            "top"
            "notes"
            "aside"
            "cards";
    }

    .news-element img {
        width: 64px;
        height: 64px;
    }

}

@media (max-width: 768px) {
    footer {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "nav"
            "contacts"
            "social"
            "copy";
    }
}

@media (max-width: 712px) {

    .feedback-form,
    .feedback-form>fieldset:first-of-type {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 560px) {
    .spheres-grid {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas: "web" "data" "mobile" "games" "enterprise" "system" "scripts";
    }
}

@media (max-width: 480px) {
    :root {
        --page-pad: 16px;
    }

    main {
        padding-bottom: 32px;
    }

    .site-header {
        gap: 10px;
        padding: 12px 16px;
    }

    .feedback-form {
        padding: 1rem 0.75rem;
    }

    .feedback-form fieldset {
        padding: 0.5em 0.75em 0.75em;
    }

    .feedback-form input[type="file"] {
        max-width: 100%;
    }

    .logo {
        gap: 6px;
    }

    .logo span {
        font-size: 0.85em;
    }

    .video-caption p {
        display: none;
    }
}

@media (min-width: 1800px) {
    :root {
        --content-width: 1300px;
    }

    body {
        font-size: 1.15rem;
    }
}

/* Пользователь попросил уменьшить анимацию */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}

/* Версия для печати */
@media print {

    .site-header,
    .to-top,
    .skip-link,
    .filter-panel,
    .tab-list,
    .copy-btn,
    .embed-map,
    .video-card,
    .footer-nav {
        display: none !important;
    }

    body {
        background: #fff;
        color: #000;
    }

    [role="tabpanel"][hidden] {
        display: block !important;
    }

    a::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
    }
}

/* Практика 9–10 */
.pill-btn {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 999px;
    background: var(--color-primary);
    color: #fff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: transform var(--duration), background var(--duration), box-shadow var(--duration);
}

.pill-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--glass-shadow);
}

.like-btn.liked {
    background: linear-gradient(135deg, #ff4d6d, #c9184a);
    color: #fff;
    border-color: transparent;
}

.extras-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.click-badge {
    padding: 0.5rem 1rem;
    border-radius: 999px;
    background: var(--gradient-cool);
    color: #fff;
    font-weight: 600;
}

.draw-dot {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--gradient-warm);
    pointer-events: none;
    transform: translate(-50%, -50%);
    animation: dot-fade 1.5s forwards;
}

@keyframes dot-fade {
    to {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.3);
    }
}

.login-page {
    display: grid;
    place-items: center;
    min-height: 70vh;
    padding: 2rem var(--page-pad);
}

.login-card {
    width: 100%;
    max-width: 460px;
    box-sizing: border-box;
    padding: 2.5rem 2rem;
    border: 1px solid var(--glass-border);
    border-radius: calc(var(--radius) * 2);
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    box-shadow: var(--glass-shadow);
    text-align: center;
}

.login-card h1 {
    margin: 0 0 0.25rem;
}

.login-sub {
    margin: 0 0 1.5rem;
    opacity: 0.8;
}

.login-form {
    display: grid;
    gap: 1rem;
    text-align: left;
}

.field {
    display: grid;
    gap: 0.35rem;
    font-weight: 600;
    font-size: 0.9rem;
}

.login-form input {
    width: 100%;
    box-sizing: border-box;
    padding: 0.75rem 1rem;
    border: 2px solid #c9d6e3;
    border-radius: var(--radius);
    background: #fff;
    color: #1a3a55;
    font: inherit;
    transition: border-color var(--duration), box-shadow var(--duration);
}

.login-form input:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(255, 212, 59, 0.4);
}

.captcha-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    background: var(--color-primary-dark);
    color: var(--color-text-light);
}

.captcha-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.7;
}

.captcha-text {
    font-family: monospace;
    font-size: 1.5rem;
    letter-spacing: 0.3em;
    font-style: italic;
    text-decoration: line-through rgba(255, 212, 59, 0.6);
    user-select: none;
}

.captcha-row {
    display: flex;
    gap: 0.5rem;
}

.captcha-msg {
    margin: 0;
    min-height: 1.2em;
    font-weight: 600;
}

.captcha-msg.ok {
    color: var(--color-green);
}

.captcha-msg.error {
    color: #ff6b6b;
}

.login-submit {
    padding: 0.85rem;
    border: none;
    border-radius: var(--radius);
    background: var(--gradient-warm);
    color: #1a1a1a;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: transform var(--duration), opacity var(--duration);
}

.login-submit:hover:not(:disabled) {
    transform: translateY(-2px);
}

.login-submit:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.login-extra {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1.25rem;
}

.link-btn {
    border: none;
    background: none;
    color: inherit;
    font: inherit;
    text-decoration: underline;
    cursor: pointer;
    opacity: 0.85;
}

.link-btn:hover {
    opacity: 1;
    color: var(--color-accent);
}

/* Практика 11–12 */
.store-panel {
    margin: 16px 0;
    padding: 16px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px 16px;
}

.store-panel .search-label input {
    width: 9rem;
}

.store-panel .filter-buttons {
    margin: 0;
}

.course-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
    gap: 16px;
    margin: 16px 0 0;
    padding: 0;
    list-style: none;
}

.course-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px;
    text-align: center;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: var(--radius);
    transition: transform var(--duration), box-shadow var(--duration);
}

.course-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--glass-shadow);
}

.course-card h3 {
    margin: 0;
}

.course-price {
    margin: auto 0 4px;
    font-size: 1.2em;
    font-weight: 700;
}

.cart-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.cart-item {
    display: grid;
    grid-template-columns: 1fr auto 7rem auto;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    padding: 10px 16px;
    background: #fff;
    border: 2px solid #c5d8ea;
    border-radius: 8px;
}

.cart-title {
    font-weight: 600;
}

.cart-qty {
    display: flex;
    align-items: center;
    gap: 8px;
}

.qty-btn,
.cart-remove {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: #e8f0f7;
    color: var(--color-primary);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
}

.qty-btn:hover {
    background: var(--color-accent);
}

.cart-remove:hover {
    background: #fdeeee;
}

.cart-sum {
    text-align: right;
}

.cart-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.cart-total {
    font-size: 1.2em;
}

.notification {
    position: fixed;
    z-index: 50;
    padding: 12px 18px;
    border-radius: var(--radius);
    background: var(--color-primary);
    color: #fff;
    font-weight: 600;
    box-shadow: var(--glass-shadow);
    animation: notification-in 0.3s;
}

.notification-warn {
    background: #e0573e;
}

@keyframes notification-in {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
}

@media (max-width: 600px) {
    .cart-item {
        grid-template-columns: 1fr auto;
    }
}