/* ===== Storefront — extends styles.css tokens ===== */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
body.shop-page { background: var(--page, #f5f5f5); }
body.shop-page.no-scroll { overflow: hidden; }

/* header cart button */
.cart-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: transparent; border: 1px solid var(--border); color: var(--text);
  padding: 8px 14px; border-radius: 999px; cursor: pointer; font-weight: 500; font-size: 0.9rem;
  transition: border-color var(--transition), color var(--transition);
}
.cart-btn:hover { border-color: var(--green); color: var(--green-bright); }
.cart-btn svg { width: 18px; height: 18px; }
.cart-count {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--green); color: var(--black); font-size: 0.75rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.cart-count.bump { animation: bump 0.35s ease; }
@keyframes bump { 50% { transform: scale(1.35); } }
.nav-links .active-link { color: var(--green-bright); }

.demo-banner { background: #fef3c7; color: #78350f; font-size: 0.85rem; padding: 78px 0 10px; border-bottom: 1px solid #fde68a; }
.demo-banner + .shop-hero { padding-top: 40px; }

/* hero */
.shop-hero { background: var(--black); color: var(--white); padding: 130px 0 48px; }
.shop-hero-grid { display: grid; grid-template-columns: 1.25fr 1fr; gap: 48px; align-items: center; }
.perks { display: flex; flex-direction: column; gap: 12px; }
.perks li { display: flex; gap: 14px; align-items: center; background: rgba(255,255,255,0.05); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px 18px; }
.perks strong { display: block; font-family: var(--font-display); font-size: 0.98rem; }
.perks li span:not(.perk-ico) { font-size: 0.82rem; color: var(--text-muted); }
.perk-ico { width: 42px; height: 42px; flex-shrink: 0; border-radius: 12px; background: var(--accent-glow); color: var(--green-bright); display: grid; place-items: center; }
.perk-ico svg { width: 22px; height: 22px; }
@media (max-width: 900px) { .shop-hero-grid { grid-template-columns: 1fr; gap: 28px; } }
.shop-hero h1 { font-family: var(--font-display); font-size: clamp(1.8rem, 4vw, 2.7rem); margin: 10px 0 12px; max-width: 18ch; text-wrap: balance; }
.shop-hero p { color: var(--text-muted); max-width: 56ch; margin-bottom: 26px; }
.shop-search {
  display: flex; align-items: center; gap: 10px; max-width: 520px;
  background: rgba(255, 255, 255, 0.07); border: 1px solid var(--border); border-radius: 999px; padding: 0 18px;
  transition: border-color var(--transition);
}
.shop-search:focus-within { border-color: var(--green); }
.shop-search svg { width: 18px; height: 18px; color: var(--text-muted); flex-shrink: 0; }
.shop-search input { flex: 1; min-width: 0; background: transparent; border: none; outline: none; color: var(--white); padding: 14px 0; }
.shop-search input::placeholder { color: var(--text-dim); }

/* toolbar */
.shop-section { padding: 32px 0 90px; }
.shop-toolbar { display: flex; flex-wrap: wrap; gap: 14px; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.cat-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.cat-tab {
  border: 1.5px solid var(--border-light); background: var(--surface, #fff); color: var(--text-muted-light);
  border-radius: 999px; padding: 8px 16px; font-size: 0.88rem; font-weight: 500; cursor: pointer;
  transition: var(--transition);
}
.cat-tab:hover { border-color: var(--green); }
.cat-tab.active { background: var(--ink, #0a0a0a); color: var(--on-ink, #fff); border-color: var(--ink, #0a0a0a); }
.cat-tab small { opacity: 0.6; margin-left: 4px; }
.shop-controls { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 0.88rem; color: var(--text-muted-light); cursor: pointer; }
.check input { accent-color: var(--green-dark); width: 16px; height: 16px; }
.sort select {
  border: 1.5px solid var(--border-light); background: var(--surface, #fff); border-radius: var(--radius);
  padding: 9px 12px; font-size: 0.88rem; cursor: pointer;
}
.result-count { color: var(--text-dim); font-size: 0.82rem; margin: 6px 0 18px; min-height: 1.2em; }

/* product grid */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 20px; }
.product-grid .loading, .product-grid .empty { grid-column: 1 / -1; color: var(--text-muted-light); text-align: center; padding: 60px 0; }
.p-card {
  position: relative; display: flex; flex-direction: column; background: var(--surface, #fff);
  border: 1px solid var(--border-light); border-radius: var(--radius-lg); overflow: hidden;
  box-shadow: var(--shadow);
  animation: pIn 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both; animation-delay: calc(var(--i, 0) * 35ms);
}
@keyframes pIn { from { opacity: 0; translate: 0 22px; } to { opacity: 1; translate: 0 0; } }
.p-media { position: relative; display: block; width: 100%; aspect-ratio: 4 / 3; background: #111; border: none; padding: 0; cursor: pointer; overflow: hidden; }
.p-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s ease; }
.p-card:hover .p-media img { transform: scale(1.05); }
.p-badge { position: absolute; top: 10px; left: 10px; background: #fff; color: var(--black); font-size: 0.72rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; }
.p-badge.out { background: #fee2e2; color: #991b1b; }
.p-badge.low { background: #fef3c7; color: #92400e; }
.p-badge.sale { background: var(--green); color: var(--black); left: auto; right: 10px; }
.p-body { display: flex; flex-direction: column; gap: 6px; padding: 16px 16px 18px; flex: 1; }
.p-brand { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--green-dark); }
.p-name { font-family: var(--font-display); font-size: 1rem; line-height: 1.3; font-weight: 600; text-align: left; background: none; border: none; padding: 0; cursor: pointer; color: var(--text-on-light); }
.p-name:hover { color: var(--green-dark); }
.p-price { margin-top: auto; padding-top: 8px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.p-price strong { font-family: var(--font-display); font-size: 1.15rem; }
.p-price s { color: var(--text-dim); font-size: 0.85rem; }
.p-add { margin-top: 10px; width: 100%; }
.p-add[disabled] { background: #e5e5e5; color: #737373; cursor: not-allowed; box-shadow: none; }

/* cart button on card must stay in the card's 3D layer */
[data-tilt].p-card .p-body { transform: translateZ(18px); }

/* drawer */
.drawer-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(2px); z-index: 400; }
.cart-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(430px, 100vw); background: var(--surface, #fff); color: var(--text-on-light);
  z-index: 410; display: flex; flex-direction: column; transform: translateX(105%); visibility: hidden; box-shadow: none;
  transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1), visibility 0s linear 0.35s;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.cart-drawer.open { transform: none; visibility: visible; box-shadow: -20px 0 60px rgba(0, 0, 0, 0.3); transition-delay: 0s; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px; border-bottom: 1px solid var(--border-light); }
.drawer-head h2 { font-family: var(--font-display); font-size: 1.2rem; }
.icon-btn { background: none; border: none; font-size: 1.8rem; line-height: 1; cursor: pointer; color: var(--text-muted-light); padding: 4px 8px; border-radius: 8px; }
.icon-btn:hover { background: var(--surface-2, #f5f5f5); color: var(--text-on-light); }
.drawer-body { flex: 1; overflow-y: auto; padding: 8px 22px; }
.drawer-foot { border-top: 1px solid var(--border-light); padding: 18px 22px 22px; display: flex; flex-direction: column; gap: 10px; }
.cart-empty { text-align: center; color: var(--text-muted-light); padding: 60px 10px; }
.cart-empty p { margin-bottom: 18px; }
.cart-line { display: grid; grid-template-columns: 64px 1fr auto; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--border-light); align-items: start; }
.cart-line img { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; background: #111; }
.cart-line h4 { font-size: 0.92rem; line-height: 1.3; font-weight: 600; margin-bottom: 4px; }
.cart-line .unit { font-size: 0.8rem; color: var(--text-dim); }
.cart-line .line-total { font-family: var(--font-display); font-weight: 600; font-size: 0.95rem; }
.cart-line .remove { background: none; border: none; color: var(--text-dim); font-size: 0.78rem; cursor: pointer; text-decoration: underline; padding: 6px 0 0; display: block; margin-left: auto; }
.cart-line .remove:hover { color: #b91c1c; }
.qty { display: inline-flex; align-items: center; border: 1.5px solid var(--border-light); border-radius: 999px; margin-top: 8px; }
.qty button { width: 30px; height: 30px; background: none; border: none; font-size: 1.05rem; cursor: pointer; border-radius: 50%; }
.qty button:hover:not([disabled]) { background: var(--accent-glow); color: var(--green-dark); }
.qty button[disabled] { opacity: 0.35; cursor: not-allowed; }
.qty span { min-width: 28px; text-align: center; font-weight: 600; font-size: 0.9rem; }
.sum-row { display: flex; justify-content: space-between; font-size: 0.92rem; color: var(--text-muted-light); }
.sum-row.total { font-family: var(--font-display); font-size: 1.15rem; font-weight: 700; color: var(--text-on-light); padding-top: 8px; border-top: 1px dashed var(--border-light); }
.free-note { font-size: 0.8rem; color: var(--green-dark); }

/* dialogs */
.shop-dialog {
  border: none; border-radius: var(--radius-lg); padding: 0; background: var(--surface, #fff); color: var(--text-on-light);
  max-width: min(980px, calc(100vw - 24px)); width: 100%; max-height: calc(100dvh - 24px); overflow: auto; margin: auto;
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.45);
}
.shop-dialog::backdrop { background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(3px); }
.shop-dialog[open] { animation: dlgIn 0.3s cubic-bezier(0.2, 0.7, 0.2, 1); }
@keyframes dlgIn { from { opacity: 0; translate: 0 24px; scale: 0.98; } }
.dlg-close { position: absolute; top: 12px; right: 14px; z-index: 5; background: var(--surface, #fff); border-radius: 50%; width: 38px; height: 38px; display: grid; place-items: center; box-shadow: var(--shadow); }
.pd-wrap { position: relative; }
.pd-grid { display: grid; grid-template-columns: 1.05fr 1fr; gap: 0; }
.pd-gallery { background: #0a0a0a; padding: 22px; display: flex; flex-direction: column; gap: 12px; }
.pd-main { aspect-ratio: 4 / 3; border-radius: 14px; overflow: hidden; background: #111; }
.pd-main img { width: 100%; height: 100%; object-fit: contain; }
.pd-thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.pd-thumbs button { width: 62px; height: 62px; border-radius: 10px; overflow: hidden; border: 2px solid transparent; padding: 0; cursor: pointer; background: #111; }
.pd-thumbs button.active { border-color: var(--green); }
.pd-thumbs img { width: 100%; height: 100%; object-fit: cover; }
.pd-info { padding: 32px 30px 30px; display: flex; flex-direction: column; gap: 12px; }
.pd-info h2 { font-family: var(--font-display); font-size: 1.5rem; line-height: 1.25; padding-right: 36px; }
.pd-meta { font-size: 0.82rem; color: var(--text-dim); }
.pd-price { display: flex; align-items: baseline; gap: 10px; }
.pd-price strong { font-family: var(--font-display); font-size: 1.7rem; }
.pd-price s { color: var(--text-dim); }
.stock-line { font-size: 0.85rem; font-weight: 600; }
.stock-line.in { color: var(--green-dark); }
.stock-line.low { color: #b45309; }
.stock-line.out { color: #b91c1c; }
.pd-desc { color: var(--text-muted-light); font-size: 0.95rem; }
.spec-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.spec-table td { padding: 7px 0; border-bottom: 1px solid var(--border-light); vertical-align: top; }
.spec-table td:first-child { color: var(--text-dim); width: 38%; padding-right: 12px; }
.pd-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.pd-actions .qty { margin-top: 0; }
.pd-note { font-size: 0.8rem; color: var(--text-dim); }
.pd-link { font-size: 0.85rem; color: var(--green-dark); text-decoration: underline; }

/* checkout */
.checkout-dialog { max-width: min(1040px, calc(100vw - 24px)); }
.co-head { display: flex; justify-content: space-between; align-items: center; padding: 22px 28px; border-bottom: 1px solid var(--border-light); }
.co-head h2 { font-family: var(--font-display); font-size: 1.4rem; }
.co-grid { display: grid; grid-template-columns: 1.3fr 1fr; }
.co-form { padding: 24px 28px 30px; display: flex; flex-direction: column; gap: 14px; }
.co-summary { background: var(--surface-2, #f5f5f5); padding: 24px 28px 30px; border-left: 1px solid var(--border-light); display: flex; flex-direction: column; gap: 10px; }
.co-summary h3, .co-form h3 { font-family: var(--font-display); font-size: 1rem; }
.co-form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.co-form label.f { display: flex; flex-direction: column; gap: 5px; font-size: 0.82rem; font-weight: 600; color: var(--text-muted-light); }
.co-form input, .co-form select, .co-form textarea {
  border: 1.5px solid var(--border-light); border-radius: var(--radius); padding: 11px 12px; font-size: 0.95rem; background: var(--surface, #fff); font-weight: 400; color: var(--text-on-light);
}
.co-form input:focus, .co-form select:focus, .co-form textarea:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px var(--accent-glow); }
.co-form .invalid { border-color: #dc2626; }
.field-err { color: #b91c1c; font-size: 0.78rem; font-weight: 500; min-height: 0; }
.pay-opt { display: flex; gap: 12px; align-items: flex-start; border: 1.5px solid var(--border-light); border-radius: var(--radius); padding: 12px 14px; cursor: pointer; transition: var(--transition); }
.pay-opt:has(input:checked) { border-color: var(--green); background: rgba(34, 197, 94, 0.06); }
.pay-opt input { margin-top: 4px; accent-color: var(--green-dark); }
.pay-opt strong { display: block; font-size: 0.92rem; }
.pay-opt span { font-size: 0.8rem; color: var(--text-dim); }
.co-lines { display: flex; flex-direction: column; gap: 10px; max-height: 240px; overflow: auto; }
.co-line { display: flex; justify-content: space-between; gap: 12px; font-size: 0.88rem; }
.co-line span:first-child { color: var(--text-muted-light); }
.co-error { background: #fee2e2; color: #991b1b; border-radius: var(--radius); padding: 12px 14px; font-size: 0.88rem; }
.co-error ul { margin: 6px 0 0 18px; list-style: disc; }

/* confirmation */
.done { padding: 40px 32px 34px; max-width: 620px; margin: 0 auto; text-align: center; display: flex; flex-direction: column; gap: 14px; align-items: center; }
.done .tick { width: 64px; height: 64px; border-radius: 50%; background: var(--accent-glow); color: var(--green-dark); display: grid; place-items: center; }
.done .tick svg { width: 32px; height: 32px; }
.done h2 { font-family: var(--font-display); font-size: 1.6rem; }
.done .order-no { font-family: var(--font-display); font-size: 1.3rem; font-weight: 700; background: var(--surface-2, #f5f5f5); border: 1px dashed var(--accent-border); padding: 8px 18px; border-radius: 10px; }
.done .box { text-align: left; width: 100%; background: var(--surface-2, #f5f5f5); border-radius: var(--radius); padding: 16px 18px; font-size: 0.9rem; display: flex; flex-direction: column; gap: 6px; }
.done .box dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; }
.done .box dt { color: var(--text-dim); }
.done .actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }

@media (max-width: 860px) {
  .pd-grid, .co-grid { grid-template-columns: 1fr; }
  .co-summary { border-left: none; border-top: 1px solid var(--border-light); }
  .pd-info { padding: 22px 20px 24px; }
  .co-form, .co-summary, .co-head { padding-left: 18px; padding-right: 18px; }
  .shop-dialog { max-width: 100vw; max-height: 100dvh; border-radius: 0; }
}
@media (max-width: 520px) {
  .product-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .p-body { padding: 12px 12px 14px; }
  .p-name { font-size: 0.9rem; }
  .co-form .row { grid-template-columns: 1fr; }
  .shop-hero { padding-top: 110px; }
  .demo-banner { padding-top: 70px; }
}
@media (prefers-reduced-motion: reduce) {
  .p-card, .shop-dialog[open], .cart-count.bump { animation: none; }
  .cart-drawer { transition: none; }
}

/* account + sign-in */
.acct-btn.signed { border-color: var(--green); color: var(--green-bright); }
.acct-btn .acct-label { max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auth-dialog { max-width: min(440px, calc(100vw - 24px)); }
.auth-wrap { padding: 26px 28px 28px; display: flex; flex-direction: column; gap: 14px; position: relative; }
.auth-wrap h2 { font-family: var(--font-display); font-size: 1.4rem; padding-right: 36px; }
.auth-wrap .auth-sub { color: var(--text-muted-light); font-size: 0.92rem; margin-top: -6px; }
.auth-wrap .icon-btn { position: absolute; top: 14px; right: 14px; }
.auth-google { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 11px 14px; border-radius: var(--radius); border: 1.5px solid var(--border-light); background: var(--surface, #fff); color: var(--text-on-light); font-weight: 600; font-size: 0.95rem; cursor: pointer; transition: var(--transition); }
.auth-google:hover { border-color: var(--green); }
.auth-google svg { width: 20px; height: 20px; }
.auth-or { display: flex; align-items: center; gap: 12px; color: var(--text-dim); font-size: 0.8rem; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--border-light); }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form label.f { display: flex; flex-direction: column; gap: 5px; font-size: 0.82rem; font-weight: 600; color: var(--text-muted-light); }
.auth-form input { border: 1.5px solid var(--border-light); border-radius: var(--radius); padding: 11px 12px; font-size: 0.95rem; background: var(--surface, #fff); color: var(--text-on-light); font-weight: 400; }
.auth-form input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px var(--accent-glow); }
.auth-msg { font-size: 0.86rem; border-radius: var(--radius); padding: 10px 12px; }
.auth-msg.err { background: #fee2e2; color: #991b1b; }
.auth-msg.ok { background: rgba(34, 197, 94, 0.12); color: var(--green-dark); }
.auth-links { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 0.86rem; }
.auth-link { background: none; border: none; padding: 0; color: var(--green-dark); font-weight: 600; cursor: pointer; font-size: inherit; text-decoration: underline; text-underline-offset: 3px; }
.auth-note { font-size: 0.78rem; color: var(--text-dim); line-height: 1.5; }
.auth-verify .mail { width: 56px; height: 56px; border-radius: 50%; background: var(--accent-glow); color: var(--green-dark); display: grid; place-items: center; }
.auth-verify .mail svg { width: 26px; height: 26px; }
.auth-acct dl { display: grid; grid-template-columns: 90px 1fr; gap: 6px 10px; font-size: 0.9rem; }
.auth-acct dt { color: var(--text-dim); }
.badge-ok { display: inline-block; font-size: 0.72rem; font-weight: 700; color: var(--green-dark); background: var(--accent-glow); border-radius: 999px; padding: 2px 9px; }
.my-orders { display: flex; flex-direction: column; gap: 8px; max-height: 260px; overflow: auto; }
.my-order { display: flex; justify-content: space-between; gap: 10px; border: 1px solid var(--border-light); border-radius: var(--radius); padding: 10px 12px; font-size: 0.86rem; }
.my-order small { display: block; color: var(--text-dim); }
.guest-note { font-size: 0.78rem; color: var(--text-dim); text-align: center; }
.co-user { font-size: 0.82rem; color: var(--text-dim); margin-top: -6px; }
.co-form input[readonly] { opacity: 0.75; cursor: not-allowed; }
@media (max-width: 860px) { .acct-li { order: 5; } }
