/* Mobile comfort: avoid adding Cassiopeia grid gaps to the page gutters.
   Full-bleed home/archive layouts and all desktop rules remain unchanged. */
@media (max-width: 991.98px) {
    body.wrapper-fluid:not(.cc-home-magazine):not(.cc-gc-archive-page) .site-grid {
        --cc-mobile-gutter: clamp(1rem, 2.8vw, 1.5rem);
        column-gap: 0;
        grid-template-columns:
            [full-start] var(--cc-mobile-gutter)
            [main-start] repeat(4, minmax(0, 1fr))
            [main-end] var(--cc-mobile-gutter)
            [full-end];
    }

    body.wrapper-fluid:not(.cc-home-magazine):not(.cc-gc-archive-page) .site-grid > .container-component,
    body.wrapper-fluid:not(.cc-home-magazine):not(.cc-gc-archive-page) .site-grid > .container-sidebar-left,
    body.wrapper-fluid:not(.cc-home-magazine):not(.cc-gc-archive-page) .site-grid > .container-sidebar-right {
        width: 100%;
        min-width: 0;
        margin-inline: 0;
        justify-self: stretch;
    }

    /* A plain 1fr track keeps the intrinsic width of long form fields. */
    body.wrapper-fluid .cc-membership-product-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    body.wrapper-fluid .cc-membership-product-grid > *,
    body.wrapper-fluid .cc-membership-product-hero > *,
    body.wrapper-fluid .cc-membership-product-layout,
    body.wrapper-fluid .cc-membership-product-layout form {
        min-width: 0;
        max-width: 100%;
    }

    body.wrapper-fluid .cc-membership-product-layout .hikashop_product_custom_item_info table {
        table-layout: fixed;
    }
}

