/**
 * ============================================================
 * Author:    DARK-MASTER
 * Studio:    DARK DIGITAL STUDIO
 * Site:      dark-digital-studio.com
 * Email:     Service.Dark.Digital.studio@gmail.com
 * WhatsApp:  +905378664534
 * Telegram:  https://t.me/DARK_Digital_Studio
 * GitHub:    github.com/DARK-MASTER-0
 *
 * Copyright (c) 2018-2026 Dark Digital Studio. All Rights Reserved.
 * Unauthorized copying, distribution, or use of this software,
 * in whole or in part, is strictly prohibited without prior
 * written permission from the author.
 * ============================================================
 */
/* ========================================================================
   Responsive Adjustments
   ======================================================================== */
@media (max-width: 1080px) {
    .hero {
        grid-template-columns: 1fr;
        gap: 32px;
        padding-bottom: 24px;
        min-height: 0;
    }

    .hero-content {
        text-align: center;
        align-items: center;
    }

    .hero-subtitle {
        max-width: 100%;
    }

    .hero-actions {
        justify-content: center;
    }

    /* Show scroll pill on tablets & mobile */
    .scroll-pill {
        display: block;
    }

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

    .footer-top {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 860px) {
    main {
        gap: 120px;
    }

    .site-header {
        width: calc(100vw - 22px);
    }

    .header-inner {
        padding: 4px 10px;
        gap: 6px;
        flex-wrap: nowrap;
        min-height: 48px;
        justify-content: flex-start;
    }

    .brand {
        flex: 0 1 auto;
        min-width: 0;
        gap: 6px;
        margin-right: auto;
    }

    .brand-wordmark {
        font-size: 0.75rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .brand img {
        width: 28px;
        height: 28px;
        padding: 2px;
        border-radius: 6px;
    }
    
    .site-header {
        top: 10px;
        border-radius: var(--radius-md);
    }
    
    /* Removed redundant .header-cta .btn block */
    
    /* Remove previous overrides that blocked the scroll effect */
    /* Adjust content position on mobile when scrolled - reduce downward shift */
    .site-header[data-condensed="true"] .header-inner {
        transform: translateY(4px);
    }

    .main-nav ul {
        position: absolute;
        inset: calc(100% + 12px) 16px auto 16px;
        background: var(--color-bg-soft);
        border-radius: var(--radius-md);
        border: 1px solid var(--color-border);
        box-shadow: var(--shadow-soft);
        flex-direction: column;
        padding: 18px;
        gap: 14px;
        display: none;
    }

    .main-nav ul.is-open {
        display: flex;
    }

    .main-nav {
        margin-left: auto;
        gap: 14px;
    }

    .nav-toggle {
        display: inline-flex;
    }

    .welcome-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    }

    .product-tabs {
        justify-content: flex-start;
    }

    .product-card-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    }

    .product-card-details {
        max-height: none;
        opacity: 1;
    }

    .header-cta {
        order: 2;
        width: auto;
        margin-top: 0;
        justify-content: flex-end;
        gap: 8px;
    }

    .main-nav {
        order: 3;
        margin-left: 0;
    }

    /* Fixed mobile button styling */
    .header-cta .btn {
        padding: 0 14px;
        height: 34px;
        width: auto !important;
        font-size: 0 !important; /* Hide 'Product Catalog' text */
        gap: 0 !important;
        border-radius: 10px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 4px 14px -6px rgba(13, 125, 220, 0.4);
    }

    /* Reset the pseudo-element used for gradients so we can use it for text on mobile */
    .header-cta .btn::after {
        content: "Catalog";
        font-size: 0.72rem;
        font-weight: 700;
        color: #fff;
        line-height: normal;
        letter-spacing: 0.03em;
        margin: 0;
        
        /* OVERRIDE component.css gradient styles */
        opacity: 1 !important;
        position: static;
        inset: auto;
        z-index: auto;
        background: none !important;
        transition: none;
    }

    .header-cta .theme-toggle {
        flex: 0 0 32px;
        width: 32px;
        height: 32px;
        padding: 6px;
    }

    .contact-grid {
        grid-template-columns: 1fr;
    }

    .footer-top {
        grid-template-columns: 1fr;
    }

    .footer-bottom {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }
}

