:root {
    --background: #000000;
    --text-primary: #EAEAEA;
    --text-secondary: #888888;
    --accent: #308ABF;
    --border: #222222;
    --font-main: 'Inter', -apple-system, sans-serif;
    --font-mono: 'IBM Plex Mono', monospace;
}

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

html {
    font-size: 112.5%;
}

body {
    background-color: var(--background);
    color: var(--text-primary);
    font-family: var(--font-main);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

#patternCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

main {
    position: relative;
    z-index: 2;
    background-color: transparent;
}

.container { max-width: 1000px; margin: 0 auto; padding: 0 40px; }
.section {
    padding: 140px 0;
    position: relative;
    z-index: 1;
    background-color: var(--background);
}

.section-header {
    max-width: 65ch;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 80px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.section-header h2 {
    font-size: 2.7rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--accent);
    font-family: 'IBM Plex Mono', monospace;
    text-align: center;
    transform: translateX(0.15em);
}

.section-header p {
    font-size: 1.15rem;
    line-height: 1.7;
    color: #EAEAEA;
    margin-top: 18px;
    text-align: center;
    max-width: 600px;
}

.reveal { opacity: 0; transform: translateY(20px); transition: opacity 0.8s ease-out, transform 0.8s ease-out; }
.reveal.visible { opacity: 1; transform: translateY(0); }

.main-header {
    position: fixed; top: 0; left: 0; width: 100%; z-index: 10;
    padding: 20px 0; border-bottom: 1px solid var(--border);
    background-color: rgba(0,0,0,0.8);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.header-container { display: flex; justify-content: space-between; align-items: center; }

.logo { display: block; }
.logo svg {
    display: block;
    height: 35px;
    width: auto;
}

.main-nav a {
    font-family: var(--font-mono); font-size: 0.9rem;
    color: var(--text-primary);
    text-decoration: none; margin-left: 35px; transition: color 0.2s;
    line-height: 35px;
}

.main-nav a:hover {
    color: var(--accent);
}

#hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background-color: transparent;
}

.hero-content {
    position: relative;
    z-index: 2;
    background: rgba(0,0,0,0.3);
    padding: 30px 40px;
    border-radius: 12px;
    backdrop-filter: blur(5px);
}

.hero-content h1 {
    font-family: var(--font-mono);
    font-size: 2.5rem;
    font-weight: 500;
    line-height: 1.4;
    margin-bottom: 30px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
.hero-content .cursor {
    display: inline-block; width: 1px; height: 0.9em; background-color: var(--text-primary);
    animation: blink 1s infinite step-end; margin-left: 10px; vertical-align: baseline;
}
@keyframes blink { 50% { opacity: 0; } }
.hero-content p {
    max-width: 55ch; margin: 0 auto; color: var(--text-secondary);
    font-size: 1.1rem; line-height: 1.8;
}

.content-list > li, .project-item {
    padding: 40px 0; border-bottom: 1px solid var(--border);
    display: grid; grid-template-columns: 2fr 3fr; gap: 40px;
}
.item-title h3 { font-size: 1.3rem; font-weight: 600; }
.item-description p { color: var(--text-secondary); line-height: 1.6; }

.project-item { align-items: center; }
.project-image { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 4px; }
.project-diff { margin-top: 20px; font-family: var(--font-mono); font-size: 0.9rem; }
.project-diff span { display: block; }
.project-diff .before { color: #FF5555; }
.project-diff .after { color: #00FF00; }

#contact {
    background: transparent !important;
    position: relative;
}

#contact::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        rgba(0, 0, 0, 0.4) 30%,
        rgba(0, 0, 0, 0.7) 100%
    );
    z-index: -1;
}

#contact .container {
    text-align: center;
    position: relative;
    z-index: 2;
}

.contact-links {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    margin-top: 40px;
}

.contact-link {
    display: block;
    padding: 50px 30px;
    text-decoration: none;
    color: var(--text-primary);
    border: 1px solid rgba(34, 34, 34, 0.6);
    border-radius: 12px;
    transition: all 0.3s ease;
    background: rgba(10, 10, 10, 0.4);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    position: relative;
    overflow: hidden;
}

