/* =================================================================== */
/*    PARTIAL: RESPONSIVE                                              */
/*    Contains: All @media queries for adjusting the layout on         */
/*    different screen sizes. MUST BE THE LAST PARTIAL IMPORTED.       */
/* =================================================================== */

@media (min-width: 450px) {

    /* Hide the pill list by default (Mobile/Tablet) */
    .filter-list {
      display: none !important;
    }

    /* Ensure the dropdown is the default for mobile */
    .filter-select-box {
      display: block;
    }  

    .clients-item {
      min-width: calc(33.33% - 10px);
    }

    .mobile-hidden {
        display: inline; /* Or 'block', depending on the element */
    }

    .pagination-link {
        padding: 8px 14px;
    }
}

@media (min-width: 580px) {

    /* Hide the pill list by default (Mobile/Tablet) */
    .filter-list {
      display: none !important;
    }

    /* Ensure the dropdown is the default for mobile */
    .filter-select-box {
      display: block;
    }  

    :root {
        --fs1: 32px;
        --fs2: 24px;
        --fs3: 26px;
        --fs4: 18px;
        --fs6: 15px;
        --fs7: 15px;
        --fs8: 12px;
    }

    .sidebar, article {
        width: 520px;
        margin-inline: auto;
        padding: 30px;
    }

    .article-title {
        font-weight: var(--fw600);
        padding-bottom: 15px;
    }

    .article-title::after {
        width: 40px;
        height: 5px;
    }

    .icon-box {
        width: 48px;
        height: 48px;
        border-radius: 12px;
        font-size: 18px;
    }

    main {
        margin-top: 60px;
        margin-bottom: 100px;
    }

    .sidebar {
        max-height: 180px;
        margin-bottom: 30px;
    }

    .sidebar.active {
      max-height: 720px;
    }

    .sidebar-info {
      gap: 25px;
    }

    .avatar-box {
      border-radius: 30px;
    }
    .avatar-box img {
      width: 120px;
    }

    .info-content .name {
      margin-bottom: 15px;
    }
    .info-content .title {
      padding: 5px 10px;
    }

    .info-more-btn {
        top: -30px;
        right: -30px;
        padding: 10px 15px;
    }

    .info-more-btn span {
        display: block;
        font-size: var(--fs8);
    }

    .info-more-btn ion-icon {
      display: none;
    }

    .separator {
      margin: 32px 0;
    }

    .contacts-list {
      gap: 20px;
    }

    .contact-info {
        max-width: calc(100% - 64px);
        width: calc(100% - 64px);
    }

    .navbar {
      border-radius: 20px 20px 0 0;
    }

    .navbar-list {
      gap: 20px;
    }
    .navbar-link {
      --fs8: 14px;
    }

    .about .article-title {
      margin-bottom: 20px;
    }
    .about-text {
      margin-bottom: 40px;
    }

    .service-item {
        display: flex;
        justify-content: flex-start;
        align-items: flex-start;
        gap: 18px;
        padding: 30px;
    }

    .service-icon-box {
        margin-bottom: 0;
        margin-top: 5px;
    }

    .service-content-box {
      text-align: left;
    }

    .testimonials-title {
      margin-bottom: 25px;
    }

    .testimonials-list {
        gap: 30px;
        margin: 0 -30px;
        padding: 30px;
        padding-bottom: 35px;
    }

    .content-card {
        padding: 30px;
        padding-top: 25px;
    }

    .testimonials-avatar-box {
        transform: translate(30px, -30px);
        border-radius: 28px;
    }

    .testimonials-avatar-box img {
      width: 80px;
    }

    .testimonials-item-title {
        margin-bottom: 10px;
        margin-left: 95px;
    }

    .testimonials-text {
        line-clamp: 2;
        -webkit-line-clamp: 2;
    }

    .modal-container {
      padding: 20px;
    }

    .testimonials-modal {
        display: flex;
        justify-content: flex-start;
        align-items: stretch;
        gap: 25px;
        padding: 30px;
        border-radius: 20px;
    }

    .modal-img-wrapper {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .modal-avatar-box {
        border-radius: 18px;
        margin-bottom: 0;
    }

    .modal-avatar-box img {
      width: 65px;
    }

    .modal-img-wrapper > img {
        display: block;
        position: relative;
        width: 35px;
        top: 50px;
    }
    
    .project-modal {
        padding: 30px;
    }

    .clients-list {
        gap: 25px;
        margin: 0 -30px;
        padding: 20px 45px;
        scroll-padding-inline: 45px;
    }

    .clients-item {
      min-width: calc(33.33% - 35px);
    }

    .timeline-list {
      margin-left: 65px;
    }

    .timeline-item:not(:last-child)::before {
      left: -40px;
    }

    .timeline-item::after {
        height: 8px;
        width: 8px;
        left: -43px;
    }

    .skills-item:not(:last-child) {
      margin-bottom: 25px;
    }

    .project-img, .blog-banner-box {
      border-radius: 16px;
    }

    .blog-posts-list {
      gap: 30px;
    }

    .blog-content {
      padding: 25px;
    }

/* Tablet Logic: Keep using default mobile behavior (Dropdown) */
    .filter-select-box {
        display: block;
    }

    .mapbox {
        height: 380px;
        border-radius: 18px;
    }

    .input-wrapper {
        gap: 30px;
        margin-bottom: 30px;
    }

    .form-input {
      padding: 15px 20px;
    }

    textarea.form-input {
      margin-bottom: 30px;
    }

    .form-btn {
        --fs-6: 16px;
        padding: 16px 20px;
    }

    .form-btn ion-icon {
      font-size: 18px;
    }
}

@media (min-width: 768px) {

      /* Hide the pill list by default (Mobile/Tablet) */
    .filter-list {
      display: none !important;
    }

    /* Ensure the dropdown is the default for mobile */
    .filter-select-box {
      display: block;
    }  

    .sidebar, article {
      width: 700px;
    }

    .has-scrollbar::-webkit-scrollbar-button {
      width: 100px;
    }

    .contacts-list {
        grid-template-columns: 1fr 1fr;
        gap: 30px 15px;
    }

    .navbar-link {
      --fs8: 15px;
    }

    .testimonials-modal {
        gap: 35px;
        max-width: 680px;
    }

    .modal-avatar-box img {
      width: 80px;
    }

    .article-title {
      padding-bottom: 20px;
    }

    /* .filter-select-box and .filter-list rules removed from here */

    .filter-item button {
        color: var(--light-gray);
        font-size: var(--fs5);
        transition: var(--transition1);
    }

    .filter-item button:hover {
      color: var(--light-gray70);
    }
    .filter-item button.active {
      color: var(--orange-yellow-crayola);
    }

    .project-list, .blog-posts-list {
      grid-template-columns: 1fr 1fr;
    }

    .input-wrapper {
      grid-template-columns: 1fr 1fr;
    }

    .form-btn {
        width: max-content;
        margin-left: auto;
    }
}

@media (min-width: 1024px) {

    :root {
        --shadow1: -4px 8px 24px hsla(0, 0%, 0%, .125);
        --shadow2: 0px 16px 30px hsla(0, 0%, 0%, .125);
        --shadow3: 0px 16px 40px hsla(0, 0%, 0%, .125);
    }

    .sidebar, article {
        width: 950px;
        box-shadow: var(--shadow5);
    }

    main {
      margin-bottom: 60px;
    }

    .main-content {
        position: relative;
        width: max-content;
        margin: auto;
    }

    .navbar {
        position: absolute;
        bottom: auto;
        top: 0;
        left: auto;
        right: 0;
        width: max-content;
        border-radius: 0 20px;
        padding: 0 20px;
        box-shadow: none;
    }

    .navbar-list {
        gap: 30px;
        padding: 0 20px;
    }

    .navbar-link {
      font-weight: var(--fw500);
    }

    .main-content > article {
      padding-top: 80px;
    }
    
    .service-list {
        grid-template-columns: 1fr 1fr;
        gap: 20px 25px;
    }

    .testimonials-item {
      min-width: calc(50% - 15px);
    }

    .modal-img-wrapper > img {
      top: 20px;
    }

    .clients-item {
      min-width: calc(25% - 15px);
    }

    .project-list {
      grid-template-columns: repeat(3, 1fr);
    }

    .blog-banner-box {
      height: 230px;
    }

    /* --- THE SWAP LOGIC --- */
    /* On Desktop: Show Pills, Hide Dropdown */
/* Desktop Swap: Show Pill Grid, Hide Dropdown */
    .filter-list {
      display: flex !important; /* Overrides the 'none' from _pages.css */
    }

    .filter-select-box {
      display: none !important;
    }
    
    /* Show cursor toggler on desktop */
    button[data-cursor-toggler] {
        display: flex;
    }

}

@media (min-width: 1250px) {

    body::-webkit-scrollbar {
      width: 20px;
    }
    body::-webkit-scrollbar-track {
      background: var(--smoky-black);
    }

    body::-webkit-scrollbar-thumb {
        border: 5px solid var(--smoky-black);
        background: hsla(0, 0%, 100%, .1);
        border-radius: 20px;
        box-shadow: inset 1px 1px 0 hsla(0, 0%, 100%, .11), inset -1px -1px 0 hsla(0, 0%, 100%, .11);
    }

    body::-webkit-scrollbar-thumb:hover {
      background: hsla(0, 0%, 100%, .15);
    }
    body::-webkit-scrollbar-button {
      height: 60px;
    }

    .sidebar, article {
      width: auto;
    }

    main {
        max-width: 1200px;
        margin-inline: auto;
        display: flex;
        justify-content: center;
        align-items: stretch;
        gap: 25px;
    }

    .main-content {
        min-width: 72%;
        width: 72%;
        margin: 0;
    }

    .sidebar {
        position: sticky;
        top: 60px;
        max-height: max-content;
        height: 100%;
        margin-bottom: 0;
        padding-top: 60px;
        z-index: 1;
    }

    .sidebar-info {
        flex-direction: column;
        gap: 15px;
    }

    .info-content {
        gap: 20px;
    }

    .avatar-box img {
        width: 150px;
        height: auto;
    }

    .info-content .name {
        white-space: nowrap;
        text-align: center;
    }

    .info-content .title {
      margin: auto;
    }

    .info-more-btn {
      display: none;
    }

    .sidebar-info-more {
        opacity: 1;
        visibility: visible;
    }

    .contacts-list {
      grid-template-columns: 1fr;
    }

    .contact-info :is(.contact-link) {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .contact-info :is(.contact-link, time, address) {
        --fs7: 14px;
        font-weight: var(--fw300);
    }

    .separator:last-of-type {
        margin: 15px 0;
        opacity: 0;
    }

    .social-list {
      justify-content: center;
    }

    .timeline-text {
      max-width: 700px;
    }

    .main-content.full-width {
        width: 100%;
        min-width: 100%;
        margin: 0;
    }
    
    .back-to-top-btn {
        right: calc(var(--sidebar-width, 300px) + 30px);
    }

    main.sidebar-right .back-to-top-btn {
        right: 30px;
        left: auto;
    }
}

/* =================================================================== */
/*    ECOMMERCE MOBILE OPTIMIZATIONS                                   */
/* =================================================================== */

@media (max-width: 768px) {
    .project-modal {
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
        margin: 0;
        /* Increased padding ensures content (like visualizer warnings) clears the sticky footer */
        padding-bottom: 160px; 
        /* Solid background color prevents homepage text from bleeding through */
        background: var(--smoky-black);
        /* Disable transform on mobile to ensure fixed children position correctly relative to viewport */
        transform: none !important;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .project-modal-img-wrapper {
        aspect-ratio: 4/3; /* Slightly shorter on mobile */
    }

    /* 2. Sticky Action Bar */
    .catalog-actions-row {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        /* Solid background guarantees text behind it is hidden */
        background: var(--eerie-black1); 
        border-top: 1px solid var(--jet);
        padding: 15px 20px;
        margin: 0;
        z-index: 100; /* Ensure it stays above all other content */
        box-shadow: 0 -5px 20px rgba(0,0,0,0.5);
        
        /* Flex Alignment */
        display: flex;
        align-items: center;
        gap: 15px;
    }

    /* Adjust Quantity Group to fit in the bar */
    .quantity-group {
        margin-bottom: 0;
    }
    .quantity-group label {
        display: none; /* Hide label to save space */
    }

    /* Adjust Buttons to fill remaining space */
    .buttons-group {
        flex-grow: 1;
        width: auto;
    }
    .buttons-group .form-btn {
        width: 100%;
        justify-content: center;
    }
}

/* =================================================================== */
/*    VISUALIZER MOBILE LAYOUT (Stack, Don't Hide)                     */
/* =================================================================== */

@media (max-width: 900px) {
    /* 1. Reset the container to remove all padding/margins */
    .visualizer-container {
        padding: 0 !important;
    }

    /* 2. Force Modal to fixed Full Screen with NO overflow */
    .visualizer-modal {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        max-width: 100vw !important;
        max-height: 100vh !important;
        margin: 0 !important;
        border: none !important;
        border-radius: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        transform: none !important;
        background: var(--eerie-black2) !important;
    }

    /* 3. The Body must be the only part that scrolls */
    .visualizer-body {
        display: block !important; /* Stack children vertically */
        width: 100% !important;
        flex-grow: 1 !important;
        overflow-y: auto !important; /* Enable vertical scrolling */
        overflow-x: hidden !important; /* Kill horizontal bleeding */
        -webkit-overflow-scrolling: touch;
    }

    /* 4. Reset every internal panel to 100% width */
    .visualizer-info-panel, 
    .visualizer-canvas-container, 
    .visualizer-toolbar {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        position: relative !important;
        border: none !important;
        box-sizing: border-box !important;
    }

    /* 5. Fix the text bleed */
    .visualizer-info-panel {
        padding: 15px !important;
        border-bottom: 1px solid var(--jet) !important;
    }

    .visualizer-disclaimer {
        white-space: normal !important;
        word-wrap: break-word !important;
        width: 100% !important;
        font-size: 11px;
    }

    /* 6. Fix the Canvas sizing so it doesn't take over the whole screen */
    .visualizer-canvas-container {
        height: 50vh !important; /* Slightly taller for easier finger panning */
        width: 100% !important;
        background-color: var(--onyx);
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        overflow: hidden !important; 
        position: relative !important;
        /* Critical: Stop the browser's "Pull to refresh" and "Back gesture" */
        touch-action: none !important; 
    }

    /* Force the inner Fabric interaction container to stay centered */
    .canvas-container {
        margin: 0 auto !important;
        touch-action: none !important;
        user-select: none !important;
        -webkit-user-drag: none !important;
    }

    /* 7. Force the Toolbar to appear below the image */
    .visualizer-toolbar {
        padding: 20px 15px 120px !important; /* Extra bottom padding for the mobile browser bar */
        border-top: 1px solid var(--jet) !important;
        background: var(--eerie-black2) !important;
    }

    /* Make buttons and inputs easy to hit on mobile */
    .visualizer-toolbar .tool-group {
        margin-bottom: 20px !important;
    }
    
    .visualizer-toolbar label {
        display: block !important;
        margin-bottom: 8px !important;
    }

    /* Ensure apology message is hidden and Customize button is visible in modal */
    .mobile-visualizer-msg { display: none !important; }
}

/* POS Mobile Fixes */
@media (max-width: 768px) {
    .pos-container {
        grid-template-columns: 1fr; /* Stack Product Grid on top of Cart */
        grid-template-rows: 1fr 1fr;
        height: calc(100vh - 80px); /* Adjust for header */
    }
    
    .product-grid {
        padding-bottom: 10px;
        border-bottom: 1px solid var(--jet);
    }
    
    .cart-panel {
        border-top: 2px solid var(--orange-yellow-crayola);
    }
}