/* =========================================================
   GLOBAL SAFETY NET (all screen sizes)
   ========================================================= */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

/* "clip" (not "hidden") so position: sticky headers keep working */
body { overflow-x: clip; }

img, video, svg, iframe { max-width: 100%; }

/* =========================================================
   TABLET & BELOW (max-width: 1024px)
   ========================================================= */
@media (max-width: 1024px) {
    .product-detail,
    .cart-layout,
    .checkout-layout,
    .shop-layout,
    .dashboard-layout,
    .contact-grid,
    .about-hero {
        grid-template-columns: minmax(0, 1fr);
    }

    .trust-grid,
    .stats-grid,
    .about-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    /* .shop-sidebar intentionally NOT set to static here —
       shop.css manages its own mobile slide-in behavior. */
    .dashboard-sidebar {
        position: static;
    }

    /* ---------- PAGE BANNER (shop, cart, checkout, contact, about, wishlist, legal) ---------- */
    .page-header {
        min-height: 340px;
        padding: 44px 0;
    }

    .page-header .container {
        padding: 0 28px;
    }

    .page-header h1 {
        font-size: 2.5rem;
    }

    .features-bar {
        width: 100%;
        gap: 16px;
        padding: 14px 20px;
    }

    /* ---------- FOOTER: brand on top, then 2 x 2 ---------- */
    .footer-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 32px 28px;
        padding-bottom: 32px;
    }

    /* brand spans the full row */
    .footer-brand {
        grid-column: 1 / -1;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        text-align: center;
    }

    .footer-brand p {
        max-width: 560px;
    }
}

/* =========================================================
   MOBILE (max-width: 768px)
   ========================================================= */
@media (max-width: 768px) {

    /* ---------- GENERIC MOBILE ---------- */
    /* 2 product cards per row on phones (minmax(0,…) stops cards pushing off-screen) */
    .products-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    /* inputs >= 16px so iOS Safari does not zoom the page when a field is focused */
    input,
    select,
    textarea {
        font-size: 16px;
    }

    /* ---------- PAGE BANNER ---------- */
    .page-header {
        margin: 12px;
        width: calc(100% - 24px);
        min-height: 0;
        padding: 28px 0 24px;
        border-radius: 20px;
    }

    /* stronger scrim: text sits over the whole artwork on a narrow screen */
    .page-header::before {
        background: linear-gradient(180deg, rgba(255, 247, 237, 0.94) 0%, rgba(255, 247, 237, 0.82) 100%);
    }

    .page-header .container {
        padding: 0 20px;
    }

    .page-header .breadcrumb {
        margin-bottom: 8px;
        font-size: 0.82rem;
    }

    .page-header h1 {
        font-size: 2rem;
        margin-bottom: 10px;
    }

    .page-header p {
        font-size: 0.95rem;
        line-height: 1.55;
        margin-bottom: 20px;
    }

    .features-bar {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px 10px;
        width: 100%;
        padding: 12px 14px;
        border-radius: 14px;
    }

    .feature-item {
        gap: 8px;
        min-width: 0;
    }

    .feature-item i {
        font-size: 1.3rem;
        flex-shrink: 0;
    }

    .feature-item span {
        font-size: 0.76rem;
    }

    /* ---------- FORMS ---------- */
    .form-row {
        grid-template-columns: minmax(0, 1fr);
    }

    .product-features-list {
        grid-template-columns: minmax(0, 1fr);
    }

    .auth-card {
        padding: 28px 20px;
    }

    h1 { font-size: 1.8rem; }
    h2 { font-size: 1.5rem; }

    /* ---------- FOOTER: calmer, less decoration ---------- */
    .footer-wave-wrap { height: 80px; }

    .main-footer { padding-top: 40px; }

    .footer-grid {
        gap: 28px 24px;
        padding-bottom: 28px;
    }

    /* minimalist headings: small caps label, no animated underline */
    .footer-col h4 {
        font-size: 0.8rem;
        font-weight: 700;
        letter-spacing: 0.1em;
        text-transform: uppercase;
        color: rgba(255,255,255,0.92);
        margin-bottom: 14px;
        padding-bottom: 0;
    }

    .footer-col h4::after { display: none; }

    /* touch screens: no hover slide on links */
    .footer-col ul a:hover,
    .footer-bottom-links a:hover {
        transform: none;
    }

    /* fewer sparkles = smoother scrolling */
    .spark7, .spark8, .spark9, .spark10, .spark11, .spark12 {
        display: none;
    }

    .footer-bottom {
        flex-direction: column;
        gap: 10px;
        text-align: center;
        padding: 16px 0;
        font-size: 0.8rem;
    }

    .footer-bottom-links { gap: 18px; }
}

/* =========================================================
   SMALL TABLET (max-width: 700px) — generic section system
   ========================================================= */
@media (max-width: 700px) {
    .section {
        padding: 52px 0;
    }

    .section-header {
        align-items: flex-start;
        gap: 18px;
        flex-direction: column;
    }

    .products-grid .product-wishlist {
        width: 32px;
        height: 32px;
        font-size: .9rem;
        top: 8px;
        right: 8px;
    }
}

