/* ========================================
   ПЕРЕМЕННЫЕ ДЛЯ ТЕМ
   ======================================== */
:root {
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --container-width: 1100px;
    --radius-lg: 24px;
    --radius-sm: 12px;
}

* {
    -webkit-tap-highlight-color: transparent;
}

/* ========================================
   ТЕМА 1: СВЕТЛАЯ — "Warm Earth & Clay"
   Pantone: 9224 C, 9225 C, 9226 C, 7530 C, 2727 C
   ======================================== */
[data-theme="light"] {
    /* Фоны */
    --bg-primary: #FDFBF7;              /* Pantone 9224 C — Vanilla Cream */
    --bg-secondary: #F5F0E8;            /* Pantone 9225 C — Warm White */
    --bg-card: #FDFBF7;                 /* Pantone 9225 C */
    --bg-card-hover: #E8DFD0;           /* Pantone 9226 C — Candied Ginger */

    /* Текст */
    --text-primary: #2C2418;            /* Pantone 412 C — Espresso */
    --text-secondary: #5C4A3A;          /* Pantone 4625 C — Cocoa */
    --text-muted: #8B7355;              /* Pantone 7530 C — Muted Clay */

    /* Границы */
    --border-color: #E0D5C2;            /* Pantone 9226 C — Soft Clay */
    --border-color-light: #D4C5AE;

    /* Акцент — технологичный синий */
    --accent: #3B82F6;                  /* Pantone 2727 C — Luminous Blue */
    --accent-hover: #60A5FA;            /* Pantone 2728 C — Poseidon */

    /* Тени и стекло */
    --shadow: 0 8px 32px rgba(44, 36, 24, 0.08);
}

/* ========================================
   ТЕМА 2: ТЁМНАЯ — "Deep Space"
   Pantone: 5395 C, 433 C, 2727 C, 656 C
   ======================================== */
[data-theme="dark"] {
    /* Фоны — глубокие, космические */
    --bg-primary: #111827;              /* Pantone 5395 C — Almost Black */
    --bg-secondary: #070B14;            /* Pantone 433 C — Deep Charcoal */
    --bg-card: #111827;   /* Pantone 2766 C — Space Blue */
    --bg-card-hover: #1e293b; /* Pantone 2768 C — Nebula */

    /* Текст — холодный белый */
    --text-primary: #E2E8F0;            /* Pantone 656 C — Ice White */
    --text-secondary: #94A3B8;          /* Pantone 7544 C — Steel */
    --text-muted: #64748B;              /* Pantone 7545 C — Slate */

    /* Границы — тонкие синие */
    --border-color: rgba(59, 130, 246, 0.12);
    --border-color-light: rgba(59, 130, 246, 0.2);

    /* Акцент */
    --accent: #3B82F6;                  /* Pantone 2727 C — Luminous Blue */
    --accent-hover: #60A5FA;            /* Pantone 2728 C — Poseidon */

    /* Тени и стекло */
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

#about, #services, #projects, #contacts {
    scroll-margin-top: 50px; /* высота отступа */
}
/* ========================================
   БАЗОВЫЕ СБРОСЫ
   ======================================== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.4s ease, color 0.4s ease;
}

body.modal-open {
    overflow: hidden;
    /* Компенсация ширины скроллбара, чтобы контент не прыгал */
    padding-right: var(--scrollbar-width, 0);
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

/* ========================================
   КОНТЕЙНЕР
   ======================================== */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 24px;
}

/* ========================================
   ТУМБЛЕР ДЛЯ ПЕРЕКЛЮЧЕНИЯ ТЕМ
   ======================================== */
