/* ===================================================================
   LAYOUT COMPONENTS — header, footer, nav, product cards, grids
   =================================================================== */

/* ---- Announcement bar ---- */
.announcement-bar {
  background: var(--maroon-950);
  color: var(--gold-300);
  text-align: center;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  padding: 0.5rem 1rem;
  line-height: 1.5;
}
@media (max-width: 480px) {
  .announcement-bar {
    font-size: 0.7rem;
    padding: 0.45rem 0.75rem;
    letter-spacing: 0.03em;
    /* no white-space:nowrap here on purpose — let it wrap to 2 lines
       instead of overflowing horizontally on narrow phones */
  }
}

/* ---- Header ---- */
.site-header {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 500;
}
.header-inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1.5rem;
  padding-block: 0.9rem;
}
.brand-logo { display: flex; align-items: center; gap: 0.6rem; min-width: 0; }
.brand-logo img { height: 46px; width: auto; flex-shrink: 0; }
.brand-logo .brand-name {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--maroon-900);
  letter-spacing: 0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.main-nav { display: flex; gap: 2rem; justify-content: center; }
.main-nav a {
  font-size: 0.88rem;
  letter-spacing: 0.03em;
  color: var(--ink);
  position: relative;
  padding-bottom: 4px;
}
.main-nav a::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 1px; background: var(--gold-500);
  transform: scaleX(0); transform-origin: left;
  transition: transform .25s var(--ease);
}
.main-nav a:hover::after, .main-nav a.active::after { transform: scaleX(1); }
.main-nav a.active { color: var(--maroon-900); }

.header-actions { display: flex; align-items: center; gap: 1.1rem; }
.header-icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  color: var(--maroon-900);
  border-radius: 50%;
  transition: background .2s;
}
.header-icon-btn:hover { background: var(--ivory-deep); }
.header-icon-btn svg { width: 20px; height: 20px; }
.count-pill {
  position: absolute;
  top: -2px; right: -2px;
  background: var(--maroon-900);
  color: var(--ivory);
  font-size: 0.65rem;
  min-width: 16px; height: 16px;
  border-radius: 999px; /* was 50%: a fixed circle clips 2-3 digit counts (e.g. "99+"); a pill grows sideways instead */
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
  white-space: nowrap;
  line-height: 1;
}

.hamburger-btn { display: none; }

.search-flyout {
  position: absolute;
  top: 100%; left: 0; right: 0;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
  padding: 1.2rem var(--gutter);
  display: none;
}
.search-flyout.open { display: block; }
.search-flyout form { display: flex; gap: 0.6rem; max-width: 640px; margin: 0 auto; }
.search-flyout input { flex: 1; }

/* ---- Mobile nav drawer ---- */
.mobile-drawer {
  position: fixed; inset: 0 20% 0 0;
  max-width: 320px;
  background: var(--paper);
  z-index: 900;
  transform: translateX(-100%);
  transition: transform .3s var(--ease);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  overflow-y: auto; /* drawer content scrolls internally if it's taller than the screen */
}
.mobile-drawer.open { transform: translateX(0); }
.mobile-drawer-head { display: flex; align-items: center; justify-content: space-between; }
.drawer-close-btn {
  width: 38px; height: 38px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--maroon-900); flex-shrink: 0;
}
.drawer-close-btn:hover { background: var(--ivory-deep); }
.drawer-close-btn svg { width: 18px; height: 18px; }
.mobile-drawer-backdrop {
  position: fixed; inset: 0; background: rgba(58,7,22,0.4);
  z-index: 890; display: none;
}
.mobile-drawer-backdrop.open { display: block; }
.mobile-drawer nav { display: flex; flex-direction: column; gap: 1.1rem; margin-top: 2rem; }
.mobile-drawer nav a { font-family: var(--font-display); font-size: 1.3rem; color: var(--maroon-900); }
.drawer-divider { border: none; border-top: 1px solid var(--line); margin: 1.5rem 0 0; }
.drawer-account-nav a { font-size: 1rem !important; color: var(--ink-soft) !important; }

