@import url('https://fonts.googleapis.com/css2?family=Dela+Gothic+One&display=swap');

/* Luxora Grotesk Font */
@font-face {
    font-family: 'Luxora';
    src: url('OTF/LuxoraGrotesk-Regular.otf') format('opentype');
    font-weight: 400;
    font-style: normal;
}

@font-face {
    font-family: 'Luxora';
    src: url('OTF/LuxoraGrotesk-Medium.otf') format('opentype');
    font-weight: 500;
    font-style: normal;
}

@font-face {
    font-family: 'Luxora';
    src: url('OTF/LuxoraGrotesk-Bold.otf') format('opentype');
    font-weight: 700;
    font-style: normal;
}

@font-face {
    font-family: 'Luxora';
    src: url('OTF/LuxoraGrotesk-Light.otf') format('opentype');
    font-weight: 300;
    font-style: normal;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
}

/* WebGL градиентный фон */
.webgl-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

:root {
    --bg-primary: #000000;
    --text-primary: #ffffff;
    --text-secondary: #999999;
    --border-color: #1a1a1a;
    --card-bg: #0a0a0a;
    --scrollbar-track: #111;
    --scrollbar-thumb: #333;
    --scrollbar-thumb-hover: #555;
}

/* Кастомный скроллбар в стиле проекта */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}
*::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
*::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
    border-radius: 4px;
}
*::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 4px;
}
*::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}
*::-webkit-scrollbar-corner {
    background: var(--scrollbar-track);
}

body {
    font-family: 'Luxora', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    position: relative;
    overflow-x: hidden;
    cursor: none;
}

/* Header сверху сайта (z-index выше .bento-grid z-index:1 — иначе бургер под контентом; ниже прелоадера 9999) */
.site-header {
    position: relative;
    z-index: 100;
    max-width: 1600px;
    margin: 2rem auto 0;
    padding: 0 2rem;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.3rem 2rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    backdrop-filter: blur(20px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.header-content:hover {
    border-color: #333;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.logo {
    font-family: 'Luxora', sans-serif;
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 500;
    letter-spacing: 0.5px;
    transition: color 0.3s ease;
    text-decoration: none;
}

.logo:hover {
    color: var(--text-primary);
}

.nav-links {
    font-family: 'Luxora', sans-serif;
    display: flex;
    gap: 1.5rem;
}

.nav-links a {
    font-size: 0.9rem;
    text-decoration: none;
    color: var(--text-secondary);
    transition: all 0.3s ease;
    padding: 0.2rem 0;
    white-space: nowrap;
}

.nav-links a:hover {
    color: var(--text-primary);
}

/* Активный пункт меню */
.nav-links a.active {
    color: var(--text-primary);
    position: relative;
}

.nav-links a.active::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -0.2rem;
    height: 2px;
    border-radius: 999px;
    background: linear-gradient(90deg, #ffffff 0%, #aaaaaa 100%);
}

/* Переключатель языка RU/EN — пилюля в конце навигации */
.lang-toggle {
    font-family: 'Luxora', sans-serif;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 0.25rem 0.7rem;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.lang-toggle:hover {
    color: var(--text-primary);
    border-color: #555;
    background: rgba(255, 255, 255, 0.05);
}

@media (max-width: 900px) {
    .lang-toggle {
        align-self: flex-start;
        margin-top: 0.5rem;
    }
}

/* Свитчер языка RU/EN — сегментированный переключатель в конце навигации.
   Активный сегмент подсвечивает «бегунок» (.lang-switch__thumb), который
   едет между RU и EN. */
.lang-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    padding: 2px;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: transparent;
    font-family: 'Luxora', sans-serif;
    white-space: nowrap;
}

.lang-switch__opt {
    position: relative;
    z-index: 1;
    border: 0;
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    line-height: 1.2;
    min-width: 2.2em;
    text-align: center;
    padding: 0.22rem 0.55rem;
    border-radius: 999px;
    cursor: pointer;
    transition: color 0.3s ease;
}

.lang-switch__opt:hover,
.lang-switch__opt.is-active {
    color: var(--text-primary);
}

.lang-switch__thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    bottom: 2px;
    width: calc(50% - 2px);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    transition: transform 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    pointer-events: none;
    z-index: 0;
}

.lang-switch.is-en .lang-switch__thumb {
    transform: translateX(100%);
}

@media (max-width: 900px) {
    .lang-switch {
        align-self: flex-start;
        margin-top: 0.5rem;
    }
}

/* Кнопка гамбургера — скрыта на десктопе */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center; /* линии по центру кнопки, а не по левому краю контента */
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 10px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    z-index: 1002;
}
.nav-toggle:hover {
    border-color: #333;
    background: rgba(255,255,255,0.05);
}
.nav-toggle__line {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 1px;
    transition: transform 0.3s, opacity 0.3s;
}
.site-header.is-open .nav-toggle__line:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.site-header.is-open .nav-toggle__line:nth-child(2) {
    opacity: 0;
}
.site-header.is-open .nav-toggle__line:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Bento Grid */
.bento-grid {
    max-width: 1600px;
    margin: 0 auto 0;
    padding: 1.5rem 2rem 2rem;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 1.5rem;
    /* minmax вместо жёсткой высоты: ряд не может стать ниже базы,
       но растёт, если контент (текст) не влезает — ничего не режется */
    grid-auto-rows: minmax(320px, auto);
    /* preserve-3d/perspective убраны: вместе с translateZ в анимациях появления
       они вызывали GPU plane-splitting — фон карточек «резался» на части.
       3D-tilt при ховере задаёт perspective() инлайном сам, ему это не нужно. */
}

/* Обеспечиваем, что все элементы помещаются в карточки */
.bento-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 2rem;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    text-decoration: none;
    color: inherit;
    display: block;
    /* Обеспечиваем правильное размещение контента */
    box-sizing: border-box;
    min-height: 0; /* Позволяет flex-элементам сжиматься */
}

/* Убеждаемся, что изображения и видео не выходят за границы */
.bento-card img,
.bento-card video {
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
    border-radius: inherit;
}

/* Специальные правила для карточек проектов */
.projects-row .card-laptop,
.projects-row .card-collage,
.projects-row .card-tshirt {
    overflow: hidden;
    position: relative;
}

.projects-row .card-laptop .project-image,
.projects-row .card-laptop .project-video,
.projects-row .card-collage .project-image,
.projects-row .card-collage .project-video,
.projects-row .card-tshirt .project-image,
.projects-row .card-tshirt .project-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
    border-radius: 24px;
}

/* Обеспечиваем правильное отображение фото карточки */
.card-flip-front img,
.card-flip-back img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* Убеждаемся, что текст не выходит за границы */
.bento-card h1,
.bento-card h2,
.bento-card h3,
.bento-card h4,
.bento-card p {
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

/* Специальные правила для длинного текста в специализации:
   скролл появляется только когда развёрнутый контент реально не влезает */
.spec-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    /* Пункты идут сверху с фиксированным gap. Раньше был space-between —
       он растягивал пункты на всю высоту карточки, и при любом росте
       ряда сетки между пунктами появлялись большие дыры */
    justify-content: flex-start;
}

.spec-item {
    flex-shrink: 0;
}

/* Обеспечиваем правильное размещение инструментов */
.tools-carousel {
    width: 100%;
    overflow: hidden;
    mask: linear-gradient(90deg, transparent, white 10%, white 90%, transparent);
    -webkit-mask: linear-gradient(90deg, transparent, white 10%, white 90%, transparent);
    padding: 1rem 0;
    position: relative;
    height: auto;
    min-height: 120px;
}

.tools-track {
    display: flex;
    /* Без gap: промежутки задаются margin на .tool-icon (пол-гэпа с каждой
       стороны) — тогда 50% ширины трека ровно равны одному циклу контента
       и анимация translateX(-50%) зацикливается без шва */
    gap: 0;
    animation: scroll-tools 20s linear infinite;
    width: fit-content;
    padding: 1rem 0;
    height: auto;
}

.tool-icon {
    flex-shrink: 0;
    margin: 0 1rem; /* = gap 2rem между плитками */
    width: 90px;
    height: 90px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    background: rgba(255, 255, 255, 0.02);
    cursor: pointer;
    position: relative;
}

/* Контакты - обеспечиваем правильное размещение */
.contacts-list {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    width: 100%;
    height: 100%;
    align-items: center;
}

.contact-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--text-primary);
    text-decoration: none;
    padding: 0.5rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    font-size: 0.9rem;
    font-weight: 500;
    min-height: 44px; /* Минимальная высота для удобства нажатия */
    box-sizing: border-box;
}

.bento-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(255, 255, 255, 0.05), transparent 50%);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

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

