/* Novela Cake mobile design system — intentionally independent from desktop. */
:root{
  --mobile-gutter:clamp(16px,4.5vw,22px);
  --mobile-section-gap:clamp(42px,11vw,64px);
  --mobile-card-gap:12px;
  --mobile-control-height:44px;
  --mobile-radius:16px;
}

@media (max-width:820px){
  html,body{max-width:100%;overflow-x:visible}
  body{font-size:15px;line-height:1.8}
  body.route-products,body.route-checkout{overflow-x:visible}
  body *{min-width:0}
  img,video,svg,canvas{max-width:100%;height:auto}
  input,select,textarea,button{max-width:100%}
  input,select,textarea{width:100%;min-height:var(--mobile-control-height);font-size:16px}
  textarea{min-height:116px}

  .container,.products-shell,.checkout-shell,.support-shell{
    width:min(calc(100% - (var(--mobile-gutter) * 2)),680px);
    max-width:680px;
    margin-inline:auto;
    padding-inline:0;
  }
  .section{padding-block:var(--mobile-section-gap)}
  .section-head{align-items:flex-start;gap:12px;margin-bottom:24px}
  .section-head h2{font-size:clamp(1.38rem,6vw,1.78rem);line-height:1.5}
  .section-head p{font-size:.86rem;line-height:1.85}
  h1{font-size:clamp(1.8rem,8vw,2.45rem);line-height:1.42}
  h2{line-height:1.5}

  /* Ordinary actions hug their label. Only explicit primary decisions fill a row. */
  .btn,.btn-block{width:fit-content;min-height:var(--mobile-control-height);padding:10px 16px;white-space:normal}
  .btn-lg{min-height:48px;padding:12px 18px}
  #cartCheckout,#loginForm button[type="submit"],#registerForm button[type="submit"],
  #profileForm button[type="submit"],#reviewForm button[type="submit"],
  #customForm button[type="submit"],#cateringForm button[type="submit"],
  #checkoutSubmit,#supportSubmit{width:100%}
  #receiptPick,#customPick,#supportImagePick{width:fit-content}
  .icon-btn,.icon-action,.menu-toggle{min-width:44px;min-height:44px}

  /* Compact storefront header and right-side navigation drawer. */
  .header-inner{width:min(calc(100% - (var(--mobile-gutter) * 2)),680px);min-height:62px;padding-block:8px;gap:8px}
  .header-inner>.brand{width:42px;flex:none}
  .header-inner>.header-brand{width:108px;flex:none}
  .header-brand .header-brand-logo{width:100%;height:auto;max-height:48px;padding:0;border:0;border-radius:0;background:transparent;box-shadow:none;object-fit:contain}
  .brand-logo{width:42px;height:42px;padding:2px}
  .header-inner .brand-text{display:none}
  .header-actions{display:flex;align-items:center;justify-content:flex-end;gap:6px;min-width:0}
  .header-actions .icon-action,.header-actions .menu-toggle{width:44px;height:44px;padding:0;justify-content:center}
  .header-actions .account-action{width:44px!important;min-width:44px!important;max-width:44px!important;padding:0!important}
  .header-actions .account-action .action-label,.header-actions .cart-action .action-label{display:none!important}
  /* Guests need a clear login affordance; signed-in customers keep the compact account icon. */
  .header-actions .account-action[data-account-state="guest"]{width:auto!important;min-width:66px!important;max-width:none!important;padding-inline:10px!important;gap:6px}
  .header-actions .account-action[data-account-state="guest"] .action-label{display:inline!important;font-size:.78rem;font-weight:800;white-space:nowrap}
  .header-search-panel{grid-area:search;width:100%;max-width:none}
  .header-shortcuts{background:rgba(255,253,248,.98)}
  .header-shortcuts-inner{width:100%;max-width:none;padding-inline:var(--mobile-gutter);gap:8px;overflow-x:auto;scroll-padding-inline:var(--mobile-gutter);scroll-snap-type:inline proximity}
  .header-shortcut{flex:none;min-height:38px;padding:7px 12px;scroll-snap-align:start;font-size:.74rem}
  .header-nav{inset:0 0 0 auto;width:min(86vw,340px);max-width:calc(100% - 18px);height:100dvh;border:0;border-radius:0 0 0 20px;box-shadow:-18px 0 50px rgba(31,16,8,.2)}
  .mobile-nav-head{display:flex;min-height:70px;padding:12px 14px}
  .mobile-nav-brand .mobile-nav-brand-logo{width:176px;height:auto;max-height:54px;padding:0;border:0;border-radius:0;background:transparent;object-fit:contain}
  .mobile-nav-close{width:44px;height:44px}
  .nav-inner{width:100%;padding:10px 12px calc(24px + env(safe-area-inset-bottom,0px));gap:5px;overflow:visible}
  .nav-inner a{width:100%;min-height:48px;margin:0;padding:12px 14px;border-radius:11px;font-size:.93rem;white-space:normal}

  /* Hero: editorial copy first, square visual second. */
  .hero{padding:22px 0 38px}
  .hero-layout{grid-template-columns:1fr;gap:24px}
  .hero-copy{order:1;padding:0;text-align:right}
  .hero-copy h1{max-width:12ch;margin:16px 0 14px}
  .hero-copy>p{max-width:52ch;margin-bottom:22px;font-size:.94rem;line-height:2}
  .hero-copy .hero-actions{display:grid;grid-template-columns:minmax(0,270px);justify-content:center;gap:10px;width:100%}
  .hero-copy .hero-actions>.btn{width:100%;min-width:0;min-height:50px;justify-content:center;padding:6px 14px;font-size:.92rem}
  .hero-copy .hero-products-cta>span{padding:0}
  .hero-copy .hero-products-cta>i{flex-basis:30px;width:30px;height:30px}
  .hero-points{display:flex;flex-direction:column;align-items:flex-start;gap:7px;margin-top:18px;font-size:.76rem}
  .hero-media-shell{order:2;width:100%;padding:0}
  .hero-slideshow{width:100%;height:auto;max-height:none;aspect-ratio:1 / 1;border-radius:var(--mobile-radius)}
  .hero-slide-media{width:100%;height:100%;object-fit:cover;object-position:center center}
  .hero-slide-nav{width:42px;height:42px}

  .trust{padding:12px 0}
  .trust-grid{grid-template-columns:1fr;gap:0;padding-block:4px}
  .trust-item{padding:10px 0;border-inline-start:0;border-bottom:1px solid rgba(255,255,255,.1)}
  .trust-item:last-child{border-bottom:0}
  .trust-item strong{font-size:.87rem}.trust-item span{font-size:.73rem}

  /* Categories and collection rails retain breathing room. */
  .cat-grid{grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:none;gap:var(--mobile-card-gap)}
  .cat-card:nth-child(n){grid-column:auto;grid-row:auto;min-height:150px;height:auto}
  .cat-card:first-child{grid-column:1 / -1;min-height:182px}
  .cat-glass{padding:13px}
  .cat-card strong{font-size:.9rem}
  .cat-card small{font-size:.67rem;line-height:1.55}
  .menu-boxes{gap:20px}
  .menu-box{padding:14px;border-radius:var(--mobile-radius)}
  .menu-box-head{align-items:flex-start;gap:10px;margin-bottom:14px;padding-bottom:12px}
  .menu-box-head h3{font-size:1rem}
  .menu-box-tools{gap:8px;flex-wrap:wrap;justify-content:flex-end}
  .menu-track{gap:12px;scroll-padding-inline:1px;scroll-snap-type:inline mandatory}
  .menu-track .product-card{flex-basis:min(64vw,218px);width:min(64vw,218px);scroll-snap-align:start}

  /* Promotional photographs use a square crop with the subject anchored left. */
  .promo{padding:20px 0}
  .promo-inner{grid-template-columns:1fr;gap:0;border-radius:var(--mobile-radius);overflow:hidden}
  .promo-media,.promo-custom .promo-media,.promo-catering .promo-media{width:100%;height:auto;min-height:0;aspect-ratio:1 / 1}
  .promo-media img,.promo-custom .promo-media img,.promo-catering .promo-media img{width:100%;height:100%;object-fit:cover;object-position:left center}
  .promo-content{padding:22px var(--mobile-gutter) 24px}
  .promo-content h2{font-size:1.42rem}
  .promo-content p{font-size:.9rem;line-height:1.95}
  .promo-highlights{grid-template-columns:1fr;gap:8px;margin:20px 0}
  .promo-content .promo-cta{width:fit-content;margin-top:4px}

  /* Product discovery: two cards only when each card has enough room. */
  .products-view{inset:auto;top:auto;width:100%;min-height:calc(100dvh - var(--route-header-offset));overflow-x:visible}
  .products-shell{padding-top:16px;padding-bottom:calc(48px + env(safe-area-inset-bottom,0px))}
  .products-topbar{align-items:center;margin-bottom:14px}
  .products-topbar .brand-text{display:none}
  .products-hero{gap:14px;padding:18px;margin-bottom:18px;border-radius:var(--mobile-radius)}
  .products-hero h1{font-size:1.62rem}
  .products-hero .muted{font-size:.84rem;line-height:1.85}
  .products-search{width:100%;min-height:48px}
  .products-layout{display:block}
  .products-results-bar{align-items:center;flex-wrap:wrap;gap:10px;margin-bottom:12px}
  .products-filter-toggle{min-height:42px}
  .products-filters-panel{width:min(88vw,350px);max-width:calc(100% - 18px);padding:18px 16px calc(24px + env(safe-area-inset-bottom,0px));border-radius:18px 0 0 18px}
  .filter-option,.filter-fav-toggle{min-height:44px}
  .filter-price{display:grid;grid-template-columns:minmax(0,1fr) auto minmax(0,1fr)}
  .products-view .products-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:var(--mobile-card-gap);width:100%;max-width:none;margin:0;align-items:stretch}
  .products-view .product-card{display:flex;flex-direction:column;align-items:stretch;width:100%;min-height:0;margin:0;border-radius:14px;overflow:hidden}
  .products-view .product-card>.product-media{align-self:stretch;width:100%;height:auto;min-height:0;aspect-ratio:1 / 1;border-radius:0}
  .products-view .product-card>.product-media>img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
  .products-view .product-card>.product-body{width:100%;padding:10px;gap:5px;overflow:visible}
  .products-view .product-name{display:-webkit-box;min-height:2.9em;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:2;white-space:normal;font-size:.9rem;line-height:1.45}
  .products-view .product-desc{display:none}
  .products-view .product-allergens,.products-view .product-ingredients{display:none}
  .products-view .product-foot{align-items:center;flex-wrap:wrap;gap:7px;margin-top:auto;padding-top:7px}
  .products-view .price{max-width:calc(100% - 40px);font-size:.85rem;line-height:1.55;white-space:normal;overflow-wrap:anywhere}
  .products-view .add-cart-btn{flex:0 0 34px;width:34px;height:34px}

  /* Forms and route pages use one outer gutter, not nested horizontal padding. */
  .custom-view,.checkout-view,.support-view{width:100%}
  .form-grid,.checkout-form{grid-template-columns:1fr;gap:14px}
  .form-grid .field,.checkout-form .field{min-width:0}
  .field label,.field-label{font-size:.83rem}
  .form-card{padding:18px;border-radius:var(--mobile-radius)}
  .checkout-topbar,.products-topbar{gap:10px}
  .custom-view .checkout-topbar{padding:6px}
  .checkout-grid{grid-template-columns:1fr;gap:18px}
  .checkout-invoice,.checkout-payment{min-width:0}
  .checkout-grid h2{font-size:1.2rem}
  .invoice-box,.checkout-form,.discount-card{border-radius:14px}
  .checkout-form{padding:16px}
  .pay-card{padding:18px;border-radius:var(--mobile-radius)}
  .pay-card-number{font-size:clamp(1rem,5.2vw,1.35rem);letter-spacing:2px}
  .discount-entry{grid-template-columns:minmax(0,1fr) auto;gap:8px}
  .discount-entry .btn{width:fit-content;min-height:44px;padding-inline:14px}
  #checkoutSubmit{position:sticky;bottom:10px;z-index:4;box-shadow:0 10px 28px rgba(46,26,13,.22)}
  .checkout-success{padding:38px 0}
  .checkout-success-actions{display:flex;justify-content:center;flex-wrap:wrap;gap:10px}
  .checkout-success-actions .btn{width:fit-content}

  /* Drawers and dialogs become dedicated touch surfaces. */
  .cart-drawer,.account-drawer{width:min(100%,430px);max-width:100%;border-radius:18px 0 0 18px}
  .cart-head{min-height:66px;padding:12px 14px}
  .cart-body,.account-body{padding:14px}
  .cart-foot{padding:12px 14px calc(14px + env(safe-area-inset-bottom,0px))}
  .cart-item{display:grid;grid-template-columns:72px minmax(0,1fr);gap:10px;align-items:start}
  .cart-item-media{grid-row:1 / span 2;width:72px;height:72px}
  .cart-item-info{min-width:0}
  .cart-item-title{font-size:.84rem;overflow-wrap:anywhere}
  .cart-item-actions{grid-column:2;display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:8px}
  .modal-overlay{align-items:flex-end;padding:8px}
  .modal-box{width:100%;max-width:100%;max-height:calc(100dvh - 16px);overflow:auto;border-radius:20px 20px 12px 12px}
  .modal-media{max-height:none;aspect-ratio:4 / 3;background:var(--surface-2)}
  .modal-media>img{width:100%;height:100%;object-fit:cover}
  .modal-content{padding:15px 16px 18px}
  .modal-content h3{font-size:1.12rem;line-height:1.55;margin-block:7px}
  .modal-content>p{font-size:.82rem;line-height:1.9;margin:0}
  .modal-price{margin-top:12px;font-size:1.1rem}
  .modal-actions{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:8px;margin-top:14px}
  .modal-actions .btn{min-height:44px;padding-inline:14px}
  #modalFav{width:44px;min-width:44px;padding:0;font-size:0}
  #modalFav i{font-size:1rem}
  .product-modal-gallery{position:relative;width:100%;height:100%;overflow:hidden;background:var(--surface-2)}
  .product-modal-gallery>img{width:100%;height:100%;object-fit:cover;touch-action:pan-y;user-select:none}
  .product-gallery-nav{position:absolute;top:50%;z-index:2;display:grid;width:38px;height:38px;place-items:center;border:1px solid rgba(255,255,255,.7);border-radius:50%;background:rgba(46,26,13,.66);color:#fff;transform:translateY(-50%)}
  .product-gallery-prev{right:10px}.product-gallery-next{left:10px}
  .product-gallery-count{position:absolute;top:10px;left:10px;padding:3px 8px;border-radius:999px;background:rgba(46,26,13,.68);color:#fff;font-size:.66rem;font-weight:700}
  .product-gallery-dots{position:absolute;right:50%;bottom:10px;display:flex;align-items:center;gap:5px;transform:translateX(50%)}
  .product-gallery-dots button{width:6px;height:6px;padding:0;border-radius:50%;background:rgba(255,255,255,.6);box-shadow:0 1px 3px rgba(0,0,0,.22)}
  .product-gallery-dots button.active{width:18px;border-radius:99px;background:#fff}
  .modal-actions .btn{width:fit-content}
  .modal-actions .btn-primary{flex:1 1 190px}

  .reviews-grid{grid-template-columns:1fr;gap:var(--mobile-card-gap)}
  .faq-list{gap:9px}
  .faq-question{min-height:54px;padding:13px 14px;font-size:.86rem;line-height:1.75}
  .faq-answer p{padding:0 14px 14px;font-size:.84rem;line-height:1.9}
  .contact-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:var(--mobile-card-gap)}
  .contact-card{min-height:138px;padding:16px 10px;text-align:center}
  .contact-card>span:last-child{font-size:.73rem;overflow-wrap:anywhere}

  /* Support and account surfaces. */
  .support-view{padding:12px 0 36px}
  .support-hero{padding:28px 0 20px}
  .support-layout{grid-template-columns:1fr;gap:var(--mobile-card-gap)}
  .support-side{grid-template-columns:repeat(2,minmax(0,1fr));gap:var(--mobile-card-gap)}
  .support-side-card{padding:18px;border-radius:var(--mobile-radius)}
  .support-login-note{align-items:flex-start;flex-wrap:wrap;padding:15px}
  .support-login-note .btn{width:fit-content}
  .support-detail-meta{grid-template-columns:1fr}
  .auth-tabs.account-tabs{display:flex;gap:7px;overflow-x:auto;scroll-snap-type:inline proximity}
  .auth-tabs.account-tabs .auth-tab{flex:none;min-height:42px;scroll-snap-align:start}
  .account-stats{grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}

  .site-footer{margin-top:0}
  .footer-grid{grid-template-columns:1fr 1fr;gap:24px 18px;padding-block:36px}
  .footer-about{grid-column:1 / -1}
  .footer-col h4{font-size:.9rem}.footer-col li{font-size:.81rem}
  .footer-bottom{padding:14px 0}
  .footer-bottom-inner{align-items:flex-start;gap:5px;flex-direction:column;font-size:.69rem}
}

@media (max-width:420px){
  .header-inner{gap:8px}
  .header-actions{gap:5px}
  .header-actions #favBtn{display:none}
  .header-actions .icon-action,.header-actions .menu-toggle{width:42px;min-width:42px;min-height:42px;height:42px}
  .header-actions .account-action[data-account-state="guest"]{min-width:62px!important;padding-inline:8px!important}
  .header-inner>.brand{width:40px}
  .header-inner>.header-brand{width:92px}
  .header-inner>.brand .brand-logo{width:40px;height:40px}
  .hero-copy h1{font-size:clamp(1.72rem,9vw,2.12rem)}
  .hero-slideshow{border-radius:14px}
  .cat-grid{gap:9px}
  .cat-card:nth-child(n){min-height:136px}
  .cat-card:first-child{min-height:164px}
  .cat-glass{padding:10px}.cat-icon{width:34px;height:34px}
  .menu-box-head{flex-wrap:wrap}.menu-box-tools{width:100%;justify-content:space-between}
  .products-view .products-grid{grid-template-columns:1fr;gap:10px}
  .products-view .product-card{display:grid;grid-template-columns:104px minmax(0,1fr);grid-template-areas:"media body";align-items:start;min-height:112px}
  .products-view .product-card>.product-media{grid-area:media;align-self:start;width:104px;height:auto;min-height:0;aspect-ratio:1 / 1}
  .products-view .product-card>.product-body{grid-area:body;padding:10px}
  .products-view .product-name{min-height:auto}
  .support-side{grid-template-columns:1fr}
  .contact-grid{grid-template-columns:1fr}.contact-card{min-height:112px}
  .footer-grid{grid-template-columns:1fr;gap:20px}.footer-about{grid-column:auto}
  .discount-entry{grid-template-columns:1fr}.discount-entry .btn{width:fit-content}
}

@media (max-width:340px){
  :root{--mobile-gutter:14px}
  .header-inner>.header-brand{width:84px}
  .header-actions{gap:4px}
  .header-actions .icon-action,.header-actions .menu-toggle{width:40px;min-width:40px;min-height:40px;height:40px}
  .header-actions .account-action[data-account-state="guest"]{min-width:54px!important;padding-inline:6px!important;gap:3px}
  .header-actions .account-action[data-account-state="guest"] .action-label{font-size:.74rem}
  .header-actions #favBtn{display:none}
  .header-shortcut{padding-inline:10px;font-size:.71rem}
  .header-shortcut i{display:none}
  .products-view .product-card{grid-template-columns:92px minmax(0,1fr)}
  .products-view .product-card>.product-media{width:92px}
}

@media (prefers-reduced-motion:reduce){
  .header-nav,.products-filters-panel,.modal-box,.btn,.product-card{transition-duration:0s!important}
}

/* Final mobile product geometry: square media never stretches with card copy. */
@media (max-width:420px){
  .products-view .product-card{
    grid-template-columns:104px minmax(0,1fr)!important;
    grid-template-rows:auto!important;
    min-height:0!important;
    align-items:start!important;
    background:linear-gradient(to left,var(--surface-2) 0 104px,var(--surface) 104px)!important;
  }
  .products-view .product-card>.product-media{
    align-self:start!important;
    width:104px!important;
    height:104px!important;
    min-height:104px!important;
    max-height:104px!important;
    aspect-ratio:1 / 1!important;
    border-radius:0 13px 13px 0!important;
  }
  .products-view .product-card>.product-media>img{
    position:absolute!important;
    inset:0!important;
    display:block!important;
    width:100%!important;
    height:100%!important;
    object-fit:cover!important;
    object-position:center!important;
  }
  .products-view .product-card>.product-body{
    align-self:start!important;
    min-height:104px!important;
    height:auto!important;
    padding:9px 10px!important;
  }
  .products-view .product-card:not(.is-size-product)>.product-body{justify-content:center!important}
  .products-view .product-foot{margin-top:4px!important}
  .modal-media{position:relative;aspect-ratio:1 / 1!important;height:auto!important;min-height:0!important;overflow:hidden}
  .modal-media>img{position:absolute;inset:0;width:100%!important;height:100%!important;object-fit:cover!important;object-position:center!important}
}
@media (max-width:340px){
  .products-view .product-card{grid-template-columns:92px minmax(0,1fr)!important;background:linear-gradient(to left,var(--surface-2) 0 92px,var(--surface) 92px)!important}
  .products-view .product-card>.product-media{width:92px!important;height:92px!important;min-height:92px!important;max-height:92px!important}
  .products-view .product-card>.product-body{min-height:92px!important}
}
