/*
 * Local magazine-demo phone shell.  It is intentionally gated by
 * body.demo-mobile-layout so the customer application keeps its existing
 * desktop and mobile treatment.
 */
body.demo-mobile-layout{
  --demo-topbar-h:52px;
  --demo-nav-h:60px;
  --demo-safe-bottom:env(safe-area-inset-bottom,0px);
  --demo-frame-h:min(calc(100dvh - 36px),860px);
  min-width:320px;
  min-height:100dvh;
  margin:0;
  display:grid;
  place-items:center;
  overflow:hidden;
  background:linear-gradient(145deg,#ede6df,#d9cdc2);
}

body.demo-mobile-layout #app{
  width:min(calc(100vw - 32px),calc(var(--demo-frame-h) * 9 / 16));
  height:var(--demo-frame-h);
  min-width:0;
  min-height:0;
  display:flex;
  flex-direction:column;
  overflow:hidden;
  background:var(--cream,#f8f4ef);
  border:1px solid rgba(80,54,46,.16);
  border-radius:26px;
  box-shadow:0 24px 64px rgba(53,36,31,.24);
}

body.demo-mobile-layout #app .topbar{
  position:relative;
  z-index:8;
  flex:0 0 var(--demo-topbar-h);
  width:100%;
  height:var(--demo-topbar-h);
  min-height:var(--demo-topbar-h);
  padding:0 14px;
  gap:8px;
  overflow:hidden;
  background:rgba(255,253,250,.96);
}
body.demo-mobile-layout #app .topbar .brand-logo{width:78px;max-height:19px}
body.demo-mobile-layout #app .topbar-actions{min-width:0;gap:6px}
body.demo-mobile-layout #app .topbar-actions>span,
body.demo-mobile-layout #app .topbar-actions .text-button,
body.demo-mobile-layout #app .demo-notice{display:none}
body.demo-mobile-layout #app .demo-mobile-label{
  min-width:0;
  color:var(--muted,#7d7170);
  font:9px/1.2 Arial,sans-serif;
  text-overflow:ellipsis;
  white-space:nowrap;
  overflow:hidden;
}
body.demo-mobile-layout #app .demo-mobile-salutation{
  min-width:0;
  margin-left:auto;
  overflow:hidden;
  color:var(--ink,#251b1b);
  font-size:11px;
  text-overflow:ellipsis;
  white-space:nowrap;
}
body.demo-mobile-layout #app .demo-mobile-switch{
  flex:0 0 auto;
  padding:6px 0 6px 5px;
  color:var(--wine,#6d1e2a);
  font:10px/1 Arial,sans-serif;
  text-decoration:none;
}

body.demo-mobile-layout #app .customer-frame{
  flex:1 1 auto;
  min-height:0;
  padding:0;
  overflow:auto;
  overscroll-behavior:contain;
}
body.demo-mobile-layout #app .bottom-nav{
  position:relative;
  z-index:8;
  inset:auto;
  flex:0 0 calc(var(--demo-nav-h) + var(--demo-safe-bottom));
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  align-items:start;
  width:100%;
  height:calc(var(--demo-nav-h) + var(--demo-safe-bottom));
  min-height:calc(var(--demo-nav-h) + var(--demo-safe-bottom));
  padding:6px 8px calc(6px + var(--demo-safe-bottom));
  border-top:1px solid var(--line,#e9e1da);
  background:rgba(255,253,250,.97);
  box-shadow:0 -8px 22px rgba(64,39,32,.07);
}
body.demo-mobile-layout #app .bottom-nav button{
  position:relative;
  display:grid;
  place-content:center;
  gap:2px;
  min-width:0;
  min-height:48px;
  padding:4px 2px;
  border:0;
  background:transparent;
  color:var(--muted,#7d7170);
  font-size:10px;
  line-height:1.1;
}
body.demo-mobile-layout #app .bottom-nav .nav-icon{display:grid;place-content:center;width:22px;height:22px;margin:0 auto}
body.demo-mobile-layout #app .bottom-nav .nav-icon svg{display:block;width:22px;height:22px}
body.demo-mobile-layout #app .bottom-nav button>span{display:block}
body.demo-mobile-layout #app .bottom-nav button.active{color:var(--wine,#6d1e2a)}
body.demo-mobile-layout #app .bottom-nav button.active::after{
  position:absolute;
  bottom:2px;
  left:50%;
  width:18px;
  height:2px;
  border-radius:2px;
  background:currentColor;
  content:"";
  transform:translateX(-50%);
}

