/* ==========================================================================
   Pop's Red Hot — Responsive Styles
   Comprehensive responsive design for all templates and components.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Large Desktop (max-width: 1200px)
   -------------------------------------------------------------------------- */
@media (max-width: 1200px) {
    .product-grid--jams {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* --------------------------------------------------------------------------
   Tablet (max-width: 1024px)
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
    /* ---- Hero (Tablet/iPad) ---- */

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

    .footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: var(--space-md);
    }

    .single-product-layout {
        gap: var(--space-lg);
    }

    .about-hero {
        gap: var(--space-lg);
    }

    .recipe-grid {
        grid-template-columns: repeat(2, 1fr);
    }

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

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

    .retailer-list {
        grid-template-columns: repeat(2, 1fr);
    }

    .wholesale-cta {
        padding: var(--space-md);
    }
}

/* --------------------------------------------------------------------------
   Tablet Portrait / Large Mobile (max-width: 768px)
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
    :root {
        --space-lg: 3rem;
        --space-xl: 4rem;
        --header-height: 72px; /* logo 40px + reduced padding */
    }

    /* Prevent horizontal overflow */
    html, body {
        overflow-x: hidden;
    }

    /* ---- Header ---- */
    .site-logo img {
        height: 40px;
    }

    .menu-toggle {
        display: block;
    }

    .main-nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        max-width: 350px;
        height: 100vh;
        background: var(--color-white);
        flex-direction: column;
        justify-content: center;
        padding: var(--space-lg);
        box-shadow: var(--shadow-lg);
        transition: right var(--transition-base);
        z-index: 1000;
    }

    .main-nav.open {
        right: 0;
    }

    .main-nav__list {
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
    }

    .main-nav__list a {
        font-size: 1.1rem;
        padding: 0.75rem 0;
        display: flex;
        align-items: center;
        min-height: 44px;
    }

    .main-nav__list a::after {
        bottom: 0;
        left: 0;
        transform: none;
    }

    .nav-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }

    .nav-overlay.active {
        display: block;
    }

    /* ---- Hero ---- */
    .hero__bottom {
        gap: var(--space-sm);
    }

    /* ---- Section Titles (Bilingual) ---- */
    .section-title {
        font-size: clamp(1.5rem, 5vw, 2.5rem);
    }

    /* EN stays same size as FR but moves to its own line on small screens for readability.
       Size override removed per May 21 directive — FR/EN identical font size site-wide. */
    .lang-en {
        display: block;
        margin-top: 0.1em;
    }

    .product-grid-section__title {
        font-size: clamp(1.3rem, 4vw, 1.8rem);
    }

    /* ---- Product Groups ---- */
    .product-groups {
        grid-template-columns: 1fr;
        gap: var(--space-sm);
    }

    .product-group {
        min-height: 0;
    }

    .product-group__title {
        font-size: clamp(1.5rem, 5vw, 2.5rem);
    }

    /* ---- Product Grids ---- */
    .product-grid--sauces {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-sm);
    }

    .product-grid--jams {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-sm);
    }

    .product-grid-section__header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    /* ---- Single Product ---- */
    .single-product-layout {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }

    .product-gallery {
        position: relative;
        top: 0;
    }

    .product-info__title {
        font-size: clamp(1.5rem, 5vw, 2rem);
    }

    /* ---- Related Products ---- */
    .related-products__grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* ---- About ---- */
    .about-hero {
        grid-template-columns: 1fr;
    }

    .about-hero__image {
        order: -1;
    }

    /* ---- Recipes ---- */
    .recipe-grid {
        grid-template-columns: 1fr;
    }

    /* ---- Ideas ---- */
    .ideas-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .ideas-intro {
        font-size: 1rem;
    }

    /* ---- Where to Buy ---- */
    .retailer-list {
        grid-template-columns: 1fr;
    }

    .where-to-buy__intro {
        font-size: 1rem;
        padding: 0 var(--space-xs);
    }

    .region-group__title {
        font-size: clamp(1.2rem, 4vw, 1.6rem);
    }

    .retailer-item {
        padding: var(--space-sm);
    }

    .wholesale-cta {
        padding: var(--space-md);
        text-align: center;
    }

    .wholesale-cta h3 {
        font-size: clamp(1.2rem, 4vw, 1.5rem);
    }

    /* ---- CTA Banner ---- */
    .section--dark h2 {
        font-size: clamp(1.3rem, 4vw, 1.8rem);
    }

    /* ---- Footer ---- */
    .footer-grid {
        grid-template-columns: 1fr;
        gap: var(--space-md);
        text-align: center;
    }

    .footer-brand__text {
        max-width: none;
        margin: 0 auto;
    }

    .footer-brand__logo {
        margin: 0 auto var(--space-sm);
    }

    .footer-social {
        justify-content: center;
    }

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

    .footer-col__title {
        margin-top: var(--space-xs);
    }

    /* ---- Forms (prevent iOS zoom on focus) ---- */
    .form-group input,
    .form-group textarea,
    select {
        font-size: 16px;
    }
}

