/* --breakpoint-mobile */
@media (min-width: 381px) {
    .section__heading {
        flex-direction: row;
    }

    .footer__main {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* --breakpoint-tablet: tablet layout */
@media (min-width: 768px) {
    :root {
        --content-gutter: 2.5rem;
    }

    .header {
        display: flex;
        flex-wrap: nowrap;
        justify-content: space-between;
        gap: var(--space-4);
        padding-inline: var(--content-gutter);
    }

    .header__brand {
        order: 0;
        justify-self: auto;
    }

    .header__menu {
        display: contents;
    }

    .header__menu-toggle {
        display: none;
    }

    .header__menu > .header__nav {
        position: static;
        display: flex;
        width: auto;
        height: auto;
        min-height: 0;
        order: 2;
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        gap: var(--space-4);
        min-width: 0;
        overflow: visible;
        padding: 0;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
        transform: none;
        visibility: visible;
        pointer-events: auto;
        transition: none;
    }

    .header__search {
        order: 1;
        width: min(16.25rem, 27vw);
        min-width: 12rem;
        margin-inline: auto;
    }

    .header > .button--primary,
    .header > .header__profile {
        order: 3;
        grid-area: auto;
        justify-self: auto;
    }

    .header__menu-toggle[aria-expanded="true"] + .header__nav .header__link--host {
        display: initial;
    }

    .header__menu > .header__nav .header__link,
    .header__menu > .header__nav .header__map {
        font-size: var(--font-size-xs);
    }

    .header__link--host,
    .header__map {
        display: initial;
    }

    /* The avatar already links to the profile on tablet and desktop. */
    .header__link--profile {
        display: none;
    }

    .header__nav {
        gap: var(--space-4);
    }

    .hero {
        grid-template-columns: 1fr 1fr;
        min-height: 28rem;
    }

    .hero__image-wrap {
        height: 19rem;
        aspect-ratio: auto;
    }

    .events {
        gap: var(--space-10);
    }

    .section__heading {
        align-items: center;
    }

    .events__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .event-card__visual {
        height: 16.25rem;
        aspect-ratio: auto;
    }

    .event-card__details {
        min-height: 9.375rem;
    }

    .disciplines {
        gap: var(--space-8);
    }

    .disciplines__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .discipline-card {
        min-height: 12rem;
    }

    .how-it-works {
        min-height: 31.25rem;
        gap: var(--space-14);
    }

    .steps__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .step-card {
        min-height: 15.625rem;
        padding: var(--space-8) var(--space-6);
    }

    .footer__main {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: var(--space-8);
        padding: var(--space-14) var(--content-gutter);
    }

    .footer__brand-column {
        grid-column: auto;
    }

    .footer__bottom {
        align-items: center;
        flex-direction: row;
        justify-content: space-between;
    }

    .footer__bottom nav {
        justify-content: flex-end;
    }
}

/* Keep event cards compact on tablet widths without changing desktop layouts. */
@media (min-width: 768px) and (max-width: 1023px) {
    .events__grid {
        grid-auto-rows: 1fr;
    }

    .event-card__visual {
        height: 12rem;
    }

    .event-card__details {
        min-height: 7.5rem;
    }
}

/* --breakpoint-desktop */
@media (min-width: 1024px) {
    :root {
        --content-gutter: 5.90rem;
    }

    .header {
        gap: var(--space-6);
        padding-inline: 3rem;
    }

    .header__nav {
        gap: var(--space-6);
    }

    .hero {
        min-height: 34.75rem;
    }

    .hero__image-wrap {
        height: 22.5rem;
    }

    .events__grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .event-card__visual {
        height: auto;
        aspect-ratio: 1.62;
    }

    .event-card__details {
        min-height: 0;
        gap: var(--space-2);
        padding: var(--space-3);
    }

    .event-card__title {
        font-size: var(--font-size-xs);
    }

    .disciplines__grid,
    .steps__grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .discipline-card {
        min-height: 14.5rem;
    }

    .footer__main {
        grid-template-columns: 1.4fr repeat(4, 1fr) 10rem;
    }
}

@media (max-width: 1023px) {
    .profile-groups-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 767px) {
    .section__heading {
        align-items: center;
        flex-direction: row;
        gap: var(--space-2);
    }

    .section__heading .section__title {
        flex: 1 1 auto;
        min-width: 0;
        align-self: flex-start;
        text-align: left;
    }

    .section__heading > .button--secondary-outline {
        min-height: 2rem;
        flex: 0 0 auto;
        padding-inline: calc(var(--space-2) + 2px);
        font-size: var(--font-size-xs);
    }

    .user-profile-main {
        gap: var(--space-8);
    }

    .profile-summary {
        gap: var(--space-4);
        padding: var(--space-5);
    }

    .profile-summary__top {
        align-items: flex-start;
        gap: var(--space-4);
    }

    .profile-summary__avatar {
        width: 4rem;
        height: 4rem;
        flex-basis: 4rem;
    }

    .profile-summary__name {
        font-size: var(--font-size-m);
    }

    .profile-summary__role {
        line-height: 1.35;
    }

    .profile-stats {
        gap: var(--space-2);
    }

    .profile-stat__label {
        font-size: var(--font-size-xxs);
    }

    .profile-stat__value {
        font-size: var(--font-size-l);
    }

    .profile-groups-grid,
    .profile-settings-grid {
        grid-template-columns: 1fr;
    }

    .profile-group {
        min-height: 5rem;
    }

    .profile-setting-card {
        padding: var(--space-5);
    }
}