/* =====================================================================
   MOBILE / SMALL-TABLET HEADER
   Root cause of the cramped mobile navbar: the header simply reused the
   full desktop action row (search + account + wishlist + cart, 4 icons)
   inside a narrower "auto auto auto" grid track with no reduction in
   content — so the icons' combined natural width exceeded the space
   left after the logo, and they spilled past the viewport edge /
   overlapped the brand name. The fix removes icons from the row (search
   becomes a permanent bar below the header, reusing the exact same
   markup/JS; account moves into the hamburger drawer) rather than
   shrinking everything until it barely fits.
   ===================================================================== */
@media (max-width: 900px) {
  .main-nav { display: none; }
  .hamburger-btn { display: inline-flex; }
  .header-inner { grid-template-columns: auto 1fr auto; gap: 0.5rem; }

  .header-actions { gap: 0.2rem; }
  #search-toggle-btn, #account-link { display: none; }

  .brand-logo img { height: 34px; }
  .brand-logo .brand-name { font-size: 1.2rem; }

  /* Reuses the existing #search-flyout + #header-search-form untouched —
     just always visible as a bar under the header instead of a toggled
     overlay, since its icon no longer has room in the action row. */
  .search-flyout {
    display: block;
    position: static;
    box-shadow: none;
    padding: 0.65rem var(--gutter);
  }
  .search-flyout form { max-width: none; }
}
@media (max-width: 480px) {
  .brand-logo .brand-name { font-size: 1.05rem; }
  .brand-logo img { height: 30px; }
  .header-icon-btn { width: 34px; height: 34px; }
}

/* ---- Footer ---- */
.site-footer {
  background: var(--maroon-950);
  color: var(--gold-100);
  padding-block: 3.5rem 1.5rem;
  margin-top: 4rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1.2fr;
  gap: 2.5rem;
}
.site-footer h4 { color: var(--gold-300); font-size: 1.1rem; }
.site-footer a { color: var(--gold-100); opacity: 0.85; font-size: 0.88rem; }
.site-footer a:hover { opacity: 1; color: var(--gold-300); }
.footer-links { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.65rem; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.12);
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.78rem;
  opacity: 0.7;
}
.newsletter-form { display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.newsletter-form input {
  flex: 1; padding: 0.65rem 0.8rem; border-radius: 2px; border: 1px solid rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.06); color: var(--ivory);
}
.social-row { display: flex; gap: 0.8rem; margin-top: 1rem; }
.social-row a {
  width: 34px; height: 34px; border: 1px solid rgba(255,255,255,0.25);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
}

@media (max-width: 900px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .footer-grid { grid-template-columns: 1fr; gap: 2rem; }
  .footer-bottom { flex-direction: column; text-align: center; }
}

/* ---- Product grid & card ----
   Flexbox (not CSS grid) is used deliberately: with a CSS grid of
   `repeat(4, 1fr)`, any row that isn't fully populated (e.g. only 3
   New Arrivals) leaves a permanent empty column of dead space on the
   right because grid tracks always reserve their full width. Flexbox
   with `justify-content: center` lets a short/partial row of cards
   center itself instead, while equal flex-basis keeps every card the
   same width and every gap the same size when a row IS full. */
.product-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1.75rem;
  justify-content: center;
}
.product-grid > .product-card {
  flex: 1 1 calc(25% - 1.3125rem); /* 4 up: 3 gaps of 1.75rem shared across 4 cards */
  max-width: calc(25% - 1.3125rem);
  min-width: 210px;
}
.product-grid > .empty-state { flex: 1 1 100%; }
@media (max-width: 1100px) {
  .product-grid > .product-card { flex-basis: calc(33.333% - 1.1667rem); max-width: calc(33.333% - 1.1667rem); }
}
@media (max-width: 780px) {
  .product-grid { gap: 1rem; }
  .product-grid > .product-card { flex-basis: calc(50% - 0.5rem); max-width: calc(50% - 0.5rem); min-width: 0; }
}
@media (max-width: 340px) {
  .product-grid > .product-card { flex-basis: 100%; max-width: 100%; }
}