/* =========================================================
   SMALL (max-width: 640px)
   Everything shared that applies at 640px and below lives in this ONE block.
   ".main-content" keeps the generic section values stronger than the
   700px values above and the .section base in home.css.
   ========================================================= */
@media (max-width: 640px) {

    .container {
        padding-left: 12px;
        padding-right: 12px;
    }

    .search-suggestions {
        border-radius: 13px;
    }

    .search-suggestion {
        grid-template-columns: 40px 1fr;
    }

    .search-suggestion-thumb {
        width: 40px;
        height: 40px;
    }

    .search-suggestion-price {
        grid-column: 2;
        margin-top: -8px;
    }

    /* ---------- TIGHTER SPACING ---------- */
    .main-content .section {
        padding-top: 28px;
        padding-bottom: 28px;
    }

    .main-content .section-header {
        margin-bottom: 16px;
        gap: 8px;
    }

    .main-content .section-heading h2 {
        font-size: 1.45rem;
        margin-bottom: 4px;
    }

    .main-content .section-heading p {
        font-size: 0.9rem;
    }

    /* inner-page banners */
    .page-header { margin: 8px; width: calc(100% - 16px); padding: 20px 0 18px; }
    .page-header .container { padding: 0 14px; }

    /* breadcrumb / generic blocks */
    .breadcrumb { padding: 10px 0; }

    /* shop page */
    .shop-layout { padding-bottom: 32px; }

    /* ---------- FOOTER: minimalist 2-column phone layout ----------
       Row 1: brand (full width)
       Row 2: Quick Links | Customer Service  (side by side)
       Row 3: Contact (full width)
       Row 4: Newsletter (full width) */
    .main-footer { padding-top: 32px; }

    .footer-grid {
        gap: 24px 16px;
        padding-bottom: 24px;
    }

    /* Contact (4th column) and Newsletter (5th) take the full row */
    .footer-grid > .footer-col:nth-child(4),
    .footer-newsletter {
        grid-column: 1 / -1;
    }

    /* brand: compact, short description */
    .footer-logo { margin-bottom: 12px; }


    .footer-brand p {
        font-size: 0.85rem;
        line-height: 1.6;
        margin-bottom: 16px;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .footer-social { gap: 10px; }

    .footer-social a {
        width: 34px;
        height: 34px;
        font-size: 0.85rem;
    }

    /* link lists: tight and scannable */
    .footer-col ul li { margin-bottom: 9px; }

    .footer-col ul a {
        font-size: 0.85rem;
        line-height: 1.35;
    }

    /* contact: compact rows, long emails/addresses wrap */
    .contact-list li {
        gap: 10px;
        font-size: 0.85rem;
        margin-bottom: 10px;
        overflow-wrap: anywhere;
    }

    /* newsletter: short blurb, single row form */
    .footer-newsletter p {
        font-size: 0.85rem;
        line-height: 1.5;
    }

    .newsletter-form {
        margin-top: 10px;
        width: 100%;
        max-width: 100%;
    }

    .newsletter-form input,
    .newsletter-form button {
        box-sizing: border-box;
        min-width: 0;
    }

    .newsletter-form input {
        padding: 11px 14px;
        font-size: 16px; /* stops iOS zoom on focus */
    }

    .newsletter-form button {
        padding: 11px 16px;
        flex-shrink: 0;
    }

    .footer-newsletter {
        min-width: 0;
        max-width: 100%;
    }

    /* calmer background: no drifting glow on phones */
    .main-footer::before,
    .main-footer::after {
        animation: none;
    }

    .main-footer::before {
        width: 360px;
        height: 360px;
    }
}

/* =========================================================
   EXTRA SMALL (max-width: 480px)
   Only properties NOT already set by the 640px block above.
   ========================================================= */
@media (max-width: 480px) {
    /* keep 2 cards per row on phones — one-per-row wastes the screen */
    .products-grid {
        gap: 10px;
    }

    .product-detail-actions {
        flex-direction: column;
    }

    .cart-product {
        flex-direction: column;
        align-items: flex-start;
    }

    /* ---------- PAGE BANNER ---------- */
    .page-header {
        border-radius: 18px;
    }

    .page-header h1 {
        font-size: 1.75rem;
    }

    .page-header p {
        font-size: 0.9rem;
    }

    .features-bar {
        padding: 12px;
    }

    .feature-item i {
        font-size: 1.15rem;
    }

    .feature-item span {
        font-size: 0.72rem;
    }

    /* ---------- FOOTER ---------- */
    .footer-wave-wrap { height: 60px; }

    .spark4, .spark5, .spark6 { display: none; }

    /* newsletter: stack input above button so it never overflows */
    .newsletter-form {
        flex-direction: column;
        gap: 10px;
    }

    .newsletter-form input,
    .newsletter-form button {
        width: 100%;
        max-width: 100%;
        border-radius: 10px;
    }
}

/* =========================================================
   NARROW PHONES (max-width: 360px)
   ========================================================= */
@media (max-width: 360px) {
    .products-grid {
        gap: 8px;
    }

    .page-header h1 {
        font-size: 1.6rem;
    }

    .features-bar {
        gap: 10px 8px;
        padding: 10px;
    }

    /* ---------- FOOTER ---------- */
    .footer-grid { gap: 22px 12px; }
}