.theme-switcher {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 56px;
    height: 30px;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: #111827;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50px;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background: #F5F0E8;
    border-radius: 50%;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.toggle-switch input:checked + .toggle-slider {
    background: #5C4A3A;
    border-color: rgba(255, 255, 255, 0.1);
}

.toggle-switch input:checked + .toggle-slider::before {
    background: #e8dfd0;
    transform: translateX(26px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* Hover тумблера — оставляем везде (навигационный элемент) */
/*
.toggle-switch:hover .toggle-slider {
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.06);
}

.toggle-switch input:checked:hover + .toggle-slider {
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.08);
}
*/

[data-theme="dark"] .toggle-switch:hover .toggle-slider,
[data-theme="dark"] .toggle-switch input:checked:hover + .toggle-slider {
    box-shadow: 0 0 0 0.2px rgba(59, 130, 246, 0.25), 0 0 8px 2px rgba(59, 130, 246, 0.35);
}

/* Hover — светлая тема (мягкая тень) */
[data-theme="light"] .toggle-switch:hover .toggle-slider,
[data-theme="light"] .toggle-switch input:checked:hover + .toggle-slider {
    box-shadow: 
        0 0 0 0.2px rgba(0, 0, 0, 0.4),
        0 0 8px 2px rgba(0, 0, 0, 0.3);
}

/* ========================================
   ШАПКА
   ======================================== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: 
        linear-gradient(90deg, #0a0a0a 0%, transparent 50%),
        linear-gradient(270deg, #0a0a0a 0%, transparent 50%),
        #0F0F0F;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 1000;
    padding: 16px 0;
}

.header__inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header__left {
    display: flex;
    align-items: center;
    gap: 25px;
}

/* Hover навигации — оставляем везде */
.header__back {
    display: flex;
    align-items: center;
    gap: 6px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.25s ease;
    text-decoration: none;
}

.header__back:hover {
    color: #ffffff;
    transform: translateX(-3px);
}

.header__back svg {
    width: 18px;
    height: 18px;
    stroke: rgba(255, 255, 255, 0.5);
    transition: stroke 0.25s ease, transform 0.25s ease;
}

.header__back:hover svg {
    stroke: #ffffff;
    transform: translateX(-3px);
}

.logo {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    color: #ffffff;
    transition: transform 0.25s ease;
    display: inline-block;
}

.logo:hover {
    transform: scale(1.04);
}

.nav__list {
    display: flex;
    gap: 32px;
}

.nav__link {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.6);
    transition: color 0.2s;
    position: relative;
    cursor: pointer;
}

.nav__link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: #3b82f6;
    transition: width 0.3s;
}

.nav__link:hover {
    color: #ffffff;
}

.nav__link:hover::after {
    width: 100%;
}

.nav__link--active {
    color: var(--accent);
}

.nav__link--active:hover {
    color: var(--accent-hover);
}

.nav__link--active::after {
    width: 100%;
    background: var(--accent);
}

.nav__divider {
    color: rgba(255, 255, 255, 0.15);
    user-select: none;
    display: flex;
    align-items: center;
}

.nav__divider-mobile {
    display: none;
}

.nav__link--external::after {
    background: #f59e0b;
}

.nav__link--external:hover {
    color: #ffffff;
}

.nav__link--external:hover::after {
    width: 100%;
}

.burger {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.burger__line {
    display: block;
    width: 24px;
    height: 2px;
    background: #ffffff;
    transition: all 0.3s;
}

.burger--active .burger__line:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.burger--active .burger__line:nth-child(2) {
    opacity: 0;
}
.burger--active .burger__line:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ========================================
   HERO
   ======================================== */
.hero {
    position: relative;
    transition: background 0.4s;
    z-index: 3;
}

.hero__image-wrapper {
    position: relative;
    width: 100%;
    border-radius: 0 0 48px 48px;
    overflow: hidden;
    transition: border-color 0.4s;
}

[data-theme="light"] .hero__image-wrapper {
    border: 1px solid var(--border-color);
    border-top: none;
}

[data-theme="dark"] .hero__image-wrapper {
    border: none;
}

.hero__image {
    width: 100%;
    height: 60vh;
    min-height: 400px;
    max-height: 700px;
    position: relative;
    overflow: hidden;
}

.hero__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.hero__image::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 65%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
    pointer-events: none;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.hero__content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: absolute;
    bottom: 48px;
    left: 0;
    right: 0;
    text-align: center;
    padding: 0 24px;
    z-index: 2;
}

.hero__title {
    font-size: 3.5rem;
    line-height: 1.2;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: #ffffff;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.hero__title-accent {
    color: #3B82F6;
}

.hero__role {
    font-size: 0.9rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.65);
    margin-bottom: 20px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.hero__subtitle {
    font-size: 1.2rem;
    line-height: 1.2;
    color: rgba(255, 255, 255, 0.85);
    max-width: 800px;
    margin: 0 auto;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

/* ========================================
   TECH-STACK
   ======================================== */
.tech-stack {
    margin-top: -100px;
    transition: background 0.4s;
    position: relative;
    z-index: 1;
}

.tech-stack__wrapper {
    width: 100%;
    background: var(--bg-secondary);
    border-radius: 0 0 48px 48px;
    padding: 125px 0 30px;
    transition: all 0.4s;
    position: relative;
}

.tech-stack__scroll-container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 24px;
    position: relative;
}

.tech-stack__scroll {
    overflow: hidden;
    position: relative;
    padding: 4px 0;
    mask-image: linear-gradient(to right, transparent, black 8%, black 92%, transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, black 8%, black 92%, transparent);
}

.tech-stack__track {
    display: flex;
    gap: 40px;
    animation: scrollTech 20s linear infinite;
    width: max-content;
    padding: 6px 0;
}

.tech-stack__item {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    padding: 10px 28px;
    border-radius: 100px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s;
    white-space: nowrap;
    position: relative;
    z-index: 1;
    cursor: default;
}

.tech-stack__item i {
    font-size: 1.2em;
    line-height: 1;
}

[data-theme="light"] .tech-stack__item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

[data-theme="dark"] .tech-stack__item {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #d0d0d0;
}

@keyframes scrollTech {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50%);
    }
}