.contact-link:hover {
    background: rgba(15, 15, 15, 0.6);
    border-color: var(--accent);
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 174, 239, 0.2);
}

.contact-link h3 {
    font-family: var(--font-mono);
    font-size: 1.4rem;
    margin-bottom: 15px;
    position: relative;
    z-index: 1;
}

.contact-link p {
    color: var(--text-secondary);
    line-height: 1.6;
    position: relative;
    z-index: 1;
}

.email-contact {
    margin-top: 40px;
    padding: 25px;
    background: rgba(10, 10, 10, 0.3);
    border-radius: 8px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(34, 34, 34, 0.4);
}

.sub-heading {
    font-family: var(--font-mono);
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 20px;
}

.approach-block, .specialization-block, .start-work-block, .tech-stack-block {
    margin-top: 100px;
}

.sub-heading-p {
    max-width: 65ch;
    margin: 0 auto 40px auto;
    text-align: center;
    color: var(--text-secondary);
    line-height: 1.7;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

.feature-item {
    background-color: #0A0A0A;
    border: 1px solid var(--border);
    padding: 30px;
    border-radius: 8px;
    transition: transform 0.3s, border-color 0.3s;
}

.feature-item:hover {
    transform: translateY(-5px);
    border-color: var(--accent);
}

.feature-item h4 {
    font-size: 1.2rem;
    color: var(--accent);
    margin-bottom: 15px;
}

.feature-item p {
    color: var(--text-secondary);
    line-height: 1.6;
}

.specialization-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
}

.spec-item {
    background: rgba(10, 10, 10, 0.3);
    border-left: 3px solid var(--accent);
    padding: 25px;
    transition: background-color 0.3s, transform 0.3s;
}

.spec-item:hover {
    background-color: #080808;
    transform: translateY(-5px);
}

.spec-item h5 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.spec-item p {
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 0.95rem;
}

.start-work-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-top: 40px;
    background-color: #0A0A0A;
    border: 1px solid var(--border);
    padding: 40px;
    border-radius: 8px;
}

.start-item p {
    color: var(--text-secondary);
    line-height: 1.7;
    font-size: 1.1rem;
}

.start-item p strong {
    color: var(--text-primary);
}

@media (max-width: 768px) {
    .contact-links, .start-work-grid {
        grid-template-columns: 1fr;
    }
    .project-item {
        grid-template-columns: 1fr;
    }
    .specialization-grid {
        grid-template-columns: 1fr;
    }
}

/* ====================================================== */
/* ============== СТИЛИ ЛОГО-СКРОЛЛЕРА ============== */
/* ====================================================== */
@keyframes scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-40%); }
}

.logo-scroller {
    max-width: 100%;
    overflow: hidden;
    -webkit-mask: linear-gradient(90deg, transparent, white 20%, white 80%, transparent);
    mask: linear-gradient(90deg, transparent, white 20%, white 80%, transparent);
    padding: 30px 60px;
}

.logo-scroller-inner {
    --gap: 2rem;
    display: flex;
    flex-wrap: nowrap;
    gap: var(--gap);
    animation: scroll 20s linear infinite;
    width: max-content;
}

.logo-scroller:hover .logo-scroller-inner {
    animation-play-state: paused;
}

.logo-scroller-inner svg {
    height: 50px;
    width: auto;
    fill: var(--text-secondary);
    opacity: 0.7;
    transition: opacity 0.3s, fill 0.3s;
    flex-shrink: 0;
}

.logo-scroller:hover .logo-scroller-inner svg {
    fill: var(--text-primary);
    opacity: 1;
}

#services.section {
    padding: 140px 0 10px 0;
}

/* ====================================================== */
/* ============== СЛАЙДЕР И МОДАЛЬНОЕ ОКНО ============== */
/* ====================================================== */

/* Стили слайдера проектов */
body.modal-open { overflow: hidden; }

.project-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
    height: 100%;
}

.projects-slider-wrapper {
    position: relative;
    overflow: hidden;
    padding: 0 60px;
    -webkit-mask: linear-gradient(90deg,
        transparent 0%,
        black 60px,
        black calc(100% - 60px),
        transparent 100%);
    mask: linear-gradient(90deg,
        transparent 0%,
        black 60px,
        black calc(100% - 60px),
        transparent 100%);
}

