/* Поддержка плавной прокрутки */
html {
    scroll-behavior: smooth;
}

/* Fallback для браузеров без поддержки smooth scroll */
@media not all and (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
    .work-element {
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
    }
    
    .menu-element__link.active {
        color: var(--color-accent) !important;
        font-weight: bold;
    }
}

@media screen and (max-width: 1350px) {
    .logo {
        font-size: 32px;
    }
    .about-me__image {
        width: 300px;
        padding-left: 50px;
    }
    .work-wrapper {
        width: 700px;
    }
    .work-element {
        width: 450px;
    }
    .work-element.left {
        margin-right: 595px;
    }
    .work-element:before {
        width: 49px;
    }
    .work-element.right {
        margin-left: 595px;
    }
    .work-element.right:before {
        left: -52px;
    }
    .work-element.left:before {
        margin-right: 24px;
    }
     .cta-button {
        font-size: 21px;
    }
}

@media screen and (max-width: 1200px) {
    .logo {
        font-size: 28px;
        width: 200px;
    }
    .menu-element {
        font-size: 24px;
        margin-right: 15px;
    }
    .switcher {
        width: 200px;
    }
    .about-me {
        padding: 40px 20px;
    }
    .about-me__image {
        width: 250px;
    }
    .about-me__title {
        font-size: 32px;
    }
    .about-me__descriprion {
        font-size: 18px;
    }
    .work-wrapper {
        width: 600px;
    }
    .work-element {
        width: 400px;
    }
    .work-element.left {
        margin-right: 545px;
    }
    .work-element.right {
        margin-left: 545px;
    }
    .interest-wrapper {
        width: 45%;
    }
    .contact-me__form {
        max-width: 1104px;
    }
      .cta-button {
        font-size: 21px;
    }
}