@media (max-width: 767.98px) {
    body.wrapper-fluid .container-component h1 {
        min-width: 0;
        overflow-wrap: anywhere;
    }

    body.cc-join-page .cc-join-hero h1 {
        font-size: clamp(2rem, 9vw, 2.75rem);
    }

    /* One useful inner margin, instead of several nested desktop paddings. */
    body.wrapper-fluid :is(
        .cc-project-hero__content, .cc-teams-hero__content,
        .cc-groups-hero__content, .cc-join-hero__content,
        .cc-events-hero__content, .cc-event-hero__content
    ) {
        width: calc(100% - 1rem);
        padding-inline: 1rem;
    }

    body.wrapper-fluid :is(
        .cc-project-copy, .cc-membership-card, .cc-event-card__body,
        .cc-event-copy, .cc-event-practical,
        .cc-training-hero__content, .cc-training-detail-hero__content,
        .cc-training-copy, .cc-training-practical, .cc-training-pricing,
        .cc-partitions-hero__content, .cc-pd-hero__content, .cc-pd-latest,
        .cc-shop-hero, .cc-membership-product-hero,
        .cc-membership-product-guide, .cc-membership-product-card,
        .cc-login-intro, .cc-login-panel,
        .cc-bo-hero, .cc-bo-guide, .cc-bo-card,
        .cc-volunteer-form-hero, .cc-volunteer-form-card,
        .cc-sete-landing__hero, .cc-gc-landing__hero,
        .cc-legal-hero, .cc-legal-section,
        .cc-thanks-hero, .cc-grand-resource-hero, .cc-ag-resource-hero,
        .cc-space-header, .cc-space-hero, .cc-account-intro,
        .cc-orders-hero, .cc-order-history-hero, .cc-order-detail-hero
    ) {
        padding-inline: 1rem;
    }

    body.wrapper-fluid .cc-membership-product-hero {
        grid-template-columns: minmax(0, 1fr);
    }

    body.wrapper-fluid .cc-membership-product-layout .hikashop_product_custom_item_info_table tbody {
        grid-template-columns: minmax(0, 1fr);
    }

    body.wrapper-fluid :is(.cc-training-practical, .cc-training-pricing) > article {
        min-width: 0;
        padding-inline: .85rem;
    }

    body.wrapper-fluid :is(.cc-event-copy, .cc-project-copy, .cc-legal-section, .cc-choir-contact) a {
        overflow-wrap: anywhere;
    }

    /* Journal: give both the lead story and the compact cards room to breathe. */
    body.cc-home-news.view-category .com-content-category-blog > .page-header,
    body.cc-home-news.view-category .com-content-category-blog > .category-desc {
        padding-inline: 1.1rem;
    }

    body.cc-home-news.view-category .blog-item .item-content,
    body.cc-home-news.view-category .cc-news-page--first .blog-item:first-child .item-content {
        padding: 1.2rem 1rem;
    }

    body.cc-home-news.view-category .cc-news-tools {
        width: calc(100% - 1rem);
        min-width: 0;
    }

    body.cc-home-news.view-category .cc-news-tools .cc-news-search {
        min-width: 0;
    }

    body.cc-home-news.view-category .cc-news-search__form {
        min-width: 0;
    }

    body.cc-home-news.view-category .cc-news-search__input {
        width: 0;
        min-width: 0;
        font-size: 1rem;
    }

    body.cc-home-news.view-category .cc-news-search__submit {
        min-height: 2.75rem;
    }

    body.cc-home-news .cc-news-section,
    body.cc-home-news .com-content-article:has(.cc-news-body) > .cc-news-teaser {
        padding-inline: 1rem;
    }

    body.cc-gc-tag-page :is(.cc-gc-journal-hero__copy, .cc-gc-journal-hero__visual, .cc-gc-story__body),
    body.cc-gc-tag-page .cc-gc-story--lead .cc-gc-story__body {
        padding-inline: 1rem;
    }

    /* Results use the same width as their header, without native column margins. */
    body.itemid-238.layout-listing .hikashop_container {
        margin-inline: 0 !important;
    }

    body.itemid-238.layout-listing .cc-catalogue-hero {
        padding-inline: 1rem;
    }

    body.itemid-238.layout-listing .hikashop_pagination {
        overflow: visible;
        width: 100%;
    }

    body.itemid-238.layout-listing .hikashop_pagination.pagination {
        flex-wrap: wrap;
        justify-content: flex-start;
        row-gap: .4rem;
        margin-inline: 0;
    }

    body.wrapper-fluid .cc-choir-profile,
    body.wrapper-fluid .com-content-article:has(.cc-choir-profile) > .page-header {
        padding-inline: 1rem;
    }

    /* Prevent Safari's focus zoom on small text fields; leave quantities alone. */
    body.wrapper-fluid .container-component :is(
        input[type="text"], input[type="email"], input[type="tel"],
        input[type="password"], input[type="search"], textarea, select
    ):not(.hikashop_product_quantity_field) {
        min-width: 0;
        max-width: 100%;
        font-size: 1rem;
    }

    body.wrapper-fluid .container-component :is(
        .cc-membership-product-card__heading, .cc-bo-card__head,
        .cc-grand-resource-hero__body, .cc-ag-resource-hero__copy
    ) {
        min-width: 0;
    }
}

/* Four compact account tabs instead of a tall stack before every section. */
@media (max-width: 575.98px) {
    body.wrapper-fluid .cc-space-navigation {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: .55rem;
    }

    body.wrapper-fluid .cc-space-navigation__item {
        grid-template-columns: 1.75rem minmax(0, 1fr);
        gap: .55rem;
        min-height: 4.25rem;
        padding: .7rem;
    }

    body.wrapper-fluid .cc-space-navigation__item > span:first-child {
        width: 1.75rem;
        height: 1.75rem;
        font-size: .85rem;
    }

    body.wrapper-fluid .cc-space-navigation__item strong {
        font-size: .8rem;
        line-height: 1.3;
    }

    body.wrapper-fluid .cc-space-navigation__item small,
    body.wrapper-fluid .cc-space-navigation__arrow {
        display: none;
    }
}