/* Обновляем стрелки чтобы были поверх маски */
.slider-controls {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    pointer-events: none;
    z-index: 5;
}

/* Адаптивность */
@media (max-width: 768px) {
    .projects-slider-wrapper {
        padding: 0 40px;
        -webkit-mask: linear-gradient(90deg,
            transparent 0%,
            black 40px,
            black calc(100% - 40px),
            transparent 100%);
        mask: linear-gradient(90deg,
            transparent 0%,
            black 40px,
            black calc(100% - 40px),
            transparent 100%);
    }

    .slider-arrow {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .projects-slider-wrapper {
        padding: 0 20px;
        -webkit-mask: linear-gradient(90deg,
            transparent 0%,
            black 20px,
            black calc(100% - 20px),
            transparent 100%);
        mask: linear-gradient(90deg,
            transparent 0%,
            black 20px,
            black calc(100% - 20px),
            transparent 100%);
    }
}
.projects-slider-track {
    display: flex;
    transition: transform 0.3s ease;
    width: 100%;
}

.project-slide {
    display: flex;
    gap: 25px;
    min-width: 100%;
    flex-shrink: 0;
    justify-content: flex-start;
    padding: 10px 0;
    padding-left: 25px;
}

.project-card {
    display: flex;
    flex-direction: column;
    background-color: #0A0A0A;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    width: 240px;
    height: 400px;
    cursor: pointer;
    flex-shrink: 0;
}

.project-card-link:hover .project-card {
    transform: translateY(-5px);
    border-color: var(--accent);
}

.project-card-image {
    height: 180px;
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
}

.project-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.project-card-content {
    padding: 20px;
    height: 200px;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.project-card-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 12px;
    line-height: 1.3;
    height: 2.6em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-shrink: 0;
}

.project-card-summary {
    color: var(--text-secondary);
    line-height: 1.5;
    font-size: 0.9rem;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 4.5em;
}

/* Управление слайдером */

.slider-arrow {
    pointer-events: all;
    background-color: rgba(10, 10, 10, 0.8);
    border: 1px solid var(--border);
    color: var(--text-primary);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.slider-arrow:hover {
    background-color: var(--accent);
}

/* === НОВЫЙ КОД (ВСТАВИТЬ) === */
#project-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0);
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition:
        opacity 0.4s ease,
        background-color 0.4s ease,
        backdrop-filter 0.4s ease;
}

#project-modal-overlay.active {
    opacity: 1;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    pointer-events: all;
}

#project-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8) rotateX(5deg);
    width: 95%;
    max-width: 1200px;
    max-height: 92vh;
    background-color: #0A0A0A;
    border: 1px solid var(--border);
    border-radius: 16px;
    z-index: 1001;
    overflow-y: auto;
    opacity: 0;
    pointer-events: none;
    transition:
        opacity 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275),
        transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-style: preserve-3d;
    perspective: 1000px;
}

#project-modal.active {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1) rotateX(0deg);
    pointer-events: all;
}


.modal-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    transition: color 0.2s;
    z-index: 10;
}

.modal-close-btn:hover {
    color: var(--text-primary);
}

.modal-gallery-wrapper {
    margin-bottom: 30px;
    position: relative;
}

/* Сетка 2x2 для галереи */
.grid-gallery {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 320px 180px;
    gap: 15px;
    height: 515px;
}

.grid-item {
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    background: #000;
    border: 1px solid #2a2a2a;
}

.grid-item.large {
    grid-column: 1 / -1;
    grid-row: 1;
}

.grid-item.small { }

.grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
    cursor: zoom-in; /* Добавляем курсор для изображений */
}

.grid-item:hover img {
    transform: scale(1.05);
}

.grid-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    padding: 12px;
    color: white;
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

/* Управление листанием фото в модалке */
.gallery-controls {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    pointer-events: none;
    z-index: 5;
}