.product-card {
  position: relative;
  display: flex;
  flex-direction: column;
}
.product-card .thumb-wrap {
  position: relative;
  display: block; /* anchors are inline by default; aspect-ratio and the
    height:100% image below only take effect on a block-level box, which
    is the actual root cause of the oversized/inconsistent image area */
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: var(--ivory-deep);
}
.product-card .thumb-wrap img {
  width: 100%; height: 100%;
  object-fit: contain; /* show full jewellery piece, never crop or stretch it */
  object-position: center;
  padding: 1.1rem;
  box-sizing: border-box;
  background: var(--ivory-deep);
  transition: transform .5s var(--ease);
}
.product-card:hover .thumb-wrap img { transform: scale(1.06); }
.product-card .wishlist-toggle {
  position: absolute; top: 0.6rem; right: 0.6rem;
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255,253,249,0.9);
  display: flex; align-items: center; justify-content: center;
  color: var(--maroon-900);
}
.product-card .wishlist-toggle.active { color: var(--danger); }
.product-card .badges-row { position: absolute; top: 0.6rem; left: 0.6rem; display: flex; flex-direction: column; gap: 0.3rem; z-index: 1; }
.product-card .card-body {
  padding-top: 0.9rem;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto; /* fills the leftover height in the row so... */
}
.product-card .p-name {
  font-family: var(--font-display); font-size: 1.15rem; color: var(--maroon-900);
  margin-bottom: 0.3rem; line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; min-height: 2.5em; /* clamp to 2 lines so a long name
    can never push one card's contents further down than its neighbours */
}
.product-card .p-price-row { display: flex; align-items: baseline; gap: 0.5rem; flex-wrap: wrap; }
.product-card .p-price { font-weight: 600; }
.product-card .p-mrp { text-decoration: line-through; color: var(--ink-soft); font-size: 0.85rem; }
.product-card .p-discount { color: var(--success); font-size: 0.8rem; }
.product-card .p-rating { font-size: 0.8rem; color: var(--gold-600); margin-top: 0.2rem; }
.product-card .quick-add {
  margin-top: auto; /* ...then this sticks to the bottom every time, so
    every Add to Cart button lands on the same line across a row */
  padding-top: 0.6rem;
  width: 100%;
}

/* ---- Category tiles ---- */
.category-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; }
@media (max-width: 780px) { .category-grid { grid-template-columns: repeat(2, 1fr); } }
.category-tile { text-align: center; }
.category-tile .tile-image {
  aspect-ratio: 1; border-radius: 50%; overflow: hidden;
  border: 1px solid var(--gold-300); margin-bottom: 0.8rem;
}
.category-tile .tile-image img { width: 100%; height: 100%; object-fit: cover; }
.category-tile h4 { font-size: 1.1rem; margin: 0; }

/* ---- Empty / error states ---- */
.empty-state { text-align: center; padding: 4rem 1rem; color: var(--ink-soft); }
.empty-state svg { margin-bottom: 1rem; opacity: 0.6; }

/* ---- WhatsApp float button ---- */
.whatsapp-float {
  position: fixed; bottom: 1.5rem; left: 1.5rem; z-index: 400;
  width: 54px; height: 54px; border-radius: 50%;
  background: #25D366; color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-lift);
}

/* ---- Breadcrumb ---- */
.breadcrumb { font-size: 0.82rem; color: var(--ink-soft); margin-bottom: 1.5rem; }
.breadcrumb a { color: var(--maroon-900); }
.breadcrumb span { margin: 0 0.4rem; }