/* ==========================================================================================================
   Nhà Moon app shell (theme 2.6.0): touch feel, safe areas, standalone-mode tightening, install hint.
   ========================================================================================================== */

body.moon-se { -webkit-tap-highlight-color: transparent; text-size-adjust: 100%; -webkit-text-size-adjust: 100%; }
body.moon-se a, body.moon-se button, body.moon-se [role="button"], body.moon-se input, body.moon-se select, body.moon-se label { touch-action: manipulation; }
@media (max-width: 899px) {
	body.moon-se { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
	body.moon-se .moon-pdp-dock { padding-bottom: env(safe-area-inset-bottom, 0px); }
}

/* launched from the home screen: no browser chrome, so drop the promo strip and keep the header close to the top edge */
html.moon-standalone body.moon-se .moon-topbar { display: none; }
html.moon-standalone body.moon-se { -webkit-user-select: none; user-select: none; }
html.moon-standalone body.moon-se input, html.moon-standalone body.moon-se textarea, html.moon-standalone body.moon-se [contenteditable], html.moon-standalone body.moon-se p, html.moon-standalone body.moon-se address, html.moon-standalone body.moon-se td { -webkit-user-select: text; user-select: text; }

/* install hint (phones only; sits above the bottom navigation) */
.moon-install { position: fixed; left: 12px; right: 12px; bottom: calc(var(--moon-bottom-nav-h, 64px) + 10px); z-index: 60; display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 14px; background: #fffdfb; border: 1px solid #eadfd8; border-radius: 18px; box-shadow: 0 10px 34px rgba(58, 44, 39, .16); color: #2d2320; font: 14px/1.35 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif; animation: moon-install-in .4s cubic-bezier(.22, 1, .36, 1) both; }
.moon-install__icon { width: 44px; height: 44px; border-radius: 11px; flex: none; }
.moon-install__text { display: grid; gap: 2px; min-width: 0; flex: 1 1 auto; }
.moon-install__text strong { font-weight: 600; font-size: 14px; }
.moon-install__text small { font-size: 12.5px; color: #6a5d56; }
.moon-install__go { flex: none; min-height: 40px; padding: 0 16px; border: 0; border-radius: 999px; background: #3a2c27; color: #fff; font: 600 13.5px/1 inherit; cursor: pointer; }
.moon-install__x { flex: none; width: 36px; height: 36px; border: 0; border-radius: 50%; background: transparent; color: #7c6f68; font-size: 22px; line-height: 1; cursor: pointer; }
.moon-install__share { display: inline-block; width: 14px; height: 16px; vertical-align: -3px; background: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b05a3d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3v12M8 7l4-4 4 4M5 12v8h14v-8'/%3E%3C/svg%3E"); }
@keyframes moon-install-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (min-width: 900px) { .moon-install { display: none; } }
@media (prefers-reduced-motion: reduce) { .moon-install { animation: none; } }

/* installed (standalone) app only: no pull-to-refresh bounce, brand-coloured canvas so a page change never flashes white, Back button */
html.moon-standalone, html.moon-standalone body.moon-se { background-color: #faf8f6; }
html.moon-standalone body.moon-se { overscroll-behavior-y: auto; }
.moon-app-back { display: none; }
html.moon-standalone .moon-app-back { position: absolute; left: max(6px, env(safe-area-inset-left)); top: 50%; transform: translateY(-50%); z-index: 3; display: inline-grid; place-items: center; width: 40px; height: 44px; padding: 0; border: 0; border-radius: 12px; background: transparent; color: var(--se-ink, #3a2b26); cursor: pointer; -webkit-tap-highlight-color: transparent; }
html.moon-standalone .moon-app-back:active { background: rgba(58, 43, 38, .08); }
@media (max-width: 899px) { html.moon-standalone.moon-has-back .moon-header-row { position: relative; } html.moon-standalone.moon-has-back .moon-mobile-menu-toggle { margin-left: 46px; } }
@media (min-width: 900px) { html.moon-standalone .moon-app-back { display: none; } }

/* ==========================================================================================================
   2.6.1  HOME-SCREEN APP = SAME PAGE AS THE BROWSER.
   Cause of the "tiny text / big blank gap" in the installed app: the closed cart drawer (and the filter drawer) sat OUTSIDE the screen (translateX 105%), so iOS
   measured the page as ~800px wide and zoomed the whole page out to fit; at that width the shop grid also reserved an empty 286px column. Closed off-canvas panels
   are now invisible AND inside the screen, nothing can widen the page, and the viewport meta forbids zooming out below 1.
   ========================================================================================================== */
html, body { max-width: 100%; overflow-x: clip; }
body .moon-cart-drawer:not(.is-open) { visibility: hidden !important; pointer-events: none !important; transform: none !important; }
body .moon-cart-drawer.is-open { animation: moon-panel-in-right .28s ease-out; }
@media (max-width: 899px) {
	body .moon-shop-sidebar:not(.is-open) { visibility: hidden !important; pointer-events: none !important; transform: none !important; }
	body .moon-shop-sidebar.is-open { animation: moon-panel-in-left .25s ease-out; }
}
@media (min-width: 783px) and (max-width: 899px) { body.moon-se .moon-shop-layout { display: block !important; } }
@keyframes moon-panel-in-right { from { transform: translateX(40px); opacity: .2; } to { transform: none; opacity: 1; } }
@keyframes moon-panel-in-left { from { transform: translateX(-40px); opacity: .2; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { body .moon-cart-drawer.is-open, body .moon-shop-sidebar.is-open { animation: none; } }

/* ==========================================================================================================
   2.6.4  HOME-SCREEN APP: the second cause of the "tiny page".
   Visually-hidden helper text (.screen-reader-text) was `white-space: nowrap` inside a 1px box: its text (~600px long) still counted as page content and iOS zoomed the
   whole installed app out to fit it (the page looked ~0.65x: 5 columns, tiny type, narrow buy bar). The helper text now wraps inside its 1px box and is painted-contained,
   the photo slider track is contained, and nothing can widen the page. Native scrolling / bounce is kept in the app (no overscroll lock) so it feels like the browser.
   ========================================================================================================== */
.screen-reader-text, .sr-only { white-space: normal !important; contain: paint; max-width: 1px; }
.screen-reader-text:focus, .sr-only:focus { max-width: none; contain: none; }
.woocommerce-product-gallery .flex-viewport, .moon-product-gallery .flex-viewport { contain: paint; }
html.moon-standalone body.moon-se { overscroll-behavior-y: auto !important; }