.gallery-arrow {
    pointer-events: all;
    background-color: rgba(10, 10, 10, 0.8);
    border: 1px solid var(--border);
    color: var(--text-primary);
    width: 45px;
    height: 45px;
    border-radius: 50%;
    font-size: 1.3rem;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-gallery-wrapper:hover .gallery-arrow {
    opacity: 1;
}

.gallery-arrow:hover {
    background-color: var(--accent);
}

.gallery-counter {
    position: absolute;
    bottom: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    z-index: 5;
}

.modal-content-wrapper {
    padding: 35px;
}

.modal-title {
    font-size: 2.1rem;
    margin-bottom: 15px;
    color: var(--accent);
    font-family: 'IBM Plex Mono', monospace;
}

.modal-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 25px;
}

.modal-tags span {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.85rem;
    background-color: rgba(48, 138, 191, 0.1);
    color: var(--accent);
    padding: 5px 12px;
    border-radius: 4px;
}

.modal-description p,
.modal-description ul,
.modal-description li {
    color: var(--text-secondary); /* Тот самый серый цвет (#888888) */
    line-height: 1.7;
    font-size: 1.05rem;
}

.modal-description p {
    margin-bottom: 15px; /* Отступ между абзацами */
}

.modal-description ul {
    list-style: disc;       /* Возвращаем точки */
    padding-left: 20px;     /* Отступ слева */
    margin-bottom: 20px;    /* Отступ снизу */
}

.modal-description li {
    margin-bottom: 8px;     /* Расстояние между пунктами списка */
}



.modal-description h4 {
    color: var(--text-primary); /* Белый цвет заголовков (#EAEAEA) */
    margin-top: 22px;
    margin-bottom: 10px;
    font-size: 1.15rem;
    font-weight: 600;
}

/* Адаптивность */
@media (max-width: 1100px) {
    .project-card { width: 250px; height: 380px; }
    .project-card-image { height: 180px; }
    .project-card-content { height: 200px; }
    .grid-gallery { grid-template-rows: 280px 160px; height: 455px; }
}

@media (max-width: 768px) {
    .projects-slider-wrapper { padding: 0 40px; }
    .project-card { width: 220px; height: 350px; }
    .project-card-image { height: 150px; }
    .project-card-content { height: 200px; padding: 15px; }
    .slider-arrow { width: 40px; height: 40px; font-size: 1.2rem; }
    .modal-content-wrapper { padding: 25px; }
    .modal-title { font-size: 1.8rem; }
    .grid-gallery { grid-template-columns: 1fr; grid-template-rows: 200px 120px 120px; height: auto; gap: 12px; }
    .grid-item.large { grid-column: 1; }
    .gallery-arrow { opacity: 1; width: 40px; height: 40px; font-size: 1.2rem; }
}

@media (max-width: 480px) {
    .projects-slider-wrapper { padding: 0 20px; }
    .project-card { width: 200px; height: 320px; }
    .project-card-image { height: 120px; }
    .project-card-content { height: 200px; }
    .project-card-title { font-size: 1.1rem; height: 2.4em; }
    .project-card-summary { font-size: 0.85rem; min-height: 4em; }
    .grid-gallery { grid-template-rows: 180px 100px 100px; }
}

/* ====================================================== */
/* =================== СТИЛИ ДЛЯ ФУТЕРА =================== */
/* ====================================================== */

.main-footer {
    background-color: #050505;
    padding: 80px 0;
    border-top: 1px solid var(--border);
    position: relative;
    z-index: 5;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 40px;
}

.footer-column h5 {
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 20px;
    letter-spacing: 0.5px;
}

.footer-logo {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    margin-bottom: 15px;
}

.copyright {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.7;
    max-width: 300px;
}

.footer-column ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-column ul li {
    margin-bottom: 12px;
}

.footer-column ul a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.2s ease;
}

.footer-column ul a:hover {
    color: var(--accent);
}

@media (max-width: 768px) {
    .footer-grid { grid-template-columns: 1fr; text-align: center; }
    .copyright { margin: 0 auto; }
    .footer-column { margin-bottom: 30px; }
}

/* ====================================================== */
/* ============== ПОЛНОЭКРАННЫЙ РЕЖИМ ============== */
/* ====================================================== */

#fullscreen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.98);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

#fullscreen-overlay.active {
    display: flex;
}

