/* /assets/styles.css */
:root{
  --bg:#0b1220; --card:#11182a; --muted:#94a3b8; --text:#e6edf7;
  --acc:#5eead4; --acc2:#60a5fa; --line:#1f2937; --warn:#22c55e;
}

/* Base */
*{box-sizing:border-box}
html,body{
  margin:0; padding:0; background:var(--bg); color:var(--text);
  font-family:ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,Apple Color Emoji,Segoe UI Emoji
}
a{color:inherit; text-decoration:none}
.container{max-width:1200px; margin:0 auto; padding:16px}

/* Header / Nav */
header{
  position:sticky; top:0; z-index:50;
  background:linear-gradient(180deg,rgba(11,18,32,.95),rgba(11,18,32,.85));
  backdrop-filter:blur(8px);
  border-bottom:1px solid #162032
}
.nav{display:flex; align-items:center; gap:16px; justify-content:space-between; padding:12px 0; flex-wrap:nowrap}
.brand{display:flex; align-items:center; gap:10px; font-weight:800; letter-spacing:.5px}
.logo{
  width:36px; height:36px; border-radius:12px; background:#0f172a; display:grid; place-items:center;
  box-shadow:0 0 0 2px #1f2a44 inset
}
.logo svg{width:22px; height:22px}
.welcome{font-size:14px; color:#8aa0be; letter-spacing:.2px}
.brand-name{font-size:18px}

.search{
  flex:1; max-width:520px; display:flex; gap:8px;
  background:#0e1526; border:1px solid #1c2942; border-radius:12px; padding:8px 10px
}
.search input{all:unset; flex:1; color:var(--text)}

.btn{
  background:#15213a; border:1px solid #24324f; color:#e5ecf7;
  padding:10px 14px; border-radius:12px; cursor:pointer; transition:.2s; min-height:44px
}
.btn:hover{transform:translateY(-1px); border-color:#33507a}
.cart{position:relative}
.badge{
  position:absolute; top:-6px; right:-6px; background:var(--acc2); color:#04101f;
  font-weight:700; border-radius:999px; padding:2px 7px; font-size:12px; min-width:22px; text-align:center
}

/* Categories hero */
.hero{margin:18px 0}
.hero-grid{display:grid; grid-template-columns:repeat(6,1fr); gap:12px}
@media (max-width:1000px){.hero-grid{grid-template-columns:repeat(3,1fr)}}
@media (max-width:640px){.hero-grid{grid-template-columns:repeat(2,1fr)}}
@media (max-width:400px){.hero-grid{grid-template-columns:1fr}}

.cat{
  background:linear-gradient(180deg,#101a2f,#0c1426);
  border:1px solid #1b2945; border-radius:16px; padding:14px;
  display:flex; align-items:center; gap:10px; cursor:pointer; transition:.2s
}
.cat:hover{border-color:#294775; box-shadow:0 6px 24px rgba(96,165,250,.08)}
.cat .icon{
  width:34px; height:34px; border-radius:10px; display:grid; place-items:center;
  background:#0a1222; border:1px solid #1a2644
}
.cat span{font-weight:700}

/* Sections / Carousel */
.section{margin:26px 0}
.section h2{margin:0 0 12px 6px; font-size:20px; letter-spacing:.3px}
.carousel{position:relative}
.track{
  display:flex; gap:12px; overflow:auto; scroll-behavior:smooth; padding-bottom:8px;
  -webkit-overflow-scrolling:touch;
  scroll-snap-type:x proximity;
}
.track > *{scroll-snap-align:start}
.track::-webkit-scrollbar{height:8px}
.track::-webkit-scrollbar-thumb{background:#1d2a44; border-radius:999px}
.navbtn{
  position:absolute; top:50%; transform:translateY(-50%);
  background:#0f1b32; border:1px solid #243557; border-radius:12px;
  width:44px; height:44px; display:grid; place-items:center; cursor:pointer
}
.navbtn.left{left:-8px}
.navbtn.right{right:-8px}

/* Product card */
.card{
  background:linear-gradient(180deg,#0f172a,#0b1324);
  border:1px solid #1d2946; border-radius:16px;
  min-width:220px; max-width:220px; flex:0 0 auto; display:flex; flex-direction:column
}
.imgwrap{
  aspect-ratio:16/10; border-bottom:1px solid #1a2742; background:#0a1222;
  border-top-left-radius:16px; border-top-right-radius:16px; display:grid; place-items:center;
  position:relative
}
/* Aspect-ratio fallback for very old browsers */
@supports not (aspect-ratio: 16 / 10){
  .imgwrap{height:0; padding-top:62.5%}
  .imgwrap > *{position:absolute; inset:0}
}

.card .body{padding:12px 12px 14px; display:flex; flex-direction:column; gap:8px}
.title{font-weight:700; line-height:1.2}
.meta{font-size:12px; color:var(--muted)}
.price{font-weight:800; font-size:18px}
.buy{
  margin-top:4px; background:linear-gradient(90deg,var(--acc2),var(--acc));
  color:#06111a; border:none
}

/* Footer */
footer{border-top:1px solid #1a2540; color:#9aa8be; margin-top:30px}
.foot{display:flex; gap:20px; flex-wrap:wrap; justify-content:space-between; padding:18px 0; font-size:14px}

/* -------------------------
   Accessibility & polish
   ------------------------- */
:focus-visible{outline:2px solid var(--acc2); outline-offset:2px}
.btn:focus-visible, .cat:focus-visible, .navbtn:focus-visible{outline:2px solid var(--acc)}
.btn:active{transform:translateY(0); filter:brightness(1.05)}
.buy:hover{filter:saturate(1.05) brightness(1.05)}
.cat:active{transform:scale(0.99)}
@media (prefers-reduced-motion: reduce){
  *{scroll-behavior:auto !important; transition:none !important}
}
@media (max-width:360px){
  .container{padding:12px}
  .cat span{font-size:14px}
}

/* =========================
   Cart Drawer & Overlay
   ========================= */
.overlay{
  position:fixed; inset:0; background:rgba(3,10,22,.55);
  backdrop-filter:saturate(1.1) blur(2px);
  z-index:80; opacity:0; pointer-events:none; transition:opacity .25s ease;
}
.overlay.open{ opacity:1; pointer-events:auto; }
.hidden{ display:none !important; }

.cart-drawer{
  position:fixed; top:0; right:0; height:100vh; width:380px; max-width:92vw;
  background:#0b1324; border-left:1px solid #1d2946; z-index:90;
  display:flex; flex-direction:column; transform:translateX(100%);
  transition:transform .28s cubic-bezier(.22,.61,.36,1);
  box-shadow:-24px 0 48px rgba(0,0,0,.35);
}
.cart-drawer.open{ transform:translateX(0); }
.cart-header{
  display:flex; align-items:center; justify-content:space-between;
  padding:16px; border-bottom:1px solid #1a2742;
}
.cart-header h3{ margin:0; font-size:18px }
.icon-btn{
  background:#12203a; border:1px solid #243557; color:#dbeafe;
  width:36px; height:36px; border-radius:10px; cursor:pointer;
}
.icon-btn:hover{ filter:brightness(1.06); }

.cart-items{
  flex:1; overflow:auto; padding:8px 12px;
}
.cart-item{
  display:flex; gap:12px; align-items:flex-start;
  border-bottom:1px solid #13203a; padding:12px 4px;
}
.cart-thumb{
  width:64px; height:64px; border-radius:10px; overflow:hidden; background:#0a1222; border:1px solid #1a2644;
  display:grid; place-items:center;
}
.cart-thumb img{ width:100%; height:100%; object-fit:cover; }
.cart-info{ flex:1; min-width:0; }
.cart-title{ font-weight:700; line-height:1.2; }
.cart-meta{ color:#94a3b8; font-size:12px; margin-top:2px; }
.cart-row{
  display:flex; align-items:center; justify-content:space-between; gap:8px; margin-top:6px;
}
.cart-remove{
  background:#1a243c; border:1px solid #2b3f68; color:#cbd5e1; padding:6px 10px; border-radius:8px; cursor:pointer;
}
.cart-remove:hover{ border-color:#45659e }

.cart-footer{
  border-top:1px solid #1a2742; padding:14px; display:flex; flex-direction:column; gap:12px;
  background:linear-gradient(180deg,#0b1324,#0b1220);
  position:sticky; bottom:0; /* stays visible while scrolling the drawer */
}
.cart-total{ display:flex; align-items:center; justify-content:space-between; }
.checkout-btn{
  width:100%; background:linear-gradient(90deg,var(--acc2),var(--acc)); color:#06111a; border:none;
  font-weight:800;
}

/* =========================
   Mobile Optimizations
   ========================= */

/* Tablets and down */
@media (max-width: 900px){
  .container{padding:14px}
  .search{max-width:none}
}

/* Phones */
@media (max-width: 640px){
  /* Header stacks neatly */
  .nav{flex-wrap:wrap; row-gap:10px}
  .brand{order:1; width:100%}
  .search{order:3; width:100%}
  .nav > .cart{order:2; margin-left:auto}

  /* Reduce section spacing and title size */
  .section{margin:20px 0}
  .section h2{font-size:18px; margin:0 0 10px 4px}

  /* Make product cards a bit narrower for smaller screens */
  .card{min-width:190px; max-width:190px}
  .price{font-size:16px}

  /* Hide arrow buttons; rely on swipe */
  .navbtn{display:none}

  /* Footer compact */
  .foot{gap:12px; font-size:13px}
}

/* Small phones */
@media (max-width: 480px){
  .container{padding:12px}
  .brand-name{font-size:16px}
  .welcome{font-size:12px}

  .search{padding:8px}
  .btn{padding:10px 12px}

  .card{min-width:170px; max-width:170px}
  .cat{padding:12px}
  .cat .icon{width:30px; height:30px}

  /* Cart drawer behaves like a full-width sheet on phones */
  .cart-drawer{
    width:100vw; max-width:100vw; border-left:none; box-shadow:0 -12px 48px rgba(0,0,0,.45);
  }
  .cart-header{padding:14px}
  .cart-items{padding:8px}
  .cart-footer{padding:12px}
}

/* Ultra-small (older/smaller handsets) */
@media (max-width: 360px){
  .card{min-width:155px; max-width:155px}
  .title{font-size:14px}
  .meta{font-size:11px}
}

/* --- Clickability fixes (z-index / stacking contexts) --- */
.carousel{ position:relative; }
.track{ position:relative; z-index:1; }          /* content layer */
.navbtn{ position:absolute; z-index:3; }         /* arrows above track */
.navbtn{ pointer-events:auto; }                  /* ensure clickable */

.card{ position:relative; }
.imgwrap{ position:relative; z-index:0; }        /* image under body */
.card .body{ position:relative; z-index:1; }     /* text/buttons over image */
.card .buy{ position:relative; z-index:2; pointer-events:auto; }

header .cart{ position:relative; z-index:10; }   /* cart button above anything nearby */

/* keep overlay from blocking page unless open */
.overlay{ pointer-events:none; }
.overlay.open{ pointer-events:auto; }