.bento-card:hover:not(.card-laptop):not(.card-collage):not(.card-tshirt) {
    border-color: #333;
    z-index: 10;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* Убираем border для карточек проектов */
.card-laptop,
.card-collage,
.card-tshirt,
.projects-row .card-laptop,
.projects-row .card-collage,
.projects-row .card-tshirt {
    border: none !important;
    outline: none !important;
}

/* Убираем псевдоэлемент before для карточек проектов */
.card-laptop::before,
.card-collage::before,
.card-tshirt::before,
.card-laptop:hover::before,
.card-collage:hover::before,
.card-tshirt:hover::before {
    display: none !important;
    opacity: 0 !important;
}

/* Убираем все возможные outline и focus стили для карточки-ссылки */
.card-laptop:focus,
.card-laptop:active,
.card-laptop:visited,
a.card-laptop:focus,
a.card-laptop:active,
a.card-laptop:visited {
    outline: none !important;
    border: none !important;
    box-shadow: none !important;
}

/* Старые стили удалены - теперь используются более полные стили ниже */

/* Card Name */
.card-name {
    grid-column: span 6;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    position: relative;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 100%);
}

.name-container {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    height: 100%;
    padding-bottom: calc(2rem - 45px);
}

.main-title {
    font-family: 'Dela Gothic One', cursive;
    /* Fluid: ~3.1rem на 1200px → 4rem на 1600px+ */
    font-size: clamp(2.75rem, 1.2rem + 2.6vw, 4rem);
    font-weight: 500;
    line-height: 0.85;
    letter-spacing: 0.02em;
    text-align: left;
    margin: 0;
    margin-bottom: 15px;
}

.job-title {
    font-family: 'Luxora', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    font-size: clamp(1rem, 0.7rem + 0.55vw, 1.25rem);
    color: var(--text-primary);
    font-weight: 300;
    letter-spacing: 0.02em;
    text-transform: none;
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    margin: 0;
}

/* Card Photo */
.card-photo {
    grid-column: span 3;
    grid-row: 1;
    padding: 0;
    perspective: 1000px;
    cursor: pointer;
}

/* Полностью отключаем все эффекты для карточки с фото */
.card-photo,
.card-photo:hover,
.card-photo.flipped,
.card-photo.flipped:hover {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    transform: none !important;
    z-index: 1 !important;
}

.card-photo::before,
.card-photo:hover::before,
.card-photo.flipped::before,
.card-photo.flipped:hover::before {
    opacity: 0 !important;
}

/* Flip Container */
.card-flip-container {
    width: 100%;
    height: 100%;
    position: relative;
}

.card-flip-inner {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    /* Убираем любые другие transition эффекты */
    animation: none !important;
}

.card-photo.flipped .card-flip-inner {
    transform: rotateY(180deg);
}

/* Front and Back sides */
.card-flip-front,
.card-flip-back {
    width: 100%;
    height: 100%;
    position: absolute;
    backface-visibility: hidden;
    border-radius: 24px;
    overflow: hidden;
    border: none;
    /* Стабилизация для предотвращения мерцания */
    -webkit-backface-visibility: hidden;
    -moz-backface-visibility: hidden;
    -ms-backface-visibility: hidden;
    will-change: transform;
}

.card-flip-front {
    z-index: 2;
}

.card-flip-back {
    transform: rotateY(180deg);
    background: linear-gradient(135deg, #1a1a1a 0%, #0a0a0a 100%);
}

.card-flip-front img,
.card-flip-back img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

.card-photo:not(.flipped):hover .card-flip-front img {
    transform: scale(1.1);
}

.card-photo.flipped:hover .card-flip-back img {
    transform: scale(1.1);
}

/* Animation for photo card shake */
@keyframes photoCardShake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-2px); }
    20%, 40%, 60%, 80% { transform: translateX(2px); }
}

/* Card Spec */
.card-spec {
    grid-column: span 3;
    grid-row: 1 / 3;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.card-spec h2 {
    font-size: clamp(1.3rem, 0.75rem + 0.85vw, 1.85rem);
    font-weight: 600;
}

.spec-item h3 {
    font-size: clamp(1.05rem, 0.9rem + 0.25vw, 1.2rem);
    margin-bottom: 0.4rem;
    font-weight: 600;
}

.spec-item p {
    color: var(--text-secondary);
    font-size: clamp(0.9rem, 0.82rem + 0.16vw, 1rem);
    line-height: 1.5;
}

/* ---------- Аккордеон специализации ----------
   Заголовки видны всегда; описание раскрывается по клику (grid-rows 0fr→1fr).
   Управляется классом .is-open на .spec-item (script.js).
   Пункты оформлены карточками с иконками — блок не выглядит пустым
   даже со свёрнутыми описаниями. */
.spec-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 0.85rem 1rem;
    transition: border-color 0.3s ease, background 0.3s ease;
}

.spec-item:hover {
    border-color: rgba(255, 255, 255, 0.14);
}

.spec-item.is-open {
    background: rgba(139, 92, 246, 0.07);
    border-color: rgba(139, 92, 246, 0.35);
}

.spec-icon {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #b7a8f0;
    background: rgba(139, 92, 246, 0.12);
    border: 1px solid rgba(139, 92, 246, 0.25);
    transition: color 0.3s ease, background 0.3s ease, border-color 0.3s ease;
}

.spec-item.is-open .spec-icon {
    color: #ddd4ff;
    background: rgba(139, 92, 246, 0.22);
    border-color: rgba(139, 92, 246, 0.5);
}

.spec-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
    padding: 0;
    background: none;
    border: 0;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.spec-toggle h3 {
    margin-bottom: 0;
    flex: 1;
}

.spec-toggle__chevron {
    flex-shrink: 0;
    color: var(--text-secondary);
    transition: transform 0.35s cubic-bezier(0.23, 1, 0.32, 1), color 0.3s ease;
}

.spec-item.is-open .spec-toggle__chevron {
    transform: rotate(180deg);
    color: #c4b5fd;
}

.spec-item__body {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.35s cubic-bezier(0.23, 1, 0.32, 1);
}

.spec-item__body > p {
    overflow: hidden;
    min-height: 0;
    margin: 0;
    /* Текст описания выравниваем под заголовком (после иконки-плитки),
       иначе он висит у левого края под иконкой и «съезжает» влево */
    padding-left: calc(38px + 0.75rem);
    transition: padding-top 0.35s cubic-bezier(0.23, 1, 0.32, 1);
}

.spec-item.is-open .spec-item__body {
    grid-template-rows: 1fr;
}

.spec-item.is-open .spec-item__body > p {
    padding-top: 0.65rem;
}

/* Card Text */
.card-text {
    grid-column: span 3;
    grid-row: 2;
    display: flex;
    align-items: center;
}

.card-text p {
    color: var(--text-secondary);
    font-size: clamp(0.92rem, 0.82rem + 0.2vw, 1.05rem);
    line-height: 1.6;
}

