/*
 * Shared responsive safeguards for Spade Cleaning.
 * Loaded after each page's existing styles so the current visual design stays
 * intact while rigid viewport, grid, media, and navigation sizing can adapt.
 */

html {
    width: 100%;
    max-width: 100%;
    overflow-x: clip;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    width: 100% !important;
    max-width: 100%;
    overflow-x: clip !important;
}

@supports not (overflow: clip) {
    html,
    body {
        overflow-x: hidden !important;
    }
}

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

img,
video {
    height: auto;
}

input,
select,
textarea {
    max-width: 100%;
    min-width: 0;
}

button {
    min-width: 0;
}

.main-nav-bar,
.main-nav,
.nav-item,
.quote-wrap,
.hero-content,
.svc-hero-content,
.comp-left,
.comp-right,
.comp-card-text,
.about-col,
.standard-editorial-grid > *,
.dual-grid > *,
.hiw-grid > *,
.ba-wrapper > *,
.promise-banner > *,
.footer-top > *,
.form-grid > *,
.radio-grid > *,
.realistic-services-grid > * {
    min-width: 0;
}

.contact-item,
.contact-item a,
.footer-copy,
main a,
main p {
    overflow-wrap: anywhere;
}

.footer-search {
    width: min(100%, 340px) !important;
}

.footer-brand .logo {
    width: min(300px, 100%) !important;
    max-width: 100%;
    overflow: visible;
}

.footer-brand .logo img {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    transform: none !important;
}

.home-page .footer-brand .logo {
    width: min(220px, 100%) !important;
}

.footer-copyright-right {
    flex-wrap: wrap;
    justify-content: inherit;
}

/* Keep the full desktop header, but make its three regions genuinely flexible. */
@media (min-width: 1101px) and (max-width: 1320px) {
    .main-nav-bar {
        padding-inline: clamp(1.25rem, 3vw, 2.5rem) !important;
        gap: clamp(0.75rem, 1.8vw, 1.5rem) !important;
    }

    .site-logo {
        width: clamp(175px, 17vw, 220px) !important;
        min-width: clamp(175px, 17vw, 220px) !important;
    }

    .site-logo img {
        width: clamp(165px, 16vw, 205px) !important;
        max-width: 100%;
    }

    .nav-separator {
        margin-left: 0 !important;
    }

    .main-nav {
        gap: clamp(1rem, 2.25vw, 2.25rem) !important;
    }

    .nav-link {
        font-size: clamp(0.76rem, 1vw, 0.86rem) !important;
        letter-spacing: clamp(1px, 0.12vw, 1.45px) !important;
    }

    .quote-wrap {
        width: auto !important;
        min-width: 0 !important;
    }

    .quote-wrap .btn-gold {
        padding-inline: clamp(0.85rem, 1.5vw, 1.25rem) !important;
    }
}

/* Responsive navigation. The existing links and styling are reused verbatim. */
.mobile-menu-toggle {
    display: none;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    padding: 0;
    border: 1px solid rgba(212, 175, 55, 0.55);
    border-radius: 4px;
    background: rgba(8, 27, 58, 0.72);
    color: #f3d472;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.16);
}

.mobile-menu-toggle span {
    width: 20px;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
    transition: transform 0.25s ease, opacity 0.2s ease;
}

