/* ============================================
   TOTY'S MAGIC BOX - RESPONSIVE STYLES
   Mobile-First Breakpoints
   ============================================ */

/* ============================================
   MOBILE (0 - 479px)
   ============================================ */
@media screen and (max-width: 479px) {
    :root {
        --spacing-lg: 2rem;
        --spacing-xl: 4rem;
    }

    body {
        cursor: auto;
    }

    /* Hide custom cursor on mobile */
    .cursor {
        display: none;
    }

    /* Header */
    .header {
        padding: var(--spacing-xs) var(--spacing-sm);
    }

    .header-logo {
        width: 80px;
    }

    .nav-menu {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: var(--spacing-md);
        background-color: var(--blanco-puro);
        transform: translateX(-100%);
        transition: transform var(--transition-slow);
        z-index: 5;
    }

    .nav-menu.active {
        transform: translateX(0);
    }

    .nav-link {
        font-size: 1.25rem;
    }

    .menu-toggle {
        display: flex;
    }

    .btn-cta {
        padding: 0.5rem 1rem;
        font-size: 0.75rem;
    }

    /* Hero */
    .hero-content {
        padding: 0 var(--spacing-sm);
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .hero-cta {
        padding: 0.75rem 1.5rem;
        font-size: 0.9rem;
    }

    /* Services */
    .services-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-sm);
    }

    .service-card {
        padding: var(--spacing-sm);
    }

    /* About */
    .about::before,
    .about::after {
        display: none;
    }

    .about-container {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
        text-align: center;
    }

    .about-content {
        padding: var(--spacing-sm);
        overflow-wrap: break-word;
        word-wrap: break-word;
        max-width: 100%;
        overflow: hidden;
    }

    .about-visuals {
        max-width: 100%;
        overflow: hidden;
    }

    .about-image-wrapper::before,
    .about-image-wrapper::after,
    .about-visuals::after {
        left: 0;
        right: 0;
        top: 0;
        bottom: 0;
    }

    .about-image {
        height: 300px;
    }

    .about-script {
        font-size: 1.75rem;
    }

    .about-text {
        text-align: center;
        padding-left: 0;
    }

    .about-text::before {
        display: none;
    }

    .about-values {
        grid-template-columns: 1fr;
    }

    .about-value {
        justify-content: center;
    }

    /* Timeline / Process */
    .process-grid {
        flex-direction: column;
        align-items: center;
        gap: var(--spacing-lg);
    }

    .process-grid::before {
        display: none;
        /* Hide horizontal connecting line on mobile */
    }

    .process-card {
        width: 100%;
        max-width: 320px;
        margin: 0 auto;
    }

    /* Gallery */
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: auto;
    }

    .gallery-item:nth-child(1) {
        grid-column: span 2;
        grid-row: span 1;
    }

    .gallery-item:nth-child(4) {
        grid-column: span 1;
    }

    /* Testimonials */
    .testimonial-card {
        width: 300px;
    }

    /* Instagram */
    .instagram-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    /* Contact */
    .contact-container {
        grid-template-columns: 1fr;
    }

    .contact-form {
        padding: var(--spacing-md);
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    /* Footer */
    .footer-container {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
        text-align: center;
    }

    .footer-brand {
        max-width: 100%;
    }

    .footer-social {
        justify-content: center;
    }

    .footer-bottom {
        flex-direction: column;
        text-align: center;
    }

    .footer-legal {
        flex-direction: column;
        gap: var(--spacing-xs);
    }
}

/* ============================================
   MOBILE LARGE (480px - 767px)
   ============================================ */
