/* 
 * ALPINE COFFEE ESTATE - Comprehensive Responsive Styles
 * Mobile-First Polish, Touch Screen Adaptations & Navigation Drawer
 */

/* =========================================
   [00] MOBILE VIEWPORT & SCROLL OVERRIDE (<= 768px ONLY)
   Touch scrolling and drawer navigation for mobile devices
   Desktop and laptop viewports preserve full snap-scroll & section dots
   ========================================= */
@media screen and (max-width: 768px) {
    html {
        scroll-snap-type: none !important;
        height: auto !important;
        overflow-x: hidden !important;
        overflow-y: visible !important;
    }

    body {
        height: auto !important;
        overflow-x: hidden !important;
        overflow-y: visible !important;
        position: relative !important;
        min-height: 100% !important;
        -webkit-overflow-scrolling: touch;
    }

    .full-page-section {
        height: auto !important;
        min-height: 100dvh;
        max-height: none !important;
        scroll-snap-align: none !important;
        scroll-snap-stop: normal !important;
        padding-top: calc(70px + 1.5rem);
        padding-bottom: 2.5rem;
    }

    .hero-section.full-page-section {
        min-height: 100vh;
        min-height: 100dvh;
        height: 100dvh !important;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        align-items: flex-start;
        padding-top: calc(70px + 2rem);
        padding-bottom: 0;
        overflow: hidden !important;
        position: relative;
    }

    /* Prevent hero physics canvas and backgrounds from intercepting touch scrolling on mobile */
    #beans-canvas-container,
    #beans-canvas-container canvas,
    .hero-bg,
    .bg-gradient-overlay {
        pointer-events: none !important;
        touch-action: pan-y !important;
    }

    .section-nav {
        display: none !important;
    }

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

/* =========================================
   [01] MOBILE HAMBURGER MENU & DRAWER
   ========================================= */
.mobile-nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 42px;
    height: 42px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1005;
}

.hamburger-bar {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--clr-text-primary);
    border-radius: 2px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.mobile-nav-drawer {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    z-index: 1004;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-12px);
    transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1), transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.mobile-nav-links {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    text-align: center;
    width: 100%;
    max-width: 320px;
    padding: 2rem 1.5rem;
}

.mobile-nav-link {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--clr-text-primary);
    text-decoration: none;
    letter-spacing: 0.02em;
    transition: color 0.25s ease, transform 0.25s ease;
}

.mobile-nav-link:hover,
.mobile-nav-link:active {
    color: var(--clr-accent);
    transform: translateX(4px);
}

.mobile-nav-btn {
    margin-top: 1rem;
    width: 100%;
    text-align: center;
    font-size: 1rem !important;
    padding: 0.85rem 1.5rem;
}

/* Open States */
.mobile-nav-toggle.is-active .hamburger-bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.mobile-nav-toggle.is-active .hamburger-bar:nth-child(2) {
    opacity: 0;
}