.mobile-menu-toggle[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.mobile-menu-toggle[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 1100px) {
    #left-sidebar {
        display: none !important;
    }

    #top-header-wrapper.scrolled {
        transform: translateY(0) !important;
    }

    footer {
        padding-left: 0 !important;
    }

    .top-service-bar {
        display: none !important;
    }

    .main-nav-bar {
        height: 72px !important;
        padding-inline: clamp(0.75rem, 3.5vw, 1.5rem) !important;
        gap: clamp(0.45rem, 2vw, 0.85rem) !important;
    }

    .nav-separator {
        display: none !important;
    }

    .site-logo {
        width: auto !important;
        min-width: 0 !important;
        height: auto !important;
        flex: 1 1 auto;
        overflow: visible;
    }

    .site-logo img {
        width: clamp(145px, 25vw, 180px) !important;
        max-width: 100%;
        max-height: 48px !important;
        transform: none !important;
    }

    .quote-wrap {
        width: auto !important;
        min-width: 0 !important;
        flex: 0 0 auto;
    }

    .quote-wrap .btn-gold {
        min-height: 42px;
        padding: 0.65rem clamp(0.7rem, 2vw, 1rem) !important;
        font-size: clamp(0.7rem, 1.7vw, 0.8rem) !important;
        letter-spacing: 0.45px !important;
        white-space: nowrap;
    }

    .mobile-menu-toggle {
        display: inline-flex;
        order: 2;
    }

    .quote-wrap {
        order: 3;
    }

    .main-nav {
        position: absolute !important;
        top: 100%;
        left: 0;
        right: 0;
        z-index: 1200;
        display: flex !important;
        flex: none !important;
        width: 100% !important;
        height: auto !important;
        max-height: calc(100svh - 72px);
        max-height: calc(100dvh - 72px);
        margin: 0 !important;
        padding: 0.65rem clamp(0.75rem, 4vw, 1.5rem) 1rem;
        gap: 0 !important;
        flex-direction: column;
        align-items: stretch !important;
        justify-content: flex-start !important;
        overflow-y: auto;
        overscroll-behavior: contain;
        background: rgba(5, 14, 26, 0.98);
        border-bottom: 1px solid rgba(212, 175, 55, 0.4);
        box-shadow: 0 22px 40px rgba(0, 0, 0, 0.3);
        opacity: 0;
        visibility: hidden;
        pointer-events: none !important;
        transform: translateY(-0.75rem);
        transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s;
    }

    .main-nav.is-open {
        opacity: 1;
        visibility: visible;
        pointer-events: auto !important;
        transform: translateY(0);
    }

    .main-nav .nav-item {
        display: block;
        width: 100%;
        height: auto;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    }

    .main-nav .nav-link {
        width: 100%;
        min-height: 48px;
        padding: 0.85rem 0.35rem !important;
        justify-content: space-between;
        font-size: 0.82rem !important;
    }

    .main-nav .nav-link::after {
        bottom: 0.35rem;
    }

    .main-nav .dropdown-arrow {
        display: none;
    }

    .main-nav .dropdown-menu {
        position: static !important;
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
        min-width: 0 !important;
        margin: 0 0 0.65rem;
        padding: 0.25rem;
        border: 1px solid rgba(212, 175, 55, 0.18);
        border-top: 1px solid rgba(212, 175, 55, 0.32);
        border-radius: 4px;
        background: rgba(255, 255, 255, 0.05);
        box-shadow: none;
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
        transform: none !important;
    }

    .main-nav .dropdown-menu::before,
    .main-nav .dropdown-menu::after {
        display: none;
    }

    .main-nav .dropdown-menu a {
        min-width: 0;
        padding: 0.75rem !important;
        color: rgba(255, 255, 255, 0.78);
        border-color: rgba(255, 255, 255, 0.08);
        font-size: 0.8rem;
        overflow-wrap: anywhere;
    }

    .main-nav .dropdown-menu a:hover {
        color: #f3d472;
        background: rgba(212, 175, 55, 0.08);
    }
}

@media (max-width: 480px) {
    .main-nav-bar {
        padding-inline: 0.65rem !important;
        gap: 0.4rem !important;
    }

    .site-logo img {
        width: clamp(112px, 34vw, 145px) !important;
    }

    .mobile-menu-toggle {
        width: 40px;
        height: 40px;
        flex-basis: 40px;
    }

    .quote-wrap .btn-gold {
        min-height: 40px;
        padding-inline: 0.6rem !important;
        font-size: 0.68rem !important;
    }

    .main-nav .dropdown-menu {
        grid-template-columns: 1fr;
    }
}

/* Shared sections and grids */
.svc-hero {
    height: auto !important;
    min-height: 100vh;
    min-height: 100svh;
    padding-top: clamp(7rem, 14vh, 10rem) !important;
    padding-bottom: clamp(4rem, 9vh, 7rem) !important;
}

.svc-hero h1 {
    overflow-wrap: anywhere;
}