/* ========================================
   ОБО МНЕ
   ======================================== */
.about {
    padding: 80px 0;
    background: var(--bg-primary);
    transition: background 0.4s;
    z-index: 2;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.section-subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 48px;
    font-size: 1.1rem;
}

.about__grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 48px;
    align-items: start;
}

.about__content p {
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.about__title-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.about__title-row p {
    margin-bottom: 0;
}

.about__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin-inline: 10%;
    gap: 12px;
    margin-top: 12px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

/* ========================================
   КНОПКИ
   ======================================== */
.btn--primary {
    background: var(--accent);
    color: #fff;
    padding: 12px 28px;
    border-radius: 100px;
    font-weight: 600;
    transition: all 0.3s;
    border: none;
    cursor: pointer;
}

.btn--secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 12px 28px;
    border-radius: 100px;
    font-weight: 600;
    transition: all 0.3s;
    cursor: pointer;
}

/* ========================================
   НАВЫКИ
   ======================================== */
.skills {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.skills__columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 48px;
}

.skills__header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 8px;
    white-space: nowrap;
}

.skills__label {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.skills__percent {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--accent);
    white-space: nowrap;
}

.skills__bar {
    width: 100%;
    height: 4px;
    background: var(--border-color);
    border-radius: 100px;
    overflow: hidden;
    margin-bottom: 12px;
}

.skills__bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 100px;
    transition: width 0.8s ease;
}

