body {
    overflow-x: hidden;
}

:root {
    --page-inner-pad: 66px;
}

/* Ensure footer link text is displayed correctly - prevent text-transform globally */
#footer .box-bottom .box-left a,
#footer .box-bottom .box-center a {
    text-transform: none !important;
}

@media (max-width: 1280px) {
    :root {
        --page-inner-pad: 48px;
    }
    body {
        font-size: 22px;
    }
    .inner {
        padding-left: 48px;
        padding-right: 48px;
    }
    .box-header {
        padding: 140px 0 120px;
    }
    .box-header .box {
        gap: 32px;
    }
}

@media (max-width: 1024px) {
    :root {
        --page-inner-pad: 40px;
    }
    body {
        font-size: 20px;
    }
    .inner {
        padding-left: 40px;
        padding-right: 40px;
    }
    .box-header {
        padding: 110px 0 90px;
    }
    .box-header .box {
        width: 100%;
        justify-content: space-between;
    }
    .box-header .box .logo {
        font-size: 26px;
    }
    .box-header.item-scroll .box-right a[href="https://t.me/ivanofdm"] {
        display: none !important;
    }
    .menu-panel {
        width: min(420px, 100%);
        padding: 56px 36px;
    }
    .menu-link {
        font-size: 32px;
        line-height: 1.2;
    }
    .box-cols-desc {
        flex-direction: column;
        gap: 32px;
    }
    .box-cols-desc .box-left,
    .box-cols-desc .box-right {
        width: 100%;
    }
    .box-cols-desc .box-right {
        justify-content: flex-start;
    }
    .list-credits {
        flex-wrap: wrap;
        gap: 24px;
    }
    .list-credits li {
        width: calc(50% - 12px);
    }
    .list-awards .word {
        margin-left: calc(-1 * var(--page-inner-pad));
        margin-right: calc(-1 * var(--page-inner-pad));
        padding-left: var(--page-inner-pad);
        padding-right: var(--page-inner-pad);
    }
}

