/* =============================================
   SPIL - Responsive Styles
   ============================================= */

/* Tablet - max 1024px */
@media (max-width: 1024px) {

    /* Floating theme toggle - adjust position for mobile */
    .theme-toggle--desktop {
        bottom: 20px;
        right: 20px;
        width: 44px;
        height: 44px;
    }

    :root {
        --header-height: 70px;
    }

    .container {
        padding-left: var(--space-5);
        padding-right: var(--space-5);
    }

    .section {
        padding-top: var(--space-16);
        padding-bottom: var(--space-16);
    }

    .hero__title {
        font-size: var(--text-5xl);
    }

    .hero__description {
        font-size: var(--text-base);
    }

    .footer__grid {
        grid-template-columns: 1fr 1fr;
        gap: var(--space-10);
    }

    .footer__brand {
        grid-column: span 2;
        max-width: 100%;
    }

    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    .about-content {
        gap: var(--space-10);
    }
}

/* Mobile - max 768px */
@media (max-width: 768px) {
    :root {
        --header-height: 64px;
    }

    .container {
        padding-left: var(--space-4);
        padding-right: var(--space-4);
    }

    .section {
        padding-top: var(--space-12);
        padding-bottom: var(--space-12);
    }

    /* Header Mobile */
    .nav {
        position: fixed !important;
        top: 64px !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        height: calc(100vh - 64px) !important;
        width: 100% !important;
        flex-direction: column;
        justify-content: flex-start;
        align-items: stretch;
        padding: 32px 24px;
        background-color: var(--color-black) !important;
        backdrop-filter: none;
        transform: translateX(100%);
        transition: transform 0.4s cubic-bezier(0.23, 1, 0.32, 1);
        gap: 8px;
        z-index: 9999 !important;
        overflow-y: auto;
    }

    .nav--open {
        transform: translateX(0) !important;
    }

    .nav__link {
        width: 100%;
        padding: var(--space-4);
        font-size: var(--text-lg);
        text-align: left;
        border-bottom: 1px solid var(--color-gray-800);
    }

    .nav__link::after {
        display: none;
    }

    .menu-toggle {
        display: flex;
    }

    /* Hero Mobile */
    .hero {
        min-height: calc(100vh - var(--header-height));
        padding-top: var(--header-height);
    }

    .hero__content {
        padding: var(--space-6);
    }

    .hero__title {
        font-size: var(--text-4xl);
    }

    .hero__subtitle {
        font-size: 10px;
        padding: var(--space-2) var(--space-4);
    }

    .hero__description {
        font-size: var(--text-base);
        margin-bottom: var(--space-8);
    }

    .hero__actions {
        flex-direction: column;
        align-items: center;
        width: 100%;
        gap: var(--space-4);
    }

    .hero__actions .btn {
        width: auto;
        min-width: 200px;
        max-width: 280px;
        justify-content: center;
        position: relative;
        /* Ensure z-index works */
        z-index: 10;
        /* Bring above the overlapping cutter image */
    }

    /* Resize cutter image button for mobile */
    .btn-cutter-image {
        height: 64px;
        /* Restrict layout height to reduce vertical space */
    }

    .btn-cutter-image__img {
        width: 220px !important;
        max-width: none;
        /* Allow image to overflow container width if needed */
    }

    .btn-cutter-image__text {
        font-size: 11px !important;
    }

    .hero__scroll {
        display: none;
    }

    /* Reduce particle opacity on mobile */
    .hero__bg-particles {
        opacity: 0.3;
    }

    /* Section Headers Mobile */
    .section-header {
        margin-bottom: var(--space-10);
    }

    .section-header__title {
        font-size: var(--text-3xl);
    }

    .section-header__description {
        font-size: var(--text-base);
    }

    /* Page Header Mobile */
    .page-header {
        padding: calc(var(--header-height) + var(--space-12)) 0 var(--space-12);
    }

    .page-header__title {
        font-size: var(--text-4xl);
    }

    .page-header__description {
        font-size: var(--text-base);
    }

    /* =============================================
       FEATURES - Horizontal Scroll with Peek Effect
       Only applies when inside .features-wrapper (index.html)
       ============================================= */
    .features-wrapper .features {
        display: flex;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x mandatory;
        gap: var(--space-4);
        padding-bottom: var(--space-4);
        margin-left: calc(-1 * var(--space-4));
        margin-right: calc(-1 * var(--space-4));
        padding-left: var(--space-4);
        padding-right: 20%;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        /* Firefox */
        -ms-overflow-style: none;
        /* IE/Edge */
    }

    .features-wrapper .features::-webkit-scrollbar {
        display: none;
        /* Chrome/Safari */
    }

    .features-wrapper .feature {
        flex: 0 0 85%;
        scroll-snap-align: start;
        padding: var(--space-6);
        min-width: 0;
    }

    /* First card left margin */
    .features-wrapper .feature:first-child {
        margin-left: var(--space-2);
    }

    /* Gradient fade on edge to hint more content */
    .features-wrapper {
        position: relative;
        overflow: visible;
    }

    .features-wrapper::after {
        content: '';
        position: absolute;
        right: calc(-1 * var(--space-4));
        top: 0;
        bottom: 0;
        width: 50px;
        background: linear-gradient(to right, transparent, var(--color-black));
        pointer-events: none;
        z-index: 10;
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    /* Show gradient only when section is in view */
    .features-wrapper.in-view::after {
        opacity: 1;
    }

    /* Default features on other pages - grid layout */
    .features:not(.features-wrapper .features) {
        grid-template-columns: 1fr;
        gap: var(--space-6);
    }

    .feature:not(.features-wrapper .feature) {
        padding: var(--space-6);
    }

    /* Stats Mobile */
    .stats {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-6);
        padding: var(--space-10) 0;
    }

    .stat__value {
        font-size: var(--text-4xl);
    }

    /* =============================================
       PRODUCTS - Horizontal Scroll with Peek Effect
       Only applies when inside .products-wrapper (index.html)
       ============================================= */
    .products-wrapper .grid-3.products-grid {
        display: flex;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x mandatory;
        gap: var(--space-4);
        padding-bottom: var(--space-4);
        margin-left: calc(-1 * var(--space-4));
        margin-right: calc(-1 * var(--space-4));
        padding-left: var(--space-4);
        padding-right: 20%;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .products-wrapper .grid-3.products-grid::-webkit-scrollbar {
        display: none;
    }

    .products-wrapper .grid-3.products-grid>.card {
        flex: 0 0 85%;
        scroll-snap-align: start;
        min-width: 0;
    }

    /* First card left margin */
    .products-wrapper .grid-3.products-grid>.card:first-child {
        margin-left: var(--space-2);
    }

    /* Products wrapper gradient */
    .products-wrapper {
        position: relative;
        overflow: visible;
    }

    .products-wrapper::after {
        content: '';
        position: absolute;
        right: calc(-1 * var(--space-4));
        top: 0;
        bottom: 0;
        width: 50px;
        background: linear-gradient(to right, transparent, var(--color-black));
        pointer-events: none;
        z-index: 10;
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    /* Show gradient only when section is in view */
    .products-wrapper.in-view::after {
        opacity: 1;
    }

    /* =============================================
       SERVICES - Horizontal Scroll with Peek Effect
       Only applies when inside .services-wrapper (services.html)
       ============================================= */
    .services-wrapper .grid-3.services-grid {
        display: flex;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x mandatory;
        gap: var(--space-4);
        padding-bottom: var(--space-4);
        margin-left: calc(-1 * var(--space-4));
        margin-right: calc(-1 * var(--space-4));
        padding-left: var(--space-4);
        padding-right: 20%;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .services-wrapper .grid-3.services-grid::-webkit-scrollbar {
        display: none;
    }

    .services-wrapper .grid-3.services-grid>.service-card {
        flex: 0 0 85%;
        scroll-snap-align: start;
        min-width: 0;
        width: 100%;
        /* Ensure full width within flex item */
    }

    /* First card left margin */
    .services-wrapper .grid-3.services-grid>.service-card:first-child {
        margin-left: var(--space-2);
    }

    /* Services wrapper gradient */
    .services-wrapper {
        position: relative;
        overflow: visible;
    }

    .services-wrapper::after {
        content: '';
        position: absolute;
        right: calc(-1 * var(--space-4));
        top: 0;
        bottom: 0;
        width: 50px;
        background: linear-gradient(to right, transparent, var(--color-black));
        pointer-events: none;
        z-index: 10;
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    /* Show gradient only when section is in view */
    .services-wrapper.in-view::after {
        opacity: 1;
    }

    /* Default grid-3 on other pages */
    .grid-3:not(.products-grid):not(.services-grid) {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-4);
    }

    /* Handle cards in default grid */
    .grid-3:not(.products-grid):not(.services-grid)>.card,
    .grid-3:not(.products-grid):not(.services-grid)>.service-card {
        width: 100%;
    }

    /* Other grids stay as single column */
    .grid-2,
    .grid-4 {
        grid-template-columns: 1fr;
    }

    /* CTA Mobile */
    .cta {
        padding: var(--space-16) 0;
    }

    .cta__title {
        font-size: var(--text-3xl);
    }

    .cta__description {
        font-size: var(--text-base);
        margin-bottom: var(--space-8);
    }

    .cta__actions {
        flex-direction: column;
        width: 100%;
    }

    .cta__actions .btn {
        width: 100%;
    }

    /* Footer Mobile */
    .footer__grid {
        grid-template-columns: 1fr;
        gap: var(--space-8);
    }

    .footer__brand {
        grid-column: span 1;
    }

    .footer__bottom {
        flex-direction: column;
        gap: var(--space-4);
        text-align: center;
    }

    /* About Mobile */
    .about-content {
        grid-template-columns: 1fr;
        gap: var(--space-8);
    }

    /* Forms Mobile */
    .form__row {
        grid-template-columns: 1fr;
    }

    /* Contact Mobile */
    .contact-item {
        flex-direction: column;
        text-align: center;
        align-items: center;
    }

    .contact-item__icon {
        margin: 0 auto;
    }

    /* Buttons Mobile */
    .btn--lg {
        padding: var(--space-4) var(--space-8);
        font-size: var(--text-sm);
    }

    /* =============================================
       EQUIPMENT - Card Stack Animation
       ============================================= */
    .equipment-section {
        position: relative;
        min-height: 550px;
        overflow: visible;
    }

    .equipment-grid {
        display: block;
        position: relative;
        height: 500px;
        perspective: 1000px;
    }

    .equipment-image-col {
        display: none;
    }

    /* Card Stack Base Styles */
    .equipment-text-col {
        position: absolute !important;
        left: 0;
        right: 0;
        height: 100%;
        transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1),
            opacity 0.4s ease,
            box-shadow 0.4s ease;
        border-radius: var(--radius-lg);
        overflow: hidden;
    }

    /* Bottom Card (Haimer) - Initially behind */
    .equipment-text-col--light {
        z-index: 1;
        transform: scale(0.95) translateY(20px);
        opacity: 0.7;
    }

    /* Top Card (Haller) - Initially on top */
    .equipment-text-col--dark {
        z-index: 2;
        box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    }

    /* Animated states - applied via JS */
    .equipment-text-col--dark.card-stack-hidden {
        transform: translateX(-110%) rotate(-5deg);
        opacity: 0;
        z-index: 1;
    }

    .equipment-text-col--light.card-stack-visible {
        transform: scale(1) translateY(0);
        opacity: 1;
        z-index: 2;
        box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    }
}

/* Small Mobile - max 480px */
@media (max-width: 480px) {
    .hero__title {
        font-size: var(--text-3xl);
    }

    .section-header__title {
        font-size: var(--text-2xl);
    }

    .page-header__title {
        font-size: var(--text-3xl);
    }

    .stats {
        grid-template-columns: 1fr;
    }

    .stat {
        padding: var(--space-4) 0;
        border-bottom: 1px solid var(--color-gray-800);
    }

    .stat:last-child {
        border-bottom: none;
    }
}

/* Hover states - only on devices that support hover */
@media (hover: hover) {
    .card:hover {
        transform: translateY(-4px);
    }

    .feature:hover {
        transform: translateY(-4px);
    }

    .btn--primary:hover {
        transform: translateY(-2px);
    }
}

/* High resolution screens */
@media (min-width: 1600px) {
    .container {
        max-width: var(--container-max);
    }

    .hero__content {
        max-width: 1000px;
    }
}

/* Print styles */
@media print {

    .header,
    .footer,
    .hero__scroll,
    .btn {
        display: none !important;
    }

    body {
        background: white;
        color: black;
    }

    .section {
        padding: 20px 0;
    }
}
/* Mobile Footer Fixes - max 768px */
@media (max-width: 768px) {
    /* Hide 'Sayfalar' column - typically the 2nd child in .footer__grid */
    /* Note: nth-child(2) assumes structure: Brand, Sayfalar, Ürünler, İletişim */
    .footer__grid .footer__column:nth-child(2) {
        display: none; 
    }

    /* Make footer grid use auto rows, but we want a specific layout for the remaining items */
    .footer__grid {
        display: grid;
        grid-template-columns: 1fr 1fr !important; /* Forces 2 columns for the remaining items below brand */
        gap: var(--space-6) !important;
        text-align: center;
    }

    /* Brand takes full width */
    .footer__brand {
        grid-column: 1 / -1; /* Span 2 columns */
        text-align: center;
        margin-bottom: var(--space-4);
    }
    
    /* Ensure footer logo is centered */
    .footer__brand .footer__logo {
        justify-content: center;
    }

    /* The remaining two columns (Ürünler & İletişim) will naturally fall into the 1fr 1fr grid */
    /* Adjust font sizes for mobile optimization */
    .footer__column-title {
        font-size: var(--text-base) !important; /* Slightly smaller title */
        margin-bottom: var(--space-4);
        text-align: center;
    }

    .footer__link {
        font-size: var(--text-sm) !important;
        justify-content: center; /* Center flex items if links generate flex */
        text-align: center;
    }

    /* Center content inside columns */
    .footer__column {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .footer__links {
        align-items: center;
    }
}


/* Mobile Footer Contact Button */
@media (max-width: 768px) {
    /* Hide the detailed contact links on mobile */
    .footer__links.mobile-hidden {
        display: none !important;
    }
    
    /* Show the mobile button */
    .footer-mobile-contact-btn {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        width: 100%;
        max-width: 200px;
        height: 40px;
        margin-top: 0; 
        font-size: var(--text-sm);
        font-weight: 600;
        text-transform: uppercase;
        color: var(--color-bronze);
        background: rgba(176, 141, 87, 0.1);
        border: 1px solid var(--color-bronze);
        border-radius: var(--radius-md);
        text-decoration: none;
        transition: all 0.3s ease;
    }
    
    .footer-mobile-contact-btn:active {
        background: rgba(176, 141, 87, 0.2);
        transform: scale(0.98);
    }
}

/* Hide button on desktop */
.footer-mobile-contact-btn {
    display: none;
}

