@media (max-width: 768px) {
    .hero {
        background-attachment: scroll;
    }

    .ingredients {
        background-attachment: scroll;
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .hero-subtitle {
        font-size: 1.2rem;
    }

    .logo {
        max-width: 400px;
    }

    .section-title {
        font-size: 2.5rem;
    }

    .section-subtitle {
        font-size: 1rem;
    }

    .story-grid {
        grid-template-columns: 1fr;
    }

    .flavors-grid {
        grid-template-columns: 1fr;
    }

    .ingredients-showcase {
        grid-template-columns: 1fr;
    }

    .hero-cta {
        flex-direction: column;
        gap: 1rem;
    }

    .btn {
        padding: 1rem 2.5rem;
        font-size: 1rem;
    }

    .cta-title {
        font-size: 2.5rem;
    }

    .cta-subtitle {
        font-size: 1.2rem;
    }

    .cta-buttons {
        flex-direction: column;
        gap: 1rem;
    }

    section {
        padding: 4rem 0;
    }

    .star {
        font-size: 1.5rem;
    }

    .cloud {
        font-size: 2rem;
    }

    .story-card {
        padding: 2rem;
    }

    .ingredient-category {
        padding: 2rem;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .logo {
        max-width: 300px;
    }

    .section-title {
        font-size: 2rem;
    }

    .story-card {
        padding: 1.5rem;
    }

    .flavor-content {
        padding: 1.5rem;
    }

    .ingredient-category {
        padding: 1.5rem;
    }

    .cta-title {
        font-size: 2rem;
    }

    .btn {
        width: 100%;
        padding: 1rem 2rem;
    }

    .card-icon {
        font-size: 3rem;
    }

    .category-icon {
        font-size: 3rem;
    }
}

@media (max-width: 480px) {
    .quantity-cart {
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
    }

    .quantity-ticker {
        justify-content: center;
        align-self: center;
    }

    .add-to-cart-btn {
        width: 100%;
    }

    .cart-toast {
        bottom: 16px;
        right: 16px;
        left: 16px;
        max-width: unset;
        font-size: 0.95rem;
    }
}

/* ============================================================
   MOBILE NAV — independent panel, never touches #nav-links
   ============================================================ */

/* Independent panel — always in DOM, off-screen when closed */
#mob-nav-panel {
    position: fixed;
    top: 75px;                          /* below navbar (72px) + border (3px) */
    right: 0;
    height: calc(100vh - 75px);
    width: 280px;
    background: #fff;
    border-left: 3px solid var(--color-primary-yellow);
    border-top: 3px solid var(--color-primary-yellow);
    border-radius: 0 0 0 16px;
    box-shadow: -6px 0 40px rgba(0, 0, 0, 0.18);
    z-index: 1001;
    transform: translateX(110%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 1.5rem 1.2rem 2rem;
    pointer-events: none;               /* block clicks while off-screen */
}
#mob-nav-panel.open {
    transform: translateX(0);
    pointer-events: auto;
}

/* Links inside the panel */
.mob-nav-link {
    display: block;
    font-family: 'Fredoka', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-chocolate-dark);
    text-decoration: none;
    padding: 0.9rem 1rem;
    border-radius: 12px;
    transition: background 0.2s, color 0.2s;
}
.mob-nav-link:hover,
.mob-nav-link.active {
    background: var(--color-primary-pink);
    color: #fff;
}

/* Divider */
.mob-nav-divider {
    height: 2px;
    background: var(--color-primary-yellow);
    border-radius: 2px;
    margin: 0.4rem 0 0.6rem;
    flex-shrink: 0;
}

/* Auth section */
#nav-mob-auth {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.mob-auth-link {
    display: block;
    font-family: 'Fredoka', sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    color: #fff;
    background: var(--color-primary-pink);
    text-decoration: none;
    padding: 0.8rem 1rem;
    border-radius: 30px;
    text-align: center;
    transition: background 0.2s;
}
.mob-auth-btn {
    font-family: 'Fredoka', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text-medium-gray);
    background: none;
    border: 2px solid #eee;
    border-radius: 30px;
    padding: 0.7rem 1rem;
    cursor: pointer;
    text-align: center;
    width: 100%;
    transition: all 0.2s;
}
.mob-auth-btn:hover {
    color: var(--color-error);
    border-color: var(--color-error);
}

/* Hide panel on desktop */
@media (min-width: 769px) {
    #mob-nav-panel { display: none !important; }
}

