:root {
  --brown: #4A3221;
  --gold: #A67C3D;
  --cream: #F3ECDD;
  --dark: #2B2117;
  --error: #c0392b;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html.modal-open, body.modal-open { overflow: hidden; height: 100%; }
body { font-family: 'Segoe UI', Arial, sans-serif; color: var(--dark); background: #FBF7EF; overflow-x: hidden; }
.container { max-width: 1100px; margin: 0 auto; padding: 0 24px; }
a { text-decoration: none; color: inherit; }

/* ---------- Header ---------- */
.site-header { background: #fff; border-bottom: 1px solid #eee; }
.header-inner { display: flex; justify-content: space-between; align-items: center; padding: 8px 16px; gap: 12px; width: 100%; position: relative; }
.logo-img { height: 78px; width: auto; flex-shrink: 0; }
.header-center {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  text-align: center; font-size: 20px; letter-spacing: 1.2px; color: var(--brown);
  font-weight: bold; text-transform: uppercase; white-space: nowrap;
}
.header-actions { display: flex; align-items: center; gap: 34px; flex-shrink: 0; margin-left: auto; }
.btn-link { background: none; border: none; color: var(--brown); font-weight: bold; cursor: pointer; font-size: 14px; }
.cart-toggle { cursor: pointer; font-weight: bold; color: var(--brown); display: flex; align-items: center; gap: 4px; position: relative; }
#cartCount { background: var(--brown); color: white; border-radius: 50%; padding: 1px 7px; font-size: 11px; }

/* ---------- Hero ---------- */
.hero { position: relative; background: linear-gradient(135deg, #FBF7EF, #F3ECDD, #EFE3C8); padding: 70px 0; text-align: center; overflow: hidden; }
.hero h1 { font-size: 40px; color: var(--brown); margin-bottom: 14px; position: relative; z-index: 2; }
.hero em { color: var(--gold); font-style: italic; }
.hero p { color: #5c4a36; margin-bottom: 20px; font-size: 15px; position: relative; z-index: 2; }
.hero-inner { position: relative; z-index: 2; }
.btn-primary {
  display: inline-block; background: var(--brown); color: white; padding: 12px 28px;
  border-radius: 6px; border: none; cursor: pointer; font-size: 15px; font-weight: bold;
}
.btn-primary.full-width { width: 100%; margin-top: 12px; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary { background: #cbb185 !important; color: #5c4a36 !important; margin-top: 10px; }

/* ---------- Products ---------- */
.products { padding: 60px 24px; }
.products h2 { text-align: center; color: var(--brown); font-size: 28px; margin-bottom: 30px; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 24px; }
.product-card { background: white; border: 1px solid #eee; border-radius: 10px; padding: 20px; text-align: center; display: flex; flex-direction: column; height: auto; align-self: stretch; }
.product-card-body { display: flex; flex-direction: column; flex: 1; }
.product-card .cart-controls { margin-top: auto; padding-top: 10px; }

.carousel-wrap { display: flex; align-items: center; gap: 6px; margin-bottom: 14px; }
.carousel { position: relative; flex: 1; overflow: hidden; border-radius: 8px; aspect-ratio: 3 / 4; background: #fff; touch-action: pan-y; }
.carousel-track { display: flex; height: 100%; transition: transform 0.35s ease; }
.carousel-track img { width: 100%; height: 100%; flex-shrink: 0; object-fit: contain; }
.carousel-arrow {
  flex-shrink: 0; background: #fff; border: 1px solid #e2d4b4; border-radius: 50%;
  width: 28px; height: 28px; cursor: pointer; font-size: 12px; color: var(--brown);
  display: flex; align-items: center; justify-content: center;
}
.carousel-dots { position: absolute; bottom: 8px; left: 0; right: 0; display: flex; justify-content: center; gap: 6px; }
.carousel-dots .dot { width: 7px; height: 7px; border-radius: 50%; background: rgba(74,50,33,0.3); }
.carousel-dots .dot.active { background: var(--brown); }

.product-card h3 { color: var(--brown); margin-bottom: 4px; }
.product-card .grade { font-size: 12px; color: #9c8a6c; margin-bottom: 8px; }
.price-row { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 2px; }
.mrp-strike { text-decoration: line-through; color: #9c8a6c; font-size: 13px; }
.discount-pct { color: #2e7d32; font-weight: bold; font-size: 12.5px; }
.product-card .price { font-size: 18px; font-weight: bold; color: var(--gold); margin-bottom: 12px; }

.cart-controls { min-height: 44px; }
.initial-actions { display: flex; gap: 8px; }
.btn-add, .btn-buy, .btn-goto-cart {
  flex: 1; border: none; padding: 10px 12px; border-radius: 6px; cursor: pointer; font-weight: bold; font-size: 13.5px;
}
.btn-add { background: var(--gold); color: white; }
.btn-buy { background: var(--brown); color: white; }
.btn-goto-cart { background: var(--brown); color: white; width: 100%; margin-top: 8px; }
.qty-actions { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.qty-control { display: flex; align-items: center; justify-content: center; gap: 14px; }
.qty-btn { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--gold); background: white; cursor: pointer; font-size: 16px; }
.qty-value { font-weight: bold; min-width: 20px; }
.btn-add:disabled, .btn-buy:disabled { opacity: 0.5; cursor: not-allowed; }
.out-of-stock-label { display: block; width: 100%; text-align: center; color: #b33; font-weight: bold; font-size: 12.5px; margin-top: 6px; }
.low-stock-label { display: block; width: 100%; text-align: center; color: #c0392b; font-weight: bold; font-size: 12.5px; margin-bottom: 8px; }
.stock-limit-msg { display: block; text-align: center; color: #c0392b; font-weight: bold; font-size: 11px; margin-top: 4px; }
.qty-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.loading-products { text-align: center; color: #9c8a6c; grid-column: 1 / -1; padding: 40px 0; }

/* ---------- Full-screen image lightbox ---------- */
.lightbox {
  display: none; position: fixed; inset: 0; background: rgba(20,14,8,0.94); z-index: 400;
  align-items: center; justify-content: center;
}
.lightbox.show { display: flex; }
.lightbox-image-wrap { max-width: 78vw; max-height: 78vh; display: flex; align-items: center; justify-content: center; }
.lightbox-image-wrap img { max-width: 78vw; max-height: 78vh; object-fit: contain; border-radius: 6px; background: white; }
.lightbox-close {
  position: absolute; top: 18px; right: 20px; background: rgba(20,14,8,0.85); color: white;
  border: 2px solid rgba(255,255,255,0.4); width: 40px; height: 40px; border-radius: 50%; font-size: 22px; cursor: pointer; z-index: 2;
}
.lightbox-arrow {
  position: absolute; top: 50%; transform: translateY(-50%); background: rgba(20,14,8,0.85);
  color: white; border: 2px solid rgba(255,255,255,0.4); width: 44px; height: 44px; border-radius: 50%; font-size: 18px; cursor: pointer; z-index: 2;
}
.lightbox-arrow.left { left: 8px; }
.lightbox-arrow.right { right: 8px; }
.lightbox-dots { position: absolute; bottom: 24px; left: 0; right: 0; display: flex; justify-content: center; gap: 8px; }
.lightbox-dots .lb-dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,0.35); cursor: pointer; }
.lightbox-dots .lb-dot.active { background: white; }

@media (max-width: 480px) {
  .lightbox-arrow { width: 36px; height: 36px; font-size: 14px; }
  .lightbox-close { width: 34px; height: 34px; font-size: 18px; }
}

.product-grid-dots { display: none; }
@media (max-width: 680px) {
  .product-grid-dots {
    display: flex; justify-content: center; gap: 7px; margin-top: 4px;
  }
  .product-grid-dots .pg-dot {
    width: 7px; height: 7px; border-radius: 50%; background: rgba(74,50,33,0.25);
    transition: background 0.2s, width 0.2s; cursor: pointer;
  }
  .product-grid-dots .pg-dot.active { background: var(--brown); width: 18px; border-radius: 4px; }
}

/* ---------- Footer ---------- */
.site-footer { background: #3B2A1C; color: #F0E4CC; padding: 40px 24px 16px; margin-top: 40px; }
.footer-scale-wrapper { width: 100%; overflow: hidden; display: flex; justify-content: center; }
.footer-inner { display: flex; justify-content: space-between; gap: 28px; width: 1100px; flex-shrink: 0; transform-origin: top center; }
.footer-col { flex: 1; }
.footer-left { text-align: left; }
.footer-center { text-align: center; }
.footer-right { text-align: right; }
.footer-logo { height: 84px; margin-bottom: 10px; }
.site-footer h4 { color: #E7C989; margin-bottom: 10px; font-size: 15px; }
.packed-by-label { color: #E7C989; font-size: 13px; margin-bottom: 10px; opacity: 0.85; }
.site-footer h4.nowrap { white-space: nowrap; }
.site-footer p { font-size: 13px; line-height: 1.7; }
.contact-line { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.contact-line .ic { width: 18px; height: 18px; flex-shrink: 0; }
.reg-line { font-size: 12px; opacity: 0.9; margin-bottom: 8px; }
.reg-line.bold { font-weight: bold; }

.logo-chip {
  background: #F0E4CC; border-radius: 6px; padding: 4px; display: flex;
  align-items: center; justify-content: center; flex-shrink: 0; width: 52px; height: 52px;
}

.gov-badges { display: flex; justify-content: center; gap: 16px; margin-top: 10px; }
.gov-badges.right-align { justify-content: flex-end; }
.gov-logo { height: 100%; width: 100%; object-fit: contain; }
.copyright { text-align: center; margin-top: 24px; font-size: 12px; opacity: 0.7; }
.policy-links { text-align: center; margin-top: 16px; font-size: 12px; }
.policy-links a { color: #E7C989; text-decoration: underline; }

/* ---------- Cart Drawer ---------- */
.cart-drawer {
  position: fixed; top: 0; right: -400px; width: 380px; max-width: 100%; height: 100%; background: white;
  box-shadow: -4px 0 16px rgba(0,0,0,0.15); z-index: 200; transition: right 0.3s ease;
  display: flex; flex-direction: column; padding: 20px;
}
.cart-drawer.open { right: 0; }
.cart-drawer-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.cart-drawer-header button { background: none; border: none; font-size: 24px; cursor: pointer; }

.cart-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: #9c8a6c; }
.cart-empty p { font-size: 15px; font-weight: bold; }

.cart-items { flex: 1; overflow-y: auto; }
.cart-item {
  display: grid; grid-template-columns: 56px 1fr auto; gap: 10px; align-items: center;
  padding: 12px 0; border-bottom: 1px solid #eee; font-size: 13.5px;
}
.cart-item img { width: 56px; height: 56px; object-fit: contain; border-radius: 6px; border: 1px solid #eee; }
.cart-item-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cart-item-info .name { font-weight: bold; color: var(--brown); overflow-wrap: break-word; }
.cart-item-info .free-delivery { font-size: 11px; color: #2e7d32; font-weight: bold; }
.cart-item-info .line-price { font-size: 13.5px; font-weight: bold; color: #2B2117; margin-top: 1px; }
.cart-price-block { display: flex; flex-direction: column; gap: 1px; }
.cart-mrp-row { display: flex; align-items: baseline; gap: 6px; }
.cart-mrp-strike { text-decoration: line-through; color: #9c8a6c; font-size: 11px; }
.cart-discount-pct { color: #2e7d32; font-weight: bold; font-size: 11px; }
.cart-item-qty { display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.cart-item-qty .qty-btn { width: 22px; height: 22px; font-size: 13px; }
.cart-item-actions { display: flex; flex-direction: column; align-items: center; gap: 4px; justify-self: end; }
.bin-btn { background: none; border: none; cursor: pointer; color: #b33; padding: 0; }
.bin-btn span { display: block; font-size: 10px; margin-top: 2px; }

.cart-total { display: flex; justify-content: space-between; font-weight: bold; padding: 14px 0; border-top: 2px solid var(--brown); font-size: 16px; }

.overlay {
  display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.4); z-index: 150;
}
.overlay.show { display: block; }

/* ---------- Checkout Modal ---------- */
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 300; align-items: center; justify-content: center; background: rgba(0,0,0,0.5); }
.modal.show { display: flex; }
.modal-content {
  background: white; border-radius: 10px; width: 92%; max-width: 440px; max-height: 88vh;
  position: relative; display: flex; flex-direction: column; overflow: hidden;
}
.modal-content h3 { color: var(--brown); margin-bottom: 16px; }
.close-modal {
  align-self: flex-end; margin: 10px 10px 0 0;
  background: white; border-radius: 50%; width: 30px; height: 30px;
  border: none; font-size: 20px; cursor: pointer; z-index: 5;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15); flex-shrink: 0;
}
.modal-scroll { padding: 6px 30px 30px; overflow-y: auto; }

.field { margin-bottom: 14px; text-align: left; }
.field label { display: block; font-size: 12.5px; font-weight: bold; color: var(--brown); margin-bottom: 4px; }
.field .optional { font-weight: normal; color: #999; }
#checkoutForm input { width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; }
#checkoutForm input.invalid { border-color: var(--error); }
.error-msg { display: block; color: var(--error); font-size: 11.5px; margin-top: 4px; min-height: 14px; }
.error-msg.center { text-align: center; }
.form-row { display: flex; gap: 10px; }
.form-row .field { flex: 1; }
.otp-copy { font-size: 13.5px; color: #555; margin-bottom: 14px; }

.phone-row { display: flex; gap: 8px; }
.phone-prefix {
  display: flex; align-items: center; justify-content: center; padding: 0 10px;
  background: #F3ECDD; border: 1px solid #ddd; border-radius: 6px; font-weight: bold; color: var(--brown);
}
.phone-row input { flex: 1; }

/* ---------- OTP boxes ---------- */
.otp-boxes { display: flex; justify-content: center; gap: 8px; margin: 6px 0 4px; }
.otp-box {
  width: 42px; height: 50px; text-align: center; font-size: 20px; font-weight: bold;
  border: 1.5px solid #ddd; border-radius: 8px; color: var(--brown);
}
.otp-box:focus { border-color: var(--gold); outline: none; }
.otp-timer-row { text-align: center; font-size: 13px; color: #666; margin: 10px 0 4px; }
.success-stage { text-align: center; }
.success-tick { display: flex; justify-content: center; margin-bottom: 14px; }
.success-title { color: #2e7d32 !important; font-size: 20px; }
.success-order-id { font-size: 14px; margin-bottom: 10px; }
.spam-note { text-align: center; font-size: 11.5px; color: #999; margin-bottom: 16px; }
#otpTimer { font-weight: bold; color: var(--brown); }
#otpTimer.warn { color: var(--error); animation: blink 0.8s ease-in-out infinite; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

/* ---------- Mobile: horizontal peek-scroll product carousel ---------- */
/* Instead of stacking products in a single column, show them as a
   swipeable horizontal row where the next card peeks in from the edge -
   a familiar "scroll for more" pattern on phones and small tablets. */
@media (max-width: 680px) {
  .product-grid {
    display: flex;
    grid-template-columns: none;
    align-items: stretch;
    overflow-x: auto;
    gap: 14px;
    padding: 4px 4px 14px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .product-grid::-webkit-scrollbar { display: none; }
  .product-grid .product-card {
    flex: 0 0 72%;
    scroll-snap-align: start;
  }
}

@media (max-width: 420px) {
  .product-grid .product-card { flex: 0 0 78%; }
}

/* ---------- Footer stays a compact horizontal row on all screen sizes ---------- */
@media (max-width: 480px) {
  .cart-drawer { width: 100%; right: -100%; }
  .hero h1 { font-size: 22px; }
  .hero em { font-size: 18px; white-space: nowrap; }
  .hero p { font-size: 11.5px; white-space: nowrap; }
  .logo-img { height: 52px; }
  .header-actions { gap: 18px; }
  .site-footer { padding-left: 6px; padding-right: 6px; }
}

/* Stack the header into two rows on phones/small tablets instead of hiding
   the "A TYAGI & CO. PRODUCT" tagline - logo+actions on row one, tagline
   centered on row two, so nothing gets cut or overlaps. */
@media (max-width: 680px) {
  .header-inner { flex-wrap: wrap; row-gap: 4px; padding-bottom: 6px; }
  .logo-img { order: 1; }
  .header-actions { order: 2; }
  .header-center {
    order: 3; position: static; transform: none; width: 100%;
    font-size: 12px; letter-spacing: 0.8px; margin-top: 2px;
  }
}

@media (max-width: 380px) {
  .hero em { font-size: 15.5px; }
  .hero p { font-size: 10px; }
}

@media (min-width: 681px) and (max-width: 900px) {
  .hero h1 { font-size: 32px; }
  .product-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 901px) {
  .product-grid { grid-template-columns: repeat(2, minmax(280px, 1fr)); max-width: 700px; margin: 0 auto; }
}
