/* Large desktop screens */
.hero {
    padding: 52px 140px 0 140px;
}
.hero__description {
    margin: 0 0 83px;
}

/* Laptops */
@media (max-width: 1600px) {
    .hero {
        padding: 20px 40px 0 40px;
    }
    .hero__description {
        margin: 0 0 83px;
    }
}

/* Tablets */
@media (max-width: 1043px) {
    html {
        overflow-x: clip;
    }

    .hero {
        padding: 20px 41px 0 41px;
    }

    .hero__title {
        margin-bottom: 24px;
    }

    .hero__description {
        margin: 0 0 83px;
    }

    .hero__content {
        flex-direction: column !important;
        align-items: center;
        justify-content: center;
        width: 100%;
    }

    .hero__visual {
        display: flex;
        justify-content: center;
        align-items: center;
        margin-top: 56px;
        width: 100%;
    }

    /* Make .hero and .hero__collage the same width and centered on tablet and below */
    .hero__copy,
    .hero__visual {
        width: 100%;
        max-width: 600px; /* same visual width for both blocks */
        margin-left: auto;
        margin-right: auto;
        box-sizing: border-box;
    }

    .hero__visual img{
        width: 100%;
        height: auto;
        max-width: 100%;
        display: block;
    }

    /* Tablet: reduce top spacing */
    .hero__copy {
        margin-top: 56px;
    }
    .header__nav-item::after,
    .header__nav-item a::after {
        display: none !important;
        /* The navigation underline is intentionally hidden at this breakpoint. */
        width: 0 !important;
        height: 0 !important;
        content: none !important;
    }

    .header__nav {
        position: fixed;
        top: 0;
        right: 0;
        width: min(320px, 90vw);
        height: 100vh;
        color: #fff;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        transform: translateX(105%);
        transition: transform 0.32s ease;
        z-index: 1000;
        padding: 0 20px;
        overflow: hidden;
        background-color: rgb(54, 54, 54);
    }

    /* Remove decorative particles from the mobile drawer */
    .header__nav::before,
    .header__nav::after {
        display: none;
    }

    .header__nav--open {
        transform: translateX(0);
    }

    .header__nav-list {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 28px;
        margin: 0;
        padding: 0; /* remove user-agent ul padding */
        width: 100%;
        box-sizing: border-box;
        list-style: none;
        position: relative;
    }

    .header__nav-item {
        display: block;
        position: relative;
        z-index: 1;
    }

    .header__nav-item::before {
        display: none;
    }

    .header__nav-item {
        display: block;
    }

    .header__nav-item {
        text-transform: uppercase;
        font-weight: 700;
        font-size: 20px;
        letter-spacing: 3px;
        color: #fff;
        list-style: none;
        text-align: center;
        cursor: pointer;
        width: 100%;
        display: flex;
        justify-content: center;
    }

    .header__burger {
        display: flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 44px;
        position: relative;
        z-index: 1001;
        width: 44px;
        height: 44px;
        padding: 0;
    }

    .header__burger-icon {
        display: block;
        width: 24px;
        height: 24px;
        object-fit: contain;
        object-position: center;
    }

    .header__registration {
        display: inline-block;
        flex: 0 0 auto;
        font-size: 13px;
        border-bottom-width: 2px;
    }

    .stats__content {
        flex-direction: column;
        gap: 41px;
    }
    .stats__cards {
        flex-direction: row;
        width: 100%;
    }
    .stats__intro {
        display: flex;
        justify-content: center;
        align-items: center;
        width: 100%;
    }
}

/* Mobile devices */
@media (max-width: 640px) {
    .hero {
        padding: 20px 21px 0 21px;
    }

    .hero__title {
        margin-bottom: 32px;
    }
    .hero__description {
        margin: 0 0 56px;
    }
    /* Small tablet / large phone: moderate top spacing */
    .hero__copy {
        margin-top: 56px;
    }
    .header {
        gap: 8px;
    }

    .header__logo-text {
        font-size: 13px;
        letter-spacing: 0.07em;
    }

    .header__registration {
        font-size: 12px;
    }

    .solving {
        padding-left: 20px;
        padding-right: 20px;
        padding-top: 56px;
        padding-bottom: 56px;
    }

    .solving__items {
        grid-template-columns: 1fr;
        width: min(100%, 560px);
    }

    .solving__item:nth-child(n) {
        grid-column: auto;
    }

    .stats__cards {
        flex-direction: column;
    }
    
    .stats__card-description {
        text-align: center;
    }

    .contact {
        padding: 56px 24px;
    }

    .contact__content {
        grid-template-columns: 1fr;
        gap: 64px;
    }

    .site-footer {
        align-items: flex-start;
        flex-direction: column;
        gap: 18px;
        padding: 28px 24px;
    }

    .site-footer__nav {
        justify-content: flex-start;
        gap: 12px 20px;
    }

    .contact__title {
        margin-bottom: 32px;
    }

    .account-page__content {
        width: min(100% - 24px, 520px);
        padding: 12px 0 24px;
    }

    .account-page__shell {
        grid-template-columns: 1fr;
        min-height: 0;
        border-radius: 16px;
    }

    .account-page__visual {
        display: none;
    }

    .account-page__back {
        margin-bottom: 0;
    }

    .account-page__logo {
        margin-bottom: 36px;
    }

    .account-page__visual-title {
        font-size: clamp(38px, 12vw, 56px);
    }

    .account-page__image {
        width: min(100%, 280px);
        margin: 32px auto 0;
    }

    .account-page__panel {
        width: 100%;
        padding: 36px 28px 44px;
    }

    .account-page__back--panel {
        display: inline-flex;
        margin-bottom: 48px;
    }

    .account-page__options {
        align-items: flex-start;
        flex-direction: column;
    }
}

/* Small mobile */
@media (max-width: 420px) {
    .header__logo-text {
        font-size: 11px;
        letter-spacing: 0.045em;
    }

    .header__registration {
        font-size: 11px;
    }

    .header__nav {
        width: 100vw;
        left: 0;
        right: 0;
        padding: 0 16px;
    }
    .hero__description {
        margin: 0 0 56px;
        text-align: left;
        letter-spacing: 2px;
    }
    .hero__title {
        letter-spacing: 2px;
    }
    /* Phones up to 420px: reduce top spacing */
    .hero__copy {
        margin-top: 50px;
        justify-content: center;
        align-items: center;
    }
    .hero__break {
        display: none;
    }

    .solving {
        padding-left: 16px;
        padding-right: 16px;
        padding-top: 40px;
        padding-bottom: 40px;
    }

}

/* Fix tiny white strip caused by the mobile drawer peeking at very small widths */
@media (max-width: 300px) {
    /* Very small screens: smallest top spacing */
    .hero__copy {
        margin-top: 32px;
    }
}