/* Wali World — MegaMart-inspired layout (static)
   Mobile-first, fast load, minimal JS.
*/

:root{
  --bg: #F5F7FB;
  --surface: #FFFFFF;
  --surface2: #F1F5F9;
  --text: #0B1B2B;
  --muted: rgba(11,27,43,0.68);
  --border: rgba(11,27,43,0.10);

  --brand: #6D28D9;     /* purple */
  --brand2:#A855F7;     /* accent */
  --brandSoft: rgba(109,40,217,0.12);

  --shadow: 0 18px 55px rgba(11,27,43,0.10);
  --shadow2: 0 10px 24px rgba(11,27,43,0.08);

  --r-lg: 18px;
  --r-md: 14px;
  --r-sm: 12px;

  --container: 1140px;
}

*{box-sizing:border-box;}
html,body{height:100%;}
body{
  margin:0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  color: var(--text);
  background: var(--bg);
  line-height:1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x:hidden;

  /* Offset for fixed header (set dynamically in JS) */
  padding-top: var(--navH, 0px);
}

html{scroll-padding-top: var(--navH, 0px);} 

img{max-width:100%; display:block;}
a{color:inherit; text-decoration:none;}

.container{width:min(100% - 32px, var(--container)); margin:0 auto;}
.section{padding:40px 0;}
.section--tight{padding:28px 0;}

.grid{display:grid; gap:18px;}
.grid-2{grid-template-columns: 1fr;}
.grid-3{grid-template-columns: 1fr;}
@media(min-width:900px){
  .grid-2{grid-template-columns: 1.2fr 0.8fr; gap:26px;}
  .grid-3{grid-template-columns: repeat(3, 1fr); gap:18px;}
}

/* Topbar */
.topbar{background: #F3EEFF; border-bottom: 1px solid rgba(11,27,43,0.06);}
.topbar__row{display:flex; align-items:center; justify-content:space-between; gap:12px; padding:8px 0; font-size:12.5px; color: rgba(11,27,43,0.70);} 
.topbar__right{display:flex; align-items:center; gap:10px;}
.topbar__link{color: rgba(11,27,43,0.72);} 
.topbar__link:hover{text-decoration:underline; text-decoration-color: rgba(109,40,217,0.5);} 
.topbar__sep{opacity:0.6;}

@media(max-width:520px){
  .topbar__row{flex-wrap:wrap; row-gap:6px;}
  .topbar__right{width:100%; justify-content:flex-start;}
}

/* Header */
.nav{
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid rgba(11,27,43,0.08);
  padding-top: env(safe-area-inset-top);
}
@supports ((-webkit-backdrop-filter: blur(10px)) or (backdrop-filter: blur(10px))) {
  .nav{background: rgba(245,247,251,0.92); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);} 
}
.nav__row{display:flex; align-items:center; gap:14px; padding:12px 0;}

.brand{display:flex; align-items:center; gap:10px; min-width:220px;}
.brand__mark{width:40px; height:40px; border-radius:12px; overflow:hidden; background: linear-gradient(135deg, rgba(109,40,217,0.15), rgba(168,85,247,0.08)); border:1px solid rgba(11,27,43,0.08); display:grid; place-items:center;}
.brand__mark img{width:100%; height:100%; object-fit:cover;}
.brand__name{font-weight:900; letter-spacing:-0.03em; line-height:1.0; font-size:16px; color: rgba(11,27,43,0.92);} 
.brand__tag{font-size:12px; color: rgba(11,27,43,0.60); margin-top:2px;}

/* Mobile header: prevent overflow */
@media(max-width:520px){
  .nav__row{gap:10px;}
  .brand{min-width:0; flex:1;}
  .brand__meta{min-width:0;}
  .brand__tag{display:none;}
  .nav__actions{gap:8px;}
  .iconbtn{padding:9px 10px; border-radius:11px;}
}