/* Card Resume */
.card-resume {
    grid-column: span 6;
    grid-row: 2;
    display: flex;
    flex-direction: column;
    position: relative;
    background: linear-gradient(135deg, #1a1a1a 0%, #0a0a0a 100%);
    text-decoration: none;
    color: inherit;
    transition: transform 0.3s ease;
}

.card-resume:hover {
    transform: translateY(-2px);
}

.experience-list {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    flex: 1;
    justify-content: center;
}

.experience-item {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 0.7rem;
}

.experience-item__main {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

/* Плитка-логотип компании слева от места работы. Пока монограмма-заглушка —
   заменяется на реальный логотип (img), когда появится. */
.experience-logo {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Inter Tight', 'Inter', sans-serif;
    font-weight: 700;
    font-size: 0.78rem;
    letter-spacing: 0.02em;
    color: #cbbff5;
    background: rgba(139, 92, 246, 0.14);
    border: 1px solid rgba(139, 92, 246, 0.28);
    margin-top: 0.15rem;
    overflow: hidden;
}

.experience-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.period {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 600;
    letter-spacing: 0.05em;
}

.position {
    font-size: clamp(0.95rem, 0.85rem + 0.2vw, 1.1rem);
    color: var(--text-primary);
    font-weight: 400;
    line-height: 1.3;
}

.resume-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
    font-size: 1.15rem;
    transition: all 0.3s;
    position: absolute;
    bottom: 2rem;
    right: 2rem;
}

.card-resume:hover .resume-link {
    gap: 1rem;
}

.resume-link svg {
    transition: transform 0.3s;
}

.card-resume:hover .resume-link svg {
    transform: rotate(45deg);
}

/* Card Tools */
.card-tools {
    grid-column: span 12;
    grid-row: 5; /* Строго в 5-м ряду, после проектов */
    position: relative;
    overflow: visible;
}

.card-tools h3 {
    font-size: 1.45rem;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.tools-carousel {
    width: 100%;
    overflow: hidden; /* Возвращаю hidden для корректной работы маски */
    mask: linear-gradient(90deg, transparent, white 10%, white 90%, transparent);
    -webkit-mask: linear-gradient(90deg, transparent, white 10%, white 90%, transparent);
    padding: 1rem 0; /* Дополнительный padding для hover эффектов */
    position: relative;
}

.tools-track {
    display: flex;
    gap: 0; /* промежутки — через margin на .tool-icon, см. комментарий выше */
    animation: scroll-tools 20s linear infinite;
    width: fit-content;
    padding: 1rem 0; /* Дополнительный padding для hover эффектов */
}

.tool-icon {
    margin: 0 1rem; /* = gap 2rem между плитками */
    width: 90px;
    height: 90px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    background: rgba(255, 255, 255, 0.02);
    cursor: pointer;
    flex-shrink: 0;
    position: relative;
}

.tool-icon:hover {
    transform: translateY(-8px) scale(1.1);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
    z-index: 5;
}

.tool-img-dark,
.tool-img-color {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.3s ease;
}

.tool-img-dark {
    opacity: 1;
}

.tool-img-color {
    opacity: 0;
}

.tool-icon:hover .tool-img-dark {
    opacity: 0;
}

.tool-icon:hover .tool-img-color {
    opacity: 1;
}

.tool-cursor {
    position: fixed;
    color: white;
    font-size: 0.9rem;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
    z-index: 10000;
    white-space: nowrap;
    transform: translate(-50%, -50%);
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
}

.tool-cursor.show {
    opacity: 1;
    animation: fadeInScale 0.2s ease-out;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.tool-label {
    display: none;
}

/* Card Contacts */
.card-contacts {
    grid-column: span 12;
    grid-row: 6;
    background: linear-gradient(135deg, #1a1a1a 0%, #0a0a0a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    height: 120px;
}

.contacts-list {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    width: 100%;
}

.contact-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--text-primary);
    text-decoration: none;
    padding: 0.5rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    font-size: 0.9rem;
    font-weight: 500;
}

.contact-item:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.contact-item img {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.contact-item svg {
    width: 20px;
    height: 20px;
    color: var(--text-primary);
}

@keyframes scroll-tools {
    0% {
        transform: translateX(-50%);
    }
    100% {
        transform: translateX(0);
    }
}

/* Projects Row — 4 категории (2×2) на главной */
.projects-row {
    grid-column: span 12; /* Занимает все 12 колонок */
    grid-row: 3 / 5; /* Ряды 3-4 */
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 1.5rem;
    height: calc(320px * 2 + 1.5rem); /* Чуть выше, чтобы категории «дышали» */
    position: relative; /* Для позиционирования подсветки */
}

/* Card Glow Effects - МАКСИМАЛЬНО ЯРКАЯ ПОДСВЕТКА */
.card-glow {
    /* временно убираем подсветку, чтобы не ломала сетку категорий */
    display: none !important;
}

.card-glow-laptop {
    left: 0;
    background: radial-gradient(circle, rgba(255, 255, 255, 1.0) 0%, rgba(255, 255, 255, 1.0) 30%, rgba(255, 255, 255, 0.9) 60%, rgba(255, 255, 255, 0.7) 100%);
}

.card-glow-collage {
    left: calc(33.333% + 0.5rem);
    background: radial-gradient(circle, rgba(255, 255, 255, 1.0) 0%, rgba(255, 255, 255, 1.0) 30%, rgba(255, 255, 255, 0.9) 60%, rgba(255, 255, 255, 0.7) 100%);
}

.card-glow-tshirt {
    right: 0;
    background: radial-gradient(circle, rgba(255, 255, 255, 1.0) 0%, rgba(255, 255, 255, 1.0) 30%, rgba(255, 255, 255, 0.9) 60%, rgba(255, 255, 255, 0.7) 100%);
}

/* HOVER ЭФФЕКТ - ВРЕМЕННО ОТКЛЮЧЕН ДЛЯ ОТЛАДКИ */
/*
.projects-row .card-laptop:hover ~ .card-glow-laptop,
.projects-row .card-collage:hover ~ .card-glow-collage,
.projects-row .card-tshirt:hover ~ .card-glow-tshirt {
    opacity: 1.0 !important;
    filter: blur(35px) brightness(1.5) !important;
    transform: scale(1.1) !important;
}
*/

/* Project Cards - Equal width, independent of main grid */
.projects-row .card-laptop,
.projects-row .card-collage,
.projects-row .card-tshirt {
    padding: 0;
    position: relative;
    overflow: hidden;
    border-radius: 24px;
    z-index: 1; /* Поверх подсветки */
    min-height: 100%;
}

/* Позиционирование 4 категорий (2×2) внутри projects-row */
.projects-row .project-slot-1 {
    grid-column: 1 / span 3;
    grid-row: 1;
}

.projects-row .project-slot-2 {
    grid-column: 4 / span 3;
    grid-row: 1;
}

.projects-row .project-slot-3 {
    grid-column: 1 / span 3;
    grid-row: 2;
}

.projects-row .project-slot-4 {
    grid-column: 4 / span 3;
    grid-row: 2;
}

/* Card Laptop */
.card-laptop {
    background: #0f0f0f;
    position: relative;
    overflow: hidden;
}

.card-laptop .project-image,
.card-laptop .project-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
    border-radius: 24px;
}

.card-laptop .project-image {
    opacity: 1; /* Картинка по умолчанию, видео показывается после загрузки */
    transition: opacity 0.8s ease;
    z-index: 1;
}

.card-laptop .project-video {
    opacity: 0;
    transition: opacity 0.8s ease;
    z-index: 2;
}

/* Card Collage */
.card-collage {
    background: #0f0f0f;
    position: relative;
    overflow: hidden;
}

.card-collage .project-image,
.card-collage .project-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
    border-radius: 24px;
}

.card-collage .project-image {
    opacity: 1;
    transition: opacity 0.8s ease;
    z-index: 1;
}

.card-collage .project-video {
    opacity: 0;
    transition: opacity 0.8s ease;
    z-index: 2;
}

/* Card Tshirt */
.card-tshirt {
    background: #0f0f0f;
    position: relative;
    overflow: hidden;
}

.card-tshirt .project-image,
.card-tshirt .project-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
    border-radius: 24px;
}

.card-tshirt .project-image {
    opacity: 1;
    transition: opacity 0.8s ease;
    z-index: 1;
}

.card-tshirt .project-video {
    opacity: 0;
    transition: opacity 0.8s ease;
    z-index: 2;
}



/* Image Overlay Effect */
.image-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40%;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.8) 0%,
        rgba(0, 0, 0, 0.3) 70%,
        transparent 100%
    );
    opacity: 1; /* Всегда видимый */
    transform: translateY(0); /* Всегда на месте */
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    display: flex;
    align-items: flex-end;
    padding: 1.5rem;
    border-radius: 0 0 24px 24px;
    mask: linear-gradient(
        to top,
        black 0%,
        black 50%,
        transparent 100%
    );
    -webkit-mask: linear-gradient(
        to top,
        black 0%,
        black 50%,
        transparent 100%
    );
    z-index: 10; /* Поверх видео и изображения */
}

.image-overlay::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 0 0 24px 24px;
    z-index: -1;
}

/* Убираем hover эффекты для overlay - теперь он всегда виден */
/*
.card-laptop:hover .image-overlay,
.card-collage:hover .image-overlay,
.card-tshirt:hover .image-overlay {
    opacity: 1;
    transform: translateY(0);
}
*/

.overlay-content h4 {
    font-size: clamp(1.25rem, 0.95rem + 0.75vw, 1.7rem);
    font-weight: 700;
    color: var(--text-primary);
    text-shadow: 0 6px 20px rgba(0, 0, 0, 0.8);
    margin: 0 0 0.3rem 0;
    line-height: 1.2;
}

.overlay-content p {
    font-size: clamp(0.9rem, 0.8rem + 0.25vw, 1.05rem);
    font-weight: 400;
    color: rgba(255, 255, 255, 0.85);
    margin: 0;
    line-height: 1.3;
}



/* Responsive */

/* Средние экраны (между планшетами и мобильными) */
/* Планшеты и узкие десктопы (769–1280px): единый блок вместо трёх
   пересекавшихся диапазонов (900/992/1200), которые перезаписывали друг
   друга и ломали раскладку. Сетка 6 колонок, ряды — от контента.
   Страницы кейсов (.case-page) сохраняют 12 колонок — их мозаика
   рассчитана на 12 и имеет собственный адаптив в style-premium.css. */
