/* ============================================================
 * Dermosa Mobile Header & Stories — front-end styles
 * Token-first: inherits --drm-* from the theme when present,
 * with safe fallbacks so it renders standalone.
 * ============================================================ */

.drmh,
.drmh *{ box-sizing:border-box; }

.drmh{
	/* Fallbacks mirror the Dermosa token contract */
	--_primary: var(--drm-primary, #6c1410);
	--_primary-050: var(--drm-primary-050, #fff2ea);
	--_text: var(--drm-text, #4d4d4d);
	--_text-strong: var(--drm-text-strong, #1e1e1e);
	--_muted: var(--drm-text-muted, #9aa4b2);
	--_bg: var(--drm-bg, #ffffff);
	--_surface: var(--drm-surface-2, #f4f8fb);
	--_r-md: var(--drm-r-md, 14px);
	--_r-lg: var(--drm-r-lg, 18px);
	--_r-pill: var(--drm-r-pill, 999px);
	--_gutter: var(--drm-mobile-gutter, 15px);
	--_font: var(--drm-font, inherit);
	--_ease: var(--drm-ease, cubic-bezier(.22,.61,.36,1));

	position:sticky;
	top: var(--drmh-top, 0px);
	z-index:9980;
	direction:rtl;
	font-family: var(--_font);
	background: var(--_bg);
	/* bottom-edge divider is applied at runtime (mobile/desktop configurable) */
	/* Header is exempt from the 15px module rule, but we keep tidy padding */
	padding:9px var(--_gutter);
	display:flex;
	align-items:center;
	gap:10px;
}

/* MOBILE WRAPPERS: reproduce the original single-row layout robustly (without
   display:contents, for maximum browser stability). .drmh-top is the flex row;
   .drmh-top__main holds the bubble + search and fills the row. Visual result is
   identical to the original mobile header. */
.drmh-top{
	display:flex; align-items:center; gap:10px; width:100%;
}
.drmh-top__main{
	display:flex; align-items:center; gap:10px; flex:1 1 auto; min-width:0; width:100%;
}
/* Desktop-only pieces are never shown on mobile */
.drmh-logo,
.drmh-drow2{ display:none; }

/* ---------- Search box ---------- */
.drmh-search{
	position:relative;
	flex:1 1 auto;
	min-width:0;
	display:flex;
	align-items:center;
	gap:8px;
	height:44px;
	border-radius: var(--_r-md);
	background: var(--_surface);
	border:1px solid rgba(15,23,42,.06);
	padding:0 13px;
	cursor:text;
}
.drmh-search__ic{ flex:0 0 auto; width:18px; height:18px; color:var(--_muted); z-index:2; }
.drmh-search__field{ position:relative; flex:1 1 auto; min-width:0; height:100%; }

.drmh-ph{
	position:absolute; inset:0; z-index:1;
	display:flex; align-items:center; gap:5px;
	font-size:16px; color:var(--_muted); line-height:1;
	overflow:hidden; white-space:nowrap;
	pointer-events:none;
}
.drmh-ph__fixed{ flex:0 0 auto; }
.drmh-ph__rot{
	flex:0 0 auto; position:relative; display:inline-block;
	font-weight:700; min-width:1px;
	color: var(--_primary); /* single tone, brand color */
	transition:opacity .35s var(--_ease), transform .35s var(--_ease);
}
.drmh-ph__rot.is-fade{ opacity:0; transform:translateY(-4px); }
.drmh.is-searching .drmh-ph{ opacity:0; visibility:hidden; }

/* iOS/Android no-zoom + no dotted ring */
.drmh-search__input{
	position:absolute; inset:0; z-index:2;
	width:100%; height:100%;
	margin:0 !important; padding:0 !important;
	border:0 !important; outline:none !important;
	background:transparent !important; box-shadow:none !important;
	border-radius:0 !important;
	font-size:16px !important; line-height:normal;
	color: var(--_text-strong) !important; font-family:inherit !important;
	-webkit-appearance:none; appearance:none;
}
.drmh-search__input:focus{ box-shadow:none !important; outline:none !important; }
.drmh-search__input::-webkit-search-decoration,
.drmh-search__input::-webkit-search-cancel-button,
.drmh-search__input::-webkit-search-results-button,
.drmh-search__input::-webkit-search-results-decoration{ -webkit-appearance:none; display:none; }
.drmh-search__input::-ms-clear{ display:none; }

/* ---------- AJAX suggestions ---------- */
.drmh-suggest{
	position:absolute;
	inset-inline:0;
	top: calc(100% + 8px);
	z-index:30;
	background: var(--_bg);
	border:1px solid rgba(15,23,42,.08);
	border-radius: var(--_r-lg);
	box-shadow:0 12px 30px rgba(15,23,42,.12);
	overflow:hidden;
	padding:6px;
}
.drmh-suggest__item{
	display:flex; align-items:center; gap:10px;
	padding:8px; border-radius: var(--_r-md);
	text-decoration:none; color:var(--_text-strong);
	transition:background .15s var(--_ease);
}
.drmh-suggest__item:active{ background: var(--_surface); }
.drmh-suggest__thumb{
	flex:0 0 auto; width:42px; height:42px; border-radius: var(--_r-md);
	background: var(--_surface); overflow:hidden;
}
.drmh-suggest__thumb img{ width:100%; height:100%; object-fit:cover; display:block; }
.drmh-suggest__txt{ flex:1 1 auto; min-width:0; display:flex; flex-direction:column; gap:2px; }
.drmh-suggest__title{ font-size:12.5px; font-weight:500; line-height:1.5; color:var(--_text-strong);
	overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.drmh-suggest__price{ font-size:11.5px; color:var(--_primary); font-weight:600; }
.drmh-suggest__all{
	display:block; text-align:center; padding:9px;
	font-size:11.5px; font-weight:500; color:var(--_muted);
	text-decoration:none; border-top:1px solid rgba(15,23,42,.06); margin-top:4px;
}
.drmh-suggest__all:active{ color:var(--_primary); }
.drmh-suggest__empty{ padding:18px; text-align:center; color:var(--_muted); font-size:12.5px; }

/* suggestion skeleton */
.drmh-skel{ position:relative; overflow:hidden; background:#eef1f5; border-radius:8px; }
.drmh-skel::after{
	content:""; position:absolute; inset:0;
	transform:translateX(-100%);
	background:linear-gradient(90deg, transparent, rgba(255,255,255,.6), transparent);
	animation:drmh-shimmer 1.1s infinite;
}
@keyframes drmh-shimmer{ to{ transform:translateX(100%);} }
.drmh-suggest__item.is-skel{ pointer-events:none; }
.drmh-suggest__item.is-skel .drmh-suggest__thumb{ background:#eef1f5; }
.drmh-suggest__item.is-skel .drmh-suggest__title{ width:70%; height:12px; }
.drmh-suggest__item.is-skel .drmh-suggest__price{ width:35%; height:10px; margin-top:6px; }

/* ---------- Story bubble in header (single, right of search) ---------- */
.drmh-hl{
	flex:0 0 auto;
	display:flex; align-items:center; justify-content:center;
	background:none; border:0; padding:0; cursor:pointer;
	-webkit-tap-highlight-color:transparent;
	/* admin-configurable diameter (default 40px) */
	width:var(--drmh-story-size, 40px); height:var(--drmh-story-size, 40px);
}
.drmh-hl__ring{
	display:block; width:100%; height:100%; border-radius:var(--_r-pill);
	padding:2px;
	background: conic-gradient(from 200deg, var(--_primary), #b8524d, var(--_primary));
	transition:transform .15s var(--_ease);
}
.drmh-hl:active .drmh-hl__ring{ transform:scale(.92); }
.drmh-hl.is-seen .drmh-hl__ring{ background:#d9d2d0; }
.drmh-hl__img{
	display:block; width:100%; height:100%; border-radius:var(--_r-pill);
	overflow:hidden; background:var(--_surface);
	border:2px solid var(--_bg);
}
.drmh-hl__img img{ width:100%; height:100%; object-fit:cover; display:block; }

/* ============================================================
 * FULL-SCREEN STORY VIEWER (highest priority overlay)
 * ============================================================ */
.drmh-viewer{
	position:fixed; inset:0; z-index:2147483000;
	background:#000;
	display:flex; align-items:center; justify-content:center;
	opacity:0; visibility:hidden;
	transition:opacity .25s var(--_ease, ease), visibility .25s;
	direction:rtl;
	font-family: var(--drm-font, inherit);
	-webkit-tap-highlight-color:transparent;
	overscroll-behavior:contain;
}
.drmh-viewer.is-open{ opacity:1; visibility:visible; }
/* While the theme cart overlay is open, hide the story completely (but keep it
   mounted & paused). This avoids any z-index fight with the cart and prevents
   the site header from flashing over the story. The story returns on cart close. */
.drmh-viewer.is-behind-cart{ opacity:0 !important; visibility:hidden !important; pointer-events:none !important; }

.drmh-viewer__stage{
	position:relative;
	width:100%; height:100%;
	max-width:480px;
	margin:0 auto;
	background:#0b0b0b;
	overflow:hidden;
}
@media (min-width:480px){
	.drmh-viewer__stage{ height:min(92vh, 860px); border-radius:20px; }
}

/* media layers */
.drmh-viewer__media{ position:absolute; inset:0; }
.drmh-viewer__media img,
.drmh-viewer__media video{
	width:100%; height:100%; object-fit:cover; display:block;
	background:#0b0b0b;
}
.drmh-viewer__media .drmh-vfade{ opacity:0; transition:opacity .3s var(--_ease, ease); }
.drmh-viewer__media .is-shown{ opacity:1; }

/* progressive content skeleton */
.drmh-viewer__skel{
	position:absolute; inset:0; z-index:2;
	background:linear-gradient(180deg,#1a1a1a,#0d0d0d);
	display:flex; align-items:center; justify-content:center;
}
.drmh-viewer__skel::after{
	content:""; width:46px; height:46px; border-radius:50%;
	border:3px solid rgba(255,255,255,.25);
	border-top-color:#fff; animation:drmh-spin .8s linear infinite;
}
@keyframes drmh-spin{ to{ transform:rotate(360deg);} }
.drmh-viewer.is-ready .drmh-viewer__skel{ opacity:0; pointer-events:none; transition:opacity .25s; }

/* top progress segments (story pagination) */
.drmh-viewer__bars{
	position:absolute; top:0; inset-inline:0; z-index:6;
	display:flex; gap:4px; padding:10px 12px 0;
}
.drmh-bar{
	flex:1 1 0; height:3px; border-radius:3px;
	background:rgba(255,255,255,.3); overflow:hidden;
}
.drmh-bar__fill{
	display:block; height:100%; width:0%;
	background:#fff; border-radius:3px;
}
.drmh-bar.is-done .drmh-bar__fill{ width:100%; }

/* header row: title + close */
.drmh-viewer__top{
	position:absolute; top:0; inset-inline:0; z-index:6;
	display:flex; align-items:center; gap:10px;
	padding:22px 14px 0;
	background:linear-gradient(180deg, rgba(0,0,0,.55), transparent);
}
.drmh-viewer__cover{
	width:34px; height:34px; border-radius:50%; overflow:hidden; flex:0 0 auto;
	border:2px solid rgba(255,255,255,.85);
}
.drmh-viewer__cover img{ width:100%; height:100%; object-fit:cover; }
.drmh-viewer__name{ flex:1 1 auto; color:#fff; font-size:13px; font-weight:600;
	text-shadow:0 1px 2px rgba(0,0,0,.4);
	display:inline-flex; align-items:center; gap:5px; min-width:0; }
.drmh-verify{ flex:0 0 auto; display:inline-flex; width:15px; height:15px;
	filter:drop-shadow(0 1px 1px rgba(0,0,0,.35)); }
.drmh-verify svg{ width:100%; height:100%; display:block; }
.drmh-viewer__ctrls{ flex:0 0 auto; display:flex; flex-direction:row; align-items:center; gap:8px; }
/* sound + close share one identical look */
.drmh-viewer__rbtn{
	flex:0 0 auto; width:36px; height:36px; border-radius:50%;
	background:rgba(0,0,0,.32); border:0; color:#fff; cursor:pointer;
	display:flex; align-items:center; justify-content:center; padding:0;
	-webkit-tap-highlight-color:transparent;
}
.drmh-viewer__rbtn svg{ width:20px; height:20px; display:block; }
.drmh-viewer__rbtn:active{ transform:scale(.92); }
/* sound button hidden on image slides */
.drmh-viewer:not(.is-video) .drmh-viewer__sound{ display:none; }

/* in-viewer toast */
.drmh-viewer__toast{
	position:absolute; inset-inline:0; bottom:120px; z-index:8;
	display:flex; justify-content:center; pointer-events:none;
	opacity:0; transform:translateY(8px); transition:opacity .25s, transform .25s;
}
.drmh-viewer__toast.is-show{ opacity:1; transform:translateY(0); }
.drmh-viewer__toast span{ background:rgba(0,0,0,.82); color:#fff; font-size:12px; font-weight:600;
	padding:8px 16px; border-radius:999px; }

/* tap zones for prev/next */
.drmh-viewer__nav{ position:absolute; inset:0; z-index:4; display:flex; }
.drmh-viewer__zone{ flex:1 1 50%; }
.drmh-viewer__zone--prev{ flex-basis:32%; }
.drmh-viewer__zone--next{ flex-basis:68%; }

/* product tags (bottom) */
.drmh-viewer__tags{
	position:absolute; inset-inline:0; bottom:0; z-index:6;
	padding:14px 12px calc(16px + env(safe-area-inset-bottom));
	background:linear-gradient(0deg, rgba(0,0,0,.6), transparent);
	display:flex; flex-direction:column; gap:8px;
}
.drmh-prodtag{
	display:flex; align-items:center; gap:10px;
	background:rgba(255,255,255,.97);
	border-radius:16px; padding:7px 9px;
	text-decoration:none; color:var(--drm-text-strong,#1e1e1e);
	box-shadow:0 6px 18px rgba(0,0,0,.25);
	transform:translateY(6px); opacity:0;
	animation:drmh-tag-in .35s var(--_ease, ease) forwards;
}
.drmh-prodtag__img{ width:48px; height:48px; border-radius:12px; overflow:hidden; flex:0 0 auto;
	background:#f1f1f1; }
.drmh-prodtag__img img{ width:100%; height:100%; object-fit:cover; }
.drmh-prodtag__info{ flex:1 1 auto; min-width:0; display:flex; flex-direction:column; gap:2px;
	text-decoration:none; }
.drmh-prodtag__eyebrow{ font-size:9.5px; font-weight:400; color:var(--drm-text-muted,#9aa4b2);
	line-height:1.4; }
/* title + price on one row */
.drmh-prodtag__meta{ display:flex; align-items:baseline; gap:8px; min-width:0; }
.drmh-prodtag__title{ font-size:13px; font-weight:600; line-height:1.4; color:var(--drm-text-strong,#1e1e1e);
	overflow:hidden; text-overflow:ellipsis; white-space:nowrap; flex:0 1 auto; min-width:0; }
.drmh-prodtag__price{ font-size:11.5px; color:var(--drm-primary,#6c1410); font-weight:700; line-height:1.4;
	flex:0 0 auto; white-space:nowrap; }
/* square cart button */
.drmh-prodtag__cart{
	flex:0 0 auto; width:40px; height:40px; border-radius:12px;
	background:var(--drm-primary,#6c1410); border:0; cursor:pointer;
	display:flex; align-items:center; justify-content:center; color:#fff; padding:0;
	-webkit-tap-highlight-color:transparent;
	transition:transform .15s var(--_ease, ease), background .2s;
}
.drmh-prodtag__cart:active{ transform:scale(.92); }
.drmh-prodtag__cart svg{ width:20px; height:20px; display:block; }
.drmh-prodtag__cart.is-oos{ background:#9e8c88; pointer-events:none; }
.drmh-prodtag__cart.is-loading{ opacity:.7; pointer-events:none; }
.drmh-prodtag__cart.is-done{ background:#2e7d32; }
@keyframes drmh-tag-in{ to{ transform:translateY(0); opacity:1; } }

/* "swipe up to shop" innovation hint */
.drmh-viewer__hint{
	position:absolute; inset-inline:0; bottom:88px; z-index:7;
	text-align:center; color:#fff; font-size:11px; opacity:.9;
	cursor:pointer; -webkit-tap-highlight-color:transparent;
}
.drmh-viewer__hint .chev{ display:block; margin:0 auto 2px;
	width:14px; height:14px; animation:drmh-bounce 1.4s infinite; }
@keyframes drmh-bounce{ 0%,100%{ transform:translateY(0);} 50%{ transform:translateY(-4px);} }
/* hide the hint while the shop sheet is open */
.drmh-viewer.is-shopping .drmh-viewer__hint,
.drmh-viewer.is-shopping .drmh-viewer__tags{ opacity:0; pointer-events:none; }

.drmh-viewer.is-paused .drmh-viewer__bars{ opacity:.5; }

/* ============================================================
 * Shoppable bottom sheet (swipe up to shop)
 * ============================================================ */
.drmh-shop{ position:absolute; inset:0; z-index:9; }
.drmh-shop__backdrop{
	position:absolute; inset:0; background:rgba(0,0,0,.45);
	opacity:0; transition:opacity .25s var(--_ease, ease);
}
.drmh-viewer.is-shopping .drmh-shop__backdrop{ opacity:1; }
.drmh-shop__sheet{
	position:absolute; inset-inline:0; bottom:0; z-index:2;
	max-height:74%; display:flex; flex-direction:column;
	background:var(--drm-bg,#fff);
	border-start-start-radius:22px; border-start-end-radius:22px;
	padding:8px 14px calc(16px + env(safe-area-inset-bottom));
	transform:translateY(102%);
	transition:transform .28s var(--_ease, cubic-bezier(.22,.61,.36,1));
	box-shadow:0 -10px 30px rgba(0,0,0,.3);
}
.drmh-viewer.is-shopping .drmh-shop__sheet{ transform:translateY(0); }
.drmh-shop__grip{ width:40px; height:4px; border-radius:999px; background:#d9dde4;
	margin:4px auto 10px; flex:0 0 auto; }
.drmh-shop__head{ display:flex; align-items:center; justify-content:space-between; margin-bottom:10px; }
.drmh-shop__title{ font-size:14px; font-weight:700; color:var(--drm-text-strong,#1e1e1e); }
.drmh-shop__close{ width:32px; height:32px; border-radius:50%; border:0; cursor:pointer;
	background:var(--drm-surface-2,#f4f8fb); color:var(--drm-text-strong,#1e1e1e);
	display:flex; align-items:center; justify-content:center; }
.drmh-shop__close svg{ width:18px; height:18px; }
.drmh-shop__list{ overflow-y:auto; -webkit-overflow-scrolling:touch; display:flex; flex-direction:column; gap:10px; }
.drmh-shop__item{ display:flex; align-items:center; gap:11px; }
.drmh-shop__thumb{ width:60px; height:60px; border-radius:14px; overflow:hidden; flex:0 0 auto;
	background:var(--drm-surface-2,#f4f8fb); }
.drmh-shop__thumb img{ width:100%; height:100%; object-fit:cover; }
.drmh-shop__info{ flex:1 1 auto; min-width:0; display:flex; flex-direction:column; gap:2px;
	text-decoration:none; }
.drmh-shop__name{ font-size:13px; font-weight:600; color:var(--drm-text-strong,#1e1e1e);
	line-height:1.5; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.drmh-shop__price{ font-size:12.5px; font-weight:700; color:var(--drm-primary,#6c1410); }
.drmh-shop__add{
	flex:0 0 auto; display:inline-flex; align-items:center; gap:6px;
	background:var(--drm-primary,#6c1410); color:#fff; border:0; cursor:pointer;
	border-radius:999px; padding:9px 14px; font-size:12px; font-weight:700;
	font-family:inherit; -webkit-tap-highlight-color:transparent;
	transition:transform .12s var(--_ease, ease), background .2s;
}
.drmh-shop__add svg{ width:17px; height:17px; }
.drmh-shop__add span{ white-space:nowrap; }
.drmh-shop__add:active{ transform:scale(.95); }
.drmh-shop__add.is-oos{ background:#9e8c88; pointer-events:none; }
.drmh-shop__add.is-loading{ opacity:.7; pointer-events:none; }
.drmh-shop__add.is-done{ background:#2e7d32; }

@media (prefers-reduced-motion:reduce){
	.drmh-ph__rot, .drmh-hl__ring, .drmh-prodtag, .chev{ transition:none; animation:none; }
	.drmh-shop__sheet, .drmh-shop__backdrop{ transition:none; }
}
