/* uxpeak-upgrade.css — 15-mistake redesign applied to Ratnam's Home Foods.
   Loaded LAST so it wins over Tailwind CDN utilities where they conflict.
   Lessons keyed M1..M15 / I1..I3 (see notes/UI-LESSONS.md). */

/* M5 — one strong family for UI+headings. Poppins everywhere; NTR stays for Telugu script only. */
.font-playfair, .font-federo {
    font-family: 'Poppins', 'NTR', sans-serif !important;
}
body {
    font-family: 'Poppins', 'NTR', sans-serif !important;
}
/* Telugu-script runs keep NTR even inside Poppins contexts */
.font-telugu, [data-lang="te"] {
    font-family: 'NTR', sans-serif !important;
}

/* M7 — title rhythm: presence without shouting */
.ux-product-title {
    font-size: 1.5rem;
    line-height: 1.25;
    font-weight: 700;
    letter-spacing: -0.01em;
    text-wrap: balance;
}
@media (min-width: 640px) {
    .ux-product-title { font-size: 1.875rem; }
}

/* M8 — paragraphs support understanding: looser leading, softer contrast */
.ux-body-copy {
    line-height: 1.75 !important;
    color: #475569 !important; /* slate-600, never near-black for body */
    max-width: 62ch;
}

/* M6 — micro labels breathe; badges scan in <1s */
.ux-micro-label {
    letter-spacing: 0.14em !important;
    font-weight: 700 !important;
    color: #78716c !important; /* warm stone, not cold slate */
}
.ux-badge {
    letter-spacing: 0.08em !important;
    font-weight: 800 !important;
    white-space: nowrap;
}

/* M4 — one calm action color per context; quota line stops shouting */
.ux-quota {
    color: #b45309 !important; /* mustard-700: warm urgency, not alarm red */
    font-weight: 700 !important;
}

/* M2 — one media system: consistent well, tone, focal scale across catalog + modal */
.ux-media-well {
    background: #fbf9f3 !important; /* single catalog tone, every product */
    box-shadow: inset 0 0 0 1px rgba(217, 119, 6, 0.10);
}
.ux-media-well #detail-product-emoji {
    font-size: 7rem; /* locked focal scale — system, not per-photo */
    line-height: 1;
}
@media (min-width: 640px) {
    .ux-media-well #detail-product-emoji { font-size: 8.5rem; }
}
.ux-card-media {
    background: #fbf9f3 !important;
    aspect-ratio: 4 / 3; /* every card, every product: same window */
    height: auto !important;
    min-height: 11rem;
    box-shadow: inset 0 0 0 1px rgba(217, 119, 6, 0.10);
}

/* M1 — overlays survive ANY product bg: container + contrast + outline */
.ux-icon-chip {
    box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.85), 0 4px 14px rgba(0, 0, 0, 0.25) !important;
    backdrop-filter: blur(4px);
}
#product-page-overlay .absolute.top-4.right-4 {
    box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.85), 0 4px 14px rgba(0, 0, 0, 0.30) !important;
}

/* M3 — single gutter: catalog grid + modal snap to shared rhythm */
#products-grid {
    gap: 1.5rem;
}
.ux-card {
    border-radius: 1.5rem;
    padding: 1.25rem !important;
}

/* M11 — dividers whisper, never chop */
.ux-price-block {
    border-top: 1px solid #f1f5f9 !important;
    border-bottom: 1px solid #f1f5f9 !important;
}

/* M12 — sections relate: tighter vertical rhythm inside modal */
.ux-tight-stack > * + * {
    margin-top: 1rem;
}

/* M9 — review count reads as a link to proof */
.ux-review-link {
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-color: #cbd5e1;
}
.ux-review-link:hover { color: #b91c1c !important; }

/* M10 — one icon logic: solid, single accent, even gaps */
.ux-feature-row i {
    width: 1.25rem;
    text-align: center;
}

/* M15 — CTA persuades, never shouts; total removes uncertainty */
#modal-add-to-cart-btn {
    text-transform: none !important;
    letter-spacing: 0.01em !important;
    font-weight: 700 !important;
    font-size: 0.95rem !important;
}
.ux-cta-total {
    font-weight: 800;
    padding-left: 0.5rem;
    margin-left: 0.5rem;
    border-left: 1px solid rgba(255, 255, 255, 0.45);
    font-variant-numeric: tabular-nums;
}
#detail-qty-unit {
    font-size: 0.65rem;
    font-weight: 700;
    color: #78716c;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* Weight chips (I3 presets): selected state unmistakable at a glance */