@media (max-width: 1280px) and (min-width: 769px) {
    .bento-grid {
        grid-template-columns: repeat(6, 1fr);
        grid-auto-rows: minmax(230px, auto);
        gap: 1.2rem;
        padding: 1.2rem 1.5rem 2rem;
    }

    .bento-grid.case-page {
        grid-template-columns: repeat(12, 1fr);
        grid-auto-rows: auto;
    }

    /* Сбрасываем жёсткую привязку к рядам из базовой сетки (style.css и
       style-premium.css задают grid-row без медиазапросов, поэтому нужен
       !important) — дальше карточки идут естественным потоком */
    .card-name,
    .card-text,
    .card-resume,
    .projects-row,
    .card-tools,
    .card-ai,
    .card-contacts {
        grid-row: auto !important;
    }

    .card-name {
        grid-column: span 6 !important;
        min-height: 250px;
    }

    .card-photo {
        grid-column: span 3 !important;
        grid-row: span 2 !important;
        min-height: 460px;
    }

    .card-spec {
        grid-column: span 3 !important;
        grid-row: span 2 !important;
    }

    .card-text {
        grid-column: span 3 !important;
    }

    .card-resume {
        grid-column: span 3 !important;
    }

    .projects-row {
        grid-column: span 6 !important;
        height: auto;
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: none;
        grid-auto-rows: clamp(220px, 28vw, 300px);
        gap: 1.2rem;
    }

    .projects-row .project-slot-1,
    .projects-row .project-slot-2,
    .projects-row .project-slot-3,
    .projects-row .project-slot-4 {
        grid-column: auto;
        grid-row: auto;
    }

    .card-tools,
    .card-ai {
        grid-column: span 6 !important;
    }

    .card-contacts {
        grid-column: span 6 !important;
        height: auto;
        min-height: 100px;
    }

    .contacts-list {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.8rem;
    }

    .job-title {
        top: 1.2rem;
        right: 1.2rem;
    }

    .bento-card {
        padding: 1.5rem;
    }

    .tool-icon {
        margin: 0 0.75rem; /* = gap 1.5rem */
        width: 80px;
        height: 80px;
    }
}

/* Хэдер: до 1100px пункты навигации не помещаются в строку —
   переключаемся на бургер и выезжающую панель (раньше это включалось
   только с 768px, и на 769–1100 меню вылезало за хэдер) */
@media (max-width: 1100px) {
    .nav-toggle {
        display: flex;
        margin-left: auto;
        flex-shrink: 0;
        z-index: 10035;
        position: relative;
    }

    .nav-links {
        position: fixed;
        top: 0;
        right: 0;
        width: min(100%, 320px);
        max-width: 100%;
        height: 100vh;
        height: 100dvh;
        padding: 5rem 1.5rem 2rem;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        background: var(--card-bg);
        border-left: 1px solid var(--border-color);
        box-shadow: -8px 0 32px rgba(0,0,0,0.4);
        z-index: 1;
        transform: translateX(100%);
        transition: transform 0.3s ease, visibility 0.3s;
        visibility: hidden;
        overflow-y: auto;
    }
    .site-header.is-open .nav-links {
        transform: translateX(0);
        visibility: visible;
    }
    .nav-links a {
        font-size: 1.1rem;
        padding: 1rem 1rem;
        border-radius: 12px;
        min-height: 48px;
        display: flex;
        align-items: center;
        justify-content: center; /* пункты по центру выезжающего меню */
        text-align: center;
    }
    .nav-links a:hover {
        background: rgba(255,255,255,0.06);
    }
    /* Переключатель языка — по центру, в одну линию с пунктами меню */
    .nav-links .lang-toggle,
    .nav-links .lang-switch {
        align-self: center;
        margin-top: 1rem;
    }
}

@media (max-width: 768px) {
    /* Старый сброс анимаций удалён: новый reveal (opacity/transform/filter)
       не уводит карточки за экран и безопасен на мобильных */

    /* Главная: одна колонка, flex вместо grid — без «боковой панели» */
    .bento-grid {
        display: flex;
        flex-direction: column;
        grid-template-columns: unset;
        grid-auto-rows: unset;
        gap: 1rem;
        padding: 1rem;
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
        padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
    }
    .bento-grid > * {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        grid-column: unset !important;
        grid-row: unset !important;
        flex: 0 0 auto;
    }
    
    /* Специализация: обычный горизонтальный текст, без вертикальной полосы */
    .card-spec {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }
    .card-spec h2 {
        writing-mode: horizontal-tb;
        text-orientation: mixed;
        white-space: normal;
        word-break: normal;
    }
    .spec-list {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }
    .spec-item {
        min-width: 0;
    }
    
    .site-header {
        margin: 1rem auto 0;
        padding: 0 1rem;
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .header-content {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        padding: 0.5rem 1rem;
        border-radius: 12px;
        position: relative;
        min-width: 0;
        overflow: visible;
    }
    .header-content .logo {
        min-width: 0;
        flex-shrink: 0;
        font-size: 0.95rem;
    }
    
    /* Бургер и выезжающая панель навигации — в блоке @media (max-width: 1100px) */

    /* Высоты карточек на мобильной (flex-поток) */
    .card-name {
        min-height: 140px;
    }
    /* Фото: выше соседних блоков, без обрезки головы (object-position) */
    .card-photo {
        min-height: min(88vw, 420px);
        height: auto;
        aspect-ratio: 4 / 5;
        max-height: none;
        flex-shrink: 0;
    }
    .card-photo .card-flip-container,
    .card-photo .card-flip-inner,
    .card-photo .card-flip-front,
    .card-photo .card-flip-back {
        width: 100%;
        height: 100%;
        min-height: min(88vw, 420px);
    }
    .card-photo .card-flip-front img,
    .card-photo .card-flip-back img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: top center;
        display: block;
    }
    .card-spec {
        min-height: auto;
    }
    .card-tools {
        min-height: 160px;
    }
    
    .projects-row {
        display: flex;
        flex-direction: column;
        gap: 1rem;
        height: auto;
        width: 100%;
        min-width: 0;
    }
    
    .projects-row .card-laptop,
    .projects-row .card-collage,
    .projects-row .card-tshirt {
        flex: none;
        height: 200px;
        min-height: 200px;
        margin-bottom: 0;
        width: 100%;
    }
    
    /* Отключаем подсветки на мобильных */
    .card-glow {
        display: none;
    }
    
    /* Нет горизонтального скролла */
    html { overflow-x: hidden; }
    body { overflow-x: hidden; max-width: 100vw; }
    main.bento-grid { overflow-x: hidden; max-width: 100%; }
    
    .card-contacts {
        width: 100%;
        min-width: 0;
    }
    .contacts-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    .contact-item {
        min-width: 0;
    }
    
    .main-title {
        font-size: 2rem;
        line-height: 0.85;
        margin-bottom: 10px;
    }
    
    .job-title {
        font-size: 0.9rem;
        top: 1rem;
        right: 1rem;
        position: absolute;
    }
    
    .bento-card {
        padding: 1.2rem;
        border-radius: 20px;
    }
    
    /* Специализация - улучшенная типографика */
    .card-spec h2 {
        font-size: 1.4rem;
        margin-bottom: 1rem;
    }
    
    .spec-list {
        gap: 1rem;
    }
    
    .spec-item h3 {
        font-size: 1rem;
        margin-bottom: 0.3rem;
    }
    
    .spec-item p {
        font-size: 0.85rem;
        line-height: 1.4;
    }
    
    /* Текстовая карточка */
    .card-text p {
        font-size: 0.9rem;
        line-height: 1.5;
    }
    
    /* Резюме карточка */
    .experience-list {
        gap: 0.8rem;
    }
    
    .period {
        font-size: 0.8rem;
    }
    
    .position {
        font-size: 1rem;
        line-height: 1.2;
    }
    
    .resume-link {
        font-size: 1rem;
        bottom: 1.2rem;
        right: 1.2rem;
    }
    
    /* Инструменты */
    .card-tools h3 {
        font-size: 1.2rem;
        margin-bottom: 1rem;
    }
    
    .tools-track {
        gap: 0;
        padding: 0.8rem 0;
    }

    .tool-icon {
        margin: 0 0.6rem; /* = gap 1.2rem */
        width: 65px;
        height: 65px;
        border-radius: 16px;
    }
    
    /* Контакты */
    .contacts-list {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.6rem;
    }
    
    .contact-item {
        padding: 0.6rem 0.4rem;
        font-size: 0.8rem;
        gap: 0.4rem;
        border-radius: 10px;
    }
    
    .contact-item img,
    .contact-item svg {
        width: 18px;
        height: 18px;
    }
    
    .card-contacts {
        height: 120px;
        padding: 1rem;
    }
    
    /* Overlay для проектов на мобильных */
    .image-overlay {
        height: 40%;
        padding: 1rem;
    }
    
    .overlay-content h4 {
        font-size: 1.2rem;
        margin-bottom: 0.2rem;
    }
    
    .overlay-content p {
        font-size: 0.9rem;
    }
}

.nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    /* Ниже хэдера (100), выше main (1) — затемняет страницу под выезжающей панелью */
    z-index: 90;
    backdrop-filter: blur(4px);
}
body.nav-open .nav-overlay {
    display: block;
}
body.nav-open {
    overflow: hidden;
    touch-action: none;
}
@media (min-width: 1101px) {
    .nav-overlay { display: none !important; }
    body.nav-open { overflow: visible; touch-action: auto; }
}

