/* Home opening: centered composition and compact project proof on touch layouts. */
@media (max-width: 980px) {
    /* Clip the complete Home shell, including its header and footer. A
       positioned wrapper gives mobile WebKit a local overflow boundary;
       keep its height automatic so the document still scrolls vertically. */
    body.home,
    body.home > .wp-site-blocks {
        position: relative;
        width: 100%;
        min-width: 0;
        max-width: 100%;
        overflow-x: hidden;
    }
    .am-agency-stage .am-agency-grid { grid-template-columns: minmax(0, 1fr); gap: 28px; }
    .am-agency-stage .am-agency-collage { width: 100%; max-width: none !important; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: auto auto; gap: 14px; align-items: stretch; }
    .am-agency-stage .am-agency-collage > .am-agency-desk { grid-column: 1; grid-row: 1; }
    .am-agency-stage .am-agency-collage > .am-agency-portrait { grid-column: 2; grid-row: 1; }
    .am-agency-stage .am-agency-collage > :is(.am-agency-desk, .am-agency-portrait) { position: static; min-width: 0; margin: 0; }
    .am-agency-stage .am-agency-collage > :is(.am-agency-desk, .am-agency-portrait) img { position: static; display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 16px; }
    .am-agency-stage .am-agency-note { grid-column: 1 / -1; grid-row: 2; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); align-items: center; gap: 16px; padding: 18px; }
    .am-agency-stage .am-agency-note .am-note-heading { margin: 0; font-size: 18px; line-height: 1.3; }
    .am-agency-stage .am-agency-note p:last-child { margin: 0; font-size: 13px; line-height: 1.6; }
    /* Keep sideways card scrolling inside its section, including Safari overscroll. */
    .am-service-showcase, .am-project-stage, .am-insights-stage { overflow: hidden; }
    .am-heading-row { gap: 20px; margin-bottom: 28px; }
    .am-heading-row > .wp-block-buttons { padding-bottom: 0; }
    .am-agency-stage .am-agency-pillars {
        width: 100%;
        flex-wrap: nowrap;
        justify-content: space-between;
        gap: 8px;
    }
    .am-agency-stage .am-agency-pillars p { min-width: 0; margin: 0; font-size: clamp(10px, 2.8vw, 14px); white-space: nowrap; }
    .am-agency-stage .am-agency-pillars p::before { width: 4px; height: 4px; margin-right: 6px; }
    .am-software-stage .am-software-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
    .am-software-stage .am-software-card { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); align-items: center; border-radius: 16px; }
    .am-software-stage .am-software-image { min-width: 0; margin: 0; padding: 18px; text-align: center; line-height: 0; }
    .am-software-stage .am-software-image > a { display: block; width: 100%; max-width: 320px; margin-inline: auto; }
    .am-software-stage .am-software-image img { display: block; width: 100%; max-width: 100%; height: 160px; margin-inline: auto; aspect-ratio: auto; object-fit: contain; object-position: center; }
    .am-software-stage .am-software-copy { min-width: 0; padding: 20px; gap: 10px; }
    .am-software-stage .am-software-copy h3 { font-size: 23px; line-height: 1.2; }
    .am-software-stage .am-software-copy p { font-size: 14px; line-height: 1.65; }
    .am-software-stage .am-software-copy .am-eyebrow { font-size: 9px; }
    .am-software-stage .am-software-copy .wp-block-buttons { padding-top: 4px; }
    .am-software-stage .am-software-copy .wp-block-button__link { min-height: 44px; padding: 10px 16px; font-size: 13px; }
    .am-reasons-stage { padding-bottom: 40px; }
    .am-reasons-stage .am-reasons-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 22px;
        max-width: 640px !important;
    }
    .am-reasons-stage .am-reasons-grid > .am-reasons-column {
        grid-column: 1;
        grid-row: auto;
        gap: 22px;
    }
    .am-reasons-stage .am-reason {
        display: grid;
        grid-template-columns: 32px minmax(0, 1fr);
        gap: 8px 14px;
        padding-bottom: 22px;
        border-bottom: 1px solid #b08cd329;
    }
    .am-reasons-stage .am-reason::before {
        grid-column: 1;
        grid-row: 1 / 3;
        width: 30px;
        height: 30px;
        mask-size: 26px;
        margin: 1px 0 0;
    }
    .am-reasons-stage .am-reason h3 {
        grid-column: 2;
        margin: 0;
        font-size: 21px;
        line-height: 1.3;
    }
    .am-reasons-stage .am-reason p {
        grid-column: 2;
        margin: 0;
        font-size: 16px;
        line-height: 1.7;
        color: #d0c7df;
        text-wrap: pretty;
    }
    .am-reasons-stage .am-reasons-grid > .am-reasons-image {
        grid-column: 1;
        grid-row: 3;
        width: 100%;
        max-width: none;
        margin: 2px 0 0;
        border-radius: 20px;
        overflow: hidden;
    }
    .am-reasons-stage .am-reasons-image img {
        width: 100%;
        height: auto;
        aspect-ratio: 4 / 3;
        object-fit: cover;
        object-position: center 32%;
        border-radius: 20px;
    }
    .am-service-showcase .am-service-footnote {
        margin-top: 22px;
        padding: 18px 20px;
        border: 1px solid transparent;
        border-radius: 16px;
        background: linear-gradient(130deg, #1e192b, #131721) padding-box, var(--am-brand-border) border-box;
    }
    .am-service-showcase .am-services-progress + .am-service-footnote { margin-top: 0; }
    .am-service-showcase .am-service-footnote p { margin: 0; font-size: 14px; line-height: 1.75; text-wrap: pretty; }
    .am-service-showcase .am-service-footnote a { color: #d5b7ff; text-decoration-color: #a278d57a; text-underline-offset: 3px; }
    .am-service-showcase .am-service-cards,
    .am-project-stage .am-project-grid,
    .am-insights-stage .am-insights-query .wp-block-post-template {
        display: flex;
        flex-wrap: nowrap;
        align-items: stretch;
        gap: 16px;
        /* Keep intrinsic card widths inside their own scroll container. */
        min-width: 0;
        width: calc(100% + var(--wp--custom--gutter));
        max-width: calc(100% + var(--wp--custom--gutter));
        box-sizing: border-box;
        margin-right: calc(-1 * var(--wp--custom--gutter));
        padding: 6px var(--wp--custom--gutter) 12px 0;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scroll-padding-inline: 0 var(--wp--custom--gutter);
        overscroll-behavior-x: contain;
        scrollbar-width: none;
    }
    .am-service-showcase .am-service-cards > .am-service-card,
    .am-project-stage .am-project-grid > .am-project-card,
    .am-insights-stage .am-insights-query .wp-block-post-template > .wp-block-post { flex: 0 0 46%; min-width: 0; max-width: 46%; box-sizing: border-box; }
    .am-service-showcase .am-service-cards::-webkit-scrollbar,
    .am-project-stage .am-project-grid::-webkit-scrollbar,
    .am-insights-stage .wp-block-post-template::-webkit-scrollbar { display: none; }
    .am-insights-stage .am-insights-query .wp-block-post { scroll-snap-align: start; scroll-snap-stop: normal; margin: 0; min-width: 0; }
    .am-insights-stage .am-article-preview { padding: 22px; overflow: hidden; }
    .am-insights-stage .am-article-preview .am-article-cover { width: calc(100% + 44px); margin: -22px -22px 18px !important; }
    .am-insights-stage .am-article-preview .am-eyebrow { font-size: 10px; line-height: 1.5; margin: 0 0 12px; }
    .am-insights-stage .am-article-preview .wp-block-post-title { font-size: 23px; line-height: 1.25; margin: 0 0 14px; text-wrap: pretty; }
    .am-insights-stage .am-article-preview .wp-block-post-excerpt { font-size: 15px; line-height: 1.65; margin-bottom: 16px; }
    .am-insights-stage .am-article-preview .wp-block-post-excerpt__excerpt { margin: 0; }
    .am-insights-stage .am-article-preview .am-article-read-more { display: inline-flex; align-items: center; min-height: 44px; margin-top: auto; font-size: 13px; }
    .am-insights-stage .am-insights-query { min-width: 0; max-width: 100%; }
    .am-insights-stage .am-insight-formats { display: flex; flex-wrap: nowrap; justify-content: space-between; gap: 6px; width: 100%; padding-top: 0; }
    .am-insights-stage .am-insight-formats p { min-width: 0; margin: 0; font-size: clamp(10px, 2.6vw, 14px); }
    .am-insights-stage .am-insight-formats a { display: flex; align-items: center; justify-content: center; min-height: 44px; white-space: nowrap; }
    .am-project-stage .am-project-card {
        display: flex;
        flex-direction: column;
        scroll-snap-align: start;
        scroll-snap-stop: normal;
        margin: 0;
        border: 1px solid transparent;
        border-radius: 18px;
        background: linear-gradient(#191c2b, #141722) padding-box, var(--am-brand-border) border-box;
    }
    .am-project-stage .am-project-card:hover,
    .am-project-stage .am-project-card:hover .am-project-art img { transform: none; }
    .am-project-stage .am-project-art { margin: 0; flex-shrink: 0; }
    .am-project-stage .am-project-art img { height: auto; aspect-ratio: 16 / 10; }
    .am-project-stage .am-project-info { flex: 1; gap: 12px; padding: 22px; }
    .am-project-stage .am-project-info h3 { padding: 0; font-size: 23px; line-height: 1.2; text-wrap: pretty; }
    .am-project-stage .am-project-info > p { font-size: 15px; line-height: 1.65; color: #d0c7df; }
    .am-project-stage .am-project-info .am-project-meta { font-size: 11px; line-height: 1.5; color: #c3a1ef; }
    .am-project-stage .am-project-info .am-text-link { margin-top: auto; padding-top: 14px; font-size: 13px; }
    .am-project-stage .am-project-info .am-text-link a { min-height: 44px; width: 100%; justify-content: space-between; border-top: 1px solid #b08cd32b; padding-top: 10px; }
    .am-project-stage .am-project-info .am-text-link a::after { position: static; width: 17px; height: 17px; }
    .am-service-showcase .am-service-cards > .am-service-card {
        scroll-snap-align: start;
        scroll-snap-stop: normal;
        margin: 0;
        padding: 26px;
    }
    .am-service-showcase .am-service-cards > .am-service-card:hover { transform: none; }
    .am-service-showcase .am-service-card .am-text-link a { min-height: 44px; }
    .am-home-opening .am-home-proposition {
        grid-template-columns: minmax(0, 1fr);
        justify-items: center;
        text-align: center;
        gap: 26px;
    }
    .am-home-opening .am-home-title { width: 100%; max-width: 760px; }
    .am-home-opening .am-home-title h1 { text-align: center; text-wrap: balance; }
    .am-home-opening .am-home-intro {
        max-width: 620px;
        margin: 0 auto;
        padding: 0;
        border: 0;
    }
    .am-home-opening .am-home-intro > p { margin: 0; text-wrap: pretty; }
    .am-home-opening .am-home-intro .wp-block-buttons {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        justify-content: center;
        gap: 10px;
        margin-top: 24px;
    }
    .am-home-opening .am-home-visuals {
        grid-template-columns: minmax(0, 1fr);
        justify-items: center;
        gap: 18px;
        margin-top: 32px;
    }
    .am-home-opening .am-orbit-image { width: 100%; margin: 0; }
    .am-home-opening .am-home-visuals .am-work-card {
        display: grid;
        grid-template-columns: 96px minmax(0, 1fr);
        align-items: center;
        gap: 14px;
        width: min(100%, 480px);
        margin: 0;
        padding: 12px;
        border: 1px solid #b28add3d;
        border-radius: 18px;
        background: linear-gradient(115deg, #211b31, #151824);
    }
    .am-home-opening .am-home-visuals .am-work-image {
        margin: 0;
        border-radius: 10px;
        overflow: hidden;
        background: #0c0f18;
    }
    .am-home-opening .am-home-visuals .am-work-image img {
        display: block;
        width: 100%;
        height: 72px;
        aspect-ratio: 4 / 3;
        object-fit: contain;
    }
    .am-home-opening .am-home-visuals .am-work-caption { margin: 0; padding: 0; text-align: left; }
    .am-home-opening .am-home-visuals .am-work-caption :is(h2, h3) { font-size: 17px; line-height: 1.25; }
    .am-home-opening .am-home-visuals .am-work-caption :is(h2, h3) a { gap: 10px; min-height: 44px; }
    .am-home-opening .am-home-visuals .am-work-caption :is(h2, h3) a::after { flex-basis: 18px; height: 18px; }
    .am-home-opening .am-home-visuals .am-work-caption .am-eyebrow { margin: 0 0 2px; font-size: 9px; letter-spacing: .07em; }
    .am-home-opening .am-work-caption .am-eyebrow::before { display: none; }
    .am-home-opening .am-capability-strip {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 0;
        margin-top: 26px;
        padding-block: 12px;
    }
    .am-home-opening .am-capability-strip p { width: auto; min-width: 0; margin: 0; font-size: clamp(11px, 3vw, 15px); }
    .am-home-opening .am-capability-strip p > a {
        justify-content: center;
        gap: 4px;
        padding: 8px 4px;
        min-height: 44px;
        white-space: nowrap;
    }
    .am-home-opening .am-capability-strip p > a::before { content: none; }
    .am-home-opening .am-capability-strip p > a::after { flex-basis: 11px; height: 11px; margin-left: 0; }
}
@media (max-width: 600px) {
    .am-software-stage .am-software-card { grid-template-columns: minmax(0, 1fr); }
    .am-software-stage .am-software-image { padding: 16px 20px 0; }
    .am-software-stage .am-software-image img { height: 150px; max-width: 100%; margin-inline: auto; }
    .am-software-stage .am-software-copy { padding: 18px 20px 20px; }
    .am-service-showcase .am-service-cards,
    .am-project-stage .am-project-grid,
    .am-insights-stage .am-insights-query .wp-block-post-template { gap: 14px; }
    .am-service-showcase .am-service-cards > .am-service-card,
    .am-project-stage .am-project-grid > .am-project-card,
    .am-insights-stage .am-insights-query .wp-block-post-template > .wp-block-post { flex-basis: 86%; max-width: 86%; }
    .am-service-showcase .am-service-cards > .am-service-card { padding: 24px; }
}
@media (max-width: 380px) {
    .am-home-opening .am-home-visuals .am-work-card { grid-template-columns: 76px minmax(0, 1fr); gap: 10px; padding: 10px; }
    .am-home-opening .am-home-visuals .am-work-image img { height: 64px; }
    .am-home-opening .am-home-visuals .am-work-caption :is(h2, h3) { font-size: 15px; }
    .am-home-opening .am-home-visuals .am-work-caption .am-eyebrow { font-size: 8px; }
}