.ux-chip-on {
    background: #fef2f2 !important;
    border-color: #b91c1c !important;
    color: #7f1d1d !important;
    box-shadow: 0 0 0 1px #b91c1c, 0 2px 8px rgba(185, 28, 28, 0.12) !important;
}
.ux-chip-off {
    background: #fff !important;
    border-color: #e2e8f0 !important;
    color: #475569 !important;
}

/* I1 — sheet over image; title hands off to sticky nav */
.ux-sheet {
    border-top-left-radius: 1.5rem;
    border-top-right-radius: 1.5rem;
}
/* overflow:clip (NOT hidden) keeps the sheet's rounded corners while content
   scrolls inside the overlay */
#ux-modal-card {
    overflow: clip;
}

/* Touch phones have no hover to release: the first tap sticks :hover until
   the next tap elsewhere, so every hover-lift becomes a stuck, floaty shift
   of the whole card. Kill lift/scale hovers on touch only — deliberate
   :active press states are untouched and still apply. */
@media (hover: none) {
    #products-grid .ux-card:hover {
        transform: none !important;
    }
    #products-grid .group:hover svg {
        transform: none !important;
    }
}
.ux-badge-row {
    flex-wrap: wrap;
    row-gap: 0.5rem;
}

/* Ground-up compact 2-col phone cards. Everything here is ID-scoped so it
   beats both the desktop rules above and any Tailwind utility, regardless
   of the order the Tailwind CDN injects its generated styles. */
@media (max-width: 639px) {
    #products-grid {
        gap: 0.75rem !important;
    }
    #products-grid .ux-card {
        padding: 0.8rem !important;
        border-radius: 1.25rem;
        min-width: 0;
        overflow-wrap: break-word;
    }
    #products-grid .ux-card-media {
        height: 6.5rem !important;
        min-height: 0 !important;
        aspect-ratio: auto;
        border-radius: 1rem;
        margin-bottom: 0.65rem;
    }
    #products-grid .ux-card-media svg {
        height: 4.5rem !important;
        width: 4.5rem !important;
    }
    #products-grid .ux-product-title {
        font-size: 0.95rem;
        line-height: 1.3;
    }
    #products-grid .ux-body-copy {
        font-size: 0.72rem;
        line-height: 1.55 !important;
        margin-bottom: 0.65rem;
    }
    #products-grid .ux-quota {
        font-size: 9px;
        margin-bottom: 0.4rem;
    }
}

/* Motion system: scroll reveals, modal entrance, and press feedback. Motion is
   decorative only; content is never left hidden when reduced motion is set. */
@media (prefers-reduced-motion: no-preference) {
    .motion {
        opacity: 0;
        transform: translateY(14px);
        transition: opacity 0.55s ease, transform 0.55s cubic-bezier(0.22, 0.61, 0.36, 1);
        will-change: opacity, transform;
    }
    .motion.is-visible {
        opacity: 1;
        transform: none;
    }
    .motion-delay-1 { transition-delay: 0.08s; }
    .motion-delay-2 { transition-delay: 0.16s; }
    .motion-delay-3 { transition-delay: 0.24s; }

    .ux-card-media svg,
    .ux-card-media img {
        transition: transform 0.5s ease;
    }
    .ux-card:hover .ux-card-media svg,
    .ux-card:hover .ux-card-media img {
        transform: scale(1.06) rotate(-0.5deg);
    }

    #product-page-overlay:not(.hidden) .ux-sheet {
        animation: ux-sheet-rise 0.32s ease;
        transform-origin: center top;
    }
    @keyframes ux-sheet-rise {
        from { opacity: 0; transform: translateY(18px) scale(0.99); }
        to { opacity: 1; transform: none; }
    }

    .motion-press:active {
        transform: translateY(1px) scale(0.99);
    }
}

@media (prefers-reduced-motion: reduce) {
    .motion {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