.dual-section,
.standard-section,
.positions-section,
.apply-section,
.how-it-works,
.ba-section {
    padding-top: clamp(4rem, 8vw, 8rem) !important;
    padding-bottom: clamp(4rem, 8vw, 8rem) !important;
}

.dual-section,
.standard-section,
.positions-section,
.apply-section,
.how-it-works {
    padding-inline: clamp(1rem, 5.25vw, 5.25%) !important;
}

.ba-container {
    padding-inline: clamp(1rem, 5.25vw, 5.25%) !important;
}

.ba-wrapper,
.ba-side,
.ba-thumb-row {
    min-width: 0;
}

.ba-main {
    width: 100%;
    max-width: 100%;
}

.ba-thumb-row .ba-thumb {
    min-width: 0;
}

.promise-banner-logo img {
    max-width: 100% !important;
}

@media (hover: none), (pointer: coarse) {
    .dual-content {
        transform: none !important;
    }

    .dual-list {
        opacity: 1 !important;
    }
}

@media (max-width: 1024px) {
    .ba-main {
        height: auto !important;
        min-height: 300px;
        aspect-ratio: 4 / 3;
    }

    .ba-side {
        width: 100% !important;
    }

    .dual-card {
        height: auto !important;
        min-height: clamp(420px, 58vw, 520px);
    }

    .dual-content {
        padding: clamp(1.5rem, 5vw, 2.5rem) !important;
        transform: none !important;
    }

    .dual-list {
        opacity: 1 !important;
    }
}

@media (max-width: 700px) {
    .svc-hero {
        padding: calc(72px + 3rem) 1rem 4rem !important;
        text-align: center;
    }

    .svc-hero-content {
        width: 100%;
        margin-inline: auto;
    }

    .svc-hero h1 {
        font-size: clamp(2.25rem, 11vw, 3.5rem) !important;
        line-height: 1.08 !important;
    }

    .svc-hero-desc {
        font-size: clamp(1rem, 4.2vw, 1.15rem) !important;
        line-height: 1.55 !important;
        margin-inline: auto;
        margin-bottom: 2rem !important;
    }

    .hero-signature {
        align-items: center;
        margin-top: 2rem !important;
    }

    .signature-text {
        font-size: clamp(1.8rem, 9vw, 2.5rem) !important;
    }

    .section-header {
        margin-bottom: clamp(2.5rem, 10vw, 4rem) !important;
    }

    .section-title,
    .how-it-works h2 {
        font-size: clamp(2rem, 9vw, 2.7rem) !important;
    }

    .std-item {
        gap: 1rem !important;
    }

    .std-num,
    .hiw-step-number {
        font-size: clamp(2.75rem, 14vw, 3.5rem) !important;
    }

    .ba-thumb-row {
        gap: 0.5rem !important;
    }

    .ba-thumb-row .ba-thumb-label {
        padding-inline: 0.25rem;
        font-size: 0.68rem !important;
        white-space: normal !important;
        line-height: 1.15;
    }

    .promise-banner {
        flex-direction: column;
        gap: 1.25rem !important;
        padding: 2rem 1rem !important;
        text-align: center;
    }

    .promise-banner-logo {
        width: min(230px, 72vw) !important;
        flex: 0 0 auto !important;
    }

    .promise-banner-text {
        width: 100%;
        align-items: center !important;
    }

    .promise-copy,
    .promise-banner-text p,
    .promise-banner-text .promise-copy {
        font-size: clamp(1rem, 4.2vw, 1.15rem) !important;
        text-align: center;
    }
}

@media (max-height: 560px) {
    .svc-hero {
        min-height: 100svh;
        padding-top: calc(72px + 2rem) !important;
        padding-bottom: 2.5rem !important;
    }
}

/* Homepage: retain slide snapping on larger screens; use natural document
   scrolling on phones/tablets so no slide has to hide content to fit 100vh. */
@media (min-width: 901px) and (max-width: 1024px) {
    #slider-container .about-slide {
        justify-content: flex-start;
        overflow-y: auto !important;
        overscroll-behavior-y: contain;
    }
}