/* --------------------------------------------------------------------------
   Mobile (max-width: 480px)
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
    :root {
        --space-md: 1.5rem;
        --space-lg: 2.5rem;
        --space-xl: 3rem;
        --header-height: 55px; /* logo 35px + tight padding */
    }

    .container {
        padding: 0 var(--space-sm);
    }

    /* ---- Header ---- */
    .header-inner {
        padding: var(--space-xs) var(--space-sm);
    }

    .site-logo img {
        height: 35px;
    }

    /* ---- Hero ---- */
    .hero__bottom {
        flex-direction: column;
        gap: 0.25rem;
    }

    .hero__cta {
        flex-direction: column;
        align-items: center;
        width: 100%;
    }

    .hero__cta .btn {
        width: 100%;
        max-width: 280px;
        text-align: center;
    }

    /* ---- Section Titles ---- */
    /* EN size override removed per May 21 directive — FR/EN identical font size site-wide. */

    /* ---- Product Cards ---- */
    .product-card__body {
        padding: 0.75rem;
    }

    .product-card__title {
        font-size: 0.9rem;
        line-height: 1.3;
    }

    /* FR and EN both 0.85rem (matched) on phones to fit the smaller card width. */
    .product-card__title .lang-fr,
    .product-card__title .lang-en {
        font-size: 0.85rem;
    }

    .product-card__category {
        font-size: 0.65rem;
    }

    .product-card__image-wrap {
        padding: var(--space-sm);
    }

    .product-grid--sauces,
    .product-grid--jams {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    /* ---- Buttons (min 44px touch target) ---- */
    .btn {
        padding: 0.75rem 1.5rem;
        font-size: 0.85rem;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .btn--lg {
        padding: 0.875rem 2rem;
        font-size: 0.95rem;
    }

    /* ---- Single Product ---- */
    .product-gallery__main {
        padding: var(--space-md);
    }

    .product-info__meta {
        padding: var(--space-sm);
    }

    .product-info__meta dt,
    .product-info__meta dd {
        font-size: 0.85rem;
    }

    /* ---- Where to Buy ---- */
    .retailer-item__name {
        font-size: 0.95rem;
    }

    .retailer-item__address,
    .retailer-item__phone {
        font-size: 0.85rem;
    }

    /* ---- Page Header ---- */
    .page-header {
        padding: var(--space-md) 0;
    }

    .page-header__title {
        font-size: clamp(1.5rem, 6vw, 2.2rem);
    }

    /* ---- Content Images & Embeds ---- */
    .entry-content img {
        width: 100%;
        height: auto;
        border-radius: var(--border-radius);
    }

    .entry-content iframe,
    .entry-content video,
    .entry-content embed {
        max-width: 100%;
        height: auto;
        aspect-ratio: 16 / 9;
    }

    .entry-content table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* ---- Footer ---- */
    .footer-col {
        text-align: center;
    }

    .footer-col ul a {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }
}

/* --------------------------------------------------------------------------
   Very Small Mobile (max-width: 360px)
   -------------------------------------------------------------------------- */
@media (max-width: 360px) {
    .ideas-grid {
        grid-template-columns: 1fr;
        max-width: 320px;
        margin: 0 auto;
    }

    .product-grid--sauces,
    .product-grid--jams {
        grid-template-columns: 1fr;
        max-width: 320px;
        margin: 0 auto;
    }

    .hero__cta .btn {
        font-size: 0.8rem;
        padding: 0.7rem 1rem;
    }

    /* EN size override removed per May 21 directive — FR/EN identical font size site-wide. */

    .footer-brand__logo {
        max-width: 100px;
    }

    .site-logo img {
        height: 30px;
    }
}

/* --------------------------------------------------------------------------
   Landscape Mobile (short viewport)
   -------------------------------------------------------------------------- */
@media (max-height: 500px) and (orientation: landscape) {
    .hero__middle {
        margin-bottom: 0.25rem;
    }

    .hero__bottom {
        margin-bottom: 0.25rem;
    }
}

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

    .fade-in {
        opacity: 1;
        transform: none;
    }
}

/* --------------------------------------------------------------------------
   High-DPI Screens (Retina)
   -------------------------------------------------------------------------- */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .product-card__image,
    .hero__logo,
    .hero__mascot,
    .footer-brand__logo {
        image-rendering: -webkit-optimize-contrast;
    }
}

/* --------------------------------------------------------------------------
   Print Styles
   -------------------------------------------------------------------------- */
@media print {
    .site-header,
    .site-footer,
    .menu-toggle,
    .hero__cta,
    .product-group__arrow,
    .nav-overlay {
        display: none !important;
    }

    body {
        color: #000;
        background: #fff;
        font-size: 12pt;
    }

    .hero {
        background: #fff !important;
        padding: 1rem 0;
    }

    .container {
        max-width: 100%;
        padding: 0;
    }

    .product-card {
        box-shadow: none;
        border: 1px solid #ddd;
        break-inside: avoid;
    }

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

    a[href]::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: #666;
    }

    .btn::after {
        content: none;
    }
}
