/*
 * VB Painter mobile presentation
 *
 * This is the single mobile source of truth. It is loaded after each page's
 * desktop stylesheet so desktop rules remain untouched above 768px.
 */

.mobile-nav-toggle,
.mobile-nav-overlay,
.mobile-nav-content,
.mobile-nav-header,
.mobile-nav-body,
.mobile-menu-links,
.mobile-nav-footer {
    display: none;
}

@media (max-width: 768px) {
    :root {
        --nav-height: 70px;
        --container-padding: 1.25rem;
        --m-gutter: max(1.25rem, env(safe-area-inset-left));
        --m-gutter-end: max(1.25rem, env(safe-area-inset-right));
        --m-section-space: clamp(3.5rem, 9vw, 5rem);
        --m-heading-xl: clamp(2rem, 8.6vw, 3rem);
        --m-heading-lg: clamp(1.65rem, 6.9vw, 2.35rem);
        --m-heading-md: clamp(1.25rem, 5.1vw, 1.65rem);
    }

    html {
        scroll-padding-top: calc(var(--nav-height) + 1rem);
        -webkit-text-size-adjust: 100%;
    }

    body {
        min-width: 0;
        font-size: 16px;
        overflow-wrap: anywhere;
    }

    img,
    svg,
    iframe {
        max-width: 100%;
    }

    #smooth-wrapper,
    #smooth-content {
        width: 100%;
        min-width: 0;
    }

    .container,
    .child-container {
        width: 100%;
        min-width: 0;
        padding-left: var(--m-gutter);
        padding-right: var(--m-gutter-end);
    }

    section {
        min-width: 0;
        padding: var(--m-section-space) 0;
    }

    .section-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.6rem;
        margin-bottom: 2rem;
        padding-bottom: 1.1rem;
    }

    .section-label,
    .hero-meta-tag,
    .hero-scope-label,
    .hero-trust-micro,
    .areas-hero-kicker,
    .hero-meta-kicker {
        font-size: 0.69rem;
        letter-spacing: 0.09em;
        line-height: 1.35;
    }

    .section-title,
    .cta-wrap h2,
    .footer-cta h2 {
        font-size: var(--m-heading-lg);
        line-height: 1.12;
    }

    .cta-button,
    .child-btn-primary,
    .child-btn-secondary {
        align-items: center;
        justify-content: center;
        min-height: 46px;
        padding: 0.78rem 1.15rem;
        font-size: 0.72rem;
        line-height: 1.2;
    }

    /* Header */
    .navbar {
        height: calc(var(--nav-height) + env(safe-area-inset-top));
        min-width: 0;
        padding: env(safe-area-inset-top) var(--m-gutter-end) 0 var(--m-gutter);
        pointer-events: auto;
    }

    .nav-logo {
        display: inline-flex;
        align-items: center;
        min-width: 0;
    }

    .nav-logo-img {
        display: block;
        width: auto;
        max-width: 104px;
        max-height: 38px;
    }

    .nav-links,
    .nav-call-btn {
        display: none;
    }

    .nav-contact {
        display: flex;
        align-items: center;
        gap: 0.3rem;
        min-width: 0;
    }

    .nav-quote-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 42px;
        padding: 0.45rem 0.72rem;
        font-size: 0.65rem;
        letter-spacing: 0.035em;
    }

    .mobile-nav-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex-direction: column;
        flex: 0 0 44px;
        gap: 5px;
        width: 44px;
        height: 44px;
        padding: 0;
        border: 0;
        border-radius: 50%;
        background: transparent;
        color: var(--text-dark);
        cursor: pointer;
        touch-action: manipulation;
    }

    .toggle-bar {
        display: block;
        width: 21px;
        height: 2px;
        border-radius: 2px;
        background: currentColor;
        pointer-events: none;
        transition: transform 180ms ease;
    }

    .mobile-nav-toggle[aria-expanded="true"] .toggle-bar:first-child {
        transform: translateY(3.5px) rotate(45deg);
    }

    .mobile-nav-toggle[aria-expanded="true"] .toggle-bar:last-child {
        transform: translateY(-3.5px) rotate(-45deg);
    }

    /* The menu is structurally removed from flow until its open state is set. */
    .mobile-nav-overlay {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1100;
        visibility: hidden;
        pointer-events: none;
        background: rgba(247, 246, 242, 0.98);
        opacity: 0;
        overscroll-behavior: contain;
        transition: opacity 180ms ease, visibility 0s linear 180ms;
    }

    .mobile-nav-overlay.is-open {
        visibility: visible;
        pointer-events: auto;
        opacity: 1;
        transition: opacity 180ms ease;
    }

    .mobile-nav-content {
        display: flex;
        flex-direction: column;
        width: 100%;
        min-height: 100%;
        min-height: 100dvh;
        padding: env(safe-area-inset-top) var(--m-gutter-end) calc(1.4rem + env(safe-area-inset-bottom)) var(--m-gutter);
    }

    .mobile-nav-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        min-height: var(--nav-height);
        border-bottom: 1px solid var(--border-color, rgba(26, 26, 26, 0.12));
    }

    .mobile-nav-logo {
        display: inline-flex;
        align-items: center;
        min-height: 44px;
    }

    .mobile-nav-logo .nav-logo-img {
        max-width: 115px;
        max-height: 42px;
    }

    .mobile-nav-close {
        display: inline-flex;
        position: relative;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        padding: 0;
        border: 0;
        border-radius: 50%;
        background: transparent;
        color: var(--text-dark);
        cursor: pointer;
        touch-action: manipulation;
    }

    .close-bar {
        position: absolute;
        width: 22px;
        height: 2px;
        border-radius: 2px;
        background: currentColor;
    }

    .close-bar:first-child { transform: rotate(45deg); }
    .close-bar:last-child { transform: rotate(-45deg); }

    .mobile-nav-body {
        display: flex;
        flex: 1 1 auto;
        align-items: center;
        min-height: 0;
    }

    .mobile-menu-links {
        display: grid;
        width: 100%;
        gap: 0.1rem;
        margin: 0;
        padding: 1.25rem 0;
        list-style: none;
    }

    .mobile-link {
        display: grid;
        grid-template-columns: 2.2rem minmax(0, 1fr);
        align-items: baseline;
        gap: 0.6rem;
        min-height: 48px;
        padding: 0.45rem 0;
        color: var(--text-dark);
        font-family: var(--font-heading);
        font-size: clamp(1.25rem, 6vw, 1.85rem);
        letter-spacing: -0.02em;
        line-height: 1.1;
        text-decoration: none;
    }

    .mobile-link .link-num {
        color: var(--accent-terracotta);
        font-family: var(--font-body);
        font-size: 0.68rem;
        font-weight: 700;
        letter-spacing: 0.08em;
    }

    .mobile-link.active { color: var(--accent-terracotta); }

    .mobile-nav-footer {
        display: grid;
        gap: 1.1rem;
        padding-top: 1.2rem;
        border-top: 1px solid var(--border-color, rgba(26, 26, 26, 0.12));
    }

    .mobile-nav-cta {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 48px;
        padding: 0.85rem 1rem;
        border-radius: 999px;
        background: var(--text-dark);
        color: var(--text-light);
        font-size: 0.72rem;
        font-weight: 700;
        letter-spacing: 0.06em;
        text-transform: uppercase;
    }

    .mobile-nav-phone {
        display: flex;
        align-items: baseline;
        justify-content: space-between;
        gap: 1rem;
    }

    .phone-label {
        color: var(--text-muted);
        font-size: 0.68rem;
        font-weight: 700;
        letter-spacing: 0.07em;
        text-transform: uppercase;
    }

    .phone-link {
        color: var(--text-dark);
        font-size: 0.95rem;
        font-weight: 800;
    }

    html.mobile-menu-open,
    body.mobile-menu-open {
        overflow: hidden;
    }

    /* Home */
    .hero {
        display: flex;
        align-items: flex-end;
        min-height: min(700px, 100svh);
        height: min(700px, 100dvh);
        max-height: none;
        padding: 0;
    }

    .hero-clouds {
        background: #a8a59c;
    }

    .cloud-layer,
    .cloud-layer.layer-1 {
        inset: 0;
        width: 100%;
        height: 100%;
        opacity: 1;
        transform: none;
        background-image: linear-gradient(180deg, rgba(18, 18, 18, 0.04) 25%, rgba(18, 18, 18, 0.62) 100%), url('../Hero page asset.png');
        background-position: 58% center;
        background-size: cover;
    }

    .hero-content {
        z-index: 1;
        padding-bottom: calc(1.8rem + env(safe-area-inset-bottom));
        text-align: left;
    }

    .hero-title,
    .hero-subtitle {
        max-width: 19rem;
        transform: none;
        mix-blend-mode: normal;
    }

    .hero-title {
        margin-bottom: 0.85rem;
        color: #fff;
        font-size: clamp(2rem, 8.4vw, 2.75rem);
        line-height: 1.06;
        text-shadow: 0 2px 18px rgba(0, 0, 0, 0.45);
    }

    .hero-title .line,
    .hero-title .line span,
    .hero-subtitle span {
        transform: none;
    }

    .hero-subtitle {
        margin: 0 0 1.4rem;
        color: rgba(255, 255, 255, 0.94);
        font-size: 0.92rem;
        line-height: 1.5;
        text-shadow: 0 1px 8px rgba(0, 0, 0, 0.4);
    }

    .hero .cta-button {
        width: auto;
        max-width: none;
        transform: none;
        opacity: 1;
    }

    .about-content {
        grid-template-columns: 1fr;
        gap: 1.6rem;
    }

    .about-text p {
        font-size: clamp(1rem, 4.2vw, 1.15rem);
        line-height: 1.48;
        margin-bottom: 1.1rem;
    }

    .about-image {
        width: 100%;
        aspect-ratio: 5 / 4;
        margin: 0;
        border-radius: 4px;
    }

    .service-list {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0;
        border-top: 1px solid var(--border-color, rgba(26, 26, 26, 0.14));
    }

    .service-item {
        display: grid;
        grid-template-columns: 2.1rem minmax(0, 1fr);
        gap: 0.2rem 0.55rem;
        padding: 1rem 0;
        border: 0;
        border-bottom: 1px solid var(--border-color, rgba(26, 26, 26, 0.14));
        border-radius: 0;
        background: transparent;
    }

    .service-number {
        padding-top: 0.15rem;
        color: var(--accent-terracotta);
        font-size: 0.72rem;
    }

    .service-title {
        font-size: clamp(1.05rem, 4.8vw, 1.35rem);
        line-height: 1.2;
    }

    .service-desc {
        grid-column: 2;
        margin: 0.1rem 0 0;
        color: var(--text-muted);
        font-size: 0.84rem;
        line-height: 1.45;
    }

    .gallery {
        height: auto;
        overflow: visible;
        padding: var(--m-section-space) 0;
    }

    .gallery .container { margin-bottom: 1.4rem; }

    .gallery-wrapper {
        display: flex;
        gap: 0.85rem;
        width: 100%;
        margin: 0;
        padding: 0 var(--m-gutter) 0.4rem;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x mandatory;
        scroll-padding-inline: var(--m-gutter);
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .gallery-wrapper::-webkit-scrollbar { display: none; }

    .gallery-item {
        flex: 0 0 min(80vw, 320px);
        width: auto;
        height: auto;
        aspect-ratio: 4 / 5;
        max-height: none;
        scroll-snap-align: start;
        border-radius: 4px;
    }

    .gallery-caption {
        right: 0.75rem;
        bottom: 0.75rem;
        left: 0.75rem;
        padding: 0.5rem 0.65rem;
        border-radius: 2px;
        font-size: 0.7rem;
        line-height: 1.35;
    }

    .process-grid {
        grid-template-columns: 1fr;
        gap: 0;
        border-top: 1px solid var(--border-color, rgba(26, 26, 26, 0.14));
    }

    .process-step {
        padding: 1.2rem 0;
        border-bottom: 1px solid var(--border-color, rgba(26, 26, 26, 0.14));
    }

    .process-title { font-size: var(--m-heading-md); }
    .process-desc { font-size: 0.88rem; line-height: 1.5; }
    .testimonial-quote { font-size: clamp(1.05rem, 4.9vw, 1.4rem); line-height: 1.38; }

    /* Main editorial pages */
    .about-hero,
    .services-hero,
    .areas-hero,
    .contact-hero {
        min-height: 0;
        padding-top: calc(var(--nav-height) + env(safe-area-inset-top) + 3rem);
        padding-bottom: 3rem;
    }

    .about-hero-stage,
    .services-hero-body,
    .hero-areas-stage,
    .areas-hero-grid,
    .hero-horizon-layout,
    .location-editorial-grid,
    .location-stage-grid,
    .prep-grid,
    .region-content,
    .finishes-narrative-grid,
    .prep-narrative-stage,
    .commercial-grid-stage,
    .spec-services-grid,
    .maintenance-fleet-row,
    .chapter-layout-grid,
    .chapter-layout-grid.reverse,
    .standards-grid,
    .editorial-gallery-grid,
    .architectural-quadrant-grid,
    .commercial-photos-asymmetric,
    .regional-diagram-stage,
    .colour-consult-strip {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .about-hero-title,
    .services-hero-headline,
    .areas-display-title,
    .hero-display-title {
        font-size: var(--m-heading-xl);
        line-height: 1.08;
        margin-bottom: 1rem;
    }

    .about-hero-title .title-line span,
    .services-hero-headline .hero-line span,
    .areas-display-title .title-line span,
    .hero-display-title .title-line span {
        transform: none;
    }

    .about-hero-subtitle,
    .hero-intro-lead,
    .areas-hero-lead,
    .hero-editorial-copy {
        max-width: 38rem;
        margin-bottom: 0;
        font-size: 0.96rem;
        line-height: 1.52;
    }

    .hero-stats-row {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1rem;
        padding-top: 1rem;
    }

    .stat-item .stat-val { font-size: 1rem; }
    .stat-item .stat-lbl { font-size: 0.65rem; }

    .about-hero-visual,
    .hero-image-frame,
    .hero-image-crop,
    .hero-areas-photo,
    .hero-architectural-slice,
    .prep-visual,
    .chapter-visual-col {
        width: 100%;
        height: auto;
        max-height: none;
        aspect-ratio: 16 / 10;
        border-radius: 4px;
    }

    .about-hero-visual,
    .hero-image-frame { aspect-ratio: 4 / 3; }

    .hero-editorial-top {
        display: grid;
        gap: 0.35rem;
        margin-bottom: 1.7rem;
        padding-bottom: 1rem;
    }

    .hero-trust-micro { color: var(--text-muted); }

    .services-ribbon-wrap { padding: 0.85rem 0; }
    .ribbon-track { font-size: 0.69rem; gap: 0.85rem; }

    .finishes-hero-visual {
        height: auto;
        min-height: 0;
        margin-bottom: 1.6rem;
        aspect-ratio: 4 / 3;
        border-radius: 4px;
    }

    .finish-block,
    .standard-column,
    .supporting-prep-item {
        padding-top: 1rem;
    }

    .finish-block h3,
    .prep-main-column h3,
    .chapter-title,
    .location-headline-unit h3,
    .human-step-heading {
        font-size: var(--m-heading-md);
        line-height: 1.2;
    }

    .finish-block p,
    .prep-main-column p,
    .prep-copy p,
    .region-copy p,
    .chapter-desc,
    .location-headline-unit p,
    .human-step-sub {
        font-size: 0.9rem;
        line-height: 1.52;
    }

    .swatches-grid,
    .colour-palette-sample { grid-template-columns: repeat(2, minmax(0, 1fr)); }

    .svg-diagram-wrapper {
        height: clamp(260px, 52svh, 340px);
        padding: 1rem;
    }

    .regional-svg { min-width: 0; }
    .svg-path-line { stroke-dashoffset: 0; }
    .svg-node-label { font-size: 10px; }
    .diagram-copy-block { gap: 1rem; }
    .diagram-copy-block h3 { font-size: var(--m-heading-md); }
    .diagram-copy-block p { font-size: 0.9rem; line-height: 1.52; }

    .journey-chapter { padding: 0; }
    .chapter-visual-col { order: initial; }

    .hero-direct-call-block { gap: 0.4rem; padding-top: 1rem; }
    .direct-call-num { font-size: clamp(1.6rem, 7vw, 2.25rem); }
    .direct-email-link { font-size: 0.92rem; }

    .photo-break-section {
        height: min(320px, 48svh);
        padding: 0;
    }

    .photo-break-overlay {
        right: var(--m-gutter-end);
        bottom: 1rem;
        left: var(--m-gutter);
        max-width: none;
        padding: 0.65rem 0.8rem;
        font-size: 0.72rem;
    }

    .service-typeset-grid,
    .form-fields-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .service-typeset-grid { border-right: 1px solid var(--border-color); }
    .service-typeset-row { border-right: 0; }
    .service-typeset-label { min-height: 50px; padding: 0.85rem 0.9rem; font-size: 0.88rem; }

    .human-form-section { margin-bottom: 2.5rem; }
    .editorial-field-wrap { padding: 1rem 0; }
    .editorial-input,
    textarea.editorial-input,
    select.editorial-input {
        min-height: 48px;
        font-size: 16px;
    }

    .quote-action-horizon {
        align-items: stretch;
        flex-direction: column;
        gap: 1rem;
    }

    .quote-action-horizon .cta-button { width: 100%; max-width: none; }

    .map-viewport-frame,
    .google-map-frame {
        height: min(280px, 42svh);
        min-height: 220px;
        border-radius: 4px;
    }

    .map-viewport-frame iframe,
    .google-map-frame iframe { touch-action: pan-y; }

    .map-external-row { justify-content: flex-start; }

    /* Shared child landing pages */
    .child-breadcrumb-wrap {
        padding-top: calc(var(--nav-height) + env(safe-area-inset-top) + 1.15rem);
        padding-bottom: 0.5rem;
    }

    .child-breadcrumb-list { font-size: 0.72rem; gap: 0.35rem; }
    .child-hero { padding-top: 1.25rem; padding-bottom: 2.6rem; }

    .child-hero-grid,
    .child-narrative-grid,
    .child-grid-2,
    .child-grid-3,
    .child-footer-grid {
        grid-template-columns: 1fr;
        gap: 1.1rem;
    }

    .child-hero-title {
        margin-bottom: 0.85rem;
        font-size: var(--m-heading-lg);
        line-height: 1.15;
    }

    .child-hero-lead,
    .child-narrative-copy p { font-size: 0.92rem; line-height: 1.52; }
    .child-hero-badges { gap: 0.65rem 1rem; padding-top: 0.9rem; }
    .child-hero-badge { font-size: 0.72rem; }
    .child-photo-frame { max-height: none; margin-top: 0.2rem; aspect-ratio: 4 / 3; }
    .child-section { padding: 3rem 0; }
    .child-section-header { margin-bottom: 1.4rem; }
    .child-section-title { font-size: var(--m-heading-md); }
    .child-card,
    .child-related-card,
    .child-standard-item { padding: 1.15rem; }
    .child-card-title,
    .child-related-title { font-size: 1rem; }
    .child-card-desc,
    .child-related-desc,
    .child-standard-item p { font-size: 0.84rem; }
    .child-cta-section { padding: 3rem 0; }
    .child-cta-card { padding: 2rem 1.15rem; border-radius: 4px; }
    .child-cta-title { font-size: var(--m-heading-md); }
    .child-cta-desc { font-size: 0.9rem; line-height: 1.5; }
    .child-cta-buttons { align-items: stretch; flex-direction: column; gap: 0.7rem; }
    .child-btn-primary,
    .child-btn-secondary { width: 100%; }

    /* Footers */
    .footer,
    .child-footer {
        padding-top: 3.4rem;
        padding-bottom: calc(1.5rem + env(safe-area-inset-bottom));
    }

    .footer-cta { margin-bottom: 2.8rem; }
    .footer-cta h2 { margin-bottom: 1.15rem; }
    .footer .cta-group { display: grid !important; width: 100%; gap: 0.65rem !important; }
    .footer .cta-group .cta-button { width: 100%; max-width: none; }
    .footer-bottom,
    .child-footer-bottom {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.8rem;
        font-size: 0.75rem;
        line-height: 1.5;
        text-align: left;
    }

    .footer-location,
    .child-footer-bottom > div { overflow-wrap: anywhere; }
    .glass-credit { padding: 0.4rem 0.8rem; }
    .child-footer-grid { gap: 1.9rem; }
    .child-footer-links-dual { grid-template-columns: repeat(2, minmax(0, 1fr)); }

    /* Mobile motion only uses opacity and transforms; content is visible by default. */
    .mobile-reveal-ready {
        will-change: transform, opacity;
    }
}

@media (max-width: 360px) {
    :root {
        --m-gutter: max(1rem, env(safe-area-inset-left));
        --m-gutter-end: max(1rem, env(safe-area-inset-right));
    }

    .nav-logo-img { max-width: 90px; }
    .nav-quote-btn { padding-inline: 0.55rem; font-size: 0.61rem; }
    .mobile-link { font-size: 1.2rem; }
    .hero-title { font-size: 1.9rem; }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