@media (max-width: 900px) {
    body.home-page,
    html.home-page {
        height: auto !important;
        min-height: 100%;
        overflow-y: auto !important;
        touch-action: pan-y !important;
        overscroll-behavior-y: auto !important;
    }

    #slider-container {
        display: block !important;
        width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
        transform: none !important;
        will-change: auto !important;
    }

    #slider-container .slide {
        width: 100% !important;
        height: auto !important;
        min-height: 0;
        flex: none !important;
        overflow: visible !important;
    }

    #slider-container .hero {
        min-height: 100vh;
        min-height: 100svh;
        padding: 72px 1rem 2.5rem;
        overflow: hidden !important;
    }

    .hero-content {
        padding-inline: 0 !important;
    }

    .hero h1 {
        font-size: clamp(2rem, 9vw, 3rem) !important;
        line-height: 1.08 !important;
        overflow-wrap: anywhere;
    }

    .hero h1 span {
        display: block;
    }

    .hero-desc {
        font-size: clamp(1rem, 4.2vw, 1.15rem) !important;
        line-height: 1.55;
    }

    .comp-container {
        display: block !important;
        width: 100%;
        height: auto !important;
        min-height: 0 !important;
        overflow: visible !important;
    }

    .comp-left {
        width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
        padding: clamp(2.5rem, 9vw, 4rem) 0 2rem !important;
    }

    .comp-list {
        flex: none !important;
        overflow: visible !important;
        padding-inline: clamp(0.75rem, 4vw, 1.25rem) !important;
    }

    .comp-card {
        min-height: 76px !important;
        transform: none;
    }

    .comp-card.active {
        transform: none !important;
    }

    .comp-right {
        display: none !important;
    }

    .mobile-cta {
        display: block !important;
        padding-inline: clamp(0.75rem, 4vw, 1.25rem) !important;
    }

    .about-slide {
        display: flex !important;
        overflow: visible !important;
    }

    .about-content-wrapper {
        flex: none !important;
        padding: clamp(4rem, 12vw, 6rem) 1rem 3rem !important;
        gap: 1.5rem !important;
    }

    .about-container {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 2.5rem !important;
    }

    .about-container .about-col {
        display: flex !important;
        margin-left: 0 !important;
    }

    .about-col h2 {
        font-size: clamp(2rem, 9vw, 2.6rem) !important;
    }

    .about-col p,
    .custom-list li {
        font-size: clamp(0.92rem, 3.8vw, 1rem) !important;
        line-height: 1.55 !important;
    }

    .two-col-list {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    .two-col-list > [style*="grid-column"] {
        grid-column: auto !important;
    }

    #slider-container .final-slide {
        display: block !important;
        overflow: visible !important;
    }

    #slider-container .how-it-works {
        min-height: 0;
    }
}

/* About page */
@media (min-width: 1025px) and (max-width: 1400px) {
    .home-page .about-container .about-col:first-child,
    .home-page .about-container .about-col:last-child,
    .about-page-section .about-container .about-col:first-child,
    .about-page-section .about-container .about-col:last-child {
        margin-left: 0 !important;
    }
}

@media (max-width: 1024px) {
    .about-page-section .about-content-wrapper {
        padding: calc(72px + clamp(3rem, 8vw, 6rem)) clamp(1rem, 5vw, 3rem) 4rem !important;
    }

    .about-page-section .about-container {
        gap: 2.5rem !important;
    }

    .about-page-section .about-col h2 {
        font-size: clamp(2rem, 7vw, 2.8rem) !important;
    }
}

@media (max-width: 768px) {
    .about-page-section .two-col-list > [style*="grid-column"] {
        grid-column: auto !important;
    }

    .back-button-container {
        margin-top: 2rem !important;
    }
}

/* Quote page */
.quote-wrapper,
.quote-footer,
.page-transition {
    width: 100% !important;
    max-width: 100%;
}