.skills__stack {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.skills__learning {
    justify-items: center;
    margin-top: 12px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.skills__subtitle {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.skills__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* ========================================
   ЧТО Я МОГУ ПРЕДЛОЖИТЬ
   ======================================== */
.services {
    padding: 80px 0;
    background: var(--bg-primary);
    transition: background 0.4s;
    z-index: 2;
}

.services__grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 64px;
    align-items: start;
}

.services__list {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.service-item {
    display: flex;
    gap: 20px;
    padding: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    transition: all 0.35s ease;
}

.service-item__title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.service-item__description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.services__action {
    display: flex;
    justify-content: center;
    gap: 14px;
    margin-top: 8px;
}

.services__visual {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px;
    position: sticky;
    top: 100px;
}

.services__visual-card {
    text-align: center;
}

.services__visual-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
}

/* ========================================
   ЧТО Я УМЕЮ (СОФТ-СКИЛЛЫ)
   ======================================== */
.capabilities {
    padding: 80px 0;
    background: var(--bg-secondary);
    transition: background 0.4s;
    z-index: 2;
    border-top: 1px solid var(--border-color);
}

.capabilities__grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 270px));
    justify-content: center;
    gap: 24px;
}

.capability-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 32px 24px;
    border: 1px solid var(--border-color);
    transition: all 0.35s ease;
}

.capability-card__title {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.capability-card__description {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 16px;
}

.capability-card__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* ========================================
   ПРОЕКТЫ
   ======================================== */
.projects {
    padding: 80px 0;
    background: var(--bg-secondary);
    transition: background 0.4s;
    z-index: 2;
    border-top: 1px solid var(--border-color);
}

.projects__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.project-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: all 0.35s;
}

.project-card__image {
    position: relative;
    height: 200px;
    overflow: hidden;
    background: var(--bg-secondary);
}

.project-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.project-card__status {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 4px 12px;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    z-index: 2;
}

.status--completed {
    background: rgba(52, 211, 153, 0.85);
}

.status--in-progress {
    background: rgba(59, 130, 246, 0.85);
}

.status--pet-project {
    background: rgba(139, 92, 246, 0.85);
}

.project-card__body {
    padding: 24px;
}

.project-card__title {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.project-card__description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.project-card__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;                           
    margin-bottom: 16px;
}

.project-card__more {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--accent);
    transition: color 0.2s;
}

/* ========================================
   КОНТАКТЫ
   ======================================== */
.contacts {
    padding: 80px 0;
    background: var(--bg-primary);
    transition: background 0.4s;
    z-index: 2;
}

.contacts__inner {
    text-align: center;
}

.contacts__list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
}

.contacts__link {
    display: inline-block;
    padding: 14px 32px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    transition: all 0.3s;
    border: 1px solid var(--border-color);
}

.contacts__link--primary {
    background: var(--accent);
    color: #fff;
    border-color: transparent;
}

.contacts__link--secondary {
    background: var(--bg-card);
    color: var(--text-secondary);
}

/*Разделитель контактов*/
.contacts__divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin: 26px 0 26px;
    color: var(--text-muted);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.contacts__divider::before,
.contacts__divider::after {
    content: '';
    flex: 1;
    max-width: 120px;
    height: 1px;
    background: var(--border-color);
}

.footer {
    padding: 32px 0;
    background: var(--bg-secondary);
    color: var(--text-muted);
    font-size: 0.875rem;
    text-align: center;
    border-top: 1px solid var(--border-color);
    transition: background 0.4s, border-color 0.4s;
}

/* ========================================
   ВСПОМОГАТЕЛЬНЫЕ КЛАССЫ
   ======================================== */

[data-theme="dark"] .section-gradient {
    background: linear-gradient(
        180deg,
        var(--bg-primary) 0%,
        #0D1526 50%,
        var(--bg-secondary) 100%
    );
}

.user-select-none {
    -webkit-user-select: none !important;
    -khtml-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    -o-user-select: none !important;
    user-select: none !important;
}

/* ========================================
   УНИВЕРСАЛЬНЫЕ ТЭГИ
   ======================================== */
.tag {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    transition: all 0.2s ease;
    cursor: default;
    white-space: nowrap;
}

.tag--small {
    padding: 2px 10px;
    font-size: 0.7rem;
}

.tag--learning {
    background: rgba(59, 130, 246, 0.06);
    border: 1px dashed var(--accent);
    color: var(--accent);
}

.tag--blue {
    border-color: #3B82F6;
    color: #3B82F6;
    background: rgba(59, 130, 246, 0.06);
}