@media (max-width: 600px) {
    main {
        gap: 0;
        padding-top: 0;
    }

    .content-over-video > .welcome-over-video ~ * {
        padding-top: 60px;
    }

    .hero {
        padding-top: calc(var(--header-height) + 20px);
        padding-bottom: 20px;
        gap: 20px;
    }

    .hero-content {
        gap: 16px;
    }

    .hero-media {
        min-height: 0;
        aspect-ratio: 16/9;
        max-height: 220px;
    }

    .hero-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        width: 100%;
        max-width: 320px;
        margin: 0 auto;
    }

    .hero-actions .btn {
        width: 100%;
        justify-content: center;
        padding: 12px 18px;
        font-size: 0.88rem;
        letter-spacing: 0.02em;
    }

    .hero-actions .btn-primary {
        box-shadow: 0 6px 20px -6px rgba(13, 125, 220, 0.5);
    }

    .hero-actions .btn-outline {
        background: rgba(13, 125, 220, 0.06);
        border-color: rgba(13, 125, 220, 0.3);
    }

    .hero-title {
        font-size: clamp(1.5rem, 5.5vw, 2.2rem);
        line-height: 1.15;
        word-break: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
    }

    .hero-subtitle {
        font-size: 0.88rem;
        line-height: 1.5;
    }

    .hero-kicker {
        font-size: 0.72rem;
        letter-spacing: 0.06em;
    }

    .about-highlights {
        flex-direction: column;
    }

    .certificate-stack {
        grid-template-columns: 1fr;
    }

    .certificate-modal {
        padding: 16px;
    }

    .certificate-modal-dialog {
        padding: 24px;
        border-radius: var(--radius-lg);
    }

    .certificate-modal-close {
        width: 100%;
    }

    .contact-card,
    .contact-form {
        padding: 26px;
    }

    .btn {
        width: 100%;
    }
}

    /* Specific fix for small mobile screens (e.g. Galaxy S8/S9 360px width) */
    @media (max-width: 380px) {
        .site-header {
            width: calc(100vw - 16px) !important; /* Safe margin */
            left: 50% !important;
            transform: translateX(-50%); /* Removed !important to allow vertical scroll movement */
            top: 8px !important;
            padding: 0;
            max-width: none;
        }
        
        /* Ensure the condensed state still works here appropriately matching navigation.css */
        .site-header[data-condensed="true"] {
             transform: translate(-50%, -45%);
        }

        .header-inner {
            padding: 8px 10px; 
            gap: 6px;
            justify-content: space-between;
        }
    
        .brand {
            gap: 6px;
            flex-shrink: 1; /* Allow shrinking */
            min-width: 0;
        }
    
        .brand img {
            width: 28px;
            height: 28px;
            flex-shrink: 0;
        }
    
        .brand-wordmark {
            display: flex;
            flex-direction: column;
            line-height: 1;
            font-size: 0.75rem;
            white-space: normal;
            text-align: left;
            max-width: none;
            overflow: visible;
        }

        .brand-wordmark::after {
            content: none;
        }
    
        .header-cta {
            flex-shrink: 0;
            gap: 6px;
        }

        .header-cta .btn {
            padding: 0 10px;
            width: auto !important;
            height: 30px;
            font-size: 0.75rem;
            gap: 4px;
            border-radius: 8px;
        }
    
        .header-cta .btn::after {
            content: "Catalog";
            display: inline-block;
            font-size: 0.65rem;
            letter-spacing: 0.02em;
        }
        
        .theme-toggle {
            width: 32px;
            height: 32px;
            padding: 6px;
        }

        .product-card-grid,
        .welcome-grid {
            grid-template-columns: 1fr;
        }
    
        h1 { font-size: 1.7rem; }
        h2 { font-size: 1.4rem; }
        h3 { font-size: 1.2rem; }
        
        .loading-shell {
            min-width: 0;
            width: 94vw;
            padding: 24px 16px;
        }

        .hero {
            padding-top: calc(var(--header-height) + 12px);
            padding-bottom: 16px;
            gap: 14px;
        }

        .hero-content {
            gap: 12px;
        }
    
        .hero-media {
            min-height: 0;
            height: 180px;
            width: 100%;
            max-height: 180px;
        }

        .hero-title {
            font-size: clamp(1.3rem, 5vw, 1.8rem);
        }

        .hero-kicker {
            font-size: 0.68rem;
        }

        .hero-subtitle {
            font-size: 0.82rem;
            -webkit-line-clamp: 3;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            overflow: hidden;
        }

        .hero-actions {
            max-width: 260px;
        }

        .hero-actions .btn {
            padding: 10px 14px;
            font-size: 0.82rem;
        }
    }

/* ── Mobile performance: content-visibility & containment ───── */
@media (max-width: 860px) {
    /* Skip rendering below-fold sections until they approach the viewport */
    .welcome,
    .products,
    .about,
    .contact,
    .site-footer {
        content-visibility: auto;
        contain-intrinsic-size: auto 600px;
    }

    /* Reduce paint & layout cost for independent sections
       NOTE: .hero-wrapper uses sticky, so contain:paint would break it */
    .welcome,
    .products,
    .about,
    .contact {
        contain: layout style;
    }

    /* Disable heavy box-shadows on mobile for compositing performance */
    .product-card,
    .welcome-card,
    .certificate-card {
        box-shadow: none !important;
    }

    /* Promote fixed header to own compositor layer */
    .site-header {
        will-change: transform;
    }
}

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