/*
 * Responsive Utilities
 * All media queries and responsive-specific styles
 */

/* =============================================================================
   Enhanced Responsive Breakpoints
   ============================================================================= */

/* Large screens - better container spacing */
@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }

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

/* Desktop large */
@media (max-width: 1200px) {
    .building-gallery-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.5rem;
    }

    .contact-map-wrapper {
        gap: 2rem;
    }

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

/* Tablet landscape improvements */
@media (max-width: 1024px) {
    .projects-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }

    .apartments-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }

    .contact-map-wrapper {
        gap: 2rem;
    }

    .contact-form-half {
        padding: 2rem;
    }

    .hero-content {
        max-width: 90%;
    }

    .apartment-content-wrapper {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .building-display-wrapper {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

/* Tablet portrait */
@media (max-width: 768px) {
    /* Layout adjustments */
    .contact-map-wrapper {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .projects-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .apartments-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.25rem;
        min-height: 300px;
    }

    .building-display-wrapper,
    .apartment-content-wrapper {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    /* Content adjustments */
    .hero-content {
        padding: 0 1rem;
        max-width: 95%;
    }

    .hero-subtitle {
        font-size: clamp(1rem, 4vw, 1.25rem);
        margin-bottom: 2rem;
    }

    .map-half:hover {
        transform: none;
    }

    .section-title::after {
        width: 40px;
        height: 2px;
    }

    /* Building and apartment specific */
    .apartment-image-container {
        height: 220px;
    }

    .apartment-results-section .loading-spinner {
        min-width: 150px;
        padding: 40px 20px;
    }

    /* Gallery adjustments */
    .building-gallery-section {
        margin: 2rem 0;
        padding: 1rem 0;
    }

    .building-gallery-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: var(--grid-gap);
    }

    .gallery-title {
        font-size: var(--font-size-h2);
        margin-bottom: 1.5rem;
    }

    .building-gallery-grid {
        max-width: none;
    }

    .gallery-item {
        aspect-ratio: 3/2;
    }

    /* Override grid variations on mobile for better layout */
    .building-gallery-grid:has(.gallery-item:nth-child(1):nth-last-child(1)),
    .building-gallery-grid:has(.gallery-item:nth-child(2):nth-last-child(1)),
    .building-gallery-grid:has(.gallery-item:nth-child(3):nth-last-child(1)),
    .building-gallery-grid:has(.gallery-item:nth-child(4):nth-last-child(1)),
    .building-gallery-grid:has(.gallery-item:nth-child(5):nth-last-child(1)),
    .building-gallery-grid:has(.gallery-item:nth-child(6):nth-last-child(1)) {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        max-width: none;
    }

    /* Page specific */
    .page-title {
        font-size: 2rem;
    }

    .projects-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .child-buildings-wrapper {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .child-buildings-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .back-to-projects {
        align-self: stretch;
        text-align: center;
    }

    /* Footer adjustments */
    .site-footer {
        padding: 2rem 0 1rem;
    }

    /* Filter adjustments */
    .filters-row {
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }

    .filter-group {
        min-width: auto;
    }

    .filter-actions {
        grid-column: 1 / -1;
        justify-content: stretch;
    }
}

/* Mobile large */
@media (max-width: 480px) {
    /* Root variable overrides for small screens */
    :root {
        --container-padding: 1rem;
        --section-spacing: 2rem;
    }

    /* Layout */
    .apartments-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    .filters-row {
        grid-template-columns: 1fr;
    }

    /* Content */
    .contact-form-half {
        padding: 1.5rem;
    }

    .project-item:hover {
        transform: translateY(-4px);
    }

    /* Gallery */
    .building-gallery-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .gallery-title {
        font-size: 1.25rem;
    }

    .gallery-item {
        aspect-ratio: 4/3;
    }

    /* Page headers */
    .page-header {
        padding: 1rem 0;
        margin-bottom: 0;
    }

    /* Hero slider controls */
    .hero-slider .swiper-button-next,
    .hero-slider .swiper-button-prev {
        width: 40px;
        height: 40px;
        margin-top: -20px;
    }

    /* About page */
    .contact-form-section-full,
    .contact-map-section-full {
        padding: 1.5rem;
    }

    .working-day {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    .team-members-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    /* Contact page */
    .contact-form-section-full {
        margin-top: 2rem;
    }

    /* Lightbox responsive adjustments */
    .lightbox-close,
    .lightbox-nav {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }

    .lightbox-close {
        top: 15px;
        right: 20px;
    }

    .lightbox-prev {
        left: 20px;
    }

    .lightbox-next {
        right: 20px;
    }

    .lightbox-caption {
        bottom: 20px;
        font-size: 1rem;
    }

    .lightbox-counter {
        top: 15px;
        left: 20px;
        font-size: 0.9rem;
    }
}

/* Mobile small */
@media (max-width: 360px) {
    .hero-content {
        padding: 0 0.75rem;
    }

    .contact-form-half {
        padding: 1.25rem;
    }

    .apartment-filters {
        padding: 1rem;
    }

    .filter-group select,
    .filter-group input {
        padding: 0.5rem;
    }

    .btn {
        padding: 0.625rem 1.25rem;
        font-size: var(--font-size-small);
    }
}

/* =============================================================================
   Print Styles
   ============================================================================= */

@media print {
    .site-header,
    .site-footer,
    .mobile-menu-toggle,
    .mobile-menu-overlay,
    .lightbox-modal,
    .filter-actions,
    .apartment-filters,
    .hero-slider,
    .contact-form-half,
    .map-half {
        display: none !important;
    }

    body {
        padding-top: 0;
        font-size: 12pt;
        line-height: 1.4;
        color: #000;
        background: #fff;
    }

    .container {
        max-width: none;
        padding: 0;
    }

    h1, h2, h3, h4, h5, h6 {
        color: #000;
        page-break-after: avoid;
    }

    .project-item,
    .apartment-card {
        break-inside: avoid;
        border: 1px solid #ccc;
        margin-bottom: 1rem;
    }

    .projects-grid,
    .apartments-grid {
        display: block;
    }

    .projects-grid .project-item,
    .apartments-grid .apartment-card {
        display: block;
        width: 100%;
        margin-bottom: 2rem;
    }

    a {
        color: #000;
        text-decoration: underline;
    }

    a[href^="http"]:after {
        content: " (" attr(href) ")";
        font-size: 10pt;
        color: #666;
    }
}

/* =============================================================================
   Responsive Utilities
   ============================================================================= */

/* Hide/show utilities for different screen sizes */
.hide-mobile {
    display: block;
}

.show-mobile {
    display: none;
}

.hide-tablet {
    display: block;
}

.show-tablet {
    display: none;
}

.hide-desktop {
    display: none;
}

.show-desktop {
    display: block;
}

@media (max-width: 768px) {
    .hide-mobile {
        display: none;
    }

    .show-mobile {
        display: block;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .hide-tablet {
        display: none;
    }

    .show-tablet {
        display: block;
    }
}

@media (min-width: 1025px) {
    .hide-desktop {
        display: block;
    }

    .show-desktop {
        display: none;
    }
}

/* Container queries support (future-proofing) */
@supports (container-type: inline-size) {
    .responsive-container {
        container-type: inline-size;
    }

    @container (max-width: 600px) {
        .responsive-grid {
            grid-template-columns: 1fr;
        }
    }

    @container (min-width: 601px) {
        .responsive-grid {
            grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        }
    }
}

/* =============================================================================
   High DPI / Retina Display Support
   ============================================================================= */

@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 2dppx) {
    .site-logo-img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* =============================================================================
   Reduced Motion Support
   ============================================================================= */

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

    .hero-slider .swiper-slide,
    .gallery-item,
    .project-item,
    .apartment-card {
        transform: none !important;
    }
}

/* =============================================================================
   High Contrast Mode Support
   ============================================================================= */

@media (prefers-contrast: high) {
    .project-item,
    .apartment-card,
    .card {
        border: 2px solid;
    }

    .btn {
        border: 2px solid currentColor;
    }

    .site-header {
        border-bottom: 2px solid;
    }
}

/* =============================================================================
   Dark Mode Support (Future-proofing)
   ============================================================================= */

@media (prefers-color-scheme: dark) {
    .project-placeholder,
    .apartment-placeholder {
        background: linear-gradient(135deg, #2d2d2d 0%, #404040 100%);
        color: #cccccc;
    }

    .lightbox-overlay {
        background: rgba(0, 0, 0, 0.95);
    }
}