/* Очень маленькие экраны (480px и меньше) */
@media (max-width: 480px) {
    .site-header {
        margin: 0.75rem auto 0;
        padding-left: max(0.75rem, env(safe-area-inset-left));
        padding-right: max(0.75rem, env(safe-area-inset-right));
    }
    
    .header-content {
        padding: 0.35rem 0.75rem;
        border-radius: 10px;
    }
    
    .logo {
        font-size: 0.9rem;
    }
    
    .nav-links a {
        font-size: 0.95rem;
    }
    
    .bento-grid {
        padding: 0.75rem;
        padding-left: max(0.75rem, env(safe-area-inset-left));
        padding-right: max(0.75rem, env(safe-area-inset-right));
        gap: 0.75rem;
    }
    
    .bento-card {
        padding: 1rem;
        border-radius: 16px;
    }
    
    .main-title {
        font-size: 1.6rem;
        line-height: 0.9;
        margin-bottom: 8px;
    }
    
    .job-title {
        font-size: 0.8rem;
        top: 0.8rem;
        right: 0.8rem;
    }
    
    .card-spec {
        padding: 1rem;
    }
    
    .card-spec h2 {
        font-size: 1.2rem;
        margin-bottom: 0.75rem;
    }
    
    .spec-list {
        gap: 0.75rem;
    }
    
    .spec-item {
        flex-shrink: 0;
    }
    
    .spec-item h3 {
        font-size: 0.9rem;
        margin-bottom: 0.25rem;
        line-height: 1.2;
    }
    
    .spec-item p {
        font-size: 0.8rem;
        line-height: 1.3;
        margin-bottom: 0;
    }
    
    /* Текст */
    .card-text {
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
    }
    
    .card-text p {
        font-size: 0.85rem;
        line-height: 1.4;
        margin: 0;
    }
    
    /* Резюме */
    .card-resume {
        padding: 1rem;
    }
    
    .experience-list {
        gap: 0.6rem;
        margin-bottom: 2.5rem; /* Место для кнопки */
    }
    
    .period {
        font-size: 0.75rem;
    }
    
    .position {
        font-size: 0.9rem;
        line-height: 1.2;
    }
    
    .resume-link {
        font-size: 0.9rem;
        bottom: 1rem;
        right: 1rem;
    }
    
    /* Проекты */
    .projects-row {
        gap: 0.8rem;
    }
    
    .projects-row .card-laptop,
    .projects-row .card-collage,
    .projects-row .card-tshirt {
        height: 180px;
        border-radius: 16px;
    }
    
    .image-overlay {
        height: 45%;
        padding: 0.8rem;
        border-radius: 0 0 16px 16px;
    }
    
    .overlay-content h4 {
        font-size: 1.1rem;
        margin-bottom: 0.15rem;
        line-height: 1.1;
    }
    
    .overlay-content p {
        font-size: 0.8rem;
        line-height: 1.2;
        margin: 0;
    }
    
    /* Инструменты */
    .card-tools {
        padding: 1rem;
    }
    
    .card-tools h3 {
        font-size: 1.1rem;
        margin-bottom: 0.8rem;
    }
    
    .tools-carousel {
        min-height: 100px;
        padding: 0.6rem 0;
    }
    
    .tool-icon {
        width: 60px;
        height: 60px;
        border-radius: 14px;
    }
    
    .tools-track {
        gap: 0;
        padding: 0.6rem 0;
    }

    .tool-icon {
        margin: 0 0.5rem; /* = gap 1rem */
    }
    
    /* Контакты */
    .card-contacts {
        height: 100px;
        padding: 0.8rem;
    }
    
    .contacts-list {
        gap: 0.5rem;
    }
    
    .contact-item {
        padding: 0.5rem 0.3rem;
        font-size: 0.75rem;
        gap: 0.3rem;
        border-radius: 8px;
        min-height: 40px;
    }
    
    .contact-item img,
    .contact-item svg {
        width: 16px;
        height: 16px;
        flex-shrink: 0;
    }
    
    .contact-item span {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* Горизонтальная ориентация на мобильных устройствах */
@media (max-width: 768px) and (orientation: landscape) {
    .bento-grid {
        grid-auto-rows: 160px;
        gap: 0.8rem;
        padding: 0.8rem;
    }
    
    .bento-card {
        padding: 1rem;
    }
    
    .main-title {
        font-size: 1.8rem;
    }
    
    .job-title {
        font-size: 0.8rem;
    }
    
    .card-spec {
        grid-row: span 2 !important;
    }
    
    .card-spec h2 {
        font-size: 1.2rem;
        margin-bottom: 0.6rem;
    }
    
    .spec-item h3 {
        font-size: 0.9rem;
        margin-bottom: 0.2rem;
    }
    
    .spec-item p {
        font-size: 0.8rem;
        line-height: 1.2;
    }
    
    .projects-row .card-laptop,
    .projects-row .card-collage,
    .projects-row .card-tshirt {
        height: 160px;
    }
    
    .image-overlay {
        height: 50%;
        padding: 0.8rem;
    }
    
    .overlay-content h4 {
        font-size: 1rem;
    }
    
    .overlay-content p {
        font-size: 0.8rem;
    }
    
    .card-contacts {
        height: 80px;
        padding: 0.6rem;
    }
    
    .contact-item {
        padding: 0.4rem 0.2rem;
        font-size: 0.7rem;
    }
}

/* Page Styles */
.page-content {
    max-width: 1600px;
    margin: 100px auto 0;
    padding: 2rem;
}

.page-header {
    text-align: center;
    margin-bottom: 4rem;
}

.page-header h1 {
    font-family: 'Dela Gothic One', cursive;
    font-size: 4rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.page-subtitle {
    font-size: 1.5rem;
    color: var(--text-secondary);
    font-weight: 300;
}

/* Resume Styles */
.resume-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 3rem;
    margin-bottom: 4rem;
}

.resume-section {
    margin-bottom: 3rem;
}

.resume-section h2 {
    font-size: 2rem;
    margin-bottom: 2rem;
    color: var(--text-primary);
    font-weight: 600;
}

.info-card, .experience-card, .education-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 1.5rem;
}

.info-card h3, .experience-card h3, .education-card h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.position {
    font-size: 1.2rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.contact-info p {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.experience-header {
    margin-bottom: 1rem;
}

.company {
    font-size: 1.1rem;
    color: var(--text-primary);
    font-weight: 500;
}

.period {
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: block;
    margin-top: 0.5rem;
}

.responsibilities {
    list-style: none;
    padding: 0;
}

.responsibilities li {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    padding-left: 1rem;
    position: relative;
}

.responsibilities li::before {
    content: '•';
    color: var(--text-primary);
    position: absolute;
    left: 0;
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
}

.skill-category h4 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.skill-category ul {
    list-style: none;
    padding: 0;
}

.skill-category li {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.download-section {
    text-align: center;
    margin: 4rem 0;
}

.download-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--text-primary);
    color: var(--bg-primary);
    padding: 1rem 2rem;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s;
}

.download-btn:hover {
    background: var(--text-secondary);
    gap: 1rem;
}

/* Projects Grid */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
    margin-bottom: 4rem;
}

.project-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.3s;
}

.project-card:hover {
    border-color: #333;
    transform: translateY(-5px);
}

.project-image {
    width: 100%;
    height: 250px;
    overflow: hidden;
}

.project-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.project-card:hover .project-image img {
    transform: scale(1.05);
}

.project-info {
    padding: 2rem;
}

.project-info h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.project-info p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    border: 1px solid var(--border-color);
}

/* Tools Section */
.tools-section, .services-section {
    margin: 4rem 0;
}

.tools-section h2, .services-section h2 {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 3rem;
    color: var(--text-primary);
}

.tools-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
}

.tool-item {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
    transition: all 0.3s;
}

.tool-item:hover {
    border-color: #333;
    transform: translateY(-5px);
}

.tool-item img {
    width: 60px;
    height: 60px;
    margin-bottom: 1rem;
}

.tool-item h4 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.tool-item p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Services Grid */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.service-item {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
}

.service-item h4 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.service-item ul {
    list-style: none;
    padding: 0;
}

.service-item li {
    color: var(--text-secondary);
    margin-bottom: 0.8rem;
    padding-left: 1rem;
    position: relative;
}

.service-item li::before {
    content: '✓';
    color: var(--text-primary);
    position: absolute;
    left: 0;
}

/* CTA Section */
.cta-section {
    text-align: center;
    margin: 4rem 0;
    padding: 4rem 2rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 24px;
}

.cta-section h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.cta-section p {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.cta-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--text-primary);
    color: var(--bg-primary);
    padding: 1rem 2rem;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 500;
    font-size: 1.1rem;
    transition: all 0.3s;
}

.cta-button:hover {
    background: var(--text-secondary);
    gap: 1rem;
}