@media (max-width: 768px) {
    :root {
        --page-inner-pad: 28px;
    }
    body {
        font-size: 18px;
    }
    .inner {
        padding-left: 28px;
        padding-right: 28px;
    }
    /* Align header elements horizontally on mobile */
    .box-header {
        padding: 80px 0 40px;
        display: flex !important;
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: center !important;
    }
    #content {
        margin-top: 0 !important;
    }
    .box-header .box {
        flex: 1;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 16px;
    }
    .box-header .box:first-child {
        justify-content: flex-start !important;
    }
    .box-header .box:last-child {
        justify-content: flex-end !important;
    }
    .item-scroll {
        opacity: 1 !important;
        top: 0 !important;
        transform: translateY(0) !important;
    }
    .box-header.item-scroll {
        font-weight: 600;
    }
    .box-header.item-scroll .box-left,
    .box-header.item-scroll .box-right {
        font-weight: inherit;
    }
    .menu-panel {
        padding: 48px 28px;
    }
    .menu-close {
        top: 32px;
        right: 32px;
    }
    .menu-link {
        font-size: 28px;
        min-height: 44px;
    }
    button,
    .menu-toggle {
        min-height: 44px;
    }
    .box-words {
        padding-top: 240px;
        align-items: center;
        text-align: center;
    }
    /* Reduce padding-top for box-words on specific pages (agency, studio, independent) to bring it closer to menu */
    /* Apply only to pages where box-trophy is empty (not index.htm which has trophy image) */
    /* Apply spacing reduction only to pages with empty box-trophy */
    #block-header:has(.box-trophy:empty) .box-words {
        padding-top: 0 !important;
        margin-top: 0 !important;
    }
    #block-header:has(.box-trophy:empty) {
        padding-top: 0 !important;
        margin-top: 0 !important;
        padding-bottom: 40px;
    }
    /* Remove any spacing between header and content on specific pages */
    #content:has(#block-header .box-trophy:empty) {
        margin-top: 0 !important;
        padding-top: 0 !important;
    }
    #content:has(#block-header .box-trophy:empty) #block-header {
        margin-top: 0 !important;
        padding-top: 0 !important;
    }
    #content:has(#block-header .box-trophy:empty) #block-header .inner {
        padding-top: 0 !important;
        margin-top: 0 !important;
    }
    /* Remove spacing from wrapper or any parent containers on specific pages */
    .wrapper #content:has(#block-header .box-trophy:empty) #block-header {
        margin-top: 0 !important;
        padding-top: 0 !important;
    }
    /* Remove any spacing from inner elements on specific pages */
    #block-header:has(.box-trophy:empty) .inner > *:first-child {
        margin-top: 0 !important;
        padding-top: 0 !important;
    }
    /* Remove spacing from box-words and word rotate elements on specific pages */
    #block-header:has(.box-trophy:empty) .box-words {
        margin-top: 0 !important;
    }
    #block-header:has(.box-trophy:empty) .box-words .word.rotate:first-of-type {
        margin-top: 0 !important;
        padding-top: 0 !important;
    }
    #block-header:has(.box-trophy:empty) .box-words .box-trophy:empty {
        margin-top: 0 !important;
        padding-top: 0 !important;
        margin-bottom: 0 !important;
        padding-bottom: 0 !important;
        height: 0 !important;
        min-height: 0 !important;
    }
    .box-words .box-trophy {
        width: 100%;
        height: clamp(180px, 55vw, 280px);
        position: relative;
    }
    .box-words .trophy {
        position: absolute;
        width: clamp(180px, 55vw, 280px);
        max-width: 320px;
        top: calc(-1 * clamp(180px, 55vw, 280px));
        left: 50%;
        right: auto;
        transform: translateX(-50%);
    }
    .box-words .word {
        font-size: 18vw;
    }
    .box-words .word.medium {
        font-size: 22vw;
    }
    .box-words .word.small {
        font-size: 30vw;
    }
    .box-cols-desc {
        margin-bottom: 32px;
    }
    .block.block-circle {
        margin-top: -120px !important;
        padding-top: 0 !important;
    }
    .box-cols-desc .follow {
        flex-wrap: wrap;
        gap: 16px;
        font-size: 19px;
    }
    .list-awards li {
        margin-bottom: 24px;
        opacity: 1 !important;
        mix-blend-mode: normal !important;
    }
    .list-awards .word {
        font-size: 9vw;
        line-height: 1.1;
        mix-blend-mode: normal !important;
    }
    .list-awards .title {
        display: inline-block;
        background-image: linear-gradient(120deg, var(--color-primary), var(--color-secondary), var(--color-primary)) !important;
        background-size: 200% auto !important;
        background-clip: text !important;
        -webkit-background-clip: text !important;
        -webkit-text-fill-color: transparent !important;
        color: transparent !important;
        animation: mobileGradientSweep 2.5s linear infinite !important;
        -webkit-animation: mobileGradientSweep 2.5s linear infinite !important;
        mix-blend-mode: normal !important;
    }
    @keyframes mobileGradientSweep {
        0% {
            background-position: 0% 50%;
        }
        50% {
            background-position: 100% 50%;
        }
        100% {
            background-position: 0% 50%;
        }
    }
    @-webkit-keyframes mobileGradientSweep {
        0% {
            background-position: 0% 50%;
        }
        50% {
            background-position: 100% 50%;
        }
        100% {
            background-position: 0% 50%;
        }
    }
    .list-awards .img {
        width: 100%;
        max-width: 100%;
        height: auto !important;
        max-height: none;
        right: auto;
        object-fit: contain;
    }
    .list-credits li {
        width: 100%;
    }
    .tags {
        flex-wrap: wrap;
        gap: 12px;
    }
    .tags .item {
        height: 48px;
        padding: 0 22px;
        font-size: 16px;
    }
    .box-video .bt-play {
        width: 60px;
        height: 60px;
    }
    img,
    video {
        max-width: 100%;
        height: auto;
    }
    #contact-modal h2 {
        font-size: 38px;
    }
    #contact-modal a {
        font-size: 18px;
        min-height: 42px;
    }
    /* Reduce margin-bottom for list-awards on index page to bring footer up */
    #services .list-awards {
        margin-bottom: 40px !important;
    }
    /* Make footer text stack vertically on mobile */
    #footer .box-bottom {
        flex-direction: column !important;
        gap: 12px;
        text-align: center !important;
        align-items: center !important;
        justify-content: center !important;
    }
    #footer .box-bottom .box-left,
    #footer .box-bottom .box-center,
    #footer .box-bottom .box-right {
        width: 100%;
        text-align: center !important;
        display: flex;
        justify-content: center;
        align-items: center;
    }
    /* Reorder footer elements for mobile: Контакты, Все права защищены, © 2025 Dev by Ivanov */
    #footer .box-bottom .box-center {
        flex: 1 1 auto !important;
        order: 1;
    }
    #footer .box-bottom .box-right {
        order: 2;
    }
    #footer .box-bottom .box-left {
        order: 3;
    }
    /* Show box-left in mobile version (override has-desktop class) */
    #footer .box-bottom .box-left.has-desktop {
        display: flex !important;
    }
    #footer .box-bottom .box-left a,
    #footer .box-bottom .box-center a,
    #footer .box-bottom .box-right {
        text-align: center !important;
        display: inline-block;
    }
    /* Ensure footer link text is displayed correctly - prevent text-transform */
    #footer .box-bottom .box-left a,
    #footer .box-bottom .box-center a {
        text-transform: none !important;
    }
    #footer .box-bottom .box-left a,
    #footer .box-bottom .box-center a,
    #footer .box-bottom .box-right {
        font-weight: 600 !important;
        opacity: 1 !important;
    }
    #footer .box-bottom,
    #footer .box-bottom *,
    body.mobile-section #footer .box-bottom,
    body.word-hero-up #footer .box-bottom {
        font-size: 17px !important;
        line-height: 1.4 !important;
    }
}