@media screen and (max-width: 992px) {
    .header {
        height: 100vh;
        -webkit-clip-path: polygon(100% 0, 100% 95%, 56% 100%, 0 95%, 0 0);
        clip-path: polygon(100% 0, 100% 95%, 56% 100%, 0 95%, 0 0);
    }
    .header-top {
        -webkit-box-pack: justify;
        -ms-flex-pack: justify;
        justify-content: space-between;
        padding: 0 20px;
    }
    .navigation {
        display: none;
    }
    .menu-hamburger {
        display: -webkit-box;
        display: -ms-flexbox;
        display: flex;
        -webkit-box-orient: vertical;
        -webkit-box-direction: normal;
        -ms-flex-direction: column;
        flex-direction: column;
        -webkit-box-pack: justify;
        -ms-flex-pack: justify;
        justify-content: space-between;
        width: 30px;
        height: 20px;
        position: fixed;
        top: 25px;
        right: 20px;
        z-index: 100;
        cursor: pointer;
        background: transparent;
        border: none;
        padding: 0;
    }
    .menu-hamburger .line {
        display: block;
        height: 3px;
        width: 100%;
        background: white;
        border-radius: 3px;
        -webkit-transition: all 0.3s ease;
        -o-transition: all 0.3s ease;
        transition: all 0.3s ease;
    }
    .menu-hamburger .line1 {
        -webkit-transform-origin: 0% 0%;
        transform-origin: 0% 0%;
    }
    .menu-hamburger .line2 {
        opacity: 1;
        -webkit-transition: opacity 0.2s ease;
        -o-transition: opacity 0.2s ease;
        transition: opacity 0.2s ease;
    }
    .menu-hamburger .line3 {
        -webkit-transform-origin: 0% 100%;
        transform-origin: 0% 100%;
    }
    #hamburger:checked~.menu-hamburger .line1 {
        -webkit-transform: rotate(45deg) translate(1px, -1px);
        transform: rotate(45deg) translate(1px, -1px);
    }
    #hamburger:checked~.menu-hamburger .line2 {
        opacity: 0;
    }
    #hamburger:checked~.menu-hamburger .line3 {
        -webkit-transform: rotate(-45deg) translate(1px, 1px);
        transform: rotate(-45deg) translate(1px, 1px);
    }
    #hamburger:checked~.header-top .navigation {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background: rgba(0, 0, 0, 0.95);
        z-index: 99;
        padding-top: 100px;
        -webkit-animation: fadeIn 0.3s ease;
        animation: fadeIn 0.3s ease;
    }
    @-webkit-keyframes fadeIn {
        from {
            opacity: 0;
        }
        to {
            opacity: 1;
        }
    }
    @keyframes fadeIn {
        from {
            opacity: 0;
        }
        to {
            opacity: 1;
        }
    }
    #hamburger:checked~.header-top .menu {
        -webkit-box-orient: vertical;
        -webkit-box-direction: normal;
        -ms-flex-direction: column;
        flex-direction: column;
        -webkit-box-align: center;
        -ms-flex-align: center;
        align-items: center;
    }
    #hamburger:checked~.header-top .menu-element {
        margin: 20px 0;
        font-size: 24px;
        opacity: 0;
        -webkit-animation: slideIn 0.3s ease forwards;
        animation: slideIn 0.3s ease forwards;
    }
    @-webkit-keyframes slideIn {
        from {
            opacity: 0;
            -webkit-transform: translateY(20px);
            transform: translateY(20px);
        }
        to {
            opacity: 1;
            -webkit-transform: translateY(0);
            transform: translateY(0);
        }
    }
    @keyframes slideIn {
        from {
            opacity: 0;
            -webkit-transform: translateY(20px);
            transform: translateY(20px);
        }
        to {
            opacity: 1;
            -webkit-transform: translateY(0);
            transform: translateY(0);
        }
    }
    /* Задержка анимации для каждого пункта меню */
    #hamburger:checked~.header-top .menu-element:nth-child(1) {
        -webkit-animation-delay: 0.1s;
        animation-delay: 0.1s;
    }
    #hamburger:checked~.header-top .menu-element:nth-child(2) {
        -webkit-animation-delay: 0.2s;
        animation-delay: 0.2s;
    }
    #hamburger:checked~.header-top .menu-element:nth-child(3) {
        -webkit-animation-delay: 0.3s;
        animation-delay: 0.3s;
    }
    #hamburger:checked~.header-top .menu-element:nth-child(4) {
        -webkit-animation-delay: 0.4s;
        animation-delay: 0.4s;
    }
    .name {
        font-size: 40px;
    }
    .description {
        font-size: 20px;
        white-space: normal;
        -webkit-animation: none;
        animation: none;
        width: 90%;
    }
    .about-me {
        -webkit-box-orient: vertical;
        -webkit-box-direction: normal;
        -ms-flex-direction: column;
        flex-direction: column;
    }
    .about-me .left {
        padding-right: 0;
        text-align: center;
    }
    .about-me__image {
        margin: 0 auto;
        padding-left: 0;
    }
    .work-wrapper {
        width: 100%;
    }
    .work-wrapper:before {
        display: none;
    }
    .work-element {
        width: 90%;
        margin: 0 auto 40px !important;
    }
    .work-element:before {
        display: none;
    }
    .interest-wrapper {
        width: 45%;
    }
    .contact-me__form {
        padding: 0px 0px 0px 13px
    }
    .input-wrapper {
        width: 96%;
        float: none !important;
        margin-bottom: 15px;
    }
    .textarea-wrapper {
         width: 96%;
    }
       .cta-button {
        font-size: 21px;
    }
}

@media screen and (max-width: 768px) {
    .header {
        -webkit-clip-path: polygon(100% 0, 100% 97%, 56% 100%, 0 97%, 0 0);
        clip-path: polygon(100% 0, 100% 97%, 56% 100%, 0 97%, 0 0);
    }
    .name {
        font-size: 32px;
    }
    .description {
        font-size: 18px;
    }
    .about-me__image {
        width: 245px;
    }
    .second-title {
        font-size: 28px;
        margin-bottom: 50px;
    }
    .second-title::after {
        --underline-width: 250px;
    }
    .interest-wrapper {
        width: 100%;
        margin-bottom: 20px;
    }
    .interest-image {
        width: 200px;
    }
    .about-me__descriprion {
        display: none;
    }
    .text-mobile {
        display: block;
        margin-bottom: 19px;
        font-size: 18px;
    }
    .about-me__extra-element {
        display: none;
    }
    .about-me__extra-mobil {
        display: -webkit-box;
        display: -ms-flexbox;
        display: flex;
        -webkit-box-orient: vertical;
        -webkit-box-direction: normal;
        -ms-flex-direction: column;
        flex-direction: column;
        word-wrap: break-word;
        overflow-wrap: break-word;
        white-space: normal;
        max-width: 100%;
        padding-top: 4px;
    }
    .about-me__extra-mobil span {
        word-wrap: break-word;
        overflow-wrap: break-word;
        white-space: normal;
        -webkit-box-pack: center;
        -ms-flex-pack: center;
        justify-content: center;
        text-align: center;
        -webkit-box-align: center;
        -ms-flex-align: center;
        align-items: center;
    }
    .about-me .right {
        padding-left: 10px;
        padding-right: 10px;
        text-align: center;
    }
    .work-element.left,
    .work-element.right {
        display: none;
    }
    .work-element.left-mobil,
    .work-element.right-mobil {
        display: block;
        width: 252px;
        border: 0px solid var(--color-green);
    }
    .work-wrapper {
        width: 365px;
        padding-left: 10px;
    }
    .contact-me__form {
        padding: 0px 20px;
        width: 335px;
    }
    .socials {
        padding-right: 51px;
    }
    .cta-button {
        font-size: 20px;
    }
    .recaptcha-container {
        transform: scale(0.9);
    }
}