/* Page-specific bento card styles */
.page-title {
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.page-title h1 {
    font-family: 'Dela Gothic One', cursive;
    font-size: 3rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.page-title .page-subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    font-weight: 300;
}

/* Project cards in bento grid */
.bento-card.project-card {
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.bento-card.project-card .project-image {
    width: 100%;
    height: 60%;
    overflow: hidden;
}

.bento-card.project-card .project-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.bento-card.project-card:hover .project-image img {
    transform: scale(1.05);
}

.bento-card.project-card .project-info {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.bento-card.project-card .project-info h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.bento-card.project-card .project-info p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.4;
    font-size: 0.9rem;
    flex: 1;
}

.bento-card.project-card .project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.bento-card.project-card .tag {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.7rem;
    border: 1px solid var(--border-color);
}

/* Tools and Services sections in bento cards */
.bento-card.tools-section,
.bento-card.services-section {
    display: flex;
    flex-direction: column;
}

.bento-card.tools-section h2,
.bento-card.services-section h2 {
    font-size: 2rem;
    margin-bottom: 2rem;
    color: var(--text-primary);
    text-align: center;
}

.bento-card.tools-section .tools-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.bento-card.tools-section .tool-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s;
}

.bento-card.tools-section .tool-item:hover {
    border-color: #333;
    transform: translateY(-3px);
}

.bento-card.tools-section .tool-item img {
    width: 50px;
    height: 50px;
    margin-bottom: 1rem;
}

.bento-card.tools-section .tool-item h4 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.bento-card.tools-section .tool-item p {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.bento-card.services-section .services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.bento-card.services-section .service-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
}

.bento-card.services-section .service-item h4 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.bento-card.services-section .service-item ul {
    list-style: none;
    padding: 0;
}

.bento-card.services-section .service-item li {
    color: var(--text-secondary);
    margin-bottom: 0.6rem;
    padding-left: 1rem;
    position: relative;
    font-size: 0.9rem;
}

.bento-card.services-section .service-item li::before {
    content: '✓';
    color: var(--text-primary);
    position: absolute;
    left: 0;
}

/* CTA section in bento card */
.bento-card.cta-section {
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #1a1a1a 0%, #0a0a0a 100%);
}

.bento-card.cta-section h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.bento-card.cta-section p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.bento-card.cta-section .cta-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--text-primary);
    color: var(--bg-primary);
    padding: 1rem 2rem;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 500;
    font-size: 1rem;
    transition: all 0.3s;
}

.bento-card.cta-section .cta-button:hover {
    background: var(--text-secondary);
    gap: 1rem;
}

/* Responsive for pages */
@media (max-width: 1200px) {
    .resume-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .projects-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }
    
    .page-title h1 {
        font-size: 2.5rem;
    }
    
    .bento-card.project-card {
        grid-column: span 6 !important;
    }
}

@media (max-width: 768px) {
    .page-title h1 {
        font-size: 2rem;
    }
    
    .page-title .page-subtitle {
        font-size: 1rem;
    }
    
    .bento-card.project-card {
        grid-column: span 1 !important;
    }
    
    .bento-card.tools-section .tools-list,
    .bento-card.services-section .services-grid,
    .skills-grid {
        grid-template-columns: 1fr;
    }
    
    .bento-card.cta-section {
        padding: 1.5rem;
    }
    
    .bento-card.cta-section h2 {
        font-size: 1.5rem;
    }
    
    .bento-card.cta-section p {
        font-size: 1rem;
    }
}







@keyframes particleFloat {
    0% {
        transform: translateY(100vh) translateX(0) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100vh) translateX(200px) rotate(360deg);
        opacity: 0;
    }
}



/* Улучшенная видимость контента поверх ASCII фона */
.bento-grid {
    position: relative;
    z-index: 1;
}





/* Дополнительные эффекты для ASCII */
.ascii-glow {
    position: absolute;
    width: 100%;
    height: 100%;
    background: radial-gradient(
        circle at 50% 50%,
        rgba(102, 255, 178, 0.03) 0%,
        rgba(64, 224, 144, 0.01) 30%,
        transparent 60%
    );
    animation: glowPulse 4s ease-in-out infinite alternate;
}

@keyframes glowPulse {
    0% {
        opacity: 0.3;
        transform: scale(1);
    }
    100% {
        opacity: 0.7;
        transform: scale(1.1);
    }
}


/* Улучшенные переходы для частиц */
/* Эффект магического следа за лошадьми */
.ascii-horse::before {
    content: '';
    position: absolute;
    top: -20px;
    left: -100px;
    width: 600px;
    height: calc(100% + 40px);
    background: radial-gradient(
        ellipse at center,
        rgba(102, 255, 178, 0.08) 0%,
        rgba(102, 255, 178, 0.04) 30%,
        rgba(64, 224, 144, 0.02) 60%,
        transparent 80%
    );
    pointer-events: none;
    z-index: -1;
    animation: trailPulse 2s ease-in-out infinite alternate;
}

@keyframes trailPulse {
    0% {
        opacity: 0.3;
        transform: scaleX(0.8);
    }
    100% {
        opacity: 0.7;
        transform: scaleX(1.2);
    }
}

/* Дополнительное свечение для деталей лошади */
.ascii-horse {
    filter: drop-shadow(0 0 10px rgba(102, 255, 178, 0.3));
}
/* Скрываем системный курсор для всех элементов (только десктоп) */
@media (min-width: 769px) {
    * {
        cursor: none !important;
    }
    a, button, input, textarea, select, [data-tilt], .bento-card, .tool-icon, .nav-links a, .logo {
        cursor: none !important;
    }
}

/* На мобильных — обычный курсор, скрываем кастомный курсор */
@media (max-width: 768px) {
    .custom-cursor,
    .tool-cursor {
        display: none !important;
        pointer-events: none;
        opacity: 0;
    }
}

/* Page-specific bento card styles */
.page-title {
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    grid-row: span 1;
}

.page-title h1 {
    font-family: 'Dela Gothic One', cursive;
    font-size: 3rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.page-title .page-subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    font-weight: 300;
}

/* Project cards in bento grid */
.bento-card.project-card {
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    grid-row: span 2;
}

.bento-card.project-card .project-image {
    width: 100%;
    height: 60%;
    overflow: hidden;
}

.bento-card.project-card .project-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.bento-card.project-card:hover .project-image img {
    transform: scale(1.05);
}

.bento-card.project-card .project-info {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.bento-card.project-card .project-info h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.bento-card.project-card .project-info p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.4;
    font-size: 0.9rem;
    flex: 1;
}

.bento-card.project-card .project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.bento-card.project-card .tag {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.7rem;
    border: 1px solid var(--border-color);
}

/* Tools and Services sections in bento cards */
.bento-card.tools-section,
.bento-card.services-section {
    display: flex;
    flex-direction: column;
    grid-row: span 2;
}

.bento-card.tools-section h2,
.bento-card.services-section h2 {
    font-size: 2rem;
    margin-bottom: 2rem;
    color: var(--text-primary);
    text-align: center;
}

.bento-card.tools-section .tools-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.bento-card.tools-section .tool-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s;
}

.bento-card.tools-section .tool-item:hover {
    border-color: #333;
    transform: translateY(-3px);
}

.bento-card.tools-section .tool-item img {
    width: 50px;
    height: 50px;
    margin-bottom: 1rem;
}

.bento-card.tools-section .tool-item h4 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.bento-card.tools-section .tool-item p {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.bento-card.services-section .services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.bento-card.services-section .service-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
}

.bento-card.services-section .service-item h4 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.bento-card.services-section .service-item ul {
    list-style: none;
    padding: 0;
}

.bento-card.services-section .service-item li {
    color: var(--text-secondary);
    margin-bottom: 0.6rem;
    padding-left: 1rem;
    position: relative;
    font-size: 0.9rem;
}

.bento-card.services-section .service-item li::before {
    content: '✓';
    color: var(--text-primary);
    position: absolute;
    left: 0;
}

/* CTA section in bento card */
.bento-card.cta-section {
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #1a1a1a 0%, #0a0a0a 100%);
    grid-row: span 1;
}

.bento-card.cta-section h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.bento-card.cta-section p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.bento-card.cta-section .cta-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--text-primary);
    color: var(--bg-primary);
    padding: 1rem 2rem;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 500;
    font-size: 1rem;
    transition: all 0.3s;
}

.bento-card.cta-section .cta-button:hover {
    background: var(--text-secondary);
    gap: 1rem;
}

/* Responsive updates for pages */
@media (max-width: 1200px) {
    .page-title h1 {
        font-size: 2.5rem;
    }
    
    .bento-card.project-card {
        grid-column: span 6 !important;
    }
}

@media (max-width: 768px) {
    .page-title h1 {
        font-size: 2rem;
    }
    
    .page-title .page-subtitle {
        font-size: 1rem;
    }
    
    .bento-card.project-card {
        grid-column: span 1 !important;
    }
    
    .bento-card.tools-section .tools-list,
    .bento-card.services-section .services-grid {
        grid-template-columns: 1fr;
    }
    
    .bento-card.cta-section {
        padding: 1.5rem;
    }
    
    .bento-card.cta-section h2 {
        font-size: 1.5rem;
    }
    
    .bento-card.cta-section p {
        font-size: 1rem;
    }
}
/* Resume-specific styles */
.bento-card.resume-info,
.bento-card.experience-card,
.bento-card.skills-card,
.bento-card.education-card {
    display: flex;
    flex-direction: column;
    grid-row: span 2;
}