.iconbtn{
  border:1px solid rgba(11,27,43,0.10);
  background: var(--surface);
  color: rgba(11,27,43,0.85);
  border-radius: 12px;
  padding:10px 12px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  cursor:pointer;
  box-shadow: 0 8px 20px rgba(11,27,43,0.06);
}
.iconbtn:hover{background: rgba(109,40,217,0.08); border-color: rgba(109,40,217,0.22);} 

.nav__toggle{display:inline-flex;}
@media(min-width:900px){.nav__toggle{display:none;}}

.search{flex:1; display:none; align-items:center; gap:10px;}
.search__input{
  width:100%;
  padding:12px 14px;
  border-radius: 14px;
  border:1px solid rgba(11,27,43,0.10);
  background: var(--surface);
  box-shadow: 0 10px 24px rgba(11,27,43,0.06);
}
.search__input:focus{outline:none; border-color: rgba(109,40,217,0.50); box-shadow: 0 0 0 4px rgba(109,40,217,0.14), 0 10px 24px rgba(11,27,43,0.06);} 
.search__btn{min-width:44px;}
@media(min-width:900px){.search{display:flex;}}

.nav__actions{margin-left:auto; display:flex; align-items:center; gap:10px;}
.navlink{font-weight:800; color: rgba(11,27,43,0.72); padding:8px 10px; border-radius:12px; display:none;}
.navlink:hover{background: rgba(109,40,217,0.10); color: rgba(11,27,43,0.92);} 
@media(min-width:900px){.navlink{display:inline-flex;}}

.cartbtn{position:relative;}
.cartcount{position:absolute; top:-7px; right:-7px; width:20px; height:20px; border-radius:999px; display:grid; place-items:center;
  background: linear-gradient(135deg, var(--brand2), var(--brand));
  color:#062225; font-weight:950; font-size:12px; border:1px solid rgba(0,0,0,0.15);
}

/* Category nav */
.catnav{display:flex; align-items:center; gap:10px; overflow:auto; padding:10px 0 14px; -webkit-overflow-scrolling: touch;}
.catnav::-webkit-scrollbar{display:none;}
.catpill{display:inline-flex; align-items:center; gap:8px; padding:9px 12px; border-radius:999px; font-weight:900; font-size:13px;
  background: var(--surface);
  border:1px solid rgba(11,27,43,0.10);
  box-shadow: 0 10px 24px rgba(11,27,43,0.05);
  color: rgba(11,27,43,0.82);
}
.catpill:hover{background: rgba(109,40,217,0.10); border-color: rgba(109,40,217,0.25);} 