/* The cover keeps its existing image and copy; only its containing viewport changes. */
body.demo-mobile-layout #app .customer-frame:has(.hero){overflow:hidden}
body.demo-mobile-layout #app .hero{height:100%;min-height:0}
body.demo-mobile-layout #app .hero-copy{padding:clamp(24px,7vh,52px) 20px clamp(30px,7vh,52px)}
body.demo-mobile-layout #app .hero h1{font-size:clamp(28px,8vw,43px)}

/* Recommendation: the neighboring sheets are deliberately blank white paper. */
body.demo-mobile-layout #app .customer-frame:has(.demo-mobile-magazine){overflow:hidden}
body.demo-mobile-layout #app .demo-mobile-magazine{
  --demo-card-top:12px;
  --demo-card-bottom:8px;
  --demo-card-gap:9px;
  --demo-reactions-h:52px;
  position:relative;
  isolation:isolate;
  display:grid;
  grid-template-rows:minmax(0,1fr) var(--demo-reactions-h);
  gap:var(--demo-card-gap);
  height:100%;
  min-height:0;
  padding:var(--demo-card-top) 22px var(--demo-card-bottom);
  overflow:hidden;
  background:linear-gradient(145deg,#e8e0d7,#d8ccc0);
}
body.demo-mobile-layout #app .demo-mobile-peek{
  position:absolute;
  z-index:1;
  top:calc(var(--demo-card-top) + 13px);
  bottom:calc(var(--demo-card-bottom) + var(--demo-reactions-h) + var(--demo-card-gap) + 13px);
  width:calc(100% - 44px);
  overflow:hidden;
  border:1px solid rgba(255,255,255,.9);
  border-radius:18px;
  background:#fff;
  box-shadow:0 8px 20px rgba(67,44,36,.12);
  pointer-events:none;
}
body.demo-mobile-layout #app .demo-mobile-peek.is-left{right:calc(100% - 8px)}
body.demo-mobile-layout #app .demo-mobile-peek.is-right{left:calc(100% - 8px)}
body.demo-mobile-layout #app .demo-mobile-peek img{display:none}
body.demo-mobile-layout #app .demo-mobile-card{
  position:relative;
  z-index:2;
  display:grid;
  grid-template-rows:minmax(0,1fr) 82px;
  min-width:0;
  min-height:0;
  overflow:hidden;
  padding:5px 5px 0;
  border:1px solid #fff;
  border-radius:19px;
  background:#fff;
  box-shadow:0 12px 26px rgba(64,40,33,.16);
}
body.demo-mobile-layout #app .demo-mobile-visual{
  position:relative;
  min-width:0;
  min-height:0;
  overflow:hidden;
  border-radius:14px 14px 3px 3px;
  background:var(--soft,#f0e8e1);
  touch-action:pan-y;
}
body.demo-mobile-layout #app .demo-mobile-visual>.outfit-main{
  display:block;
  width:100%;
  height:100%;
  max-width:none;
  object-fit:contain;
  object-position:center top;
  background:var(--soft,#f0e8e1);
  -webkit-user-drag:none;
  user-select:none;
}
body.demo-mobile-layout #app .demo-mobile-number{
  position:absolute;
  z-index:2;
  top:10px;
  left:10px;
  padding:5px 7px;
  border-radius:3px;
  background:rgba(255,253,250,.88);
  color:var(--ink,#251b1b);
  font:18px/1 ui-serif,"Noto Serif SC","Songti SC",serif;
  letter-spacing:.02em;
}
body.demo-mobile-layout #app .demo-mobile-number small{color:var(--muted,#7d7170);font:11px/1 Arial,sans-serif}
body.demo-mobile-layout #app .demo-review-corner{
  position:absolute;
  z-index:3;
  top:9px;
  right:9px;
  display:flex;
  max-width:calc(100% - 82px);
  gap:4px;
  align-items:center;
}
body.demo-mobile-layout #app .demo-review-corner .template-compare-button,
body.demo-mobile-layout #app .demo-review-corner .demo-review-status{
  min-height:28px;
  padding:5px 7px;
  border:1px solid rgba(255,255,255,.8);
  border-radius:4px;
  background:rgba(255,253,250,.91);
  color:var(--wine,#6d1e2a);
  font:9px/1 Arial,sans-serif;
  white-space:nowrap;
}
body.demo-mobile-layout #app .demo-review-corner .template-compare-button{overflow:hidden;text-overflow:ellipsis}
body.demo-mobile-layout #app .demo-mobile-footer{
  position:relative;
  min-width:0;
  min-height:0;
  overflow:hidden;
  background:#fff;
}
body.demo-mobile-layout #app .demo-mobile-products{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:3px;
  height:100%;
  padding:4px 98px 3px 1px;
  overflow:hidden;
  border-top:1px solid var(--line,#e9e1da);
}
body.demo-mobile-layout #app .demo-mobile-products:has(> :nth-child(3)){
  display:flex;
  gap:4px;
  overflow-x:auto;
  overscroll-behavior-x:contain;
  scroll-snap-type:x proximity;
}
body.demo-mobile-layout #app .demo-mobile-product{
  display:grid;
  grid-template-columns:24px minmax(0,1fr);
  gap:5px;
  align-items:center;
  min-width:0;
  height:100%;
  padding:1px;
  border:0;
  background:transparent;
  color:var(--ink,#251b1b);
  text-align:left;
}
body.demo-mobile-layout #app .demo-mobile-products:has(> :nth-child(3)) .demo-mobile-product{flex:0 0 118px;scroll-snap-align:start}
body.demo-mobile-layout #app .demo-mobile-product>img{
  width:24px;
  height:38px;
  object-fit:contain;
  background:var(--soft,#f0e8e1);
}
body.demo-mobile-layout #app .demo-mobile-product>span{min-width:0}
body.demo-mobile-layout #app .demo-mobile-product b{
  display:-webkit-box;
  overflow:hidden;
  -webkit-box-orient:vertical;
  -webkit-line-clamp:2;
  font-size:9px;
  font-weight:500;
  line-height:1.2;
}
body.demo-mobile-layout #app .demo-mobile-product small{
  display:block;
  margin-top:2px;
  color:var(--wine,#6d1e2a);
  font:11px/1 ui-serif,"Noto Serif SC","Songti SC",serif;
}
body.demo-mobile-layout #app .demo-mobile-commerce{
  position:absolute;
  z-index:2;
  right:1px;
  bottom:8px;
  display:flex;
  gap:4px;
}
body.demo-mobile-layout #app .demo-mobile-op{
  display:grid;
  place-content:center;
  width:44px;
  height:44px;
  min-height:44px;
  padding:0;
  border:1px solid var(--line,#e9e1da);
  border-radius:50%;
  background:#fffdfa;
  color:var(--wine,#6d1e2a);
  box-shadow:0 3px 10px rgba(61,38,31,.11);
  font-size:10px;
  line-height:1;
}
body.demo-mobile-layout #app .demo-mobile-op>svg{display:block;width:20px;height:20px}
body.demo-mobile-layout #app .demo-mobile-op.primary,
body.demo-mobile-layout #app .demo-mobile-op:last-child{background:var(--wine,#6d1e2a);border-color:var(--wine,#6d1e2a);color:#fff}
body.demo-mobile-layout #app .demo-mobile-reactions{
  position:relative;
  z-index:3;
  display:flex;
  justify-content:center;
  align-items:center;
  gap:14px;
  min-width:0;
}
body.demo-mobile-layout #app .demo-mobile-reactions .round-action{
  display:grid;
  place-content:center;
  flex:1 1 0;
  width:auto;
  max-width:145px;
  height:48px;
  min-height:48px;
  padding:0;
  border:1px solid var(--line,#e9e1da);
  border-radius:26px;
  background:#fffdfa;
  color:var(--muted,#7d7170);
  box-shadow:0 3px 10px rgba(61,38,31,.12);
  font-size:11px;
  line-height:1;
}
body.demo-mobile-layout #app .demo-mobile-reactions .favorite-action,
body.demo-mobile-layout #app .demo-mobile-reactions .favorite-action.active{background:var(--wine,#6d1e2a);border-color:var(--wine,#6d1e2a);color:#fff}

/* Secondary customer views stay compact inside the same phone frame. */
body.demo-mobile-layout #app .profile-page,
body.demo-mobile-layout #app .need-page{
  width:100%;
  max-width:none;
  min-height:100%;
  padding:18px 14px 22px;
}
body.demo-mobile-layout #app .profile-page h1,
body.demo-mobile-layout #app .need-page h1{margin:6px 0 12px;font-size:25px;line-height:1.1}
body.demo-mobile-layout #app .profile-page .section-eyebrow,
body.demo-mobile-layout #app .need-page .section-eyebrow{font-size:9px}
body.demo-mobile-layout #app .history-grid,
body.demo-mobile-layout #app .wardrobe-page .history-grid{
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:9px;
  margin-top:12px;
}
body.demo-mobile-layout #app .history-card{min-width:0}
body.demo-mobile-layout #app .history-card img{aspect-ratio:.77;object-fit:cover}
body.demo-mobile-layout #app .history-card div{min-height:48px;padding:7px;font-size:12px}
body.demo-mobile-layout #app .history-card strong{display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:2}
body.demo-mobile-layout #app .history-card small{font-size:9px}
body.demo-mobile-layout #app .wardrobe-page .history-grid{padding-bottom:64px}
body.demo-mobile-layout #app .profile-page .staff-grid{
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:8px;
  margin-top:12px;
}
body.demo-mobile-layout #app .profile-page .staff-card{min-height:92px;padding:11px}
body.demo-mobile-layout #app .profile-page .staff-card h3{margin-bottom:4px;font-size:14px}
body.demo-mobile-layout #app .profile-page .staff-card p{font-size:11px;line-height:1.4}
body.demo-mobile-layout #app .mine-photo-summary{display:flex;align-items:center;min-height:60px;margin:4px 0 13px;padding:3px 0}
body.demo-mobile-layout #app .mine-photo-summary>img,
body.demo-mobile-layout #app .mine-photo-summary>button,
body.demo-mobile-layout #app .mine-photo-summary .mine-photo{width:44px;height:58px;margin-left:-10px;overflow:hidden;border:2px solid var(--paper,#fffdfa);border-radius:6px;background:var(--soft,#f0e8e1);box-shadow:0 2px 6px rgba(61,38,31,.11)}
body.demo-mobile-layout #app .mine-photo-summary>:first-child{margin-left:0}
body.demo-mobile-layout #app .mine-photo-summary img{object-fit:cover;object-position:center top}
body.demo-mobile-layout #app .mine-photo-summary .mine-photo img{width:100%;height:100%}
body.demo-mobile-layout #app .demo-mobile-me-menu{display:grid;margin:0;border-top:1px solid var(--line,#e9e1da)}
body.demo-mobile-layout #app .demo-mobile-me-menu>button{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px;align-items:center;min-height:62px;padding:9px 2px;border:0;border-bottom:1px solid var(--line,#e9e1da);background:transparent;color:var(--ink,#251b1b);text-align:left}
body.demo-mobile-layout #app .demo-mobile-me-menu b{display:block;font-size:13px;font-weight:500}
body.demo-mobile-layout #app .demo-mobile-me-menu small{display:block;margin-top:3px;color:var(--muted,#7d7170);font-size:10px;line-height:1.35}
body.demo-mobile-layout #app .demo-mobile-me-menu>button>span[aria-hidden]{color:var(--wine,#6d1e2a);font:23px/1 ui-serif,"Songti SC",serif}
body.demo-mobile-layout #app .photo-strip{gap:7px;padding:3px 0}
body.demo-mobile-layout #app .reference-photo{flex-basis:58px}
body.demo-mobile-layout #app .reference-photo img,
body.demo-mobile-layout #app .reference-photo .media-empty{width:56px;height:70px}
body.demo-mobile-layout #app .reference-photo span{padding:4px;font-size:8px}
body.demo-mobile-layout #app .need-page textarea{height:112px;margin:12px 0}
body.demo-mobile-layout #app .need-page .section-note{margin-bottom:13px;font-size:12px;line-height:1.5}
body.demo-mobile-layout #app .need-page .button{min-height:44px;width:100%}
body.demo-mobile-layout #app .cart-list{gap:7px;margin-top:12px}
body.demo-mobile-layout #app .cart-row{grid-template-columns:44px minmax(0,1fr) auto;gap:8px;padding:8px}
body.demo-mobile-layout #app .cart-row img,
body.demo-mobile-layout #app .cart-row .media-empty{width:44px;height:54px}
body.demo-mobile-layout #app .cart-row strong{font-size:12px;line-height:1.25}
body.demo-mobile-layout #app .cart-row small{margin-top:3px;font-size:10px}
body.demo-mobile-layout #app .cart-controls{gap:5px}
body.demo-mobile-layout #app .drawer,
body.demo-mobile-layout>.drawer{
  z-index:30;
  width:min(calc(100vw - 32px),calc(var(--demo-frame-h) * 9 / 16));
  height:var(--demo-frame-h);
  padding:16px;
  box-shadow:none;
}
body.demo-mobile-layout>.drawer{
  position:fixed;
  top:50%;
  right:50%;
  transform:translate(50%,-50%);
  border-radius:26px;
}
body.demo-mobile-layout>.drawer .demo-shop-choices .demo-mobile-product{grid-template-columns:48px minmax(0,1fr);min-height:60px}
body.demo-mobile-layout>.drawer .demo-shop-choices .demo-mobile-product>img{width:48px;height:60px}
body.demo-mobile-layout #app .drawer-head{margin-bottom:13px;padding-bottom:11px}
body.demo-mobile-layout #app .drawer h2{font-size:20px}
body.demo-mobile-layout #app .drawer .drawer-product-image{max-height:38vh;object-fit:contain;background:var(--soft,#f0e8e1)}