@media (max-width: 1100px) {
    .quote-wrapper {
        display: block !important;
        min-height: 0 !important;
    }

    .sidebar-panel {
        position: relative !important;
        width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
        padding: clamp(2rem, 7vw, 3rem) clamp(1rem, 5vw, 2.5rem) !important;
        border-right: 0 !important;
        border-bottom: 4px solid var(--secondary);
        overflow: hidden;
    }

    .sidebar-bottom-img {
        position: relative !important;
        height: clamp(220px, 42vw, 320px) !important;
        margin-top: 2rem;
    }

    .form-panel {
        width: 100% !important;
        margin-left: 0 !important;
        padding: clamp(2.5rem, 7vw, 4rem) clamp(1rem, 5vw, 4rem) !important;
    }

    .form-grid {
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 0 !important;
    }

    .radio-grid {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    .realistic-services-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

@media (min-width: 1101px) and (max-height: 760px) {
    .sidebar-panel {
        padding: 1.5rem 2rem !important;
        overflow-y: auto !important;
    }

    .sidebar-panel .sidebar-logo {
        max-width: 110px !important;
        margin-bottom: 1.25rem !important;
    }

    .sidebar-title {
        font-size: 1.8rem !important;
        margin-bottom: 1rem !important;
    }

    .sidebar-text {
        padding-bottom: 34vh;
        font-size: 0.92rem !important;
        line-height: 1.5 !important;
    }

    .sidebar-bottom-img {
        height: 34vh !important;
    }
}

@media (max-width: 600px) {
    .form-section {
        padding: clamp(1.25rem, 6vw, 2rem) !important;
    }

    .form-header {
        margin-bottom: 2rem !important;
    }

    .form-header h2,
    .sidebar-title {
        font-size: clamp(1.8rem, 9vw, 2.2rem) !important;
    }

    .realistic-services-grid {
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 1rem !important;
    }

    input,
    select,
    textarea {
        font-size: 16px !important;
    }
}

@media (min-width: 601px) and (max-width: 768px) {
    .realistic-services-grid {
        grid-template-columns: minmax(0, 1fr) !important;
    }
}

/* Careers form and accordion */
.role-info,
.file-upload-wrapper,
.file-name {
    min-width: 0;
}

.accordion-header {
    gap: 1rem;
}

.accordion-icon {
    flex: 0 0 30px;
}

.file-custom-btn {
    flex: 0 0 auto;
    white-space: nowrap;
}

.file-name {
    flex: 1 1 auto;
    max-width: none !important;
}

@media (max-width: 600px) {
    .apply-section {
        padding-inline: 1rem !important;
    }

    .form-container {
        padding: clamp(1.5rem, 7vw, 2.5rem) clamp(1rem, 5vw, 1.5rem) !important;
    }

    .job-details {
        padding: 1.25rem 1rem !important;
    }
}

@media (max-width: 360px) {
    .file-upload-wrapper {
        align-items: stretch !important;
        flex-direction: column;
        gap: 0.75rem;
    }

    .file-name {
        margin-left: 0 !important;
    }
}

/* Footer tracks need to collapse before their declared minimums exceed a
   1024px-wide viewport. */
@media (max-width: 1180px) {
    .footer-top {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: clamp(2rem, 5vw, 3.5rem) !important;
    }
}

@media (max-width: 640px) {
    .footer-top {
        grid-template-columns: minmax(0, 1fr) !important;
        padding-inline: 1rem !important;
        text-align: center;
    }

    .footer-col {
        align-items: center;
    }

    .footer-copyright {
        flex-direction: column;
        gap: 1rem;
        padding-inline: 1rem !important;
        text-align: center;
    }

    .footer-copyright-right {
        justify-content: center;
    }

    .contact-item {
        justify-content: center;
        text-align: center;
    }
}

/* Legal pages and transition overlays */
.transition-logo-img {
    width: min(250px, 80vw) !important;
}

#global-curtain img {
    width: min(220px, 80vw) !important;
}

.loader-track,
.curtain-loader-track {
    width: min(220px, 70vw) !important;
}

.page-transition,
#global-curtain,
#dynamic-curtain {
    height: 100vh;
    height: 100dvh !important;
}

#dynamic-curtain img {
    width: min(250px, 80vw) !important;
    height: auto !important;
}

#dynamic-curtain [style*="width: 220px"] {
    width: min(220px, 70vw) !important;
}

@media (max-width: 768px) {
    main h2 {
        font-size: clamp(2rem, 9vw, 4rem);
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
    }
}