/* ── Mobile navbar layout ─────────────────────────────────────── */
@media (max-width: 768px) {
    /* Hide desktop nav links and person icon */
    #nav-links        { display: none !important; }
    #nav-person-btn,
    .profile-wrapper  { display: none !important; }

    /* Logo left, cart + hamburger grouped on the right */
    .nav-actions {
        margin-left: auto;
    }

    /* Show hamburger */
    .nav-hamburger {
        display: flex;
        position: relative;
        z-index: 1003;
    }

    /* Hamburger → X animation */
    .nav-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
    .nav-hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
    .nav-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

    /* Keep yellow border on open state — remove pink fill */
    .nav-hamburger.open {
        background: transparent;
        border-color: var(--color-primary-yellow);
    }
    .nav-hamburger.open span {
        background: var(--color-primary-pink);
    }
}

@media (max-width: 480px) {
    .construction-title {
        font-size: 2.8rem;
    }

    .construction-subtitle {
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .auth-card { padding: 1.8rem 1.2rem; }
    .form-row  { grid-template-columns: 1fr; gap: 0; }
}

@media (max-width: 768px) {
    .account-hero-content { flex-direction: column; text-align: center; }
    .account-signout { margin-left: 0; }
    .orders-grid { grid-template-columns: 1fr; }
    .account-greeting { font-size: 2rem; }
}

@media (max-width: 480px) {
    /* Fix cart dropdown on mobile: anchor to viewport, not the button wrapper */
    .cart-dropdown {
        position: fixed;
        top: 75px;
        left: 12px;
        right: 12px;
        width: auto;
    }
}

@media (max-width: 860px) {
    .chk-layout {
        grid-template-columns: 1fr;
    }
    .chk-summary {
        order: -1;
        position: static;
    }
    .chk-option-grid {
        grid-template-columns: 1fr;
    }
    .chk-row-3 {
        grid-template-columns: 1fr 70px 90px;
    }
}

@media (max-width: 520px) {
    .chk-panel { padding: 1.4rem 1rem; }
    .chk-row   { grid-template-columns: 1fr; }
    .chk-row-3 { grid-template-columns: 1fr; }
    .chk-connector { max-width: 40px; }
    .chk-actions { flex-wrap: wrap; justify-content: center; }
}

@media (max-width: 480px) {

    /* Hero */
    .hero-title    { font-size: 2rem; }
    .hero-subtitle { font-size: 1rem; }
    .logo          { max-width: 240px; }
    .hero-cta      { flex-direction: column; gap: 0.8rem; }
    .hero-cta .btn { width: 100%; text-align: center; padding: 1rem 1.5rem; }

    /* Section headings */
    .section-title    { font-size: 2rem; }
    .section-subtitle { font-size: 0.92rem; }

    /* Flavor cards */
    .flavors-grid       { grid-template-columns: 1fr; padding: 0 0.5rem; }
    .flavor-card        { padding: 1.2rem 1rem; }
    .size-options       { flex-wrap: wrap; gap: 0.4rem; }
    .size-btn           { padding: 0.45rem 0.6rem; }
    .quantity-cart      { flex-direction: column; gap: 0.75rem; }
    .add-to-cart-btn    { width: 100%; text-align: center; }

    /* Brand story */
    .story-grid         { grid-template-columns: 1fr; }
    .story-card         { padding: 1.5rem 1rem; }

    /* Ingredients */
    .ingredients-showcase { grid-template-columns: 1fr; }

    /* CTA */
    .cta-buttons        { flex-direction: column; gap: 0.8rem; }
    .cta-buttons .btn   { width: 100%; text-align: center; }
    .social-icons       { flex-wrap: wrap; gap: 0.5rem; }

    /* Under construction pages */
    .construction-title    { font-size: 2.2rem; }
    .construction-subtitle { font-size: 1rem; }
    .construction-desc     { font-size: 0.9rem; }

    /* Login */
    .auth-container         { padding: 1.2rem 1rem; }
    .auth-title             { font-size: 2rem; }
    .auth-tab               { font-size: 0.92rem; padding: 0.6rem 1rem; }

    /* Account */
    .account-hero           { padding: 6rem 0 2rem; }
    .account-greeting       { font-size: 1.8rem; }
    .orders-grid            { grid-template-columns: 1fr; }

    /* Confirmation */
    .conf-card              { padding: 2rem 1.2rem; }
    .conf-title             { font-size: 2rem; }
    .conf-number            { font-size: 1.6rem; }
    .conf-actions           { flex-direction: column; }
    .conf-btn               { width: 100%; text-align: center; }
}

@media (max-width: 1024px) {
    .flavors-grid     { grid-template-columns: repeat(2, 1fr); }
    .story-grid       { grid-template-columns: repeat(2, 1fr); }
    .ingredients-showcase { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .flavors-grid         { grid-template-columns: 1fr; }
    .ingredients-showcase { grid-template-columns: 1fr; }
    .story-grid           { grid-template-columns: 1fr; }
    /* Checkout step labels truncate gracefully */
    .chk-step-lbl { font-size: 0.7rem; }
    .chk-connector { max-width: 40px; }
}


