/*
 * Mudsill mobile refinement
 * This file is intentionally phone-only. Desktop composition is untouched.
 */
@media (max-width: 700px) {
    :root {
        --mobile-gutter: 18px;
        --mobile-panel: rgba(3, 10, 12, .88);
        --mobile-panel-strong: rgba(2, 8, 10, .96);
        --mobile-line: rgba(243, 244, 239, .16);
        --mobile-acid-line: rgba(216, 255, 63, .34);
        --mobile-radius: 16px;
    }

    html,
    body {
        overflow-x: clip;
    }

    body:not(.home) .container,
    .home .container {
        width: calc(100% - (var(--mobile-gutter) * 2));
    }

    /* Compact, useful site chrome. */
    .site-header,
    .home .site-header,
    body:not(.home) .site-header {
        min-height: 72px;
        background: rgba(0, 0, 0, .96) !important;
        border-bottom: 1px solid rgba(216, 255, 63, .14);
    }

    .header-inner,
    .home .site-header .header-inner {
        width: calc(100% - 24px);
        min-height: 72px;
        gap: 8px;
    }

    .brand--new-logo img,
    .header-inner .brand--new-logo img,
    .home .site-header .brand--new-logo img,
    .footer-main .brand--new-logo img {
        width: 66px !important;
        height: 52px !important;
    }

    .nav-toggle {
        order: 3;
        width: 44px;
        height: 44px;
        border: 1px solid rgba(243, 244, 239, .2);
        border-radius: 10px;
        background: rgba(255, 255, 255, .025);
    }

    .header-call {
        min-width: 94px;
        min-height: 43px;
        margin-left: auto;
        padding: 7px 10px;
        border-radius: 9px;
        text-align: center;
    }

    .header-call span {
        font-size: .61rem;
        letter-spacing: .13em;
    }

    .site-nav {
        inset: 71px 12px auto;
        z-index: 80;
        gap: 2px;
        padding: 12px;
        border-color: var(--mobile-acid-line);
        border-radius: 14px;
        background: rgba(1, 6, 8, .985);
        box-shadow: 0 28px 70px rgba(0, 0, 0, .72);
    }

    .site-nav > a,
    .site-nav > .nav-item > a {
        padding: 13px 12px;
        border-radius: 8px;
    }

    .services-menu {
        margin: 2px 0 6px;
        padding: 7px;
        border-radius: 10px;
    }

    /* Homepage hero: the signal remains the focus, with cleaner copy and actions. */
    .volume-hero {
        height: auto;
        min-height: max(790px, 100svh);
    }

    .volume-hero::before {
        inset: 8px;
        opacity: .72;
    }

    .volume-hero__copy {
        width: auto;
        margin: 35svh 14px 76px;
        padding: 23px 20px 24px;
        border: 1px solid rgba(243, 244, 239, .13);
        border-left-color: rgba(216, 255, 63, .72);
        border-radius: 15px;
        background:
            radial-gradient(circle at 100% 0, rgba(216, 255, 63, .075), transparent 38%),
            linear-gradient(112deg, rgba(2, 8, 10, .96), rgba(2, 8, 10, .83));
        box-shadow: 0 26px 70px rgba(0, 0, 0, .42), inset 0 1px rgba(255, 255, 255, .035);
        backdrop-filter: blur(14px);
    }

    .volume-hero__copy::before {
        width: 86px;
    }

    .volume-hero__copy::after {
        display: none;
    }

    .volume-hero__kicker {
        margin-bottom: 17px;
        font-size: .58rem;
        line-height: 1.45;
        letter-spacing: .13em;
    }

    .volume-hero__copy h1 {
        font-size: clamp(2.72rem, 12.4vw, 3.45rem);
        line-height: .96;
        letter-spacing: -.048em;
    }

    .volume-hero__lede {
        margin-top: 20px;
        color: rgba(239, 242, 237, .76);
        font-size: .94rem;
        line-height: 1.55;
    }

    .volume-hero__actions {
        display: grid;
        grid-template-columns: 1fr;
        gap: 9px;
        margin-top: 22px;
    }

    .volume-hero__actions a {
        width: 100%;
        height: 54px;
        border-radius: 9px;
        font-size: .58rem;
    }

    .volume-hero__primary > span {
        width: 52px;
    }

    .volume-hero__footer {
        display: none;
    }

    /* Homepage sections: denser rhythm and intentional single-column cards. */
    .home-literal-services {
        min-height: 0;
        padding: 68px 0 72px !important;
    }

    .home-literal-services > .home-services-stage {
        width: calc(100% - 28px) !important;
        min-height: 0;
        gap: 30px !important;
    }

    .home-services-intro h2 {
        margin: 18px 0 20px;
        font-size: clamp(2.8rem, 13vw, 3.55rem) !important;
        line-height: .94 !important;
        letter-spacing: -.04em;
    }

    .home-services-intro > p:not(.home-kicker) {
        font-size: .98rem !important;
        line-height: 1.58;
    }

    .home-services-intro > a {
        display: flex;
        width: 100% !important;
        min-height: 52px;
        margin-top: 24px;
        align-items: center;
        justify-content: space-between;
        padding: 0 18px;
        border: 1px solid var(--mobile-acid-line);
        border-radius: 10px;
        background: rgba(216, 255, 63, .045);
    }

    .home-services-spectrum {
        grid-template-columns: 1fr;
        gap: 11px;
        padding: 18px 0 0;
    }

    .home-spectrum-service,
    .home-spectrum-service:nth-child(2),
    .home-spectrum-service:nth-child(4) {
        min-height: 148px;
        padding: 22px 19px 20px;
        grid-template-columns: 34px 1fr 22px;
        border-color: var(--mobile-line);
        border-radius: 13px;
        transform: none;
        background:
            radial-gradient(circle at 100% 100%, rgba(216, 255, 63, .055), transparent 35%),
            linear-gradient(145deg, rgba(7, 18, 20, .94), rgba(2, 8, 10, .9));
    }

    .home-spectrum-service strong {
        font-size: 1.65rem;
    }

    .home-spectrum-service em {
        font-size: .78rem;
    }

    .home-process {
        min-height: 0;
        padding: 72px 0 76px;
    }

    .home-process__layout {
        width: calc(100% - 28px);
        min-height: 0;
        gap: 32px;
        padding: 0;
    }

    .home-process__intro h2,
    .home-section-heading h2 {
        margin: 0 0 18px;
        font-size: clamp(2.75rem, 13vw, 3.55rem);
        line-height: .94;
        letter-spacing: -.04em;
    }

    .home-process__intro > p {
        max-width: 34ch;
        font-size: .95rem;
        line-height: 1.55;
    }

    .home-process__sequence {
        gap: 10px;
    }

    .home-process__sequence article,
    .home-process__sequence article:nth-child(even) {
        min-height: 0;
        grid-template-columns: 34px 1fr;
        gap: 0;
        padding: 18px 18px 19px;
        border-color: var(--mobile-line);
        border-radius: 13px;
        transform: none;
        background: linear-gradient(112deg, rgba(8, 21, 24, .94), rgba(2, 8, 10, .92));
    }

    .home-process__sequence article > span {
        grid-row: 1 / 3;
        align-self: start;
        padding-top: 4px;
        color: var(--home-acid);
    }

    .home-process__sequence h3 {
        margin: 0 0 7px;
        font-size: 1.55rem;
    }

    .home-process__sequence p {
        font-size: .86rem;
        line-height: 1.48;
    }

    .home-trades {
        height: auto !important;
        min-height: 0 !important;
        padding: 74px 0 82px;
    }

    .home-trades > .container,
    .home-trades__grid {
        width: calc(100% - 28px);
    }

    .home-trades__grid {
        /* The concept stylesheet assigns individual cards to fixed rows. Reset
           every part of that desktop collage so mobile has a true document flow. */
        grid-template-columns: minmax(0, 1fr) !important;
        grid-template-rows: none !important;
        grid-auto-rows: auto !important;
        height: auto !important;
        align-items: stretch;
        gap: 12px;
    }

    .home-trades__head {
        grid-column: 1 / -1 !important;
        grid-row: auto !important;
        gap: 20px;
        margin-bottom: 34px;
    }

    .home-trades__head h2 {
        margin-top: 18px;
        font-size: clamp(2.85rem, 13.5vw, 3.65rem);
        line-height: .92;
    }

    .home-trades__head > p {
        padding-top: 16px;
        font-size: .95rem;
        line-height: 1.55;
    }

    .home-trade-card,
    .home-trade-card--1,
    .home-trade-card--2,
    .home-trade-card--3,
    .home-trade-card--4,
    .home-trade-card--5,
    .home-trade-card--6,
    .home-trade-card--7,
    .home-trade-card--8,
    .home-trade-card--9,
    .home-trade-card--10 {
        grid-column: 1 / -1 !important;
        grid-row: auto !important;
        width: 100%;
        height: 255px !important;
        min-height: 255px !important;
        align-self: stretch;
        border-radius: 13px;
    }

    .home-trade-card > div {
        right: 20px;
        bottom: 19px;
        left: 20px;
    }

    .home-trade-card h3 {
        margin-bottom: 13px;
        font-size: 2rem;
    }

    .home-trades-custom {
        grid-column: 1 / -1 !important;
        grid-row: auto !important;
        grid-template-columns: 1fr;
        min-height: 0 !important;
        gap: 14px;
        padding: 25px 21px;
        border-radius: 14px;
    }

    .home-trades-custom h3 {
        font-size: 1.7rem;
    }

    .home-trades-custom > a {
        width: 100%;
        min-height: 52px;
    }

    .home-final,
    .home-final__inner {
        min-height: 0;
    }

    .home-final {
        padding: 82px 0 88px;
    }

    .home-final__inner {
        width: calc(100% - 28px);
    }

    .home-final h2 {
        margin: 27px 0 28px;
        font-size: clamp(2.9rem, 13.6vw, 3.7rem);
        line-height: .92;
    }

    .home-final__inner > p:not(.home-kicker) {
        font-size: .96rem;
        line-height: 1.55;
    }

    .home-final__inner > p br {
        display: none;
    }

    .home-final__actions {
        gap: 9px;
        margin-top: 26px;
    }

    .home-final__actions .home-literal-button,
    .home-final__actions > a:last-child {
        width: 100%;
        min-height: 54px;
        border-radius: 9px;
    }

    /* Subpages: readable hierarchy, shorter sections, and premium content cards. */
    body:not(.home) .mudsill-main {
        overflow: clip;
    }

    /* Shared phone safety pass. Several page concepts use positioned desktop
       artwork and wide grid children; keep those from widening or colliding
       with the mobile document flow. */
    .mudsill-main *,
    .site-footer *,
    .site-header * {
        min-width: 0;
    }

    .mudsill-main :is(img, video, canvas, svg, iframe) {
        max-width: 100%;
    }

    body:not(.home) :is(
        .service-detail__grid,
        .services-hero__grid,
        .contact-experience__grid,
        .website-split,
        .seo-split,
        .sem-split,
        .social-split,
        .about-split,
        .fit-grid,
        .sem-fit-grid,
        .social-fit-grid,
        .about-fit-grid,
        .project-form-contact,
        .contact-form__row
    ) {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    body:not(.home) :is(input, select, textarea) {
        width: 100%;
        max-width: 100%;
    }

    body:not(.home) .service-detail,
    body:not(.home) .subpage-hero,
    body:not(.home) .contact-experience {
        min-height: 0;
        padding: 42px 0 62px;
    }

    body:not(.home) .service-detail__grid,
    body:not(.home) .services-hero__grid,
    body:not(.home) .contact-experience__grid {
        width: calc(100% - 28px);
        min-height: 0;
        gap: 28px;
        padding: 0;
    }

    body:not(.home) .service-detail__copy,
    body:not(.home) .services-hero__copy,
    body:not(.home) .contact-experience__copy,
    body:not(.home) .about-hero .service-detail__copy,
    body:not(.home) .sem-hero .service-detail__copy {
        padding: 24px 21px !important;
        border: 1px solid rgba(243, 244, 239, .13) !important;
        border-left-color: rgba(216, 255, 63, .62) !important;
        border-radius: var(--mobile-radius);
        background:
            radial-gradient(circle at 100% 0, rgba(216, 255, 63, .07), transparent 38%),
            linear-gradient(140deg, rgba(5, 16, 16, .94), rgba(2, 8, 10, .9));
        box-shadow: 0 22px 56px rgba(0, 0, 0, .3);
    }

    body:not(.home) :is(
        .hero-copy h1,
        .service-detail__copy h1,
        .services-hero__copy h1,
        .contact-experience h1,
        .subpage-hero h1
    ) {
        margin-top: 16px;
        font-size: clamp(2.72rem, 12.3vw, 3.55rem);
        line-height: .97;
        letter-spacing: -.045em;
        overflow-wrap: normal;
        word-break: normal;
    }

    body:not(.home) .premium-heading > span,
    body:not(.home) .premium-heading .heading-accent,
    body:not(.home) .premium-heading .premium-accent {
        display: inline;
    }

    body:not(.home) :is(
        .service-detail__copy > p:not(.eyebrow),
        .services-hero__copy > p:not(.eyebrow),
        .contact-experience__copy > p:not(.eyebrow),
        .subpage-hero p
    ) {
        font-size: .97rem;
        line-height: 1.58;
    }

    body:not(.home) .hero-actions {
        display: grid;
        grid-template-columns: 1fr;
        gap: 9px;
        margin-top: 23px;
    }

    body:not(.home) .button {
        width: 100%;
        min-height: 54px;
        border-radius: 9px;
    }

    body:not(.home) :is(
        .website-hero-system,
        .seo-intent-visual,
        .sem-signal,
        .social-signal,
        .about-signal,
        .services-hero__signal
    ) {
        min-height: 300px;
        border-radius: var(--mobile-radius);
    }

    body:not(.home) :is(.system-window, .seo-intent-core) {
        right: 18px;
        left: 18px;
        width: auto;
    }

    body:not(.home) :is(.system-proof, .seo-search-stack) {
        right: 18px;
        left: 18px;
        width: auto;
    }

    body:not(.home) :is(.sem-signal__stack, .social-signal__stack, .about-signal__stack) {
        width: calc(100% - 32px);
        max-width: 330px;
        transform: none;
    }

    body:not(.home) :is(.sem-signal__proof, .social-signal__proof, .about-signal__proof) {
        right: 16px;
        left: 16px;
        width: auto;
        max-width: none;
        gap: 5px;
    }

    body:not(.home) :is(
        .website-section,
        .seo-section,
        .sem-section,
        .social-section,
        .about-section,
        .services-index,
        .section
    ) {
        padding: 64px 0;
    }

    body:not(.home) :is(
        .website-split,
        .seo-split,
        .sem-split,
        .social-split,
        .about-split,
        .fit-grid,
        .sem-fit-grid,
        .social-fit-grid,
        .about-fit-grid
    ) {
        gap: 24px;
    }

    body:not(.home) :is(
        .website-split h2,
        .website-section .section-head h2,
        .fit-card h2,
        .seo-split h2,
        .seo-section .section-head h2,
        .seo-theater-panel h2,
        .sem-split h2,
        .sem-section .section-head h2,
        .sem-fit-grid h2,
        .social-split h2,
        .social-section .section-head h2,
        .social-fit-grid h2,
        .about-split h2,
        .about-section .section-head h2,
        .about-fit-grid h2,
        .section-head h2,
        .final-cta h2
    ) {
        font-size: clamp(2.35rem, 11.2vw, 3.15rem);
        line-height: .98;
        letter-spacing: -.04em;
        overflow-wrap: normal;
        word-break: normal;
    }

    body:not(.home) :is(
        .website-card-grid article,
        .seo-foundation-grid article,
        .seo-handle-grid article,
        .seo-process-track article,
        .sem-handle-grid article,
        .sem-process-grid article,
        .social-handle-grid article,
        .social-process-grid article,
        .about-card-grid article,
        .about-principle-grid article,
        .about-process-grid article,
        .fit-card
    ) {
        min-height: 0;
        padding: 23px 21px;
        border-radius: 14px;
        border-color: var(--mobile-line);
        background:
            radial-gradient(circle at 100% 0, rgba(216, 255, 63, .055), transparent 38%),
            linear-gradient(140deg, rgba(7, 18, 20, .94), rgba(2, 8, 10, .93));
        box-shadow: 0 18px 48px rgba(0, 0, 0, .23);
    }

    body:not(.home) :is(
        .website-card-grid,
        .seo-foundation-grid,
        .seo-handle-grid,
        .seo-process-track,
        .sem-handle-grid,
        .sem-process-grid,
        .social-handle-grid,
        .social-process-grid,
        .about-card-grid,
        .about-principle-grid,
        .about-process-grid
    ) {
        gap: 11px;
    }

    body:not(.home) :is(.about-copy-stack, .seo-copy-stack, .sem-copy-stack, .social-copy-stack, .website-copy-stack) {
        padding: 23px 21px !important;
        border-radius: 14px;
    }

    body:not(.home) :is(.about-copy-stack, .seo-copy-stack, .sem-copy-stack, .social-copy-stack, .website-copy-stack) p {
        font-size: .96rem;
        line-height: 1.62;
    }

    body:not(.home) .section-head {
        margin-bottom: 26px;
    }

    body:not(.home) .services-hero__signal {
        gap: 8px;
        padding: 10px;
    }

    body:not(.home) .services-hero__signal details {
        border-radius: 11px;
    }

    body:not(.home) .services-hero__signal summary {
        min-height: 66px;
        padding: 10px 13px 10px 16px;
    }

    body:not(.home) .services-hero__signal summary b {
        font-size: 1.12rem;
    }

    body:not(.home) .services-hero__detail {
        padding: 0 16px 20px;
    }

    body:not(.home) .project-form {
        padding: 24px 19px;
        border-radius: var(--mobile-radius);
    }

    body:not(.home) .contact-actions {
        grid-template-columns: 1fr;
        gap: 9px;
    }

    body:not(.home) .contact-action {
        min-height: 62px;
        border-radius: 10px;
    }

    body:not(.home) .final-cta {
        padding: 64px 0;
    }

    body:not(.home) .final-cta__inner {
        min-height: 0;
        padding: 29px 21px;
        border-radius: var(--mobile-radius);
    }

    .site-footer {
        padding-top: 54px;
    }

    .footer-shell {
        gap: 32px;
    }

    .footer-links {
        grid-template-columns: 1fr 1fr;
        gap: 12px 18px;
    }

    .footer-bottom {
        gap: 10px;
        padding-top: 20px;
        font-size: .76rem;
    }

    /* Hover depth should not leave touch cards visually offset. */
    .home-spectrum-service:hover,
    .home-trade-card:hover,
    body:not(.home) :is(.website-card-grid article, .seo-handle-grid article, .sem-handle-grid article, .social-handle-grid article, .about-card-grid article):hover {
        transform: none;
    }
}

@media (max-width: 390px) {
    .volume-hero__copy {
        margin-right: 10px;
        margin-left: 10px;
        padding-right: 18px;
        padding-left: 18px;
    }

    .volume-hero__copy h1 {
        font-size: 2.62rem;
    }

    body:not(.home) :is(.service-detail__copy h1, .services-hero__copy h1, .contact-experience h1, .subpage-hero h1) {
        font-size: 2.55rem;
    }

    .header-call {
        min-width: 86px;
        padding-inline: 8px;
    }
}
