/* ICX mobile refinements. Preserve the desktop design and existing content model. */
.icx-mobile-panel,
.icx-search-overlay {
    /* The fixed primary navigation uses z-index 10000. */
    z-index: 20000;
    background: var(--icx-navy-dark);
    overscroll-behavior-y: contain;
    scrollbar-gutter: stable;
    padding-bottom: max(24px, env(safe-area-inset-bottom));
}

html:has(body.icx-menu-open),
html:has(body.icx-search-open) {
    overflow: hidden;
}

.icx-gallery-single-v5__hero h1 {
    color: var(--icx-white);
}

:where(main [id]) {
    scroll-margin-top: 88px;
}

@media (max-width: 780px) {
    /* Readable fields also prevent automatic input zoom on iPhones. */
    main :is(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), select, textarea),
    .icx-search-form input {
        min-width: 0;
        max-width: 100%;
        font-size: 1rem;
        min-height: 48px;
    }

    main textarea {
        min-height: 144px;
    }

    main :is(.icx-button, .icx-membership-button, .icx-contact-button) {
        min-height: 48px;
        max-width: 100%;
        white-space: normal;
        text-align: center;
    }
}

@media (max-width: 640px) {
    html,
    body {
        min-width: 0;
    }

    .icx-home-hero,
    .icx-home-hero__inner {
        min-height: 0;
    }

    .icx-home-hero__inner {
        padding-block: 40px 56px;
    }

    .icx-home .icx-testimonials.alignfull,
    .icx-partners-page .wp-block-icx-partners-grid.alignfull {
        width: 100%;
        max-width: 100% !important;
        margin-inline: 0 !important;
    }

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

    .icx-home-quick__grid > a {
        min-width: 0;
        min-height: 106px;
        padding: 16px 14px;
    }

    .icx-home-quick__grid > a:nth-child(odd) {
        border-right: 1px solid var(--icx-line);
    }

    .icx-home-quick__grid > a:nth-last-child(-n+2) {
        border-bottom: 0;
    }

    /* Utility content is already hidden here; remove its empty strip. */
    .icx-utility {
        display: none;
    }

    .icx-masthead__inner {
        min-height: 68px;
    }

    .icx-masthead__actions .icx-button--primary {
        display: inline-flex;
        min-height: 44px;
        max-width: 160px;
        white-space: normal;
        text-align: center;
    }

    .icx-nav-shell__inner {
        min-height: 52px;
    }

    .icx-icon-button,
    .icx-social-links--mobile .icx-social-link,
    .icx-mobile-panel__tools .icx-tool-button {
        min-width: 44px;
        min-height: 44px;
    }

    .icx-mobile-panel__header {
        position: sticky;
        top: -18px;
        z-index: 20;
        padding-block: 10px;
        background: var(--icx-navy-dark);
    }

    .icx-mobile-links {
        margin-top: 16px;
    }

    .icx-mobile-links > li > a {
        padding-block: 15px;
        font-size: 1.375rem;
    }

    .icx-mobile-links > .menu-item-has-children > .icx-submenu-toggle {
        width: 44px;
        height: 44px;
        top: 3px;
    }

    .icx-gallery-archive-approved__filters a,
    .icx-survey-nav a {
        display: inline-flex;
        align-items: center;
        min-height: 44px;
    }

    .icx-mobile-links .sub-menu a {
        min-height: 44px;
        padding-block: 12px;
        font-size: 1rem;
    }

    /* Keep the editorial typography, with enough room for long titles. */
    main h1,
    .icx-about-hero h1,
    .icx-gallery-single-v5 h1,
    .icx-programmes-hub__intro h1,
    .icx-events-page .icx-events-page__title,
    .icx-resources-page .icx-resources-page__title,
    .icx-home-hero h1,
    .icx-event-single__title,
    .icx-award-single__title,
    .icx-membership-hero h1,
    .icx-contact-hero h1 {
        font-size: clamp(2.125rem, 9.5vw, 3rem);
        line-height: 1.08;
        overflow-wrap: break-word;
    }

    .icx-award-single__hero,
    .icx-event-single__hero {
        padding-block: 30px 36px;
    }

    .icx-event-single__hero-grid.has-image .icx-event-single__intro {
        grid-row: 1;
        padding: 28px 20px;
    }

    .icx-event-single__hero-grid.has-image .icx-event-single__image {
        grid-row: 2;
        aspect-ratio: 16 / 9;
    }

    /* Generated artwork is decorative; do not make phone users scroll past it. */
    .icx-event-single__hero-grid.has-image:has(.icx-event-single__image--placeholder) .icx-event-single__image--placeholder {
        display: none;
    }

    .icx-event-single__facts,
    .icx-award-single__facts {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .icx-event-fact,
    .icx-award-fact {
        min-width: 0;
        min-height: 0;
        padding: 18px 14px;
    }

    .icx-event-fact strong,
    .icx-award-fact strong {
        overflow-wrap: break-word;
        font-size: .875rem;
        line-height: 1.5;
    }

    .icx-event-single__content {
        padding-block: 36px 48px;
    }

    .icx-event-single__content-grid {
        gap: 32px;
    }

    .icx-event-single__summary {
        margin-top: 16px;
    }

    .icx-event-award-bridge__ticket-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .icx-event-award-bridge__ticket-grid article {
        padding: 18px 14px;
    }

    .icx-event-award-bridge__ticket-grid strong {
        font-size: clamp(1.1rem, 5vw, 1.5rem);
        line-height: 1.2;
    }

    .icx-event-award-bridge__ticket-grid article:nth-child(odd) {
        border-right: 1px solid rgba(255, 255, 255, .11);
    }

    .icx-event-award-bridge__ticket-grid article:nth-last-child(-n+2) {
        border-bottom: 0;
    }

    /* Compact navigation at the bottom, with full-width brand and contact. */
    .icx-membership-wizard__progress ol {
        min-width: 0;
    }

    .icx-membership-wizard__progress li {
        position: relative;
        display: flex;
        justify-content: center;
    }

    .icx-membership-wizard__progress li :is(strong, small) {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
    }

    .icx-membership-wizard__step-label {
        display: block;
        grid-column: 1 / -1;
        text-align: center;
        font-size: .875rem;
    }

    .icx-footer {
        padding-block: 40px 24px;
    }

    .icx-footer__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 28px 20px;
    }

    .icx-footer__brand-column,
    .icx-footer__grid > :last-child {
        grid-column: 1 / -1;
    }

    .icx-footer__links {
        gap: 0;
    }

    .icx-footer__links a,
    .icx-footer__legal a {
        display: inline-flex;
        align-items: center;
        min-height: 44px;
        font-size: .875rem;
    }

    .icx-footer__legal {
        gap: 4px 20px;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}