.fullscreen-image {
    max-width: 95%;
    max-height: 95%;
    object-fit: contain;
    border-radius: 8px;
}

.fullscreen-close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 2.5rem;
    cursor: pointer;
    z-index: 2001;
    transition: color 0.2s;
}

.fullscreen-close-btn:hover {
    color: var(--accent);
}
/* ====================================================== */
/* ============== КАСТОМНЫЙ СКРОЛЛБАР ============== */
/* ====================================================== */

/* Для Webkit браузеров (Chrome, Safari, Edge) */
#project-modal::-webkit-scrollbar {
    width: 8px;
}

#project-modal::-webkit-scrollbar-track {
    background: #0A0A0A;
    border-radius: 4px;
}

#project-modal::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
    border: 2px solid #0A0A0A;
}

#project-modal::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* Для Firefox */
#project-modal {
    scrollbar-width: thin;
    scrollbar-color: var(--border) #0A0A0A;
}

/* Также можно стилизовать скроллбар для всего сайта */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--background);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* Для Firefox всего сайта */
html {
    scrollbar-width: thin;
    scrollbar-color: var(--border) var(--background);
}

/* ====================================================== */
/* ============== УЛУЧШЕННЫЕ АНИМАЦИИ МОДАЛКИ ============== */
/* ====================================================== */

/* Анимация для контента внутри модалки */
.modal-content-wrapper {
    opacity: 0;
    transform: translateY(20px);
    transition:
        opacity 0.4s ease 0.2s,
        transform 0.4s ease 0.2s;
}

#project-modal.active .modal-content-wrapper {
    opacity: 1;
    transform: translateY(0);
}

/* Анимация для галереи */
.grid-gallery {
    opacity: 0;
    transform: translateY(15px);
    transition:
        opacity 0.4s ease 0.1s,
        transform 0.4s ease 0.1s;
}

#project-modal.active .grid-gallery {
    opacity: 1;
    transform: translateY(0);
}

/* Анимация для заголовка */
.modal-title {
    opacity: 0;
    transform: translateX(-10px);
    transition:
        opacity 0.4s ease 0.3s,
        transform 0.4s ease 0.3s;
}

#project-modal.active .modal-title {
    opacity: 1;
    transform: translateX(0);
}

/* Анимация для тегов */
.modal-tags {
    opacity: 0;
    transform: translateX(10px);
    transition:
        opacity 0.4s ease 0.35s,
        transform 0.4s ease 0.35s;
}

#project-modal.active .modal-tags {
    opacity: 1;
    transform: translateX(0);
}

/* Анимация для описания */
.modal-description {
    opacity: 0;
    transform: translateY(10px);
    transition:
        opacity 0.4s ease 0.4s,
        transform 0.4s ease 0.4s;
}

#project-modal.active .modal-description {
    opacity: 1;
    transform: translateY(0);
}

/* Анимация для кнопки закрытия */
.modal-close-btn {
    opacity: 0;
    transform: scale(0.8) rotate(90deg);
    transition:
        opacity 0.3s ease 0.1s,
        transform 0.3s ease 0.1s,
        color 0.2s ease;
}

#project-modal.active .modal-close-btn {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

/* Анимация для стрелок галереи */
.gallery-arrow {
    transition:
        opacity 0.3s ease,
        background-color 0.2s ease,
        transform 0.2s ease;
    transform: scale(0.8);
}

.modal-gallery-wrapper:hover .gallery-arrow {
    transform: scale(1);
}

/* Плавная анимация для grid-item */
.grid-item {
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.grid-item:hover {
    transform: translateY(-2px);
}

/* Анимация для счетчика */
.gallery-counter {
    opacity: 0;
    transform: translateY(10px);
    transition:
        opacity 0.3s ease 0.5s,
        transform 0.3s ease 0.5s;
}

#project-modal.active .gallery-counter {
    opacity: 1;
    transform: translateY(0);
}

/* Анимация закрытия */
#project-modal.closing {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.9) rotateX(-5deg);
    transition:
        opacity 0.3s ease,
        transform 0.3s ease;
}