/* Buttons */
.btn{
  border:1px solid transparent;
  border-radius:14px;
  padding:12px 14px;
  font-weight:900;
  letter-spacing:-0.01em;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  user-select:none;
  cursor:pointer;
  white-space:nowrap;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease, border-color 180ms ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:focus-visible{outline:none; box-shadow: 0 0 0 4px rgba(109,40,217,0.18);} 
.btn--small{padding:10px 12px; border-radius:12px; font-size:13.5px;}
.btn--primary{background: linear-gradient(135deg, var(--brand2) 0%, var(--brand) 100%); color:#fff; box-shadow: 0 16px 32px rgba(109,40,217,0.18);} 
.btn--primary:hover{transform: translateY(-1px); box-shadow: 0 18px 34px rgba(109,40,217,0.22);} 
.btn--ghost{background: var(--surface); border-color: rgba(11,27,43,0.10); color: rgba(11,27,43,0.85); box-shadow: 0 12px 26px rgba(11,27,43,0.06);} 
.btn--ghost:hover{background: rgba(109,40,217,0.08); border-color: rgba(109,40,217,0.22); transform: translateY(-1px);} 
.btn--pill{border-radius:999px;}

/* Type */
.eyebrow{color: rgba(109,40,217,0.95); font-weight:900; font-size:13px; letter-spacing:0.14em; text-transform:uppercase; margin:0 0 8px;}
.h2{font-family: Poppins, Inter, system-ui, sans-serif; font-size: clamp(22px, 2.6vw, 32px); letter-spacing:-0.03em; line-height:1.12; margin:0 0 8px;}
.lead{margin:0; color: rgba(11,27,43,0.70); font-size:15.5px; max-width: 78ch;}

/* Hero banner / carousel */
.hero{padding: 22px 0 8px;}
.banner{position:relative; border-radius: 22px; overflow:hidden; background: #1B2B47; color:#fff; box-shadow: var(--shadow);}
.banner__inner{display:grid; grid-template-columns: 1fr; gap:14px; padding: 22px; min-height: 180px; transition: opacity 240ms ease;}
.banner.is-fading .banner__inner{opacity:0.25;}
.banner__k{opacity:0.92; font-weight:700;}
.banner__t{font-family: Poppins, Inter, system-ui; font-weight:800; letter-spacing:-0.03em; font-size: clamp(26px, 4vw, 44px); margin:6px 0 0;}
.banner__sub{opacity:0.86; margin-top:6px;}
.banner__img{display:none; align-items:center; justify-content:center;}
.banner__img img{max-width: 260px; width: 46%; min-width: 180px; filter: drop-shadow(0 18px 30px rgba(0,0,0,0.35));}
@media(min-width:900px){
  .banner__inner{grid-template-columns: 1.2fr 0.8fr; align-items:center; min-height: 240px; padding: 26px;}
  .banner__img{display:flex;}
}

.banner__dots{position:absolute; left:24px; bottom:18px; display:flex; gap:10px; z-index:3;}
.dot{
  width:8px;
  height:8px;
  border-radius:999px;
  background: rgba(255,255,255,0.30);
  border:0;
  padding:0;
  cursor:pointer;
}
.dot.is-on{background:#fff; width:20px;}
.dot:focus-visible{outline:none; box-shadow: 0 0 0 4px rgba(255,255,255,0.22);}

.banner__arrow{
  position:absolute;
  top:50%;
  transform: translateY(-50%);
  z-index:3;
  width:44px;
  height:44px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.10);
  color:#fff;
  font-size:26px;
  line-height:1;
  display:grid;
  place-items:center;
  cursor:pointer;
  backdrop-filter: blur(8px);
}
.banner__arrow:hover{background: rgba(255,255,255,0.16);}
.banner__arrow:focus-visible{outline:none; box-shadow: 0 0 0 4px rgba(255,255,255,0.22);} 
.banner__arrow--prev{left:14px;}
.banner__arrow--next{right:14px;}
@media(max-width:520px){
  .banner__arrow{display:none;}
}

/* Section header row */
.rowhead{display:flex; align-items:flex-end; justify-content:space-between; gap:12px;}
.rowhead a{color: rgba(109,40,217,0.95); font-weight:900;}
.rowhead a:hover{text-decoration:underline;}

/* Carousels */
.carousel{display:grid; grid-auto-flow:column; grid-auto-columns: minmax(220px, 1fr);
  gap:14px; overflow:auto; padding: 14px 6px 10px; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch;}
.carousel::-webkit-scrollbar{display:none;}

/* Shop product grid (used on /shop.html) */
.productgrid{display:grid; gap:14px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 8px;}
@media(min-width:700px){.productgrid{grid-template-columns: repeat(3, minmax(0, 1fr));}}
@media(min-width:1000px){.productgrid{grid-template-columns: repeat(4, minmax(0, 1fr));}}

.filters-grid{display:grid; grid-template-columns: 1fr; gap:12px; margin-top:12px;}
@media(min-width:900px){.filters-grid{grid-template-columns: repeat(4, 1fr);}}

/* Product cards */
.product{
  border:1px solid rgba(11,27,43,0.10);
  border-radius: 18px;
  background: var(--surface);
  overflow:hidden;
  box-shadow: var(--shadow2);
  scroll-snap-align: start;
  display:flex;
  flex-direction:column;
  min-height: 100%;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}
.product:hover{transform: translateY(-2px); border-color: rgba(109,40,217,0.24); box-shadow: 0 18px 38px rgba(11,27,43,0.12);} 
.product__img{aspect-ratio: 4/3; background: #F8FBFE; display:grid; place-items:center; padding:16px; position:relative; overflow:hidden;}
.product__img img{max-height: 120px; width:auto; transition: transform 260ms ease, opacity 260ms ease; will-change: transform, opacity;}

/* Hover image swap + zoom detail */
.product__imgAlt{position:absolute; inset:0; margin:auto; opacity:0; transform: scale(1.06); pointer-events:none;}
.product:hover .product__imgMain{opacity:0; transform: scale(1.03);}
.product:hover .product__imgAlt{opacity:1; transform: scale(1.0);} 

/* No hover devices (touch): keep main image and just do subtle press */
@media (hover: none){
  .product__imgAlt{display:none;}
  .product:hover .product__imgMain{opacity:1; transform:none;}
}

.discount{position:absolute; top:10px; right:10px; width:44px; height:44px; border-radius:14px; display:grid; place-items:center;
  background: linear-gradient(135deg, rgba(168,85,247,0.95), rgba(109,40,217,0.95));
  color:#062225; font-weight:950; font-size:11px; text-align:center;
  box-shadow: 0 14px 28px rgba(109,40,217,0.20);
}

.product__body{padding:14px; display:grid; gap:10px;}
.product__name{font-weight:950; letter-spacing:-0.02em; margin:0;}
.product__meta{font-size:13px; color: rgba(11,27,43,0.65);} 
.price{display:flex; align-items:baseline; gap:8px;}
.price b{font-size:16px; letter-spacing:-0.02em;}
.price s{color: rgba(11,27,43,0.50); font-size:13px;}
.save{color: rgba(109,40,217,0.92); font-weight:900; font-size:12.5px;}

.rating{display:flex; align-items:center; gap:8px; font-size:13px; color: rgba(11,27,43,0.62);} 
.rating b{color: rgba(11,27,43,0.92);} 

.product__actions{display:flex; gap:10px; flex-wrap:wrap;}
@media(max-width:420px){
  .product__actions .btn{flex:1;}
}

/* Category circles */
.cats{display:grid; gap:14px; grid-template-columns: repeat(2, 1fr); margin-top:14px;}
@media(min-width:520px){.cats{grid-template-columns: repeat(4, 1fr);}}
@media(min-width:900px){.cats{grid-template-columns: repeat(7, 1fr);}}
.cat{
  display:grid; justify-items:center; gap:10px;
}
.cat__icon{width:66px; height:66px; border-radius: 999px; background: var(--surface);
  border:1px solid rgba(11,27,43,0.10); box-shadow: var(--shadow2);
  display:grid; place-items:center;
}
.cat__icon img{width:34px; height:34px; opacity:0.9;}
@media(max-width:420px){
  .cat__icon{width:58px; height:58px;}
  .cat__icon img{width:30px; height:30px;}
}
.cat__name{font-size:12.5px; font-weight:900; color: rgba(11,27,43,0.72); text-align:center;}

/* Brand cards */
.brands{display:grid; grid-auto-flow:column; grid-auto-columns: minmax(260px, 1fr); gap:14px; overflow:auto; padding: 14px 6px 10px; -webkit-overflow-scrolling: touch; scroll-snap-type:x mandatory;}
.brands::-webkit-scrollbar{display:none;}

/* Continuous marquee mode (Home > Brands) */
.brands--marquee{scroll-snap-type:none; scroll-behavior:auto;}
.brands--marquee{mask-image: linear-gradient(90deg, transparent 0, #000 8%, #000 92%, transparent 100%);} 
@media(max-width:520px){
  .brands--marquee{mask-image: linear-gradient(90deg, transparent 0, #000 6%, #000 94%, transparent 100%);} 
}
@media (prefers-reduced-motion: reduce){
  .brands--marquee{mask-image:none;}
}

.brandcard{border-radius: 18px; border:1px solid rgba(11,27,43,0.10); background: var(--surface);
  box-shadow: var(--shadow2); padding:14px; display:flex; align-items:center; justify-content:space-between; gap:14px; scroll-snap-align:start;}
.brandcard__left{display:grid; gap:6px;}
.brandcard__tag{display:inline-flex; align-items:center; padding:6px 10px; border-radius:999px; background: rgba(11,27,43,0.06); font-weight:900; font-size:12px; color: rgba(11,27,43,0.72);} 
.brandcard__t{font-weight:950; letter-spacing:-0.02em;}
.brandcard__img{width:86px; height:64px; border-radius:16px; background: #F8FBFE; border:1px solid rgba(11,27,43,0.08); display:grid; place-items:center;}
.brandcard__img img{max-height:42px; width:auto;}

/* Daily essentials grid */
.essentials{display:grid; gap:14px; grid-template-columns: repeat(2, 1fr); margin-top:14px;}
@media(min-width:900px){.essentials{grid-template-columns: repeat(6, 1fr);} }
.ess{border-radius: 18px; border:1px solid rgba(11,27,43,0.10); background: var(--surface); box-shadow: var(--shadow2); padding:12px; display:grid; gap:10px;}
.ess__img{height:78px; border-radius:14px; background: #F8FBFE; border:1px solid rgba(11,27,43,0.08); display:grid; place-items:center;}
.ess__img img{max-height:46px; width:auto;}
.ess__name{font-weight:950; letter-spacing:-0.02em; font-size:13.5px;}
.ess__off{color: rgba(11,27,43,0.62); font-size:12.5px; font-weight:900;}

/* Forms */
.label{font-weight:900; font-size:13px; color: rgba(11,27,43,0.72); display:block; margin-bottom:6px;}
.input, select, textarea{
  width:100%;
  max-width:100%;
  padding:12px 12px;
  border-radius:14px;
  border:1px solid rgba(11,27,43,0.12);
  background: var(--surface);
  color: rgba(11,27,43,0.92);
  box-shadow: 0 10px 24px rgba(11,27,43,0.05);

  /* iOS: prevent zoom-on-focus (needs 16px+) */
  font-size:16px;
  line-height:1.3;
  font-family: inherit;
}
.input:focus, select:focus, textarea:focus{outline:none; border-color: rgba(109,40,217,0.55); box-shadow: 0 0 0 4px rgba(109,40,217,0.14), 0 10px 24px rgba(11,27,43,0.05);} 
textarea{min-height:110px; resize:vertical;}

/* Forms: buttons full-width on mobile */
@media(max-width:520px){
  form .btn{width:100%;}
}

.card{border:1px solid rgba(11,27,43,0.10); border-radius: var(--r-lg); background: var(--surface);
  box-shadow: var(--shadow2); padding:18px;}

/* Footer */
.footer{margin-top: 18px; padding: 34px 0; border-top: 1px solid rgba(11,27,43,0.10); background: #0E8FB4; color: #EAF6FB;}
.footer__grid{display:grid; gap:18px; grid-template-columns:1fr;}
@media(min-width:900px){.footer__grid{grid-template-columns: 1.1fr 0.9fr; align-items:start;}}
.footer .brand__name{color:#fff;}
.footer .brand__tag{color: rgba(234,246,251,0.82);} 
.footer__contact{margin-top:12px; display:grid; gap:2px; color: rgba(234,246,251,0.84);} 
.footer__cols{display:grid; gap:16px; grid-template-columns: 1fr 1fr;}
.footer__head{font-weight:950; letter-spacing:-0.02em; margin-bottom:8px;}
.footer__link{display:block; padding:6px 0; color: rgba(234,246,251,0.88);} 
.footer__link:hover{text-decoration:underline;}
.footer__bottom{margin-top:18px; border-top: 1px solid rgba(234,246,251,0.18); padding-top:14px; color: rgba(234,246,251,0.78);} 

/* Cart drawer */
.drawer__backdrop{position:fixed; inset:0; background: rgba(0,0,0,0.55); display:none; z-index:400;}
.drawer{position:fixed; top:0; right:0; height:100%; width:min(420px, 92vw); transform: translateX(102%);
  background: rgba(255,255,255,0.96); border-left: 1px solid rgba(11,27,43,0.10); z-index:410; box-shadow: var(--shadow);
  transition: transform 240ms ease;
  display:flex; flex-direction:column;
}
.drawer.is-open{transform: translateX(0);} 
.drawer__backdrop.is-open{display:block;}
.drawer__head{padding:16px; display:flex; align-items:center; justify-content:space-between; border-bottom: 1px solid rgba(11,27,43,0.10);} 
.drawer__head h3{margin:0; font-size:16px; letter-spacing:-0.01em;}
.drawer__body{padding:16px; overflow:auto; display:grid; gap:12px;}
.cartitem{display:flex; gap:12px; align-items:center; border:1px solid rgba(11,27,43,0.10); border-radius: var(--r-md);
  padding:12px; background: rgba(11,27,43,0.02);
}
.cartitem img{width:44px; height:44px;}
.cartitem__meta{flex:1; min-width:0;}
.cartitem__title{font-weight:950; margin:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.cartitem__sub{margin-top:2px; font-size:12.5px; color: rgba(11,27,43,0.62);} 
.cartitem__qty{display:flex; align-items:center; gap:8px;}
.qtybtn{width:30px;height:30px;border-radius:10px;border:1px solid rgba(11,27,43,0.12); background: rgba(11,27,43,0.02); color: rgba(11,27,43,0.92); font-weight:950; cursor:pointer;}
.qtybtn:hover{background: rgba(109,40,217,0.08); border-color: rgba(109,40,217,0.22);} 

.drawer__foot{padding:16px; border-top: 1px solid rgba(11,27,43,0.10); display:grid; gap:12px;}
.totals{display:flex; align-items:center; justify-content:space-between; color: rgba(11,27,43,0.72); font-weight:950;}

/* Product modal */
dialog#productModal{border:none; padding:0;}
dialog#productModal::backdrop{background: rgba(0,0,0,0.55);} 

/* Mobile menu */
.mnav-backdrop{position:fixed; inset:0; background: rgba(0,0,0,0.55); display:none; z-index:500;}
.mnav{position:fixed; top:0; right:0; height:100%; width:min(380px, 92vw); transform: translateX(102%);
  background: rgba(255,255,255,0.98); border-left: 1px solid rgba(11,27,43,0.10); z-index:510; box-shadow: var(--shadow);
  transition: transform 240ms ease; display:flex; flex-direction:column;}
.mnav.is-open{transform: translateX(0);} 
.mnav-backdrop.is-open{display:block;}
.mnav__head{padding:16px; display:flex; align-items:center; justify-content:space-between; border-bottom:1px solid rgba(11,27,43,0.10);} 
.mnav__head b{letter-spacing:-0.02em;}
.mnav__body{padding:16px; display:grid; gap:10px;}
.mnav__body a{padding:12px 12px; border-radius:14px; border:1px solid rgba(11,27,43,0.10); background: rgba(11,27,43,0.02); font-weight:900;}
.mnav__body a:hover{background: rgba(109,40,217,0.10); border-color: rgba(109,40,217,0.22);} 
.mnav__foot{padding:16px; border-top:1px solid rgba(11,27,43,0.10); display:grid; gap:10px;}

/* Floating CTA */
.floating-cta{position:fixed; left:14px; right:14px; bottom: calc(14px + env(safe-area-inset-bottom)); z-index:60; display:none;}
.floating-cta .btn{width:100%; border-radius:16px; padding:14px 16px; box-shadow: 0 16px 32px rgba(11,27,43,0.14);} 
@media(max-width:920px){.floating-cta{display:block;}}

@media (prefers-reduced-motion: reduce){
  *, *::before, *::after{scroll-behavior:auto !important; transition:none !important; animation:none !important;}
}