@media screen and (min-width: 480px) and (max-width: 767px) {
    body {
        cursor: auto;
    }

    .cursor {
        display: none;
    }

    /* Header */
    .nav-menu {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: var(--spacing-md);
        background-color: var(--blanco-puro);
        transform: translateX(-100%);
        transition: transform var(--transition-slow);
        z-index: 5;
    }

    .nav-menu.active {
        transform: translateX(0);
    }

    .menu-toggle {
        display: flex;
    }

    /* Services */
    .services-grid {
        grid-template-columns: 1fr;
    }

    /* About */
    .about::before,
    .about::after {
        display: none;
    }

    .about-container {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .about-content {
        padding: var(--spacing-sm);
        overflow-wrap: break-word;
        word-wrap: break-word;
        max-width: 100%;
        overflow: hidden;
    }

    .about-visuals {
        max-width: 100%;
        overflow: hidden;
    }

    .about-image-wrapper::before,
    .about-image-wrapper::after,
    .about-visuals::after {
        left: 0;
        right: 0;
        top: 0;
        bottom: 0;
    }

    .about-text {
        text-align: center;
        padding-left: 0;
    }

    .about-text::before {
        display: none;
    }

    .about-value {
        justify-content: center;
    }

    /* Timeline / Process */
    .process-grid {
        flex-direction: column;
        align-items: center;
        gap: var(--spacing-lg);
    }

    .process-grid::before {
        display: none;
    }

    .process-card {
        width: 100%;
        max-width: 400px;
        margin: 0 auto;
    }

    /* Gallery */
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: auto;
    }

    .gallery-item:nth-child(1) {
        grid-column: span 2;
    }

    .gallery-item:nth-child(4) {
        grid-column: span 1;
    }

    /* Contact */
    .contact-container {
        grid-template-columns: 1fr;
    }

    /* Footer */
    .footer-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================
   TABLET (768px - 1023px)
   ============================================ */
@media screen and (min-width: 768px) and (max-width: 1023px) {

    /* Header */
    .nav-menu {
        gap: var(--spacing-sm);
    }

    .nav-link {
        font-size: 0.75rem;
    }

    /* Services */
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .service-card:nth-child(3) {
        grid-column: span 2;
        max-width: 50%;
        margin: 0 auto;
    }

    /* About */
    .about-container {
        gap: var(--spacing-md);
    }

    .about-image {
        height: 400px;
    }

    /* Timeline / Process */
    .process-grid {
        flex-wrap: wrap;
        justify-content: center;
        gap: var(--spacing-lg);
    }

    .process-card {
        flex: 0 0 calc(50% - var(--spacing-md));
    }

    /* Gallery */
    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
        grid-template-rows: repeat(3, 180px);
    }

    .gallery-item:nth-child(1) {
        grid-column: span 2;
        grid-row: span 2;
    }

    /* Instagram */
    .instagram-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    /* Footer */
    .footer-container {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-md);
    }
}

/* ============================================
   DESKTOP (1024px - 1439px)
   ============================================ */
@media screen and (min-width: 1024px) and (max-width: 1439px) {
    .container {
        max-width: 960px;
    }

    /* Services */
    .services-grid {
        gap: var(--spacing-sm);
    }

    /* Gallery */
    .gallery-grid {
        grid-template-rows: repeat(3, 180px);
    }
}

/* ============================================
   DESKTOP LARGE (1440px+)
   ============================================ */
@media screen and (min-width: 1440px) {
    .container {
        max-width: 1400px;
    }

    /* Hero */
    .hero-title {
        font-size: 5rem;
    }

    .hero-subtitle {
        font-size: 1.5rem;
    }

    /* Gallery */
    .gallery-grid {
        grid-template-rows: repeat(3, 250px);
    }
}

/* ============================================
   TOUCH DEVICE OPTIMIZATIONS
   ============================================ */
@media (hover: none) and (pointer: coarse) {

    /* Increase touch targets */
    .nav-link,
    .footer-link,
    .btn-cta,
    .btn-submit,
    .service-link,
    .faq-question {
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .form-checkbox input[type="checkbox"] {
        width: 24px;
        height: 24px;
    }

    /* Disable hover effects that don't work well on touch */
    .service-card:hover {
        transform: none;
    }

    .service-card:hover .service-image {
        transform: none;
    }

    .gallery-item:hover .gallery-image {
        transform: none;
    }

    .gallery-overlay {
        opacity: 0.7;
    }

    .gallery-icon {
        transform: scale(1);
    }

    /* Show tap hint */
    .gallery-item::after {
        content: 'Toca para ver';
        position: absolute;
        bottom: 10px;
        left: 50%;
        transform: translateX(-50%);
        font-size: 0.75rem;
        color: var(--blanco-puro);
        background-color: rgba(0, 0, 0, 0.5);
        padding: 0.25rem 0.5rem;
        border-radius: var(--radius-sm);
        opacity: 0;
        transition: opacity var(--transition-base);
    }

    .gallery-item:active::after {
        opacity: 1;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {

    .preloader,
    .cursor,
    .scroll-progress,
    .back-to-top,
    .hero-particles,
    .hero-scroll-indicator,
    .lightbox {
        display: none !important;
    }

    .header {
        position: static;
        background: none;
        box-shadow: none;
    }

    body {
        font-size: 12pt;
        color: #000;
        background: #fff;
    }

    .section {
        page-break-inside: avoid;
    }

    a {
        text-decoration: underline;
    }
}

/* ============================================
   LANDSCAPE MOBILE ADJUSTMENTS
   ============================================ */
@media screen and (max-height: 500px) and (orientation: landscape) {
    .hero {
        min-height: auto;
        padding: var(--spacing-lg) var(--spacing-md);
    }

    .hero-content {
        padding: var(--spacing-md);
    }

    .hero-scroll-indicator {
        display: none;
    }

    .preloader-logo {
        width: 100px;
    }
}

/* ============================================
   HIGH DPI SCREENS
   ============================================ */
@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {

    /* Ensure crisp images on retina displays */
    .header-logo,
    .footer-logo,
    .preloader-logo {
        image-rendering: -webkit-optimize-contrast;
    }
}