#project-modal-overlay.closing {
    opacity: 0;
    background-color: rgba(0, 0, 0, 0);
    backdrop-filter: blur(0px);
    transition:
        opacity 0.3s ease,
        background-color 0.3s ease,
        backdrop-filter 0.3s ease;
}
/* ====================================================== */
/* ============== РАЗДЕЛИТЕЛЬ ПОД КАРТОЧКАМИ ============== */
/* ====================================================== */

#projects .container::after {
    content: '';
    display: block;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg,
        transparent 0%,
        var(--border) 50%,
        transparent 100%);
    margin-top: 20px;
    opacity: 0.8;
}
/* ====================================================== */
/* ============== СПЕЦИАЛЬНЫЙ МАКЕТ ДЛЯ 4-ГО КЕЙСА ============== */
/* ====================================================== */

/* Специальный макет для 4-го кейса - 2 фото слева, 1 большое справа */
.grid-gallery.special-layout {
    grid-template-columns: 55% 45%; /* Уменьшили левую часть, увеличили правую */
    grid-template-rows: 1fr 1fr;
    grid-template-areas:
        "left-top right"
        "left-bottom right";
    height: 515px;
    gap: 15px;
}

/* Позиционирование элементов в специальном макете */
.grid-item.special-left-top {
    grid-area: left-top;
}

.grid-item.special-left-bottom {
    grid-area: left-bottom;
}

.grid-item.special-right-large {
    grid-area: right;
}

/* Уменьшаем отступ между левыми фотками */
.grid-item.special-left-top {
    margin-bottom: 8px;
}

.grid-item.special-left-bottom {
    margin-top: 8px;
}

/* Адаптивность для специального макета */
@media (max-width: 768px) {
    .grid-gallery.special-layout {
        grid-template-columns: 1fr;
        grid-template-rows: 200px 200px 300px;
        grid-template-areas:
            "left-top"
            "left-bottom"
            "right";
        height: 720px;
    }

    /* На мобильных убираем дополнительные отступы */
    .grid-item.special-left-top,
    .grid-item.special-left-bottom {
        margin: 0;
    }
}
/* ====================================================== */
/* ============== МОБИЛЬНАЯ АДАПТАЦИЯ ============== */
/* ====================================================== */

/* Скрываем кнопку бургера на ПК */
.burger-btn { display: none; }

@media (max-width: 900px) {
    /* ==== ОБЩИЕ НАСТРОЙКИ ==== */
    html { font-size: 100%; } /* Уменьшаем базу шрифта */
    .container { padding: 0 20px; }
    .section { padding: 60px 0; }

    /* Заголовки */
    .section-header h2 { font-size: 1.8rem; transform: none; }
    .hero-content h1 { font-size: 1.8rem; }
    .hero-content { padding: 25px 20px; }
    .section-header { margin-bottom: 40px; }

    /* ==== БУРГЕР-МЕНЮ (Дизайн) ==== */
    .burger-btn {
        display: flex !important;
        flex-direction: column;
        justify-content: space-between;
        width: 30px;
        height: 20px;
        background: transparent;
        border: none;
        cursor: pointer;
        z-index: 1000;
        padding: 0;
    }
    .burger-btn span {
        width: 100%;
        height: 2px;
        background-color: var(--text-primary);
        transition: 0.3s;
        border-radius: 2px;
    }

    /* Анимация крестика */
    .burger-btn.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 6px); }
    .burger-btn.active span:nth-child(2) { opacity: 0; }
    .burger-btn.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -6px); }

    /* Само выезжающее меню */
    .main-nav {
        position: fixed;
        top: 0;
        right: -100%; /* Спрятано справа */
        width: 100%;
        height: 100vh;
        background-color: rgba(5, 5, 5, 0.98);
        backdrop-filter: blur(15px);
        -webkit-backdrop-filter: blur(15px);
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        transition: right 0.4s cubic-bezier(0.77, 0, 0.175, 1);
        z-index: 999;
        border-left: 1px solid var(--border);
    }
    .main-nav.active { right: 0; }

    .main-nav a {
        font-size: 1.5rem;
        margin: 15px 0;
        display: block;
        margin-left: 0; /* Убираем отступ ПК версии */
    }

    /* ==== СЕТКИ И БЛОКИ ==== */

    /* Блок "Инженер" (с фото) - перестраиваем в колонку */
    /* Используем !important, чтобы перебить inline-стили в HTML */
    .reveal[style*="grid"] {
        display: flex !important;
        flex-direction: column;
        gap: 30px !important;
        text-align: center;
    }