.mobile-nav-toggle.is-active .hamburger-bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.mobile-nav-drawer.is-open {
    display: flex;
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

/* =========================================
   [01] MOBILE & SMALL TABLETS (<= 768px)
   ========================================= */
@media screen and (max-width: 768px) {
    .mobile-nav-toggle {
        display: flex;
    }

    .nav-links {
        display: none !important;
    }

    .glass-nav .nav-cta {
        display: none !important;
    }

    .nav-container {
        padding: 0.85rem 1.25rem;
    }

    .nav-brand-logo {
        height: 34px;
    }

    .brand-name {
        font-size: 0.95rem;
    }

    .container {
        padding: 0 1.25rem;
    }

    /* Hero Section */
    .hero-container {
        padding: 0 1.25rem;
    }

    .hero-title {
        font-size: clamp(2.2rem, 7.5vw, 3.2rem);
        line-height: 1.15;
    }

    .hero-subtitle {
        font-size: 0.98rem;
        line-height: 1.55;
    }

    .hero-cta-group {
        flex-wrap: wrap;
        gap: 0.75rem;
        margin-top: 1.5rem;
    }

    .scroll-indicator {
        display: none;
    }

    /* Manifesto */
    .anniversary-highlight {
        flex-direction: row;
        align-items: center;
        gap: 1rem;
        padding: 1.25rem;
    }

    .anniversary-badge-img {
        height: 52px;
        width: auto;
    }

    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.75rem;
        margin-top: 1.75rem;
    }

    .stat-item {
        padding: 1rem 0.5rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .stat-label {
        font-size: 0.72rem;
    }

    /* Ecosystem: Clean Single Unified Card (No Double Titles/Overlay) */
    .cards-grid {
        grid-template-columns: 1fr !important;
        gap: 1.35rem;
    }

    .ecosystem-card {
        min-height: auto !important;
        height: auto !important;
        border-radius: 16px;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
        overflow: hidden;
    }

    .card-media {
        height: clamp(190px, 32vh, 230px) !important;
    }

    .card-body {
        padding: 1.35rem 1.25rem 1.5rem !important;
        height: auto !important;
    }

    .logo-stage {
        height: 65px !important;
        margin-bottom: 0.5rem !important;
    }

    .card-subtitle {
        margin-bottom: 0.5rem;
    }

    .card-desc {
        display: block !important;
        font-size: 0.88rem !important;
        line-height: 1.55 !important;
        color: var(--clr-text-secondary) !important;
        margin-top: 0.65rem !important;
        text-align: center;
        max-width: 380px;
    }

    /* Hide desktop-only slide-up overlay on mobile to prevent duplicate titles/content */
    .card-overlay {
        display: none !important;
    }

    /* Farm Section */
    .farm-visual {
        transform: none !important;
        margin-top: 1.25rem;
    }

    .farm-image-frame {
        width: fit-content;
        max-width: 100%;
        border-radius: 14px;
    }

    .farm-img {
        max-height: 280px !important;
        width: auto;
        max-width: 100%;
        border-radius: 12px;
    }

    .farm-description {
        font-size: 0.98rem;
    }

    .farm-subtext {
        font-size: 0.9rem;
    }

    .farm-badge-floating {
        bottom: 1rem;
        left: 1rem;
        font-size: 0.72rem;
        padding: 0.4rem 0.85rem;
    }

    /* Roastery */
    .roastery-visual {
        transform: none !important;
        margin-bottom: 1rem;
    }

    .roastery-image-frame {
        width: fit-content;
        max-width: 100%;
        border-radius: 14px;
    }

    .roastery-img {
        max-height: 280px !important;
        width: auto;
        max-width: 100%;
        border-radius: 12px;
    }

    .roastery-info .subtitle {
        font-size: 0.95rem;
    }

    .specs-list {
        margin-top: 1.25rem;
    }

    .spec-row {
        padding: 0.85rem 0;
    }

    .spec-name {
        font-size: 0.9rem;
    }

    .spec-val {
        font-size: 0.86rem;
    }

    /* Mission & Vision */
    .mission-vision-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
        margin-top: 1.5rem;
    }

    .mv-card {
        padding: 1.75rem 1.5rem;
    }

    .mv-title {
        font-size: 1.25rem;
        margin-bottom: 0.75rem;
    }

    .mv-statement {
        font-size: 0.9rem;
        line-height: 1.6;
        margin-bottom: 1.25rem;
    }

    .mv-tags {
        gap: 0.4rem;
        padding-top: 1rem;
    }

    .mv-tag {
        font-size: 0.72rem;
        padding: 0.3rem 0.65rem;
    }

    /* Footer & Contact */
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .footer-locations {
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }

    .footer-map {
        height: 200px;
    }

    .sleek-form input,
    .sleek-form textarea {
        font-size: 16px !important; /* Prevents auto-zoom in iOS Safari */
        padding: 0.85rem 1rem;
    }

    .footer-bottom {
        flex-direction: column;
        gap: 0.85rem;
        text-align: center;
    }
}

/* =========================================
   [04] EXTRA-SMALL PHONES (<= 480px)
   ========================================= */
@media screen and (max-width: 480px) {
    .nav-container {
        padding: 0.75rem 1rem;
    }

    .brand-name {
        font-size: 0.82rem;
        letter-spacing: 0.04em;
    }

    .hero-title {
        font-size: 2.1rem;
        line-height: 1.2;
    }

    .hero-cta-group {
        flex-direction: column;
        width: 100%;
    }

    .hero-cta-group .btn-primary,
    .hero-cta-group .btn-secondary {
        width: 100%;
        text-align: center;
    }

    .anniversary-highlight {
        flex-direction: column;
        text-align: center;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 0.85rem;
    }

    .farm-highlights {
        grid-template-columns: 1fr;
        gap: 0.85rem;
    }

    .farm-actions .btn-primary {
        width: 100%;
        text-align: center;
    }

    .spec-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.3rem;
        padding: 0.75rem 0;
    }

    .spec-val {
        font-size: 0.84rem;
    }

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

    .mv-card {
        padding: 1.5rem 1.2rem;
    }
}

/* =========================================
   [05] REDUCED MOTION ACCESSIBILITY
   ========================================= */
@media (prefers-reduced-motion: reduce) {
    .fade-up {
        transition: none !important;
        opacity: 1 !important;
        transform: none !important;
    }

    .word-inner {
        transition: none !important;
        transform: none !important;
    }

    .hero-bg {
        transform: none !important;
    }
}

/* =========================================
   [06] TOUCH DEVICES (COARSE POINTER)
   ========================================= */
@media (pointer: coarse) {
    #beans-canvas-container,
    #beans-canvas-container canvas {
        pointer-events: none !important;
        touch-action: pan-y !important;
    }
}