@media (max-width:760px){
  body.demo-mobile-layout{display:block;background:var(--cream,#f8f4ef)}
  body.demo-mobile-layout #app{width:100%;height:100dvh;max-width:none;border:0;border-radius:0;box-shadow:none}
  body.demo-mobile-layout>.drawer{top:0;right:0;width:100%;height:100dvh;transform:none;border-radius:0}
}

@media (max-width:760px) and (max-height:710px){
  body.demo-mobile-layout #app .demo-mobile-magazine{--demo-card-top:8px;--demo-card-bottom:4px;--demo-card-gap:5px;--demo-reactions-h:50px;padding-inline:18px}
  body.demo-mobile-layout #app .demo-mobile-card{grid-template-rows:minmax(0,1fr) 74px;border-radius:16px;padding:4px 4px 0}
  body.demo-mobile-layout #app .demo-mobile-peek{width:calc(100% - 36px);border-radius:15px}
  body.demo-mobile-layout #app .demo-mobile-visual{border-radius:12px 12px 2px 2px}
  body.demo-mobile-layout #app .demo-mobile-number{top:7px;left:7px;font-size:16px}
  body.demo-mobile-layout #app .demo-mobile-products{padding-right:94px}
  body.demo-mobile-layout #app .demo-mobile-product>img{width:22px;height:33px}
  body.demo-mobile-layout #app .demo-mobile-product b{font-size:8px}
  body.demo-mobile-layout #app .demo-mobile-product small{font-size:10px}
  body.demo-mobile-layout #app .demo-mobile-commerce{bottom:5px}
  body.demo-mobile-layout #app .demo-mobile-op{width:42px;height:42px;min-height:42px}
  body.demo-mobile-layout #app .demo-mobile-reactions .round-action{max-width:145px;height:48px;min-height:48px}
  body.demo-mobile-layout #app .profile-page,
  body.demo-mobile-layout #app .need-page{padding-top:13px}
  body.demo-mobile-layout #app .profile-page h1,
  body.demo-mobile-layout #app .need-page h1{font-size:22px;margin-bottom:8px}
  body.demo-mobile-layout #app .history-grid{gap:7px;margin-top:8px}
  body.demo-mobile-layout #app .history-card div{min-height:42px;padding:6px;font-size:11px}
}

@media (max-width:340px){
  body.demo-mobile-layout #app .demo-mobile-magazine{padding-inline:14px}
  body.demo-mobile-layout #app .demo-mobile-products{padding-right:90px}
  body.demo-mobile-layout #app .demo-mobile-products:has(> :nth-child(3)) .demo-mobile-product{flex-basis:104px}
  body.demo-mobile-layout #app .demo-mobile-product{grid-template-columns:21px minmax(0,1fr);gap:3px}
  body.demo-mobile-layout #app .demo-mobile-product>img{width:21px}
  body.demo-mobile-layout #app .demo-mobile-commerce{gap:2px}
  body.demo-mobile-layout #app .demo-mobile-op{width:40px;height:40px;min-height:40px;font-size:9px}
}

/* Drawers are siblings of #app, so phone preview constraints apply at body level. */
body.demo-mobile-layout>.drawer{position:fixed;top:50%;bottom:auto;left:50%;right:auto;transform:translate(-50%,-50%);width:calc(var(--demo-frame-h) * 9 / 16);max-width:100%;height:var(--demo-frame-h);max-height:100dvh;overflow-y:auto;padding:20px;z-index:50;background:var(--paper);border-radius:20px}
body.demo-mobile-layout>.drawer .drawer-product-image{display:block;width:100%;height:32dvh;max-height:300px;object-fit:contain;background:var(--soft)}
body.demo-mobile-layout>.drawer .drawer-head h2{font-size:20px;line-height:1.5}
body.demo-mobile-layout>.drawer .demo-shop-choices{display:grid;gap:10px}
body.demo-mobile-layout>.drawer .demo-mobile-product{display:grid;grid-template-columns:48px minmax(0,1fr);gap:10px;align-items:center;min-height:64px;padding:6px;border:1px solid var(--line);background:transparent;text-align:left;color:var(--ink)}
body.demo-mobile-layout>.drawer .demo-mobile-product img{width:48px;height:60px;object-fit:contain}
body.demo-mobile-layout>.drawer .demo-mobile-product b{display:block;font-size:12px;line-height:1.4}
body.demo-mobile-layout>.drawer .demo-mobile-product small{display:block;font-size:11px;color:var(--muted);margin-top:5px}
body.demo-mobile-layout>.drawer .toolbar{display:flex;flex-wrap:wrap;gap:8px}
body.demo-mobile-layout>.drawer .button{min-height:44px;font-size:12px;padding:10px 12px}
@media(max-width:760px){body.demo-mobile-layout>.drawer{width:100%;height:100dvh;border-radius:0}}

body.demo-mobile-layout #app .demo-review-corner{left:auto;right:9px}