@media screen and (max-width: 375px) {
    .header {
        height: 90vh;
        -webkit-clip-path: polygon(100% 0, 100% 97%, 56% 100%, 0 97%, 0 0);
        clip-path: polygon(100% 0, 100% 97%, 56% 100%, 0 97%, 0 0);
    }
    .header-top {
        height: 60px;
    }
    .logo {
        font-size: 24px;
        width: 150px;
    }
    .menu-hamburger {
        top: 20px;
        right: 15px;
    }
    #hamburger:checked~.header-top .menu-element {
        font-size: 20px;
        margin: 15px 0;
    }
    .name {
        font-size: 28px;
    }
    .description {
        font-size: 16px;
    }
    .about-me__title {
        font-size: 28px;
    }
    .about-me__descriprion {
        font-size: 16px;
    }
    .about-me__extra {
        font-size: 16px;
    }
    .second-title {
        font-size: 24px;
        margin-bottom: 40px;
    }
    .second-title::after {
        --underline-width: 200px;
    }
    .work-element__title {
        font-size: 20px;
    }
    .work-element__description {
        font-size: 14px;
    }
    .work-element__skills-element {
        font-size: 12px;
        padding: 6px 10px;
    }
    .interest-title {
        font-size: 18px;
    }
    .interest-text {
        font-size: 14px;
    }
    .label {
        font-size: 18px;
    }
    .input,
    .textarea {
        font-size: 14px;
    }
    .submit {
        height: 40px;
        font-size: 16px;
    }
    .footer-about {
        font-size: 12px;
    }
    .cta-button {
        font-size: 15px;
    }
    .form-result {
        padding: 1rem;
    }

    .contact-me__form {
        width: 330px;
    }
    .recaptcha-container {
        transform: scale(0.95);
        overflow: hidden;
    }
}

/* Кросс-браузерные исправления без изменения стиля */
@supports not (clip-path: polygon(0 0)) {
    .header:before {
        content: '';
        position: absolute;
        bottom: -10%;
        left: 0;
        width: 100%;
        height: 20%;
        background: inherit;
        -webkit-transform: skewY(-4deg);
        transform: skewY(-4deg);
        -webkit-transform-origin: top left;
        transform-origin: top left;
        z-index: 1;
    }
}

/* Улучшенная поддержка мобильного меню */
@media screen and (max-width: 992px) {
    #hamburger:checked~.header-top .navigation {
        display: block !important;
    }
    
    /* Упрощение для старых браузеров */
    #hamburger:checked~.header-top .menu-element {
        -webkit-animation: none !important;
        animation: none !important;
        opacity: 1 !important;
        -webkit-transform: none !important;
        transform: none !important;
    }
}

/* Гарантированное отображение элементов */
.work-element {
    opacity: 0;
    visibility: hidden;
    -webkit-transition: opacity 0.6s ease, visibility 0.6s ease;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

.work-element.visible {
    opacity: 1;
    visibility: visible;
}

/* Восстановленные стили */
.bold, .second-title, .logo, .menu-element a.link.active, 
.about-me__title, .interest-title, .cta-title, 
.work-element__title, .label, .footer-title, .submit {
    font-weight: bold;
}

.work, .contact-me {
    text-align: center;
}

.work-element {
    text-align: left;
}

ul.about-me__extra {
    padding-left: 0;
}

.interest-wrapper {
    text-align: center;
}