.bento-card.resume-info h2,
.bento-card.experience-card h2,
.bento-card.skills-card h2,
.bento-card.education-card h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.bento-card.resume-info h3 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.bento-card.resume-info .position {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.bento-card.resume-info .contact-info p {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.bento-card.experience-card .job-item {
    margin-bottom: 2rem;
}

.bento-card.experience-card .job-header h3 {
    font-size: 1.2rem;
    color: var(--text-primary);
    margin-bottom: 0.3rem;
}

.bento-card.experience-card .company {
    font-size: 1rem;
    color: var(--text-primary);
    font-weight: 500;
    display: block;
    margin-bottom: 0.2rem;
}

.bento-card.experience-card .period {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 0.8rem;
}

.bento-card.experience-card .responsibilities {
    list-style: none;
    padding: 0;
}

.bento-card.experience-card .responsibilities li {
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
    padding-left: 1rem;
    position: relative;
    font-size: 0.9rem;
}

.bento-card.experience-card .responsibilities li::before {
    content: '•';
    color: var(--text-primary);
    position: absolute;
    left: 0;
}

.bento-card.skills-card .skills-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.bento-card.skills-card .skill-category h4 {
    font-size: 1rem;
    margin-bottom: 0.8rem;
    color: var(--text-primary);
}

.bento-card.skills-card .skill-category ul {
    list-style: none;
    padding: 0;
}

.bento-card.skills-card .skill-category li {
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
    padding: 0.3rem 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.bento-card.education-card .education-info {
    margin-bottom: 2rem;
}

.bento-card.education-card .education-info h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.bento-card.education-card .university {
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 0.3rem;
}

.bento-card.education-card .degree {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.bento-card.education-card .period {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.bento-card.education-card .download-section {
    text-align: center;
    margin-top: auto;
}

.bento-card.education-card .download-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--text-primary);
    color: var(--bg-primary);
    padding: 0.8rem 1.5rem;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.bento-card.education-card .download-btn:hover {
    background: var(--text-secondary);
    gap: 1rem;
}

/* ========== Resume page (новая вёрстка) ========== */
.page-resume .resume-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    padding-top: 1rem;
}

.resume-hero {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2rem 0;
}

.resume-hero__name {
    font-family: 'Dela Gothic One', cursive;
    font-size: clamp(2.5rem, 6vw, 4rem);
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
    animation: resumeFadeInUp 0.8s ease forwards;
}

.resume-hero__role {
    font-size: 1.25rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 0.5rem;
    animation: resumeFadeInUp 0.8s ease 0.15s forwards;
    opacity: 0;
    animation-fill-mode: forwards;
}

.resume-hero__tagline {
    font-size: 0.95rem;
    color: var(--text-secondary);
    opacity: 0.85;
    animation: resumeFadeInUp 0.8s ease 0.3s forwards;
    opacity: 0;
    animation-fill-mode: forwards;
}

@keyframes resumeFadeInUp {
    from {
        opacity: 0;
        transform: translateY(24px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.resume-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 3rem;
    align-items: start;
}

.resume-sidebar {
    position: sticky;
    top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.resume-block {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 1.5rem;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.resume-block:hover {
    border-color: #333;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.resume-block__title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

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

.resume-contact-list li {
    margin-bottom: 0.6rem;
    font-size: 0.95rem;
    color: var(--text-primary);
    line-height: 1.5;
}

.resume-contact-list a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.2s;
}

.resume-contact-list a:hover {
    color: var(--text-secondary);
}

.resume-contact-telegram {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.resume-contact-telegram svg {
    flex-shrink: 0;
}

.resume-skills .resume-skill-group {
    margin-bottom: 1rem;
}

.resume-skills .resume-skill-group:last-child {
    margin-bottom: 0;
}

.resume-skill-group h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.resume-skill-group p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.resume-skill-sublist {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.resume-skill-sublist li {
    position: relative;
    padding-left: 0.75rem;
    margin-bottom: 0.25rem;
}

.resume-skill-sublist li::before {
    content: '·';
    position: absolute;
    left: 0;
    color: var(--text-primary);
    opacity: 0.7;
}

.resume-timeline__country {
    font-weight: 400;
    font-size: 0.9em;
    color: var(--text-secondary);
    opacity: 0.9;
}

.resume-edu__degree {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.resume-edu__place,
.resume-edu__year {
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: block;
}

.resume-edu__year {
    margin-top: 0.5rem;
    font-size: 0.8rem;
    opacity: 0.9;
}

.resume-download {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    background: var(--text-primary);
    color: var(--bg-primary);
    border-radius: 14px;
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    transition: transform 0.25s, box-shadow 0.25s;
}

.resume-download:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(255, 255, 255, 0.15);
}

.resume-download svg {
    flex-shrink: 0;
}

.resume-section-title {
    font-family: 'Dela Gothic One', cursive;
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 2rem;
}

.resume-main {
    min-width: 0;
}

/* Таймлайн опыта */
.resume-timeline {
    position: relative;
    padding-left: 2rem;
    border-left: 2px solid var(--border-color);
    margin-left: 0.5rem;
}

.resume-timeline__item {
    position: relative;
    margin-bottom: 2.5rem;
}

.resume-timeline__item:last-child {
    margin-bottom: 0;
}

.resume-timeline__marker {
    position: absolute;
    left: -2rem;
    top: 0.4rem;
    transform: translateX(-50%);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--text-primary);
    box-shadow: 0 0 0 4px var(--card-bg);
    transition: transform 0.3s, box-shadow 0.3s;
}

.resume-timeline__item:hover .resume-timeline__marker {
    transform: translateX(-50%) scale(1.3);
    box-shadow: 0 0 0 4px var(--card-bg), 0 0 20px rgba(255, 255, 255, 0.3);
}

.resume-timeline__content {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.resume-timeline__content:hover {
    border-color: #333;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.resume-timeline__period {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.resume-timeline__company {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.resume-timeline__role {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

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

.resume-timeline__list li {
    position: relative;
    padding-left: 1rem;
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.resume-timeline__list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.55em;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--text-secondary);
    opacity: 0.7;
}

/* Анимация появления блоков резюме при скролле */
.resume-anim {
    opacity: 0;
    transform: translateY(24px);
}

.resume-anim--visible {
    animation: resumeBlockIn 0.6s ease forwards;
}

@keyframes resumeBlockIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 900px) {
    .resume-layout {
        grid-template-columns: 1fr;
    }

    .resume-sidebar {
        position: static;
    }

    .resume-timeline {
        padding-left: 1.5rem;
        margin-left: 0.25rem;
    }

    .resume-timeline__marker {
        left: -1.5rem;
        transform: translateX(-50%);
    }
}

/* ========== Планшет: аккуратная вёрстка 768–1024px ========== */
@media (max-width: 1024px) and (min-width: 769px) {
    .site-header {
        padding: 0 1.25rem;
        margin: 1.5rem auto 0;
    }
    .header-content {
        padding: 0.35rem 1.5rem;
    }
    /* Правила .nav-links a удалены: на этой ширине навигация — выезжающая
       панель (см. @media max-width: 1100px), строчные стили ей мешали */
    .bento-grid {
        padding: 1.25rem 1.25rem 2rem;
        gap: 1.25rem;
    }
    .bento-card {
        padding: 1.25rem;
        border-radius: 20px;
    }
    .page-title {
        padding: 1.5rem 1rem;
    }
    .page-title h1 {
        font-size: 2.25rem;
    }
    .page-title .page-subtitle {
        font-size: 1.05rem;
    }
    .bento-card.project-card .project-image {
        height: 55%;
    }
    .bento-card.project-card .project-info {
        padding: 1.25rem;
    }
    .bento-card.cta-section {
        padding: 1.5rem 1.25rem;
    }
    .cta-button {
        min-height: 48px;
        padding: 0.9rem 1.5rem;
    }
}

/* ========== Мобильные: safe-area и удобные зоны нажатия ========== */
@media (max-width: 768px) {
    body {
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
    .site-header {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }
    .bento-grid {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
        padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
    }
    .bento-card.project-card {
        min-height: 280px;
    }
    .bento-card.project-card .project-image {
        height: 50%;
        min-height: 140px;
    }
    .bento-card.project-card .project-info {
        padding: 1.25rem;
    }
    .bento-card.project-card .project-info h3 {
        font-size: 1.1rem;
    }
    .bento-card.project-card .project-info p {
        font-size: 0.85rem;
    }
    .cta-button {
        min-height: 48px;
        padding: 1rem 1.5rem;
        width: 100%;
        max-width: 320px;
        justify-content: center;
    }
}

/* Страница резюме: мобильная и планшетная вёрстка */
@media (max-width: 768px) {
    .page-resume .resume-page {
        padding: 1rem;
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }
    .resume-hero {
        margin-bottom: 2rem;
        padding: 1.5rem 0;
    }
    .resume-hero__name {
        font-size: clamp(2rem, 8vw, 2.75rem);
    }
    .resume-hero__role {
        font-size: 1.1rem;
    }
    .resume-hero__tagline {
        font-size: 0.9rem;
    }
    .resume-block {
        padding: 1.25rem;
    }
    .resume-download {
        min-height: 48px;
        padding: 1rem 1.5rem;
    }
    .resume-timeline__content {
        padding: 1.25rem;
    }
    .resume-timeline__company {
        font-size: 1.1rem;
    }
    .resume-timeline__list li {
        font-size: 0.85rem;
    }
}
@media (max-width: 480px) {
    .page-resume .resume-page {
        padding: 0.75rem;
    }
    .resume-hero__name {
        font-size: 1.75rem;
    }
    .resume-section-title {
        font-size: 1.25rem;
    }
}

/* Внутренние страницы (визуал, инструменты, AI, полиграфия): планшет — 2 колонки карточек */
@media (max-width: 1024px) and (min-width: 769px) {
    .bento-card.project-card {
        grid-column: span 6 !important;
    }
}
@media (max-width: 768px) {
    .bento-grid .bento-card.page-title {
        padding: 1.5rem 1rem;
    }
    .bento-grid .bento-card.page-title h1 {
        font-size: 1.75rem;
    }
    .bento-grid .bento-card.page-title .page-subtitle {
        font-size: 0.95rem;
    }
}

/* 404: мобильная вёрстка */
@media (max-width: 768px) {
    .page-404 .error-wrap {
        padding: 1.5rem 1rem;
        padding-bottom: max(2rem, env(safe-area-inset-bottom));
    }
    .page-404 .error-content {
        max-width: 100%;
    }
    .page-404 .error-code-wrap {
        margin-bottom: 1rem;
    }
    .page-404 .error-btn {
        min-height: 48px;
        width: 100%;
        max-width: 280px;
        justify-content: center;
    }
}
@media (max-width: 480px) {
    .page-404 .error-code {
        font-size: 4rem;
    }
    .page-404 .error-title {
        font-size: 1.25rem;
    }
    .page-404 .error-description {
        font-size: 0.9rem;
    }
}

/* ========== Universal Project Popup ========== */
.popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    box-sizing: border-box;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.popup-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

.popup-window {
    position: relative;
    width: 100%;
    max-width: 1400px;
    max-height: 90vh;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    overflow: hidden;
    display: grid;
    grid-template-columns: 1fr 380px;
    grid-template-rows: 1fr;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
    transform: scale(0.96);
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Стрелки переключения между попапами (как в галерее изображений) */
.popup-prev,
.popup-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 52px;
    height: 52px;
    z-index: 10;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s, background 0.2s;
}
.popup-prev { left: 1.5rem; }
.popup-next { right: 1.5rem; }
.popup-prev:hover,
.popup-next:hover {
    border-color: #555;
    background: rgba(255, 255, 255, 0.14);
}
.popup-overlay .popup-prev,
.popup-overlay .popup-next {
    cursor: pointer !important;
}

.popup-overlay.is-open .popup-window {
    transform: scale(1);
}

/* В попапе и в галерее показываем обычный курсор и скрываем кастомный */
body.popup-open .custom-cursor,
body.gallery-viewer-open .custom-cursor {
    display: none !important;
}
.popup-overlay,
.popup-overlay * {
    cursor: default !important;
}
.popup-overlay .popup-gallery-item {
    cursor: pointer !important;
}
.popup-gallery-viewer,
.popup-gallery-viewer * {
    cursor: default !important;
}
.popup-gallery-viewer .gallery-viewer-zoom,
.popup-gallery-viewer .gallery-viewer-close,
.popup-gallery-viewer .gallery-viewer-prev,
.popup-gallery-viewer .gallery-viewer-next {
    cursor: pointer !important;
}

/* В попапе: вертикальный скролл, изображения в 2 раза меньше, по клику — галерея со стрелками и лупой */
.popup-gallery {
    overflow-y: auto;
    overflow-x: hidden;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-height: 0;
}

.popup-gallery-item {
    flex: 0 0 auto;
    max-width: 50%;
    margin: 0 auto;
    width: 100%;
    cursor: pointer;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.popup-gallery-item:hover {
    border-color: #444;
    transform: scale(1.02);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.popup-gallery-item img {
    width: 100%;
    height: auto;
    object-fit: contain;
    display: block;
}

/* Галерея по клику: стрелки (листание), лупа (увеличение) */
.popup-gallery-viewer {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.94);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 5rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.popup-gallery-viewer.is-open {
    opacity: 1;
    visibility: visible;
}

.gallery-viewer-image-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    position: relative;
    z-index: 1;
    overflow: auto;
    max-height: 100%;
}

.popup-gallery-viewer.is-zoomed .gallery-viewer-image-wrap {
    overflow: hidden;
}

/* Обёртка по размеру изображения — лупа привязана к правому краю картинки */
.gallery-viewer-image-inner {
    position: relative;
    display: inline-block;
    line-height: 0;
}

.popup-gallery-viewer .gallery-viewer-image-inner img {
    max-width: 100%;
    max-height: 85vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 12px;
    transition: transform 0.15s ease-out;
    display: block;
}

.popup-gallery-viewer.is-zoomed .gallery-viewer-image-inner img {
    cursor: grab;
}

.popup-gallery-viewer.is-zoomed .gallery-viewer-image-inner img:active {
    cursor: grabbing;
}

/* Иконки лупы: плюс по умолчанию, минус при увеличении */
.gallery-viewer-zoom .icon-zoom-out {
    display: none;
}
.popup-gallery-viewer.is-zoomed .gallery-viewer-zoom .icon-zoom-in {
    display: none;
}
.popup-gallery-viewer.is-zoomed .gallery-viewer-zoom .icon-zoom-out {
    display: inline-flex;
}

/* Зоны клика слева/справа для переключения изображений */
.gallery-viewer-click-prev,
.gallery-viewer-click-next {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 30%;
    z-index: 2;
    cursor: pointer;
}
.gallery-viewer-click-prev { left: 0; }
.gallery-viewer-click-next { right: 0; }

.gallery-viewer-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 3;
    width: 48px;
    height: 48px;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s, background 0.2s;
}

.gallery-viewer-close:hover {
    border-color: #555;
    background: rgba(255, 255, 255, 0.12);
}

.gallery-viewer-prev,
.gallery-viewer-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 52px;
    z-index: 3;
    height: 52px;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s, background 0.2s;
    flex-shrink: 0;
}

.gallery-viewer-prev { left: 1.5rem; }
.gallery-viewer-next { right: 1.5rem; }

.gallery-viewer-prev:hover,
.gallery-viewer-next:hover {
    border-color: #555;
    background: rgba(255, 255, 255, 0.14);
}

.gallery-viewer-zoom {
    position: absolute;
    bottom: 0.75rem;
    right: 0.75rem;
    width: 44px;
    height: 44px;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s, background 0.2s;
}

.gallery-viewer-zoom .icon-zoom-in {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.gallery-viewer-zoom .icon-zoom-out {
    display: none;
    align-items: center;
    justify-content: center;
}
.popup-gallery-viewer.is-zoomed .gallery-viewer-zoom .icon-zoom-in {
    display: none;
}
.popup-gallery-viewer.is-zoomed .gallery-viewer-zoom .icon-zoom-out {
    display: inline-flex;
}

.gallery-viewer-zoom:hover {
    border-color: #555;
    background: rgba(255, 255, 255, 0.12);
}

.gallery-viewer-counter {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.popup-sidebar {
    display: flex;
    flex-direction: column;
    padding: 2rem;
    border-left: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.2);
    position: relative;
}

.popup-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    width: 44px;
    height: 44px;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s, background 0.2s;
    color: var(--text-primary);
    flex-shrink: 0;
}

.popup-close:hover {
    border-color: #444;
    background: rgba(255, 255, 255, 0.1);
}

.popup-sidebar .popup-title {
    font-family: 'Dela Gothic One', cursive;
    font-size: 1.75rem;
    color: var(--text-primary);
    margin: 0 0 0.5rem 0;
    padding-right: 3rem;
    line-height: 1.2;
}

.popup-sidebar .popup-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.popup-sidebar .popup-body {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.6;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.popup-sidebar .popup-body p {
    margin-bottom: 1rem;
}

.popup-sidebar .popup-body p:last-child {
    margin-bottom: 0;
}

@media (max-width: 900px) {
    .popup-window {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
        max-height: 95vh;
    }

    .popup-sidebar {
        border-left: none;
        border-top: 1px solid var(--border-color);
        padding-top: 1rem;
    }

    .popup-gallery {
        order: 1;
        max-height: 45vh;
    }

    .popup-gallery-item {
        max-width: 85%;
    }

    .popup-sidebar {
        order: 2;
    }
}

.project-card .project-date {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.visual-cards-container {
    display: contents;
}