/* ==== КАРТОЧКИ КАК НА ПК (УЗКИЕ + ЗАТЕМНЕНИЯ ПО БОКАМ) ==== */

    /* 1. Возвращаем маску (затемнения по бокам) */
    .projects-slider-wrapper {
        position: relative;
        /* Градиент: прозрачное -> черное -> черное -> прозрачное */
        -webkit-mask: linear-gradient(90deg,
            transparent 0%,
            black 10%,
            black 90%,
            transparent 100%
        );
        mask: linear-gradient(90deg,
            transparent 0%,
            black 10%,
            black 90%,
            transparent 100%
        );
        padding: 0;
        overflow: hidden; /* Скрываем всё, что вылезает за маску */
    }

    /* 2. Лента прокрутки */
    .projects-slider-track {
        display: flex;
        flex-direction: row;
        overflow-x: auto;    /* Скролл пальцем */
        gap: 20px;           /* Отступ между карточками */

        /* Важные отступы, чтобы карточки не обрезались маской сразу */
        padding: 0 40px;

        transform: none !important;
        width: auto !important;
        scroll-snap-type: x mandatory; /* Прилипание */
        scrollbar-width: none;
    }
    .projects-slider-track::-webkit-scrollbar { display: none; }

    .project-slide {
        display: flex;
        gap: 20px;
        min-width: max-content;
        padding: 0;
        opacity: 1 !important;
    }

    /* 3. КАРТОЧКИ (Фиксированный размер, как на ПК) */
    .project-card-link {
        /* Делаем их узкими (280px), а не широкими */
        min-width: 280px;
        max-width: 280px;
        scroll-snap-align: center; /* Карточка встает по центру */
    }

    .project-card {
        width: 100%;
        height: 100%;
        min-height: 380px; /* Фиксируем высоту */
        margin: 0;
        border: 1px solid var(--border);
        background-color: #0A0A0A;
        /* Тень как на ПК */
        box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    }

    /* Картинка как на ПК */
    .project-card-image {
        height: 160px;
    }

    /* Текст и отступы */
    .project-card-content { padding: 20px; }
    .project-card-title { font-size: 1.15rem; margin-bottom: 10px; }
    .project-card-summary { font-size: 0.9rem; line-height: 1.5; }

    /* 4. СТРЕЛКИ (Поверх маски) */
    .slider-controls {
        display: flex !important;
        width: 100%;
        height: 0;
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        justify-content: space-between;
        z-index: 20;
        pointer-events: none;
        /* Стрелки сдвигаем чуть внутрь, чтобы не попали в зону прозрачности */
        padding: 0 10px;
    }

    .slider-arrow {
        pointer-events: auto;
        width: 36px;
        height: 36px;
        border-radius: 50%;
        background: rgba(0, 0, 0, 0.8); /* Более темный фон */
        border: 1px solid var(--border);
        color: white;
        font-size: 1rem;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Сетка услуг */
    .specialization-grid { grid-template-columns: 1fr; }

    /* Сетка принципов */
    .features-grid { grid-template-columns: 1fr; }

    /* Футер */
    .footer-grid { grid-template-columns: 1fr; text-align: center; gap: 40px; }

    /* Контакты */
    .contact-links { grid-template-columns: 1fr; }

    /* ==== МОДАЛЬНОЕ ОКНО ==== */
    #project-modal {
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
        top: 0;
        left: 0;
        transform: none !important;
        border: none;
    }
    .modal-content-wrapper { padding: 80px 20px 40px 20px; }
    .modal-close-btn {
        top: 20px;
        right: 20px;
        background: rgba(255,255,255,0.1);
        width: 40px;
        height: 40px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    /* Сбрасываем сетку галереи в одну колонку */
    .grid-gallery, .grid-gallery.special-layout {
        display: flex;
        flex-direction: column;
        height: auto;
        gap: 15px;
    }
    .grid-item { height: 220px !important; width: 100% !important; margin: 0 !important; }
}