.tag--green {
    border-color: #22C55E;
    color: #22C55E;
    background: rgba(34, 197, 94, 0.06);
}

.tag--purple {
    border-color: #8B5CF6;
    color: #8B5CF6;
    background: rgba(139, 92, 246, 0.06);
}

/* ========================================
   МОДАЛЬНОЕ ОКНО
   ======================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    max-width: 720px;
    width: 100%;
    margin: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    overflow: visible;
    max-height: none;
}

.modal__close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    background: rgba(0, 0, 0, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}

.modal__scroll {
    overflow-y: auto;
    flex: 1;
    padding: 0;
    -webkit-overflow-scrolling: touch;
}

.modal__scroll::-webkit-scrollbar {
    width: 6px;
}

.modal__scroll::-webkit-scrollbar-track {
    background: transparent;
    margin: 12px 0;
    border-radius: 100px;
}

.modal__scroll::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 100px;
    transition: background 0.3s ease;
}

/* Hover скроллбара — оставляем в основном CSS (это не тач) */
.modal__scroll::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.modal__scroll {
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.modal__image {
    width: 100%;
    height: 400px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.modal__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.modal__body {
    padding: 32px 32px 40px;
}

.modal__title {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 8px;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.modal__meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.modal__status {
    font-size: 0.875rem;
    font-weight: 600;
}

.modal__year {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.modal__description {
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 20px;
}

.modal__description p {
    margin-bottom: 12px;
}

.modal__description ul {
    padding-left: 20px;
    margin: 8px 0 16px;
}

.modal__description li {
    margin-bottom: 4px;
    list-style-type: disc;
}

.modal__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 24px;
}

.modal__links {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.modal__link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    border-radius: 100px;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.3s ease;
    text-decoration: none;
}

.modal__link--active {
    background: var(--accent);
    color: #fff;
    border: 1px solid var(--accent);
}

.modal__link--inactive {
    background: var(--bg-card);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    cursor: not-allowed;
    opacity: 0.6;
}

.modal__link--inactive:hover {
    transform: none;
    box-shadow: none;
}

.modal__gallery {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin: 16px 0 20px;
    justify-items: center;
}

.modal__gallery img {
    max-width: 100%;
    max-height: 160px;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    cursor: pointer;
    background: var(--bg-secondary);
}

/* ========================================
   EMAIL COPY (модалка)
   ======================================== */
.email-copy {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.email-copy__field {
    flex: 1;
    min-width: 0;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 0.95rem;
    font-weight: 500;
    outline: none;
    cursor: text;
    transition: border-color 0.2s;
    -webkit-user-select: text;
    user-select: text;
}

.email-copy__field:focus {
    border-color: var(--accent);
}

/* Кнопка-скопировать */
.email-copy__button {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    background: var(--accent);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background-color 0.2s;
}

.email-copy__icon {
    width: 18px;
    height: 18px;
    transition: transform 0.2s;
}

.email-copy__icon--check {
    display: none;
}

.email-copy__button.is-copied {
    background: #334869;
    cursor: default;
    pointer-events: none;
}

.email-copy__button.is-copied .email-copy__icon--copy {
    display: none;
}

.email-copy__button.is-copied .email-copy__icon--check {
    display: block;
    transform: scale(0.9);
}

/* Сообщение "Скопировано" */
.email-copy__message {
    margin: 8px 0 0;
    min-height: 18px;        /* резервируем место для отображения */
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.email-copy__message.is-visible {
    opacity: 1;
}

/* ========================================
   ПЕРЕКЛЮЧАТЕЛЬ ЯЗЫКОВ
   ======================================== */
.lang-switcher {
    display: flex;
    gap: 4px;
    align-items: center;
    margin-left: 16px;
}

.lang-btn {
    background: transparent;
    border: none;
    padding: 4px 8px;
    font-size: 0.7rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.3s;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Hover языков — оставляем везде */
.lang-btn:hover {
    color: rgba(255, 255, 255, 0.85);
}

.lang-btn.active {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.12);
    padding: 4px 10px;
    border-radius: 100px;
}

/* ========================================
   АДАПТИВ
   ======================================== */
@media (max-width: 1024px) {
    .services__grid {
        grid-template-columns: 1fr;
        gap: 40px;
    }
    .services__visual {
        min-height: 200px;
        position: static;
    }

    .projects__grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .capabilities__grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    .modal__image {
        height: 350px;
    }
    .modal__gallery img {
        height: 140px;
    }
}

@media (max-width: 768px) {
    .header {
        background: #0a0a0a ;
    }
    .about__grid {
        grid-template-columns: 1fr;
        gap: 32px;
    }
    .service-item {
        padding: 20px 16px;
    }
    .projects__grid {
        grid-template-columns: 1fr;
        max-width: 480px;
        margin: 0 auto;
    }
    .hero__title {
        font-size: 2.5rem;
    }
    .hero__image {
        height: 40vh;
        min-height: 300px;
    }
    .section-title {
        font-size: 2rem;
    }
    .tech-stack__item {
        padding: 10px 24px;
        font-size: 0.875rem;
    }
    .tech-stack__wrapper {
        padding: 110px 0 15px;
    }
    .skills__columns {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .lang-switcher {
        margin-left: 8px;
    }

    .lang-btn {
        font-size: 0.6rem;
        padding: 2px 6px;
    }

    .modal__image {
        height: 300px;
    }

    .modal__gallery img {
        height: 120px;
    }
}

@media (max-width: 640px) {
    
    .footer {
        padding-bottom: 80px;
    }
    
    .header__back span {
        display: inline;
    }

    .burger {
        display: flex;
    }

    .nav {
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: #151519;
        padding: 24px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
        transform: translateY(-120%);
        opacity: 0;
        transition: all 0.3s ease;
        pointer-events: none;
        z-index: 999;
    }

    .nav--open {
        transform: translateY(0);
        opacity: 1;
        pointer-events: auto;
    }

    .nav__list {
        flex-direction: column;
        gap: 16px;
        align-items: center;
    }

    .nav__link {
        font-size: 1rem;
        color: rgba(255, 255, 255, 0.7);
    }

    .nav__link:hover {
        color: #ffffff;
    }

    .nav__link--active {
        color: var(--accent);
        font-weight: 700;
    }

    .nav__link--active::after {
        width: 100%;
        background: var(--accent);
    }

    .nav__divider {
        display: none;
    }

    .nav__divider-mobile {
        display: flex !important;
        width: 40px;
        height: 1px;
        background: rgba(255, 255, 255, 0.15);
        margin: 4px 0;
    }

    .hero__title {
        font-size: 2rem;
    }

    .hero__subtitle {
        font-size: .95rem;
    }

    .contacts__list {
        flex-direction: column;
        align-items: center;
    }

    .contacts__link {
        width: 100%;
        max-width: 280px;
        text-align: center;
    }

    .theme-switcher {
        bottom: 16px;
        right: 16px;
        padding: 6px;
        z-index: 999;
    }

    .tech-stack__wrapper {
        padding: 105px 0 10px;
    }
    
    .capabilities__grid {
        grid-template-columns: 1fr;
        max-width: 400px;
        margin: 0 auto;
    }

    .modal-overlay {
        align-items: flex-start;
        padding: 0;
    }

    .modal {
        max-width: 100%;
        border-radius: 0;
        margin: 0;
    }
    
    #modal-email {
        align-items: center;
        padding: 20px;
    }
    
    #modal-email .modal {
        border-radius: var(--radius-lg);
        max-width: 100%;
    }

    .modal__body {
        padding: 24px 20px 32px;
    }

    .modal__title {
        font-size: 1.5rem;
    }

    .modal__close {
        top: 12px;
        right: 12px;
        width: 44px;
        height: 44px;
        font-size: 1.25rem;
        background: rgba(0, 0, 0, 0.75);
        border: 2px solid rgba(255, 255, 255, 0.25);
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    }

    .modal__links {
        flex-direction: column;
    }

    .modal__link {
        justify-content: center;
        width: 100%;
    }

    .modal__image {
        max-height: 220px;
        border-radius: 0;
    }

    .modal__image img {
        max-height: 220px;
    }

    .modal__gallery {
        grid-template-columns: 1fr;
    }

    .modal__gallery img {
        height: 200px;
    }
}

/* ========================================
   HOVER — только для устройств с мышью
   (кроме навигации и скроллбара — они выше)
   ======================================== */
@media (hover: hover) and (pointer: fine) {
    /* Tech-stack */
    [data-theme="light"] .tech-stack__item:hover {
        background: var(--bg-card-hover);
        color: var(--text-primary);
        border-color: var(--accent);
        transform: scale(1.05);
    }

    [data-theme="dark"] .tech-stack__item:hover {
        background: rgba(59, 130, 246, 0.12);
        border-color: #3b82f6;
        color: #ffffff;
        transform: scale(1.08);
    }

    /* Кнопки */
    .btn--primary:hover {
        background: var(--accent-hover);
        transform: translateY(-2px);
        box-shadow: var(--shadow);
    }

    .btn--secondary:hover {
        background: var(--bg-card-hover);
        transform: translateY(-2px);
    }

    /* Сервисы */
    .service-item:hover {
        transform: translateX(6px);
        background: var(--bg-card-hover);
    }

    /* Карточки */
    .capability-card:hover {
        transform: translateY(-6px);
        box-shadow: var(--shadow);
        background: var(--bg-card-hover);
    }

    .project-card:hover {
        transform: translateY(-8px);
        box-shadow: var(--shadow);
        background: var(--bg-card-hover);
    }

    [data-theme="dark"] .capability-card:hover,
    [data-theme="dark"] .service-item:hover,
    [data-theme="dark"] .project-card:hover {
        border-color: var(--accent);
    }
    
    [data-theme="light"] .capability-card:hover,
    [data-theme="light"] .service-item:hover,
    [data-theme="light"] .project-card:hover {
        border-color: var(--text-secondary);
    }
    
    .project-card:hover .project-card__image img {
        transform: scale(1.05);
    }

    .project-card__more:hover {
        color: var(--accent-hover);
    }

    /* Контакты */
    .contacts__link--primary:hover {
        background: var(--accent-hover);
        transform: translateY(-3px);
        box-shadow: var(--shadow);
    }

    .contacts__link--secondary:hover {
        background: var(--bg-card-hover);
        color: var(--text-primary);
        transform: translateY(-3px);
    }

    /* Теги */
    .tag:hover {
        border-color: var(--accent);
        color: var(--text-primary);
    }

    .tag--learning:hover {
        background: rgba(59, 130, 246, 0.12);
    }

    /* Модалки */
    .modal__close:hover {
        background: rgba(0, 0, 0, 0.85);
        transform: rotate(90deg);
        border-color: rgba(255, 255, 255, 0.4);
    }

    .modal__link--active:hover {
        background: var(--accent-hover);
        border-color: var(--accent-hover);
        transform: translateY(-2px);
        box-shadow: var(--shadow);
    }
    
    .email-copy__button:not(.is-copied):hover {
        background: var(--accent-hover);
    }
}

/* ========================================
   TOUCH DEVICES — отключаем transition при смене темы
   ======================================== */
@media (hover: none) {
    body,
    .header,
    .about,
    .services,
    .capabilities,
    .projects,
    .contacts,
    .footer,
    .tech-stack__wrapper,
    .tech-stack__item, 
    .project-card,
    .capability-card,
    .service-item,
    .btn--primary,
    .btn--secondary,
    .contacts__link,
    .modal,
    .tag {
        transition: none !important;
    }
}

/* ========================================
   REDUCED MOTION
   ======================================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .tech-stack__track {
        animation: none !important;
    }
}