@media (max-width: 414px) {
    :root {
        --page-inner-pad: 20px;
    }
    body {
        font-size: 17px;
    }
    .inner {
        padding-left: 20px;
        padding-right: 20px;
    }
    /* Align header elements horizontally on mobile (iPhone Pro Max and similar) */
    .box-header {
        padding: 64px 0 30px !important;
        display: flex !important;
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: center !important;
        gap: 20px;
    }
    .box-header.item-scroll {
        gap: 18px !important;
    }
    #content {
        margin-top: 0 !important;
    }
    .box-header .box {
        flex: 1 !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 12px;
    }
    .box-header .box:first-child {
        justify-content: flex-start !important;
    }
    .box-header .box:last-child {
        justify-content: flex-end !important;
    }
    .box-header .menu-toggle {
        align-self: auto !important;
        font-size: 18px;
        padding: 8px 12px;
    }
    .menu-panel {
        padding: 44px 24px;
    }
    .menu-link {
        font-size: 22px;
        line-height: 1.3;
    }
    .box-words .word {
        font-size: 24vw;
    }
    .box-words .word.medium {
        font-size: 28vw;
    }
    .box-words .word.small {
        font-size: 40vw;
    }
    .box-cols-desc .follow {
        font-size: 18px;
    }
    .tags .item {
        width: 100%;
        justify-content: center;
        padding: 0 16px;
        font-size: 15px;
    }
    .bt-oval {
        padding: 30px;
        font-size: 22px;
    }
    .box-words {
        margin-bottom: 20px;
    }
    .box-cols-desc {
        margin-bottom: 24px;
    }
    #footer .box-bottom {
        flex-direction: column !important;
        gap: 12px;
        text-align: center !important;
        align-items: center !important;
        justify-content: center !important;
    }
    #footer .box-bottom .box-left,
    #footer .box-bottom .box-center,
    #footer .box-bottom .box-right {
        width: 100%;
        text-align: center !important;
        display: flex;
        justify-content: center;
        align-items: center;
    }
    /* Reorder footer elements for mobile: Контакты, Все права защищены, © 2025 Dev by Ivanov */
    #footer .box-bottom .box-center {
        flex: 1 1 auto !important;
        order: 1;
    }
    #footer .box-bottom .box-right {
        order: 2;
    }
    #footer .box-bottom .box-left {
        order: 3;
    }
    /* Show box-left in mobile version (override has-desktop class) */
    #footer .box-bottom .box-left.has-desktop {
        display: flex !important;
    }
    #footer .box-bottom .box-left a,
    #footer .box-bottom .box-center a,
    #footer .box-bottom .box-right {
        text-align: center !important;
        display: inline-block;
    }
    /* Ensure footer link text is displayed correctly - prevent text-transform */
    #footer .box-bottom .box-left a,
    #footer .box-bottom .box-center a {
        text-transform: none !important;
    }
}

@media (max-width: 375px) {
    :root {
        --page-inner-pad: 18px;
    }
    body {
        font-size: 16px;
    }
    .inner {
        padding-left: 18px;
        padding-right: 18px;
    }
    .menu-panel {
        padding: 40px 20px;
    }
    .menu-link {
        font-size: 20px;
        line-height: 1.2;
    }
    .box-header .menu-toggle {
        font-size: 16px;
        padding: 6px 10px;
    }
    .box-header {
        padding: 64px 0 30px;
    }
    #content {
        margin-top: 0 !important;
    }
    .box-words .word {
        font-size: 26vw;
    }
    .box-words .word.medium {
        font-size: 32vw;
    }
    .box-words .word.small {
        font-size: 44vw;
    }
    .tags .item {
        padding: 0 14px;
        font-size: 14px;
    }
    .bt-oval {
        padding: 25px;
        font-size: 20px;
    }
    .box-words {
        margin-bottom: 18px;
    }
    .box-cols-desc {
        margin-bottom: 20px;
    }
    #contact-modal h2 {
        font-size: 32px;
    }
    #contact-modal a {
        font-size: 17px;
        padding: 12px;
    }
}

@media (max-width: 320px) {
    :root {
        --page-inner-pad: 16px;
    }
    body {
        font-size: 15px;
    }
    .inner {
        padding-left: 16px;
        padding-right: 16px;
    }
    .menu-panel {
        padding: 36px 18px;
    }
    .menu-link {
        font-size: 18px;
        line-height: 1.1;
    }
    .box-header .menu-toggle {
        font-size: 15px;
        padding: 5px 8px;
    }
    .box-header {
        padding: 64px 0 30px;
    }
    #content {
        margin-top: 0 !important;
    }
    .box-words .word {
        font-size: 28vw;
    }
    .box-words .word.medium {
        font-size: 34vw;
    }
    .box-words .word.small {
        font-size: 48vw;
    }
    .tags .item {
        font-size: 14px;
        height: 40px;
        padding: 0 12px;
    }
    .bt-oval {
        padding: 20px;
        font-size: 18px;
    }
    .box-words {
        margin-bottom: 16px;
    }
    .box-cols-desc {
        margin-bottom: 18px;
    }
    #contact-modal h2 {
        font-size: 28px;
    }
    #contact-modal a {
        font-size: 16px;
        padding: 10px;
    }
}

