/**
 * Sankha Books Storefront — Grantha.lk Design System & Nocturne Theme
 * Architected & Engineered by Malinga Rajapaksha | RAJAPAKSHA IT Solutions (https://rajapakshaitsolutions.com)
 */
/* ===================================================================
   Sankha Books Storefront — Grantha.lk Design System & Nocturne Theme
   =================================================================== */

:root {
  color-scheme: light;
  --g-bg: #f7f7f8;
  --g-surface: #fdfdfd;
  --g-surface-elevated: #ffffff;
  --g-text: #26262a;
  --g-soft: #3d3d43;
  --g-soft2: #4b4b53;
  --g-muted2: #5a5a63;
  --g-muted: #78787f;
  --g-faint: #9a9aa2;
  --g-line: rgba(38, 38, 42, 0.12);
  --g-line-strong: rgba(38, 38, 42, 0.22);
  --g-hover: rgba(38, 38, 42, 0.04);
  --g-hover-strong: rgba(38, 38, 42, 0.08);

  /* Primary Accent & CTA */
  --g-accent: #796cbf;
  --g-accent-hover: #5d5294;
  --g-cta: #5d5294;
  --g-cta-hover: #4a4177;
  --g-accent-text: #5d5294;
  --g-accent-tint: rgba(121, 108, 191, 0.12);
  --g-accent-line: rgba(121, 108, 191, 0.40);

  /* Semantic Feedback */
  --g-positive: #16a34a;
  --g-positive-tint: rgba(22, 163, 74, 0.12);
  --g-danger: #dc2626;
  --g-danger-tint: rgba(220, 38, 38, 0.10);
  --g-warning: #b45309;

  --g-header-bg: rgba(247, 247, 248, 0.94);
  --g-card: var(--g-surface);
  --g-card-bg: var(--g-surface-elevated);
  --g-veil: rgba(253, 253, 253, 0.88);

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05), 0 0 0 1px rgba(38, 38, 42, 0.06);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.07), 0 0 0 1px rgba(38, 38, 42, 0.08);
  --shadow-lg: 0 14px 34px rgba(0, 0, 0, 0.10), 0 0 0 1px rgba(38, 38, 42, 0.10);

  /* Radii */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  /* Typography */
  --font-main: "Inter", "Noto Sans Sinhala", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --max-width: 1240px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --g-bg: #151722;
  --g-surface: #20222f;
  --g-surface-elevated: #282b3b;
  --g-text: #eaeaf0;
  --g-soft: #cfd3e5;
  --g-soft2: #b2b6ca;
  --g-muted2: #9397ab;
  --g-muted: #75798c;
  --g-faint: #595d6c;
  --g-line: rgba(233, 233, 237, 0.10);
  --g-line-strong: rgba(233, 233, 237, 0.20);
  --g-hover: rgba(233, 233, 237, 0.05);
  --g-hover-strong: rgba(233, 233, 237, 0.09);

  --g-accent: #9184d9;
  --g-accent-hover: #7d6fce;
  --g-cta: #6a5dc0;
  --g-cta-hover: #5d5294;
  --g-accent-text: #d2cefd;
  --g-accent-tint: rgba(145, 132, 217, 0.14);
  --g-accent-line: rgba(145, 132, 217, 0.45);

  --g-danger: #ef4444;
  --g-positive: #4ade80;

  --g-header-bg: rgba(21, 23, 34, 0.94);
  --g-card: var(--g-surface);
  --g-card-bg: var(--g-surface-elevated);
  --g-veil: rgba(21, 23, 34, 0.88);

  --shadow-sm: 0 0 0 1px rgba(255, 255, 255, 0.08);
  --shadow-md: 0 4px 18px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.08);
  --shadow-lg: 0 14px 40px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.1);
}

/* Base Reset */
/* overflow-x: clip (not hidden) prevents sideways scroll without turning body into a
   scroll container, which would break position: sticky for the header and filter sidebar */
html {
  scroll-behavior: smooth;
}
html, body {
  overflow-x: clip;
  max-width: 100vw;
  width: 100%;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  background-color: var(--g-bg);
  color: var(--g-text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: clip;
  max-width: 100vw;
  width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.15s ease;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/* ==================== 1. TOP UTILITY BAR ==================== */
.grantha-topbar {
  background: var(--g-surface-elevated);
  border-bottom: 1px solid var(--g-line);
  font-size: 0.82rem;
  padding: 6px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--g-muted2);
}

.grantha-topbar .announcement {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  color: var(--g-soft);
}

.grantha-topbar .announcement i {
  color: var(--g-accent);
}

/* Short phone wording; swapped in by the mobile breakpoint */
.grantha-topbar .announcement .announcement-mobile-text {
  display: none;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-right a, .topbar-right button {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--g-soft);
  font-size: 0.82rem;
}

.topbar-right a:hover, .topbar-right button:hover {
  color: var(--g-accent);
}

.theme-toggle-btn {
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  transition: background 0.15s;
}
.theme-toggle-btn:hover {
  background: var(--g-hover);
}

/* ==================== 2. STICKY HEADER ==================== */
.grantha-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--g-header-bg);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--g-line);
  transition: all 0.2s ease;
}

.grantha-main-header {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.grantha-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.grantha-logo:hover {
  transform: translateY(-1px) scale(1.02);
}

.navbar-logo-img {
  height: 40px;
  width: auto;
  max-width: 180px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.08));
  transition: all 0.25s ease;
}

.grantha-logo:hover .navbar-logo-img {
  filter: drop-shadow(0 4px 12px rgba(93, 82, 148, 0.3));
}

/* Light / Dark Mode Logo Display System */
.navbar-logo-img.logo-dark,
.drawer-logo .logo-dark,
.footer-logo .logo-dark {
  display: none !important;
}

.navbar-logo-img.logo-light,
.drawer-logo .logo-light,
.footer-logo .logo-light {
  display: block !important;
}

html[data-theme="dark"] .navbar-logo-img.logo-light,
html[data-theme="dark"] .drawer-logo .logo-light,
html[data-theme="dark"] .footer-logo .logo-light {
  display: none !important;
}

html[data-theme="dark"] .navbar-logo-img.logo-dark,
html[data-theme="dark"] .drawer-logo .logo-dark,
html[data-theme="dark"] .footer-logo .logo-dark {
  display: block !important;
  filter: drop-shadow(0 2px 10px rgba(168, 85, 247, 0.28));
}

/* ==================== 2. SIMPLISTIC NAVBAR MENU & ACTIONS ==================== */
.navbar-menu {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  margin: 0 12px;
}

.nav-item {
  display: inline-flex;
  align-items: center;
  padding: 7px 13px;
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--g-soft);
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: -0.01em;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-item:hover {
  background: var(--g-hover-strong);
  color: var(--g-text);
  transform: translateY(-1px);
}

/* Special Deals: highlighted with the theme accent (no off-palette colour) */
.nav-item-highlight {
  gap: 7px;
  color: var(--g-accent);
  font-weight: 600;
}
.nav-item-highlight i {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--g-accent-tint);
  font-size: 0.78rem;
  transition: background 0.2s ease, color 0.2s ease;
}
.nav-item-highlight:hover {
  background: var(--g-accent-tint);
  color: var(--g-accent);
}
.nav-item-highlight:hover i {
  background: var(--g-accent);
  color: #ffffff;
}

/* Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* Standard Nav Icon Button (Search trigger & theme toggle) */
.nav-icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--g-line);
  background: var(--g-surface-elevated);
  color: var(--g-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.18rem;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.nav-icon-btn:hover {
  border-color: var(--g-accent);
  color: var(--g-accent);
  background: var(--g-hover-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.nav-search-icon-btn {
  color: var(--g-accent);
}
.nav-search-icon-btn:hover i {
  transform: scale(1.15);
}
.nav-search-icon-btn i {
  transition: transform 0.2s ease;
}

.cart-btn-elevated {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--g-cta);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-full);
  padding: 8px 18px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 10px rgba(93, 82, 148, 0.25);
}
.cart-btn-elevated:hover {
  background: var(--g-cta-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(93, 82, 148, 0.38);
}
.cart-btn-elevated i {
  font-size: 1.2rem;
}

/* ==================== 3. HOME SEARCH HERO BAND (SINGLE UNIFIED SEARCH) ==================== */
.home-search {
  width: 100%;
  max-width: 920px;
  margin: 44px auto 36px;
  text-align: center;
  padding: 0 20px;
  box-sizing: border-box;
}

.hero-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: var(--radius-full);
  background: var(--g-accent-tint);
  color: var(--g-accent-text);
  border: 1px solid var(--g-accent-line);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.home-search-title {
  font-size: 2.75rem;
  font-weight: 800;
  letter-spacing: -0.035em;
  color: var(--g-text);
  margin-bottom: 12px;
  line-height: 1.15;
  word-break: break-word;
}

.home-search-subtitle {
  font-size: 1.05rem;
  color: var(--g-muted2);
  max-width: 680px;
  margin: 0 auto 28px;
  line-height: 1.55;
}

.home-search-container {
  position: relative;
  width: 100%;
  max-width: 720px;
  margin: 0 auto 16px;
  box-sizing: border-box;
}

.home-search-box {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  background: var(--g-surface-elevated);
  border: 2px solid var(--g-line-strong);
  border-radius: var(--radius-full);
  padding: 6px 8px 6px 20px;
  box-shadow: var(--shadow-md);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.home-search-box:focus-within {
  border-color: var(--g-accent);
  box-shadow: 0 0 0 4px var(--g-accent-tint), 0 8px 24px rgba(93, 82, 148, 0.16);
  transform: translateY(-1px);
}

.search-leading-icon {
  font-size: 1.35rem;
  color: var(--g-accent);
  margin-right: 6px;
  flex-shrink: 0;
}

.home-search-box .search-input {
  flex: 1;
  min-width: 0;
  width: 100%;
  border: none;
  background: transparent;
  outline: none;
  padding: 10px 8px;
  font-size: 1.05rem;
  color: var(--g-text);
}
.home-search-box .search-input::placeholder {
  color: var(--g-muted);
  font-style: italic;
}

/* Refined Search Clear Button matching theme & properly positioned */
.search-clear-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: var(--g-hover-strong);
  color: var(--g-muted2);
  cursor: pointer;
  margin-right: 8px;
  flex-shrink: 0;
  font-size: 1rem;
  padding: 0;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.search-clear-btn.active {
  display: inline-flex;
}

.search-clear-btn:hover {
  background: var(--g-danger-tint);
  color: var(--g-danger);
  transform: scale(1.1);
}

.search-clear-btn i {
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}

.search-clear-btn:hover i {
  transform: rotate(90deg);
}

.home-search-box .search-btn {
  background: var(--g-cta);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-full);
  padding: 11px 24px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.18s ease;
  box-shadow: 0 2px 8px rgba(93, 82, 148, 0.3);
}
.home-search-box .search-btn:hover {
  background: var(--g-cta-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(93, 82, 148, 0.45);
}

/* Pulse animation when directed from nav search button */
@keyframes searchPulseGlow {
  0% { box-shadow: 0 0 0 0 rgba(93, 82, 148, 0.7); }
  50% { box-shadow: 0 0 0 14px rgba(93, 82, 148, 0.18); }
  100% { box-shadow: 0 0 0 0 rgba(93, 82, 148, 0); }
}
.highlight-pulse {
  animation: searchPulseGlow 1.2s ease-out 2;
  border-color: var(--g-accent) !important;
}

/* Hero Suggest Dropdown */
.hero-suggest-panel {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  right: 0;
  background: var(--g-surface-elevated);
  border: 1px solid var(--g-line);
  border-radius: var(--radius-md);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.16);
  overflow: hidden;
  z-index: 200;
  display: none;
  text-align: left;
  backdrop-filter: blur(12px);
}
.hero-suggest-panel.active {
  display: block;
  animation: dropdownFadeIn 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes dropdownFadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.suggest-header {
  padding: 10px 16px;
  background: var(--g-hover);
  border-bottom: 1px solid var(--g-line);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--g-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.singlish-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--g-accent-tint);
  color: var(--g-accent);
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: normal;
}
.singlish-badge strong {
  color: var(--g-cta);
}

.suggest-items {
  max-height: 340px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.suggest-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--g-line);
  cursor: pointer;
  transition: background 0.15s ease;
}
.suggest-item:last-child {
  border-bottom: none;
}
.suggest-item:hover {
  background: var(--g-hover-strong);
}

.suggest-thumb {
  width: 40px;
  height: 56px;
  object-fit: cover;
  border-radius: var(--radius-xs);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  flex-shrink: 0;
  background: var(--g-line);
}

.suggest-info {
  flex: 1;
  min-width: 0;
}

.suggest-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--g-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.suggest-author {
  font-size: 0.76rem;
  color: var(--g-muted);
  margin-top: 2px;
}

.suggest-price {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--g-danger);
  flex-shrink: 0;
}

.suggest-footer {
  padding: 10px 16px;
  background: var(--g-hover);
  border-top: 1px solid var(--g-line);
  text-align: center;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--g-accent);
  cursor: pointer;
  transition: all 0.15s ease;
}
.suggest-footer:hover {
  background: var(--g-hover-strong);
  text-decoration: underline;
}

/* Quick Trending Search Tags */
.quick-search-tags {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 22px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.quick-tag {
  background: var(--g-surface);
  border: 1px solid var(--g-line);
  padding: 5px 13px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--g-soft);
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: var(--shadow-sm);
}
.quick-tag:hover {
  background: var(--g-hover-strong);
  border-color: var(--g-accent);
  color: var(--g-accent);
  transform: translateY(-1px);
}

.home-search-meta {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 18px;
  font-size: 0.84rem;
  color: var(--g-muted2);
  align-items: center;
}
.home-search-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.home-search-meta i {
  color: var(--g-accent);
}
.home-search-hint {
  color: var(--g-accent) !important;
  font-weight: 600;
}

/* ==================== 4. HERO SLIDER BANNER ==================== */
.hero-slider-section {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto 52px;
  padding: 0 24px;
  box-sizing: border-box;
  display: block;
}

.hero-slider-section[hidden] { display: none; }

/* Slide layout and themes live in banners.css; the frame's ratio is 16:5, 3:2 on phones */
.hero-slider-wrap {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--g-line);
  background: var(--g-surface);
}

.slider-controls {
  position: absolute;
  bottom: 16px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 8px;
  z-index: 10;
}

.slider-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.45);
  border: none;
  cursor: pointer;
  transition: width 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), 
              background 0.3s ease, 
              transform 0.25s ease, 
              box-shadow 0.3s ease;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.slider-dot:hover:not(.active) {
  background: rgba(255, 255, 255, 0.8);
  transform: scale(1.2);
}

.slider-dot.active {
  width: 28px;
  background: #ffffff;
  box-shadow: 0 0 14px rgba(255, 255, 255, 0.7);
}

.slider-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.16);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  z-index: 10;
  opacity: 0.45;
  transition: opacity 0.25s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}
.hero-slider-wrap:hover .slider-arrow {
  opacity: 0.85;
}
.slider-arrow:hover {
  opacity: 1;
  background: rgba(15, 23, 42, 0.58);
  border-color: rgba(255, 255, 255, 0.35);
  color: #ffffff;
  transform: translateY(-50%) scale(1.05);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
}
.slider-arrow.prev { left: 14px; }
.slider-arrow.next { right: 14px; }

/* ==================== 5. CATEGORY PILLS BAR ==================== */
.category-pills-bar {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto 48px;
  padding: 0 24px;
  box-sizing: border-box;
}

.section-kicker-center {
  text-align: center;
  margin-bottom: 16px;
}
.kicker-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--g-accent);
}

/* One-Screen Top Categories Bar (All parent categories visible without hidden horizontal scroll) */
.pills-scroll {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 10px;
  max-width: 1140px;
  margin: 0 auto;
  padding: 4px 0 8px;
  overflow: visible;
}
.pills-scroll::-webkit-scrollbar {
  display: none;
}

.category-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--g-surface-elevated);
  border: 1px solid var(--g-line);
  border-radius: var(--radius-full);
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--g-text);
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1), 
              background 0.2s ease, 
              border-color 0.2s ease, 
              color 0.2s ease, 
              box-shadow 0.2s ease;
  box-shadow: var(--shadow-sm);
  user-select: none;
}

.category-pill i {
  font-size: 1.05rem;
  color: var(--g-accent);
  transition: transform 0.2s ease, color 0.2s ease;
}

.category-pill:hover {
  border-color: var(--g-accent);
  color: var(--g-accent);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
  background: var(--g-hover);
}

.category-pill:hover i {
  transform: scale(1.1);
}

.category-pill:active {
  transform: scale(0.97);
}

.category-pill.active {
  background: var(--g-accent);
  color: #ffffff;
  border-color: var(--g-accent);
  box-shadow: 0 4px 14px rgba(22, 101, 52, 0.32);
  transform: translateY(-1px);
}
.category-pill.active i {
  color: #ffffff;
}

.pill-count {
  font-size: 0.74rem;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, 0.06);
  color: var(--g-muted2);
  font-weight: 700;
  line-height: 1.2;
  transition: background 0.2s ease, color 0.2s ease;
}
.category-pill.active .pill-count {
  background: rgba(255, 255, 255, 0.24);
  color: #ffffff;
}
/* ==================== 6. SPLIT TRENDING & BESTSELLERS WIDGET ==================== */
.split-trending-section {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto 56px;
  padding: 0 24px;
  box-sizing: border-box;
}

.split-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 28px;
  width: 100%;
  max-width: 100%;
}

.trending-widget {
  background: var(--g-surface);
  border: 1px solid var(--g-line);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  box-shadow: var(--shadow-sm);
  min-width: 0;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
}

.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 22px;
  gap: 16px;
  flex-wrap: wrap;
}

.section-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--g-accent);
  margin-bottom: 4px;
}

.section-kicker.kicker-deal {
  color: #e11d48;
}

.section-heading h2 {
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--g-text);
  line-height: 1.25;
}

.section-subtitle {
  font-size: 0.86rem;
  color: var(--g-muted);
  margin-top: 3px;
}

.section-link {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--g-accent);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.section-link:hover {
  text-decoration: underline;
  color: var(--g-accent-hover);
}

.trending-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.trending-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--g-line);
  background: var(--g-surface-elevated);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  cursor: pointer;
}

.trending-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--g-accent-line);
}

.trending-rank {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--g-muted2);
  width: 32px;
  text-align: center;
  flex-shrink: 0;
}
.trending-item:nth-child(1) .trending-rank { color: #d97706; }
.trending-item:nth-child(2) .trending-rank { color: #64748b; }
.trending-item:nth-child(3) .trending-rank { color: #b45309; }

.trending-thumb {
  width: 46px;
  height: 66px;
  object-fit: cover;
  border-radius: var(--radius-xs);
  background: #151722;
  flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  display: block;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: high-quality;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform: translateZ(0);
}

.trending-info {
  flex: 1;
  min-width: 0;
}

.trending-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--g-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.trending-author {
  font-size: 0.78rem;
  color: var(--g-muted);
  margin-top: 2px;
}

.trending-sub {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
  width: 100%;
}

.trending-meta-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.trending-price {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--g-danger);
  white-space: nowrap;
  flex-shrink: 0;
}

.trending-move {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.trending-stat {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--g-muted2);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  white-space: nowrap;
  flex-shrink: 0;
}
.trending-stat i {
  font-size: 0.88rem;
  color: var(--g-accent);
}

/* ==================== 7. BOOK RAILS & PRODUCT CARDS ==================== */
.book-rail-section {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto 56px;
  padding: 0 24px;
  box-sizing: border-box;
}

.rail-scroll-wrap {
  position: relative;
}

.book-rail {
  display: flex;
  gap: 18px;
  overflow-x: auto;
  scroll-behavior: smooth;
  padding: 8px 4px 18px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.book-rail::-webkit-scrollbar {
  display: none;
}

/* Grantha Standard Book Card */
.book-card {
  flex: 0 0 196px;
  background: var(--g-surface-elevated);
  border: 1px solid var(--g-line);
  border-radius: var(--radius-md);
  padding: 12px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  position: relative;
  transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.22s ease, border-color 0.22s ease;
  cursor: pointer;
}

.book-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-md);
  border-color: var(--g-accent-line);
}

.book-cover-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1.45;
  border-radius: var(--radius-xs);
  overflow: hidden;
  background: #151722;
  margin-bottom: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  -webkit-mask-image: -webkit-radial-gradient(white, black);
  mask-image: radial-gradient(white, black);
  transform: translateZ(0);
  isolation: isolate;
  contain: paint;
}

.book-cover-wrap img {
  display: block;
  width: calc(100% + 4px);
  height: calc(100% + 4px);
  margin: -2px;
  object-fit: cover;
  object-position: center top;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: high-quality;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform: translateZ(0);
  will-change: transform;
  transition: transform 0.35s cubic-bezier(0.25, 1, 0.5, 1);
}

.book-card:hover .book-cover-wrap img {
  transform: scale(1.04) translateZ(0);
}

/* Rank Ribbon Badge */
.book-rank-ribbon {
  position: absolute;
  top: 0;
  left: 8px;
  background: var(--g-cta);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 7px;
  border-radius: 0 0 4px 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  z-index: 2;
}

/* Quick Add-to-Cart Overlay Button */
.book-quick-cart {
  position: absolute;
  top: auto;
  bottom: 8px;
  left: auto;
  right: 8px;
  width: 34px;
  height: 34px;
  min-height: 34px;
  background: var(--g-surface-elevated);
  color: var(--g-accent);
  border: 1px solid var(--g-line);
  border-radius: 50%;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  cursor: pointer;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.2s ease, transform 0.2s ease, background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.14);
  z-index: 3;
}

.book-quick-cart .quick-cart-label {
  display: none;
}

.book-quick-cart i {
  font-size: 1.05rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.book-card:hover .book-quick-cart {
  opacity: 1;
  transform: translateY(0);
}

.book-quick-cart:hover {
  background: var(--g-cta);
  color: #ffffff;
  border-color: var(--g-cta);
  transform: scale(1.08) !important;
}

/* Out of Stock Card Indicators */
.book-card.is-out-of-stock .book-cover-wrap img {
  filter: grayscale(25%) opacity(0.85);
}

.book-oos-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(15, 23, 42, 0.88);
  color: #ffffff;
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  backdrop-filter: blur(4px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  z-index: 3;
}

.book-stock-urgency {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #b45309;
  background: #fef3c7;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  margin-top: 4px;
  width: fit-content;
}

[data-theme="dark"] .book-stock-urgency {
  background: rgba(245, 158, 11, 0.18);
  color: #fde68a;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.book-quick-cart.is-oos {
  opacity: 0.75 !important;
  background: var(--g-surface);
  color: var(--g-muted2);
  cursor: not-allowed;
  border-color: var(--g-line);
  transform: none !important;
}

.book-quick-cart.is-oos:hover {
  background: var(--g-surface);
  color: var(--g-muted2);
  border-color: var(--g-line);
  transform: none !important;
}

.book-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--g-text);
  line-height: 1.3;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  height: 2.6em;
}

.book-author {
  font-size: 0.78rem;
  color: var(--g-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 8px;
}

.book-price-row {
  margin-top: auto;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.book-price {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--g-danger);
}

.book-was-price {
  font-size: 0.8rem;
  color: var(--g-muted);
  text-decoration: line-through;
}

/* Rail Controls */
.rail-controls {
  display: flex;
  gap: 8px;
}

.rail-btn {
  background: var(--g-surface-elevated);
  border: 1.5px solid var(--g-line);
  color: var(--g-text);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.rail-btn i {
  color: var(--g-soft);
  transition: color 0.15s ease;
}

.rail-btn:hover {
  background: var(--g-cta);
  border-color: var(--g-cta);
  color: #ffffff;
  transform: scale(1.08);
  box-shadow: var(--shadow-md);
}
.rail-btn:hover i {
  color: #ffffff;
}
.rail-btn:active {
  transform: scale(0.95);
}

/* ==================== 8. MAIN CATALOG SECTION & FILTERS ==================== */
.catalog-section {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto 64px;
  padding: 0 24px;
  box-sizing: border-box;
}

.catalog-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--g-line);
}

.catalog-title-group h1,
.catalog-title-group h2 {
  font-size: 1.5rem;
  font-weight: 700;
}

.catalog-count-info {
  font-size: 0.85rem;
  color: var(--g-muted);
}

.catalog-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sort-select {
  background: var(--g-surface);
  border: 1px solid var(--g-line);
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 20px;
}

/* Catalog Pagination */
.pagination-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 40px;
}

.page-btn {
  background: var(--g-surface);
  border: 1px solid var(--g-line);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.page-btn:hover {
  border-color: var(--g-accent);
  color: var(--g-accent);
}

.page-btn.active {
  background: var(--g-cta);
  color: #ffffff;
  border-color: var(--g-cta);
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ==================== 9. VALUE PROPOSITIONS STRIP ==================== */
.services-bar {
  background: var(--g-surface);
  border-top: 1px solid var(--g-line);
  border-bottom: 1px solid var(--g-line);
  padding: 40px 20px;
  margin-top: auto;
}

.services-grid {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
}

.service-card {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.service-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--g-accent-tint);
  color: var(--g-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.service-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--g-text);
  margin-bottom: 4px;
}

.service-body {
  font-size: 0.84rem;
  color: var(--g-muted2);
  line-height: 1.4;
}

/* ==================== 10. FOOTER ==================== */
.grantha-footer {
  background: var(--g-surface-elevated);
  border-top: 1px solid var(--g-line);
  padding: 50px 20px 24px;
}

.gf-main {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 40px;
}

.gf-brand p {
  font-size: 0.88rem;
  color: var(--g-muted2);
  margin: 12px 0 20px;
  max-width: 320px;
}

.gf-contact {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 0.86rem;
}

.gf-contact li {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--g-soft);
}

.gf-contact i {
  color: var(--g-accent);
  font-size: 1.1rem;
}

.gf-col h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--g-text);
}

.gf-col ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--g-muted2);
}

.gf-col ul a:hover {
  color: var(--g-accent);
}

.gf-pay-bar {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 20px 0;
  border-top: 1px solid var(--g-line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 0.82rem;
  color: var(--g-muted);
}
/* Footer Developer Credit Badge */
.credit-badge {
  font-size: 0.76rem;
  color: var(--g-muted2);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1.4;
}
.credit-badge a {
  font-weight: 600;
  color: var(--g-text);
  text-decoration: none;
  transition: color 0.15s ease;
}
.credit-badge a:hover {
  color: var(--g-accent);
}
@media (max-width: 640px) {
  .credit-badge {
    justify-content: center;
    text-align: center;
    width: 100%;
  }
}

/* ==================== 10.5. WAYS TO PAY (footer) ====================
   One quiet line above the copyright: label, card marks, then plain text with accent icons. */
.gf-accept {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 16px 0;
  border-top: 1px solid var(--g-line);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 22px;
  font-size: 0.8rem;
  color: var(--g-muted);
}
.gf-accept-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--g-muted2);
}
.gf-accept-list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.gf-accept-list li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.gf-accept-list i,
.gf-accept-secure i {
  color: var(--g-accent);
  font-size: 1rem;
}
.gf-accept-cards { gap: 5px !important; }
.gf-accept-cards img {
  display: block;
  height: 20px;
  width: auto;
  border-radius: 4px;
}
.gf-accept-secure {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  color: var(--g-muted2);
  text-decoration: none;
  transition: color 0.15s ease;
}
.gf-accept-secure strong { font-weight: 600; color: var(--g-text); }
.gf-accept-secure:hover,
.gf-accept-secure:hover strong { color: var(--g-accent); }
@media (max-width: 760px) {
  .gf-accept {
    justify-content: center;
    text-align: center;
    padding: 16px;
    gap: 10px 16px;
  }
  .gf-accept-label { flex-basis: 100%; }
  .gf-accept-list { justify-content: center; gap: 8px 14px; }
  .gf-accept-secure { margin-left: 0; flex-basis: 100%; justify-content: center; }
}

/* Checkout: "How would you like to receive your books?" choices (app.js renderReceiveOptions) */
.receive-options {
  display: grid;
  gap: 8px;
}
.receive-options .receive-option {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 11px 14px;
  border: 1px solid var(--g-line);
  border-radius: var(--radius-sm);
  background: var(--g-surface);
  color: var(--g-text);
  font-weight: 400;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.receive-options .receive-option:hover { border-color: var(--g-muted2); }
.receive-options .receive-option.is-selected {
  border-color: var(--g-accent);
  box-shadow: inset 0 0 0 1px var(--g-accent);
}
.receive-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.receive-option:has(input:focus-visible) { outline: 2px solid var(--g-accent); outline-offset: 2px; }
.receive-option > i {
  font-size: 1.3rem;
  color: var(--g-accent);
}
.receive-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.receive-text strong { font-size: 0.9rem; font-weight: 600; }
.receive-text small { font-size: 0.76rem; color: var(--g-muted); }
.receive-fee {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--g-soft);
  white-space: nowrap;
}

/* Checkout Drawer / Modal PayHere Showcase */
.checkout-payhere-box {
  margin-top: 10px;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.02);
}

.payhere-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.payhere-box-logo {
  height: 24px;
  width: auto;
}

.payhere-box-tag {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #0284c7;
  background: #e0f2fe;
  padding: 2px 8px;
  border-radius: 999px;
}

.payhere-box-desc {
  font-size: 0.8rem;
  color: #475569;
  margin: 0 0 10px;
  line-height: 1.4;
}

.payhere-methods-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.payhere-method-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.payhere-method-item img {
  height: 22px;
  border-radius: 3px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.payhere-trust-note {
  font-size: 0.76rem;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 6px;
  border-top: 1px dashed #cbd5e1;
  padding-top: 8px;
  margin-top: 4px;
}

.payhere-trust-note i {
  color: #10b981;
  font-size: 0.95rem;
}

/* ==================== 11. SLIDING CART DRAWER ==================== */
.cart-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  z-index: 1200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.cart-drawer-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 420px;
  background: var(--g-surface-elevated);
  box-shadow: var(--shadow-lg);
  z-index: 1210;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s;
  display: flex;
  flex-direction: column;
  visibility: hidden;
  pointer-events: none;
}

.cart-drawer.active {
  transform: translateX(0);
  visibility: visible;
  pointer-events: auto;
}

.cart-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--g-line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cart-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.cart-close-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--g-line);
  background: var(--g-surface-elevated);
  color: var(--g-muted2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.15rem;
  padding: 0;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
}
.cart-close-btn:hover {
  background: var(--g-danger-tint);
  color: var(--g-danger);
  border-color: var(--g-danger);
  transform: rotate(90deg);
}

.cart-items-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cart-empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--g-muted);
}

.cart-empty-state i {
  font-size: 3.5rem;
  margin-bottom: 12px;
  color: var(--g-faint);
}

.cart-item {
  display: flex;
  gap: 14px;
  align-items: center;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--g-line);
}

.cart-item-thumb {
  width: 52px;
  height: 76px;
  object-fit: cover;
  border-radius: var(--radius-xs);
  background: var(--g-line);
}

.cart-item-details {
  flex: 1;
  min-width: 0;
}

.cart-item-title {
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cart-item-price {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--g-danger);
  margin: 4px 0;
}

.cart-item-qty {
  display: flex;
  align-items: center;
  gap: 8px;
}

.qty-btn {
  width: 26px;
  height: 26px;
  border: 1px solid var(--g-line);
  background: var(--g-surface);
  border-radius: var(--radius-xs);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cart-remove-btn {
  background: none;
  border: none;
  color: var(--g-muted);
  cursor: pointer;
  font-size: 1rem;
}
.cart-remove-btn:hover {
  color: var(--g-danger);
}

.cart-footer {
  padding: 16px 20px calc(24px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--g-line);
  background: var(--g-surface-elevated);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
}

.cart-summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  margin-bottom: 8px;
  color: var(--g-muted2);
}

.cart-summary-row.total {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--g-text);
  border-top: 1px solid var(--g-line);
  padding-top: 10px;
  margin-top: 10px;
}

.cart-checkout-btn {
  width: 100%;
  background: var(--g-cta);
  color: #ffffff;
  border: none;
  padding: 13px 18px;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(93, 82, 148, 0.35);
  transition: all 0.15s ease;
}

.cart-checkout-btn:hover {
  background: var(--g-cta-hover);
  transform: translateY(-1px);
}

/* ==================== 12. BOOK DETAIL & CHECKOUT MODALS ==================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  background: var(--g-surface-elevated);
  border: 1px solid var(--g-line);
  border-radius: var(--radius-lg);
  max-width: 960px;
  width: 95%;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  position: relative;
  transform: scale(0.96) translateY(10px);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.28s ease;
}

.modal-backdrop.active .modal-box {
  transform: scale(1) translateY(0);
}

.modal-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--g-hover);
  border: 1px solid var(--g-line);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: var(--g-text);
  z-index: 10;
  transition: all 0.15s ease;
}
.modal-close-btn:hover {
  background: var(--g-danger-tint);
  color: var(--g-danger);
  transform: rotate(90deg);
}

/* Mobile Hero & Action Bar (Hidden on desktop) */
.modal-mobile-action-bar {
  display: none;
}
.modal-sheet-handle-wrap {
  display: none;
}

/* Book Detail Modal Content */

/* Purchase Actions Row */

.qty-btn {
  background: none;
  border: none;
  width: 36px;
  height: 100%;
  cursor: pointer;
  font-size: 1rem;
  color: var(--g-text);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.qty-btn:hover {
  background: var(--g-hover);
}

.btn-primary-cart {
  flex: 1;
  background: linear-gradient(135deg, var(--g-cta) 0%, var(--g-accent) 100%);
  color: #ffffff;
  border: none;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  box-shadow: 0 4px 14px rgba(93, 82, 148, 0.3);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-primary-cart:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(93, 82, 148, 0.45);
}
.btn-primary-cart:active {
  transform: scale(0.98);
}

.btn-whatsapp-order {
  background: #25d366;
  color: #ffffff;
  border: none;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.25);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-whatsapp-order:hover {
  background: #20ba59;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(37, 211, 102, 0.35);
}

/* ==================== ACTIVE FILTERS BAR ==================== */

.active-filter-label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--g-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.active-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--g-surface);
  border: 1px solid var(--g-cta);
  color: var(--g-cta);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.btn-clear-all {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--g-surface);
  border: 1px solid var(--g-line);
  color: var(--g-text);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-clear-all:hover {
  border-color: var(--g-danger);
  color: var(--g-danger);
  background: var(--g-danger-tint);
}

/* Checkout Modal */
.checkout-modal-box {
  max-width: 540px;
  padding: 28px;
}

.checkout-modal-box h2 {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 16px;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--g-soft);
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--g-line);
  background: var(--g-surface);
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  outline: none;
}

.form-control:focus {
  border-color: var(--g-accent);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1400;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--g-surface-elevated);
  border: 1px solid var(--g-line-strong);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideInUp 0.25s ease;
}

.toast.success i {
  color: var(--g-positive);
  font-size: 1.2rem;
}

@keyframes slideInUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* ==================== MOBILE MENU BUTTON ==================== */
.mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--g-line);
  background: var(--g-surface-elevated);
  color: var(--g-text);
  font-size: 1.35rem;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}
.mobile-menu-btn:hover {
  background: var(--g-hover-strong);
  border-color: var(--g-accent);
  color: var(--g-accent);
  transform: translateY(-1px);
}

/* ==================== MOBILE OFF-CANVAS DRAWER ==================== */
.mobile-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  z-index: 1050;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.3s ease;
}
.mobile-drawer-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.mobile-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 320px;
  max-width: 86vw;
  background: var(--g-surface);
  /* Closed: no shadow (it used to spill onto the page's left edge) and hidden from taps and Tab */
  box-shadow: none;
  visibility: hidden;
  z-index: 1060;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.32s ease, visibility 0s linear 0.32s;
  overflow: hidden;
}
.mobile-drawer.active {
  transform: translateX(0);
  visibility: visible;
  box-shadow: 10px 0 35px rgba(0, 0, 0, 0.22);
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.32s ease, visibility 0s;
}

.mobile-drawer-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--g-line);
  background: var(--g-surface-elevated);
}

.drawer-close-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--g-line);
  background: var(--g-hover);
  color: var(--g-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  cursor: pointer;
  transition: all 0.2s ease;
}
.drawer-close-btn:hover {
  background: var(--g-cta);
  color: #ffffff;
  border-color: var(--g-cta);
}

.mobile-drawer-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px 18px 30px;
  -webkit-overflow-scrolling: touch;
}

.drawer-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--g-muted);
  margin-bottom: 10px;
}

.mobile-drawer-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.drawer-nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--g-text);
  text-decoration: none;
  transition: all 0.15s ease;
}
.drawer-nav-link i {
  font-size: 1.25rem;
  color: var(--g-accent);
}
.drawer-nav-link:hover {
  background: var(--g-hover-strong);
  color: var(--g-cta);
}
/* ==================== STICKY MOBILE BOTTOM NAVIGATION BAR ==================== */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--g-surface-elevated);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--g-line);
  z-index: 998;
  box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.08);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.mobile-bottom-nav .bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-decoration: none;
  color: var(--g-muted2);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px 0;
  font-size: 0.72rem;
  font-weight: 500;
  transition: color 0.15s ease;
  position: relative;
}

.mobile-bottom-nav .bottom-nav-item i {
  font-size: 1.28rem;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mobile-bottom-nav .bottom-nav-item:hover,
.mobile-bottom-nav .bottom-nav-item.active {
  color: var(--g-cta);
}

.mobile-bottom-nav .bottom-nav-item:active i {
  transform: scale(0.88);
}

.bnav-badge {
  position: absolute;
  top: -5px;
  right: -9px;
  background: var(--g-danger);
  color: #ffffff;
  font-size: 0.65rem;
  font-weight: 800;
  min-width: 17px;
  height: 17px;
  border-radius: 9px;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  box-shadow: 0 2px 4px rgba(220, 38, 38, 0.4);
}

/* ==================== RESPONSIVE BREAKPOINTS (BEST PRACTICES) ==================== */

/* Tablet & Laptop (< 1024px) */
@media (max-width: 1024px) {
  .navbar-menu {
    gap: 4px;
    margin: 0 8px;
  }
  .nav-item {
    padding: 6px 10px;
    font-size: 0.82rem;
  }
  .split-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
    width: 100%;
    max-width: 100%;
  }
  .catalog-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
  }
}

/* Tablet & Mobile (< 992px) */
@media (max-width: 992px) {
  .grantha-main-header {
    display: grid;
    grid-template-columns: 44px 1fr 44px;
    align-items: center;
    justify-items: center;
    padding: 10px 16px;
    gap: 10px;
    width: 100%;
    box-sizing: border-box;
  }

  .mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--g-surface-elevated);
    border: 1px solid var(--g-line);
    color: var(--g-text);
    font-size: 1.35rem;
    cursor: pointer;
    justify-self: start;
    transition: all 0.18s ease;
    box-shadow: var(--shadow-sm);
  }
  .mobile-menu-btn:hover {
    background: var(--g-hover);
    border-color: var(--g-accent);
  }

  .grantha-logo {
    justify-self: center;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
  }

  .navbar-logo-img {
    height: 38px;
    max-width: 165px;
    object-fit: contain;
  }

  .navbar-menu {
    display: none !important; /* Managed cleanly via mobile drawer */
  }

  .header-actions {
    justify-self: end;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0;
  }

  /* Clean Zero-Duplication: Hide Search, WhatsApp, and Theme in top mobile header (All managed in bottom bar) */
  .header-actions .nav-search-icon-btn,
  .header-actions .theme-toggle-btn {
    display: none !important;
  }

  /* Cart Icon in top right header */
  .cart-btn-elevated {
    padding: 0;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: var(--g-cta);
    color: #ffffff;
    border: none;
    box-shadow: 0 2px 8px rgba(93, 82, 148, 0.3);
  }
  .cart-btn-elevated:hover {
    background: var(--g-cta-hover);
    transform: translateY(-1px);
  }
  .cart-btn-elevated i {
    font-size: 1.25rem;
  }
  .cart-btn-elevated span:not(.cart-count-badge) {
    display: none !important;
  }

  .services-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
  .gf-main {
    grid-template-columns: repeat(2, 1fr);
    gap: 32px;
  }
}

/* Standard Mobile & Phablet (< 768px) */
@media (max-width: 768px) {
  body {
    padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
  }
  .mobile-bottom-nav {
    display: flex;
  }
  .grantha-topbar {
    padding: 4px 12px;
    font-size: 0.72rem;
    justify-content: center;
    min-height: 28px;
  }
  .grantha-topbar .announcement {
    font-size: 0.72rem;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }
  .grantha-topbar .announcement .announcement-desktop-text {
    display: none;
  }
  .grantha-topbar .announcement .announcement-mobile-text {
    display: inline;
  }
  .topbar-right {
    display: none;
  }
  .home-search {
    margin: 18px auto 14px;
    padding: 0 16px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    text-align: center;
  }
  .hero-badge-pill {
    font-size: 0.76rem;
    padding: 5px 12px;
    margin-bottom: 10px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
  }
  .home-search-title {
    font-size: 1.55rem;
    letter-spacing: -0.025em;
    line-height: 1.22;
    margin-bottom: 6px;
    font-weight: 800;
    word-break: break-word;
  }
  .home-search-subtitle {
    font-size: 0.84rem;
    line-height: 1.4;
    color: var(--g-muted2);
    margin: 0 auto 14px;
    max-width: 440px;
  }
  .home-search-container {
    width: 100%;
    max-width: 100%;
    position: relative;
    margin-bottom: 10px;
  }
  .home-search-box {
    padding: 4px 5px 4px 14px;
    min-height: 48px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    border-radius: var(--radius-full);
    background: var(--g-surface-elevated);
    border: 2px solid var(--g-line-strong);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  }
  .search-leading-icon {
    font-size: 1.25rem;
    color: var(--g-accent);
    margin-right: 6px;
    flex-shrink: 0;
  }
  .home-search-box .search-input {
    font-size: 15px;
    padding: 8px 4px;
    min-width: 0;
    width: 100%;
    font-style: normal;
  }
  .home-search-box .search-input::placeholder {
    font-style: normal;
    color: var(--g-muted);
    font-size: 0.84rem;
  }
  .home-search-box .search-btn {
    padding: 8px 14px;
    font-size: 0.84rem;
    font-weight: 700;
    border-radius: var(--radius-full);
    height: 38px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 6px;
  }
  .quick-search-tags {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 8px 0 12px;
    overflow-x: auto;
    flex-wrap: nowrap;
    justify-content: flex-start;
    padding: 2px 2px 8px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  .quick-search-tags::-webkit-scrollbar {
    display: none;
  }
  .quick-tag {
    flex-shrink: 0;
    padding: 5px 13px;
    font-size: 0.76rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    background: var(--g-surface-elevated);
    border: 1.5px solid var(--g-line-strong);
    color: var(--g-text);
    white-space: nowrap;
    transition: all 0.15s ease;
    letter-spacing: 0.01em;
  }
  .quick-tag:hover {
    background: var(--g-accent-tint);
    border-color: var(--g-accent);
    color: var(--g-accent);
  }
  .quick-tag:active {
    background: var(--g-accent);
    color: #ffffff;
    border-color: var(--g-accent);
    transform: scale(0.96);
  }
  .home-search-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px 12px;
    font-size: 0.74rem;
    color: var(--g-muted2);
    margin: 6px 0 0;
    line-height: 1.4;
  }
  .home-search-meta span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
  }
  .home-search-hint {
    width: 100%;
    text-align: center;
    color: var(--g-accent);
    font-size: 0.72rem;
    font-weight: 600;
    margin-top: 2px;
  }
  .hero-slider-section {
    padding: 0 16px;
    width: 100%;
    max-width: 100%;
    margin: 0 auto 18px;
    box-sizing: border-box;
  }
  .hero-slider-wrap {
    border-radius: var(--radius-md);
  }
  .slider-arrow {
    display: none; /* Natural touch swipe replaces clunky arrows */
  }
  .category-pills-bar {
    padding: 0 12px;
    margin-bottom: 30px;
  }
  .pills-scroll {
    gap: 7px;
    justify-content: center;
    padding: 2px 0 6px;
  }
  .category-pill {
    padding: 7px 12px;
    font-size: 0.8rem;
    gap: 6px;
    min-height: 35px;
  }
  .category-pill i {
    font-size: 0.95rem;
  }
  .pill-count {
    font-size: 0.7rem;
    padding: 1px 6px;
  }
  .split-trending-section {
    padding: 0 16px;
    margin-bottom: 36px;
  }
  .trending-widget {
    padding: 16px 14px;
    border-radius: var(--radius-md);
  }
  .trending-widget .section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
    flex-wrap: nowrap;
  }
  .trending-widget .section-heading {
    flex: 1;
    min-width: 0;
  }
  .trending-widget .section-kicker {
    font-size: 0.68rem;
    margin-bottom: 2px;
  }
  .trending-widget .section-heading h2 {
    font-size: 1.25rem;
    line-height: 1.2;
    margin: 0 0 2px 0;
  }
  .trending-widget .section-subtitle {
    font-size: 0.78rem;
    color: var(--g-muted);
    line-height: 1.35;
    display: block;
  }
  .trending-widget .section-link {
    font-size: 0.82rem;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
    margin-top: 2px;
  }
  .trending-item {
    padding: 8px 10px;
    gap: 10px;
  }
  .trending-rank {
    width: 22px;
    font-size: 0.95rem;
    font-weight: 800;
    flex-shrink: 0;
  }
  .trending-thumb {
    width: 40px;
    height: 58px;
    border-radius: 4px;
    flex-shrink: 0;
  }
  .trending-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
  }
  .trending-title {
    font-size: 0.86rem;
    font-weight: 700;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
  }
  .trending-author {
    font-size: 0.73rem;
    color: var(--g-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
  }
  .trending-sub {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    width: 100%;
    margin-top: 0;
  }
  .trending-meta-left {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
  }
  .trending-price {
    font-size: 0.84rem;
    font-weight: 800;
    color: var(--g-danger);
    white-space: nowrap;
    flex-shrink: 0;
  }
  .trending-move {
    font-size: 0.64rem;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 3px;
    white-space: nowrap;
    flex-shrink: 0;
    letter-spacing: 0.02em;
    text-transform: uppercase;
  }
  .trending-stat {
    font-size: 0.70rem;
    font-weight: 600;
    color: var(--g-muted2);
    white-space: nowrap;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-left: auto;
  }
  .book-rail-section {
    padding: 0 16px;
    margin-bottom: 36px;
  }
  .section-header {
    margin-bottom: 14px;
  }
  .section-heading h2 {
    font-size: 1.3rem;
  }
  .rail-controls {
    display: none; /* Thumb swiping */
  }
  .book-rail {
    gap: 12px;
    padding: 4px 2px 14px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
  }
  .book-card {
    flex: 0 0 148px;
    padding: 9px;
    scroll-snap-align: start;
    border-radius: var(--radius-sm);
  }
  .book-cover-wrap {
    aspect-ratio: 1 / 1.45;
    margin-bottom: 6px;
  }
  .book-title {
    font-size: 0.82rem;
    line-height: 1.25;
    height: 2.5em;
    margin-bottom: 2px;
  }
  .book-author {
    font-size: 0.72rem;
    margin-bottom: 4px;
  }
  .book-price {
    font-size: 0.88rem;
  }
  .book-was-price {
    font-size: 0.72rem;
  }
  /* Touch screens: a round cart icon in the cover's corner (matching the heart), always visible
     and taking no space; the cover crops anything placed below the image */
  .book-quick-cart {
    opacity: 1;
    transform: none;
    top: auto;
    bottom: 8px;
    left: auto;
    right: 8px;
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid var(--g-line);
    background: var(--g-surface-elevated);
    color: var(--g-accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.14);
  }
  /* Icon only: the label leaves the layout so it can't push the icon off centre */
  .book-quick-cart .quick-cart-label { display: none; }
  .book-quick-cart i { font-size: 1.05rem; line-height: 1; }
  .catalog-section {
    padding: 0 16px;
    margin-bottom: 44px;
  }
  .catalog-header-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 18px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  .catalog-controls {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: space-between;
  }
  .mobile-filter-btn {
    flex-shrink: 0;
    padding: 8px 12px;
  }
  .sort-control-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
    max-width: 100%;
  }
  .sort-control-group label {
    display: none; /* Hide label on mobile to maximize room */
  }
  .sort-select {
    flex: 1;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    font-size: 0.82rem;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    text-overflow: ellipsis;
  }
  .catalog-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    width: 100%;
    max-width: 100%;
  }
  .services-bar {
    padding: 28px 16px;
  }
  .services-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .service-card {
    padding: 12px;
  }
  .gf-main {
    grid-template-columns: 1fr;
    gap: 28px;
    padding: 36px 16px;
  }
  .gf-pay-bar {
    flex-direction: column;
    gap: 12px;
    text-align: center;
    padding-bottom: 20px;
  }
  .cart-drawer {
    width: 100%;
    max-width: 100%;
  }
  .cart-footer {
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  }
  .checkout-modal-box {
    width: 95%;
    max-width: 520px;
    max-height: 88vh;
    padding: 20px 16px;
    border-radius: var(--radius-lg);
  }

  /* Mobile Product Detail Modal / Bottom Sheet Optimization */
  #detail_modal {
    align-items: flex-end;
    padding: 0;
  }
  #detail_modal .modal-box {
    width: 100%;
    max-width: 100%;
    height: 92vh;
    max-height: 92vh;
    margin: 0;
    border-radius: 24px 24px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--g-surface-elevated);
    box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.45);
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  }
  #detail_modal.active .modal-box {
    transform: translateY(0);
  }

  #detail_modal .modal-sheet-handle-wrap {
    display: flex !important;
    justify-content: center;
    padding: 10px 0 4px;
    cursor: pointer;
    flex-shrink: 0;
    background: var(--g-surface-elevated);
  }
  #detail_modal .modal-sheet-handle {
    width: 44px;
    height: 5px;
    border-radius: 999px;
    background: var(--g-line-strong);
  }

  #detail_modal .modal-close-btn {
    top: 10px;
    right: 14px;
    width: 34px;
    height: 34px;
    font-size: 1.15rem;
    z-index: 100;
  }

  #detail_modal_body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 16px 20px 16px;
    -webkit-overflow-scrolling: touch;
  }

  /* Sticky Bottom Action Bar (Docked at base of modal bottom sheet) */
  .modal-mobile-action-bar {
    flex-shrink: 0;
    width: 100%;
    z-index: 20;
    background: var(--g-surface-elevated);
    border-top: 1px solid var(--g-line);
    padding: 10px 14px calc(12px + env(safe-area-inset-bottom, 0px));
    display: flex !important;
    align-items: center;
    gap: 8px;
    box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.16);
    box-sizing: border-box;
  }
  .modal-m-stepper {
    display: flex;
    align-items: center;
    border: 1px solid var(--g-line);
    border-radius: var(--radius-sm);
    background: var(--g-surface);
    height: 42px;
  }
  .modal-m-stepper button {
    width: 28px;
    height: 100%;
    border: none;
    background: none;
    font-size: 0.95rem;
    cursor: pointer;
    color: var(--g-text);
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .modal-m-stepper input {
    width: 26px;
    text-align: center;
    border: none;
    background: none;
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--g-text);
    padding: 0;
  }
  .btn-modal-m-cart {
    flex: 1;
    height: 42px;
    background: var(--g-accent);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    white-space: nowrap;
    padding: 0 8px;
    transition: opacity 0.15s;
  }
  .btn-modal-m-cart:active {
    opacity: 0.85;
  }
  .btn-modal-m-buy {
    flex: 1;
    height: 42px;
    background: var(--g-cta);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    white-space: nowrap;
    padding: 0 8px;
    transition: opacity 0.15s;
  }
  .btn-modal-m-buy:active {
    opacity: 0.85;
  }

  /* Dimmed Facet zero counts */
  .sidebar-cat-row.is-zero, .sidebar-subcat-row.is-zero, .publisher-filter-item.is-zero {
    opacity: 0.52;
  }
  .sidebar-cat-count.zero-count, .pub-count.zero-count {
    color: var(--g-muted);
  }
}

/* Small Smartphone (< 380px - e.g. iPhone SE, Fold) */
@media (max-width: 380px) {
  .grantha-main-header {
    padding: 8px 12px;
    gap: 8px;
  }
  .navbar-logo-img {
    height: 30px;
    max-width: 125px;
  }
  .mobile-menu-btn, .nav-icon-btn {
    width: 36px;
    height: 36px;
    font-size: 1.15rem;
  }
  .home-search-title {
    font-size: 1.45rem;
  }
  .home-search-box .search-btn span {
    display: none; /* Show search icon only */
  }
  .home-search-box .search-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
  }
  .trending-item {
    padding: 7px 8px;
    gap: 8px;
  }
  .trending-thumb {
    width: 36px;
    height: 52px;
  }
  .trending-rank {
    width: 18px;
    font-size: 0.88rem;
  }
  .trending-price {
    font-size: 0.80rem;
  }
  .trending-move {
    font-size: 0.60rem;
    padding: 1px 4px;
  }
  .trending-stat {
    font-size: 0.66rem;
  }
  .book-card {
    flex: 0 0 134px;
    padding: 8px;
  }
  .catalog-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .mobile-bottom-nav {
    height: 56px;
  }
  .mobile-bottom-nav .bottom-nav-item span {
    font-size: 0.65rem;
  }
}

/* ==================== 15. POLICY & INFORMATION PAGES ==================== */
.info-page-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 20px 80px;
}

.info-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--g-muted);
  margin-bottom: 24px;
}

.info-breadcrumbs a {
  color: var(--g-muted2);
  transition: color 0.15s ease;
}

.info-breadcrumbs a:hover {
  color: var(--g-accent);
}

.info-breadcrumbs i {
  font-size: 0.75rem;
}

.info-hero {
  text-align: center;
  margin-bottom: 40px;
  padding: 40px 20px;
  background: radial-gradient(circle at 50% 0%, rgba(106, 93, 192, 0.12) 0%, transparent 70%);
  border-radius: var(--radius-xl);
  border: 1px solid var(--g-line);
}

.info-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: var(--g-accent-tint);
  border: 1px solid var(--g-accent-line);
  color: var(--g-accent-text);
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 16px;
}

.info-title {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
  color: var(--g-text);
}

.info-subtitle {
  font-size: 1.05rem;
  color: var(--g-muted2);
  max-width: 680px;
  margin: 0 auto;
  line-height: 1.6;
}

.info-card {
  background: var(--g-surface);
  border: 1px solid var(--g-line);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 28px;
  box-shadow: var(--shadow-sm);
}

.info-card h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--g-text);
  display: flex;
  align-items: center;
  gap: 10px;
}

.info-card h2 i {
  color: var(--g-accent);
}

.info-card p {
  color: var(--g-muted2);
  line-height: 1.7;
  margin-bottom: 16px;
  font-size: 0.95rem;
}

.info-card ul {
  list-style: none;
  padding: 0;
  margin: 0 0 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.info-card ul li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--g-muted2);
  font-size: 0.92rem;
  line-height: 1.5;
}

.info-card ul li i {
  color: var(--g-accent);
  margin-top: 3px;
  flex-shrink: 0;
}

/* Store Locations Grid */
.store-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin-top: 24px;
}

.store-card {
  background: var(--g-surface-elevated);
  border: 1px solid var(--g-line-strong);
  border-radius: var(--radius-md);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.store-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.store-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.store-badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  background: var(--g-accent-tint);
  color: var(--g-accent-text);
}

.store-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--g-text);
  margin-bottom: 4px;
}

.store-detail {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.88rem;
  color: var(--g-muted2);
}

.store-detail i {
  color: var(--g-accent);
  font-size: 1.1rem;
  margin-top: 2px;
  flex-shrink: 0;
}

.store-actions {
  display: flex;
  gap: 10px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--g-line);
}

.store-action-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  border: 1px solid var(--g-line-strong);
  color: var(--g-text);
  background: var(--g-surface);
  transition: all 0.15s ease;
}

.store-action-btn:hover {
  background: var(--g-accent-tint);
  border-color: var(--g-accent-line);
  color: var(--g-accent-text);
}

/* Delivery Pricing Grid */
.delivery-pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin: 24px 0;
}

.delivery-card {
  background: var(--g-surface-elevated);
  border: 1px solid var(--g-line);
  border-radius: var(--radius-md);
  padding: 24px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
}

.delivery-card.featured {
  border-color: var(--g-accent);
  box-shadow: 0 0 0 1px var(--g-accent);
  position: relative;
}

.delivery-card-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-full);
  background: var(--g-accent-tint);
  color: var(--g-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  margin: 0 auto 16px;
}

.delivery-method-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--g-text);
  margin-bottom: 6px;
}

.delivery-time {
  font-size: 0.8rem;
  color: var(--g-muted);
  margin-bottom: 16px;
}

.delivery-price-box {
  margin: auto 0 16px;
  padding: 12px;
  background: var(--g-surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--g-line);
}

.delivery-price-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--g-muted2);
  padding: 4px 0;
}

.delivery-price-val {
  font-weight: 700;
  color: var(--g-text);
}

/* Contact Page Form & Split Layout */
.contact-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 36px;
}

.contact-channels-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.contact-channel-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--g-surface-elevated);
  border: 1px solid var(--g-line);
  border-radius: var(--radius-md);
  color: var(--g-text);
  transition: all 0.2s ease;
}

.contact-channel-card:hover {
  transform: translateX(4px);
  border-color: var(--g-accent-line);
  background: var(--g-accent-tint);
}

.contact-channel-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.contact-channel-icon.wa { background: rgba(37, 211, 102, 0.15); color: #25d366; }
.contact-channel-icon.phone { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.contact-channel-icon.mail { background: rgba(168, 85, 247, 0.15); color: #a855f7; }
.contact-channel-icon.fb { background: rgba(24, 119, 242, 0.15); color: #1877f2; }

.contact-form-group {
  margin-bottom: 16px;
}

.contact-form-label {
  display: block;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--g-text);
  margin-bottom: 6px;
}

.contact-input, .contact-textarea {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  background: var(--g-surface-elevated);
  border: 1px solid var(--g-line-strong);
  color: var(--g-text);
  font-family: inherit;
  font-size: 0.92rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.contact-input:focus, .contact-textarea:focus {
  border-color: var(--g-accent);
  box-shadow: 0 0 0 3px var(--g-accent-tint);
}

.contact-textarea {
  resize: vertical;
  min-height: 120px;
}

.contact-submit-btn {
  width: 100%;
  padding: 13px 20px;
  border-radius: var(--radius-sm);
  background: var(--g-cta);
  color: #fff;
  border: none;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.15s ease, transform 0.1s ease;
}

.contact-submit-btn:hover {
  background: var(--g-cta-hover);
  transform: translateY(-1px);
}

/* Responsive tweaks for Info Pages */
@media (max-width: 860px) {
  .store-grid {
    grid-template-columns: 1fr;
  }
  .delivery-pricing-grid {
    grid-template-columns: 1fr;
  }
  .contact-layout {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .info-title {
    font-size: 1.75rem;
  }
  .info-hero {
    padding: 30px 16px;
  }
  .info-card {
    padding: 20px 16px;
  }
}

/* ==========================================================================
   16. CATEGORY MEGA-MENU & CATALOG FILTER SIDEBAR
   ========================================================================== */

/* Navbar Category Dropdown & Mega-Menu */
.grantha-main-header {
  position: relative;
}

.nav-item-dropdown {
  position: static;
  display: inline-flex;
  align-items: center;
}

.nav-categories-trigger {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}

.nav-categories-trigger .dropdown-arrow {
  font-size: 0.82rem;
  transition: transform 0.2s ease;
}

.nav-item-dropdown.is-open .nav-categories-trigger .dropdown-arrow,
.nav-item-dropdown.active .nav-categories-trigger .dropdown-arrow {
  transform: rotate(180deg);
}

.mega-menu {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  width: min(1140px, 96vw);
  background: var(--g-surface);
  border: 1px solid var(--g-line-strong);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.45), 0 0 1px 1px var(--g-line);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  z-index: 1050;
  overflow: hidden;
}

html[data-theme="light"] .mega-menu {
  background: #ffffff !important;
  box-shadow: 0 24px 60px -10px rgba(15, 23, 42, 0.2), 0 0 0 1px rgba(0, 0, 0, 0.08);
}

html[data-theme="dark"] .mega-menu {
  background: #111424 !important;
  box-shadow: 0 28px 70px -10px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

/* Opening is driven by app.js (hover intent with a close delay); focus-within keeps it
   keyboard-accessible. */
.nav-item-dropdown:not(.is-dismissed):has(:focus-visible) .mega-menu,
.nav-item-dropdown.is-open .mega-menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.nav-item-dropdown.closed .mega-menu {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.mega-menu-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  padding: 24px 28px;
  max-height: 480px;
  overflow-y: auto;
}

.mega-col {
  display: flex;
  flex-direction: column;
}

.mega-col-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--g-text);
  padding-bottom: 8px;
  margin-bottom: 8px;
  border-bottom: 2px solid var(--g-accent-line);
  text-decoration: none;
  transition: color 0.15s ease;
}

.mega-col-title i {
  color: var(--g-accent);
  font-size: 1.1rem;
}

.mega-col-title:hover {
  color: var(--g-accent);
}

.mega-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mega-links li a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  color: var(--g-muted);
  font-size: 0.84rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.15s ease;
}

.mega-links li a:hover {
  background: var(--g-hover);
  color: var(--g-text);
  transform: translateX(3px);
}

.mega-count {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  background: var(--g-hover);
  color: var(--g-muted2);
}

.mega-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  background: rgba(234, 88, 12, 0.15);
  color: #ea580c;
}

.mega-menu-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: var(--g-surface-elevated);
  border-top: 1px solid var(--g-line);
}

.mega-footer-left {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--g-muted);
}

.mega-footer-left i {
  font-size: 1.2rem;
  color: var(--g-accent);
}

.mega-footer-btn {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--g-accent);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: gap 0.15s ease;
}

.mega-footer-btn:hover {
  gap: 8px;
  color: var(--g-cta);
}

/* ==================== CATALOG CONTAINER & FILTER SIDEBAR ==================== */
.filter-sidebar-backdrop {
  display: none;
}

.catalog-container-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 28px;
  align-items: stretch;
  margin-top: 16px;
}

.catalog-main-content {
  min-width: 0;
  width: 100%;
}

/* Sidebar Styles - Height auto-fits to content on desktop */
.catalog-filters-sidebar {
  background: var(--g-card-bg);
  border: 1px solid var(--g-line);
  border-radius: var(--radius-md);
  padding: 24px 20px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  height: fit-content;
  align-self: flex-start;
  position: sticky;
  top: 80px;
  box-sizing: border-box;
  overflow: visible;
}

.filter-sheet-handle-wrap {
  display: none;
}

.filter-sidebar-mobile-footer {
  display: none;
}

.filter-sidebar-scroll-body {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.filter-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--g-line);
}

.filter-sidebar-header h3 {
  font-size: 1.05rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: var(--g-text);
}

.filter-sidebar-header h3 i {
  color: var(--g-accent);
}

.btn-clear-filters {
  background: none;
  border: none;
  color: var(--g-accent);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.btn-clear-filters:hover {
  background: var(--g-accent-tint);
  color: var(--g-cta);
}

.filter-sidebar-close {
  display: none;
  background: var(--g-hover);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  align-items: center;
  justify-content: center;
  color: var(--g-text);
  font-size: 1.1rem;
  cursor: pointer;
}

/* Filter Widgets */
.filter-widget {
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--g-line);
}

.filter-widget:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.filter-widget-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--g-text);
  margin-bottom: 12px;
  letter-spacing: -0.01em;
}

.filter-widget-title span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.filter-widget-title i {
  color: var(--g-accent);
}

/* Category Tree in Sidebar */
.filter-categories-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 260px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--g-line-strong) transparent;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

.sidebar-cat-item {
  display: flex;
  flex-direction: column;
}

.sidebar-cat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--g-muted);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: all 0.15s ease;
}

.sidebar-cat-row:hover {
  background: var(--g-hover);
  color: var(--g-text);
}

.sidebar-cat-row.active {
  background: var(--g-accent-tint);
  color: var(--g-accent);
  font-weight: 700;
}

.sidebar-cat-count {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--g-muted2);
  background: var(--g-surface-elevated);
  padding: 1px 6px;
  border-radius: var(--radius-full);
}

.sidebar-cat-row.active .sidebar-cat-count {
  background: var(--g-accent);
  color: #fff;
}

/* Subcategories Indented List */
.sidebar-subcat-list {
  margin-left: 12px;
  padding-left: 10px;
  border-left: 2px solid var(--g-line);
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 2px;
  margin-bottom: 4px;
}

.sidebar-subcat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--g-muted);
  cursor: pointer;
  border: none;
  background: none;
  text-align: left;
  transition: all 0.15s ease;
}

.sidebar-subcat-row:hover {
  background: var(--g-hover);
  color: var(--g-text);
}

.sidebar-subcat-row.active {
  color: var(--g-accent);
  font-weight: 700;
  background: var(--g-accent-tint);
}

/* ==================== DUAL-THUMB PRICE RANGE SLIDER ==================== */
.filter-price-widget .filter-widget-title {
  margin-bottom: 14px;
}

.price-range-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--g-accent-tint);
  color: var(--g-accent);
  border: 1px solid var(--g-accent-line);
  transition: all 0.2s ease;
}

.price-range-badge.active {
  background: var(--g-cta);
  color: #fff;
  border-color: var(--g-cta);
}

.price-slider-values {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 16px;
}

.price-val-box {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--g-surface-elevated);
  border: 1px solid var(--g-line);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  transition: border-color 0.15s ease;
}

.price-val-box:focus-within {
  border-color: var(--g-accent);
}

.price-val-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--g-muted2);
}

.price-val-amount {
  font-size: 0.86rem;
  color: var(--g-text);
  font-weight: 600;
  margin-top: 1px;
}

.price-val-amount strong {
  font-weight: 800;
  color: var(--g-accent);
}

.price-val-separator {
  color: var(--g-muted);
  font-weight: 700;
  font-size: 0.95rem;
}

.price-slider-container {
  position: relative;
  height: 28px;
  display: flex;
  align-items: center;
  margin: 10px 4px 18px;
}

.price-slider-track {
  position: absolute;
  left: 0;
  right: 0;
  height: 6px;
  border-radius: 999px;
  background: var(--g-line);
  z-index: 1;
}

.price-slider-fill {
  position: absolute;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--g-accent), var(--g-cta));
  z-index: 2;
  left: 0%;
  right: 0%;
  transition: left 0.05s ease, right 0.05s ease;
}

.price-range-input {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 28px;
  background: none;
  pointer-events: none;
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
  z-index: 3;
}

.price-range-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--g-cta);
  border: 3px solid #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28), 0 0 0 1px rgba(93, 82, 148, 0.4);
  cursor: pointer;
  pointer-events: auto;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.price-range-input::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--g-cta);
  border: 3px solid #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28), 0 0 0 1px rgba(93, 82, 148, 0.4);
  cursor: pointer;
  pointer-events: auto;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.price-range-input::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 4px 12px rgba(93, 82, 148, 0.45), 0 0 0 2px var(--g-accent);
}

.price-range-input::-moz-range-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 4px 12px rgba(93, 82, 148, 0.45), 0 0 0 2px var(--g-accent);
}

.price-range-input:active::-webkit-slider-thumb {
  transform: scale(1.22);
}

.price-range-input:active::-moz-range-thumb {
  transform: scale(1.22);
}

/* Preset Pills & Discount Filters (Unified 2-Column Responsive Layout) */
.price-preset-pills,
.filter-discount-levels {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 7px;
}

.price-preset,
.discount-level {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--g-line);
  background: var(--g-surface-elevated);
  color: var(--g-text);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  text-align: center;
  box-sizing: border-box;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
  user-select: none;
}

/* Master Reset / All button spans full width for clear visual hierarchy */
.price-preset:first-child,
.price-preset.is-all {
  grid-column: 1 / -1;
}

.price-preset:hover,
.discount-level:hover:not(:disabled) {
  background: var(--g-hover);
  border-color: var(--g-accent-line);
  color: var(--g-accent);
}

.price-preset.active,
.discount-level.active {
  background: var(--g-accent);
  border-color: var(--g-accent);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(22, 101, 52, 0.28);
}

.discount-level:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.discount-level-label {
  display: inline-block;
  white-space: nowrap;
}

.discount-level-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, 0.06);
  color: var(--g-muted2);
  line-height: 1.25;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.discount-level.active .discount-level-count {
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

@media (max-width: 992px) {
  .price-preset,
  .discount-level {
    min-height: 40px;
    padding: 8px 12px;
  }
}

.filter-sheet-handle {
  display: none;
}

.filter-sidebar-mobile-footer {
  display: none;
}

/* Publisher & Author Filter Lists */
.filter-publishers-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 240px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--g-line-strong) transparent;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

.publisher-filter-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--g-muted);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  transition: background 0.15s ease;
}

.publisher-filter-item:hover {
  background: var(--g-hover);
  color: var(--g-text);
}

.publisher-filter-item input[type="radio"],
.publisher-filter-item input[type="checkbox"] {
  margin-right: 8px;
  accent-color: var(--g-accent);
}

.publisher-filter-item .pub-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.publisher-filter-item .pub-count {
  font-size: 0.72rem;
  color: var(--g-muted2);
  margin-left: 6px;
}

/* Availability & Deals Checkboxes */
.filter-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--g-text);
  cursor: pointer;
  margin-bottom: 8px;
  padding: 4px 0;
}

.filter-checkbox-label input {
  width: 16px;
  height: 16px;
  accent-color: var(--g-accent);
  cursor: pointer;
}

/* Mobile Filter Trigger Button */
.mobile-filter-btn {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: var(--g-card-bg);
  border: 1px solid var(--g-line);
  color: var(--g-text);
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
}

.mobile-filter-btn .filter-count-badge {
  background: var(--g-cta);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: var(--radius-full);
}

/* Active Filter Chips Bar */
.active-filters-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding: 10px 14px;
  background: var(--g-surface-elevated);
  border: 1px solid var(--g-line);
  border-radius: var(--radius-md);
}

.active-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: var(--g-card-bg);
  border: 1px solid var(--g-accent-line);
  color: var(--g-text);
  font-size: 0.8rem;
  font-weight: 600;
}

.active-filter-chip button {
  background: none;
  border: none;
  color: var(--g-muted2);
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 0;
  font-size: 0.95rem;
  transition: color 0.15s ease;
}

.active-filter-chip button:hover {
  color: var(--g-danger);
}

/* Responsive Behavior for Catalog & Mega-Menu */
@media (max-width: 992px) {
  .nav-item-dropdown {
    display: none; /* Mobile uses mobile drawer navigation */
  }

  .catalog-container-layout {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .mobile-filter-btn {
    display: inline-flex;
  }

  .filter-sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
    z-index: 1100;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s;
  }

  .filter-sidebar-backdrop.active {
    display: block;
    opacity: 1;
    visibility: visible;
  }

  .filter-sheet-handle-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 12px 0 6px;
    cursor: pointer;
    flex-shrink: 0;
    width: 100%;
    background: var(--g-surface-elevated);
  }

  .filter-sheet-handle {
    display: block;
    width: 44px;
    height: 5px;
    border-radius: 999px;
    background: var(--g-line-strong);
    margin: 0 auto;
    flex-shrink: 0;
  }

  .catalog-filters-sidebar {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 88vh;
    height: 85vh;
    border-radius: 24px 24px 0 0;
    z-index: 1110;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s;
    box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.5);
    visibility: hidden;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    background: var(--g-surface-elevated) !important;
    border-top: 1px solid var(--g-line-strong);
    border-left: none;
    border-right: none;
    border-bottom: none;
  }

  .catalog-filters-sidebar.active {
    transform: translateY(0);
    visibility: visible;
    pointer-events: auto;
  }

  .filter-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 20px 14px;
    border-bottom: 1px solid var(--g-line);
    background: var(--g-surface-elevated);
    flex-shrink: 0;
    margin: 0;
  }

  .filter-sidebar-close {
    display: inline-flex;
  }

  .filter-sidebar-scroll-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 16px 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    background: var(--g-surface-elevated);
  }

  .filter-sidebar-mobile-footer {
    display: flex;
    gap: 12px;
    padding: 12px 20px calc(14px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--g-line);
    background: var(--g-surface-elevated);
    flex-shrink: 0;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
    position: static;
    margin: 0;
  }

  .btn-filter-reset {
    flex: 1;
    padding: 12px;
    border-radius: var(--radius-md);
    background: var(--g-hover);
    border: 1px solid var(--g-line);
    color: var(--g-text);
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.15s ease;
  }
  .btn-filter-reset:hover {
    background: var(--g-hover-strong);
  }

  .btn-filter-apply {
    flex: 2;
    padding: 12px;
    border-radius: var(--radius-md);
    background: var(--g-cta);
    border: none;
    color: #fff;
    font-weight: 700;
    font-size: 0.92rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 14px rgba(93, 82, 148, 0.35);
    transition: all 0.15s ease;
  }
  .btn-filter-apply:hover {
    background: var(--g-cta-hover);
    transform: translateY(-1px);
  }
}

/* ==================== FILTER LIST "SHOW MORE" & COMPACT SIDEBAR ==================== */
.filter-row-hidden {
  display: none !important;
}

.filter-show-more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding: 6px 8px;
  background: none;
  border: none;
  border-radius: var(--radius-xs);
  color: var(--g-accent);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}
.filter-show-more:hover {
  background: var(--g-hover);
}

/* Custom Sleek Themed Scrollbar for Filter Lists */
.filter-publishers-list::-webkit-scrollbar,
.filter-categories-list::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

.filter-publishers-list::-webkit-scrollbar-track,
.filter-categories-list::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 999px;
}

.filter-publishers-list::-webkit-scrollbar-thumb,
.filter-categories-list::-webkit-scrollbar-thumb {
  background: var(--g-line-strong);
  border-radius: 999px;
  transition: background 0.18s ease;
}

.filter-publishers-list::-webkit-scrollbar-thumb:hover,
.filter-categories-list::-webkit-scrollbar-thumb:hover {
  background: var(--g-accent);
}

.filter-list-expanded > .filter-show-more {
  position: sticky;
  bottom: 0;
  z-index: 2;
  flex-shrink: 0;
  width: 100%;
  margin-top: 4px;
  background: var(--g-card-bg);
  border-top: 1px solid var(--g-line);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.04);
  min-height: 38px;
}
.filter-list-expanded > .filter-show-more:hover {
  background: var(--g-card-bg);
  text-decoration: underline;
}

@media (max-width: 992px) {
  /* Bottom sheet is only as tall as its filters (capped), instead of a fixed 85% of the screen */
  .catalog-filters-sidebar {
    height: auto;
    max-height: 85vh;
  }
  .filter-sidebar-scroll-body {
    flex: 0 1 auto;
  }
}

/* ==================== MOBILE: ANNOUNCEMENT BAR & HERO SEARCH ==================== */
@media (max-width: 768px) {
  /* Announcement always fits on a single line */
  .grantha-topbar .announcement {
    min-width: 0;
    flex-wrap: nowrap;
  }
  .grantha-topbar .announcement i {
    flex-shrink: 0;
  }
  .grantha-topbar .announcement .announcement-mobile-text {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Search: readable placeholder and an icon-only button so the input gets the width */
  .home-search-box {
    padding: 4px 4px 4px 14px;
  }
  .home-search-box .search-input {
    font-size: 16px; /* 16px stops iOS zooming into the field on focus */
  }
  .home-search-box .search-input::placeholder {
    color: var(--g-muted2);
    font-size: 15px;
    opacity: 1;
  }
  .home-search-box .search-btn {
    width: 42px;
    height: 42px;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
    font-size: 1.15rem;
  }
  .home-search-box .search-btn span {
    display: none;
  }

  /* Trending chips: edge-to-edge scroll row with a fade hinting there is more */
  .quick-search-tags {
    width: calc(100% + 32px);
    max-width: none;
    margin: 12px -16px 10px;
    padding: 2px 16px 4px;
    gap: 8px;
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent);
  }
  .quick-tag {
    height: 30px;
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    font-size: 0.8rem;
    font-weight: 600;
    border-width: 1px;
  }

  /* Stats on one tidy line; delivery time is already in the announcement bar */
  .home-search-meta {
    gap: 4px 14px;
    font-size: 0.78rem;
    color: var(--g-soft);
  }
  .home-search-meta-delivery {
    display: none !important;
  }
  .home-search-hint {
    justify-content: center;
    font-size: 0.76rem;
    margin-top: 4px;
  }
}

/* ==================== SMOOTH FILTERING ==================== */
/* Results stay in place (dimmed) while the next set loads, instead of collapsing to a spinner */
.catalog-grid {
  transition: opacity 0.18s ease;
}
.catalog-grid.is-loading {
  opacity: 0.45;
  pointer-events: none;
}

/* Scrolling to the catalog lands below the sticky header, not under it */
#catalog_section {
  scroll-margin-top: 84px;
}
@media (max-width: 768px) {
  #catalog_section {
    scroll-margin-top: 72px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .catalog-grid,
  .catalog-filters-sidebar {
    transition: none !important;
  }
}

/* ==================== RESPONSIVE HARDENING (all screen sizes) ==================== */
/* body is a column flexbox: let its children shrink to the viewport instead of growing
   to their content's min width (which clip then cut off on small phones) */
body > main,
body > section,
body > footer,
.info-page-container {
  min-width: 0;
  max-width: 100%;
}
.info-page-container {
  width: 100%;
  max-width: 1100px;
}

/* Grid tracks that can shrink below their content's min width */
.catalog-grid,
.services-grid,
.store-grid {
  min-width: 0;
}
.catalog-grid > *,
.services-grid > *,
.store-grid > *,
.info-steps-grid > *,
.contact-channel-card > * {
  min-width: 0;
}
.services-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
}
.store-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.info-steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
  gap: 20px;
  margin-top: 20px;
}
.contact-channel-card strong,
.contact-channel-card span,
.info-page-container a {
  overflow-wrap: anywhere;
}

/* Pagination wraps instead of running off narrow screens */
.pagination-wrap {
  flex-wrap: wrap;
}

@media (max-width: 860px) {
  .store-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 768px) {
  .catalog-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  /* Readable minimums for small labels */
  .mobile-bottom-nav .bottom-nav-item,
  .mobile-bottom-nav .bottom-nav-item span {
    font-size: 11px;
  }
  .trending-move {
    font-size: 10.5px;
  }
}

@media (max-width: 380px) {
  .catalog-grid {
    gap: 10px;
  }
  .pagination-wrap {
    gap: 6px;
  }
  .page-btn {
    padding: 8px 11px;
  }
}

/* Touch screens (phones, tablets, touch laptops): comfortable tap targets for small text links */
@media (pointer: coarse) {
  .topbar-right a,
  .topbar-right button,
  .section-link,
  .info-breadcrumbs a {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
  }
  .grantha-footer ul a {
    display: inline-block;
    padding: 7px 0;
  }
  .filter-show-more {
    min-height: 36px;
  }
}

/* Mid widths (phone landscape, small tablets): desktop top bar, but short announcement and no wrapping */
@media (min-width: 769px) and (max-width: 1100px) {
  .grantha-topbar .announcement .announcement-desktop-text {
    display: none;
  }
  .grantha-topbar .announcement .announcement-mobile-text {
    display: inline;
    white-space: nowrap;
  }
  .topbar-right {
    gap: 12px;
  }
}
.grantha-topbar .announcement,
.topbar-right a,
.topbar-right button {
  white-space: nowrap;
}

/* Invisible bridge over the gap between the "Categories" link and the panel, so the pointer
   never leaves the dropdown while travelling down into it */
.mega-menu::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  height: 24px;
}
.mega-menu {
  overflow: visible;
}
.mega-menu-grid {
  border-radius: inherit;
  overflow: hidden;
}
.mega-menu-footer {
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* Keyboard focus ring in the theme accent (instead of the browser's black outline) */
.nav-item:focus-visible,
.drawer-nav-link:focus-visible,
.bottom-nav-item:focus-visible {
  outline: 2px solid var(--g-accent);
  outline-offset: 2px;
}

/* ==================== CHECKOUT (server-priced summary) ==================== */
.checkout-order-summary {
  font-size: 0.88rem;
}
.checkout-summary-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--g-accent);
}
.checkout-lines {
  max-height: 170px;
  overflow-y: auto;
  margin-bottom: 10px;
  padding-right: 4px;
}
.checkout-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px dashed var(--g-line);
}
.checkout-line strong {
  color: var(--g-text);
}
.checkout-line-qty {
  color: var(--g-muted2);
  font-weight: 600;
}
.checkout-line-was {
  color: var(--g-muted);
  text-decoration: line-through;
}
.checkout-line-total {
  flex-shrink: 0;
  font-weight: 700;
  color: var(--g-cta);
}
.checkout-totals {
  border-top: 1px solid var(--g-line);
  padding-top: 8px;
  line-height: 1.7;
}
.checkout-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--g-soft);
}
.checkout-saving {
  color: var(--g-positive, #16a34a);
  font-weight: 600;
}
.checkout-free {
  color: var(--g-positive, #16a34a);
}
.checkout-grand {
  margin-top: 4px;
  font-size: 1rem;
  font-weight: 800;
  color: var(--g-text);
}
.checkout-warning,
.checkout-error {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 8px 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(220, 38, 38, 0.08);
  color: var(--g-danger, #dc2626);
  font-size: 0.85rem;
  font-weight: 600;
}
.checkout-link-btn {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}
.checkout-payment-note {
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--g-muted2);
}
.checkout-success {
  text-align: center;
  padding: 12px 4px;
}
.checkout-success-icon {
  font-size: 4rem;
  color: var(--g-positive, #16a34a);
  margin-bottom: 10px;
}
.checkout-success > p {
  margin: 10px 0 16px;
}
.checkout-success .checkout-totals {
  text-align: left;
  max-width: 340px;
  margin: 0 auto 14px;
}
.checkout-order-number {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--g-cta);
}
.checkout-success-note {
  font-size: 0.88rem;
  color: var(--g-muted2);
}
.checkout-success .btn-whatsapp-order {
  display: inline-flex;
  justify-content: center;
  margin-bottom: 12px;
}
.checkout-success .btn-primary-cart {
  display: flex;
  margin: 0 auto;
}
/* Online payment states (app.js renderPaymentScreen) */
.checkout-payment-state .checkout-success-icon { color: var(--g-accent); }
.checkout-payment-state[data-state="failed"] .checkout-success-icon { color: var(--g-danger); }
.checkout-payment-state[data-state="slow"] .checkout-success-icon { color: var(--g-warning); }
.checkout-payment-message {
  max-width: 380px;
  margin: 0 auto 14px !important;
  font-size: 0.9rem;
}
.checkout-payment-state[data-state="failed"] .checkout-payment-message { color: var(--g-danger); }
.checkout-pay-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  max-width: 340px;
  margin: 0 auto 8px;
}
.checkout-payment-help {
  max-width: 340px;
  margin: 0 auto 14px !important;
  font-size: 0.78rem;
  color: var(--g-muted2);
}
.checkout-local-test-actions {
  display: grid;
  gap: 8px;
  max-width: 340px;
  margin: 0 auto 8px;
}
.checkout-local-test-actions .checkout-pay-btn { margin: 0; }
.checkout-local-test-actions .btn-admin {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--g-border, #ddd);
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.checkout-success-icon.is-spinning {
  display: inline-block;
  animation: checkout-spin 1.1s linear infinite;
}
@keyframes checkout-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .checkout-success-icon.is-spinning { animation: none; }
}

/* ==================== PRODUCT POPUP (pd-*) ====================
   One responsive layout: centred dialog with a sticky cover on desktop, bottom sheet with a
   sticky action bar on phones. Overrides the older modal-* product styles above. */
body.modal-open {
  overflow: hidden;
}

#detail_modal .modal-box {
  max-width: 1000px;
  width: calc(100% - 48px);
  max-height: min(880px, 92vh);
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#detail_modal .pd-topbar {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 30;
  padding: 14px;
}
#detail_modal .pd-topbar .modal-close-btn {
  position: static;
  background: var(--g-surface-elevated);
  box-shadow: var(--shadow-sm);
}
#detail_modal .pd-topbar .modal-sheet-handle-wrap {
  display: none;
}

#detail_modal_body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 36px 40px 28px;
}

.pd-main {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
  gap: 40px;
  align-items: start;
}

.pd-media {
  position: sticky;
  top: 0;
}
.pd-cover-frame {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #151722;
  box-shadow: 0 18px 40px -18px rgba(15, 23, 42, 0.45);
  -webkit-mask-image: -webkit-radial-gradient(white, black);
  mask-image: radial-gradient(white, black);
  transform: translateZ(0);
  isolation: isolate;
  contain: paint;
}
.pd-cover {
  display: block;
  width: calc(100% + 4px);
  height: calc(100% + 4px);
  margin: -2px;
  object-fit: cover;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: high-quality;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform: translateZ(0);
}
.pd-ribbon {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: var(--g-danger);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
}

.pd-info {
  min-width: 0;
  padding-right: 36px; /* clear the close button */
}
.pd-eyebrow {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--g-accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
}
.pd-eyebrow:hover {
  text-decoration: underline;
}
.pd-title {
  margin: 0;
  font-size: clamp(1.35rem, 1.1rem + 0.8vw, 1.85rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--g-text);
  overflow-wrap: anywhere;
}
.pd-title-si {
  margin: 6px 0 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--g-soft);
  line-height: 1.45;
}
.pd-byline {
  margin: 10px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.92rem;
  color: var(--g-muted2);
}
.pd-byline strong {
  color: var(--g-text);
  font-weight: 600;
}

.pd-price-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}
.pd-price {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--g-danger);
  letter-spacing: -0.02em;
}
.pd-was {
  font-size: 1rem;
  color: var(--g-muted);
}
.pd-save {
  padding: 3px 9px;
  border-radius: var(--radius-full);
  background: rgba(22, 163, 74, 0.12);
  color: var(--g-positive);
  font-size: 0.8rem;
  font-weight: 700;
}
.pd-stock {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 0;
  font-size: 0.88rem;
  font-weight: 600;
}
.pd-stock.is-in {
  color: var(--g-positive);
}
.pd-stock.is-out {
  color: var(--g-danger);
}
.pd-stock-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.pd-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}
.pd-stepper {
  display: inline-flex;
  align-items: center;
  height: 48px;
  border: 1px solid var(--g-line-strong);
  border-radius: var(--radius-md);
  background: var(--g-surface);
}
.pd-stepper button {
  width: 40px;
  height: 100%;
  border: none;
  background: none;
  color: var(--g-text);
  font-size: 1rem;
  cursor: pointer;
}
.pd-stepper button:hover {
  color: var(--g-accent);
}
.pd-stepper input {
  width: 34px;
  border: none;
  background: none;
  text-align: center;
  font-weight: 700;
  color: var(--g-text);
  -moz-appearance: textfield;
}
.pd-stepper input::-webkit-inner-spin-button,
.pd-stepper input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.pd-btn {
  height: 48px;
  padding: 0 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.pd-btn-primary {
  flex: 1 1 180px;
  border: 1px solid var(--g-cta);
  background: var(--g-cta);
  color: #fff;
}
.pd-btn-primary:hover {
  background: var(--g-cta-hover, var(--g-accent));
}
.pd-btn-secondary {
  flex: 0 1 auto;
  border: 1px solid var(--g-line-strong);
  background: transparent;
  color: var(--g-text);
}
.pd-btn-secondary:hover {
  border-color: var(--g-accent);
  color: var(--g-accent);
}
.pd-btn:active {
  transform: translateY(1px);
}
.pd-whatsapp-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  color: var(--g-soft);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
}
.pd-whatsapp-link i {
  color: #25d366;
  font-size: 1.1rem;
}
.pd-whatsapp-link:hover {
  color: var(--g-text);
  text-decoration: underline;
}

.pd-assurances {
  list-style: none;
  margin: 22px 0 0;
  padding: 16px 0 0;
  border-top: 1px solid var(--g-line);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  font-size: 0.82rem;
  color: var(--g-muted2);
}
.pd-assurances li {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pd-assurances i {
  flex-shrink: 0;
  font-size: 1.15rem;
  color: var(--g-accent);
}
.pd-assurances a {
  color: inherit;
}

.pd-section {
  margin-top: 30px;
  padding-top: 24px;
  border-top: 1px solid var(--g-line);
}
.pd-section h3 {
  margin: 0 0 12px;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--g-text);
}
.pd-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.pd-muted {
  color: var(--g-muted);
  font-size: 0.82rem;
}
.pd-desc {
  max-width: 72ch;
  margin: 0 0 10px;
  color: var(--g-soft);
  line-height: 1.75;
}
.pd-specs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 32px;
  margin: 0;
}
.pd-specs > div {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--g-line);
  font-size: 0.9rem;
}
.pd-specs dt {
  color: var(--g-muted2);
}
.pd-specs dd {
  margin: 0;
  color: var(--g-text);
  font-weight: 500;
  overflow-wrap: anywhere;
}
.pd-delivery-note p {
  display: flex;
  gap: 8px;
  margin: 0;
  font-size: 0.85rem;
  color: var(--g-muted2);
  line-height: 1.6;
}
.pd-delivery-note i {
  margin-top: 3px;
  color: var(--g-accent);
}
.pd-delivery-note a {
  color: var(--g-accent);
  font-weight: 600;
}

.pd-related-rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 140px;
  gap: 16px;
  overflow-x: auto;
  padding: 4px 2px 10px;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
}
.pd-related-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0;
  border: none;
  background: none;
  text-align: left;
  cursor: pointer;
  scroll-snap-align: start;
  color: inherit;
  font: inherit;
}
.pd-related-cover {
  display: block;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #151722;
  margin-bottom: 6px;
  -webkit-mask-image: -webkit-radial-gradient(white, black);
  mask-image: radial-gradient(white, black);
  transform: translateZ(0);
  isolation: isolate;
  contain: paint;
}
.pd-related-cover img {
  display: block;
  width: calc(100% + 4px);
  height: calc(100% + 4px);
  margin: -2px;
  object-fit: cover;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: high-quality;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform: translateZ(0);
  will-change: transform;
  transition: transform 0.25s ease;
}
.pd-related-card:hover .pd-related-cover img {
  transform: scale(1.04) translateZ(0);
}
.pd-related-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--g-text);
}
.pd-related-author {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 0.78rem;
  color: var(--g-muted2);
}
.pd-related-price {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--g-danger);
}
.pd-related-price s {
  margin-left: 4px;
  color: var(--g-muted);
  font-weight: 500;
}

@media (max-width: 900px) and (min-width: 769px) {
  #detail_modal_body {
    padding: 30px 28px 24px;
  }
  .pd-main {
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 28px;
  }
  .pd-specs {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Phones: bottom sheet, compact header, sticky action bar */
@media (max-width: 768px) {
  #detail_modal .modal-box {
    width: 100%;
    max-width: 100%;
    height: 92vh;
    height: 92dvh;
    max-height: 92dvh;
    border-radius: 20px 20px 0 0;
  }
  #detail_modal .pd-topbar {
    position: relative;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 44px;
    padding: 0 12px;
    border-bottom: 1px solid var(--g-line);
  }
  #detail_modal .pd-topbar .modal-sheet-handle-wrap {
    display: flex !important;
    padding: 8px 40px;
  }
  #detail_modal .pd-topbar .modal-close-btn {
    position: absolute;
    top: 6px;
    right: 10px;
    width: 32px;
    height: 32px;
    font-size: 1.05rem;
    box-shadow: none;
  }
  #detail_modal_body {
    padding: 16px 16px 20px;
  }
  .pd-main {
    grid-template-columns: 108px minmax(0, 1fr);
    gap: 14px;
  }
  .pd-media {
    position: static;
  }
  .pd-ribbon {
    top: 6px;
    left: 6px;
    padding: 2px 7px;
    font-size: 0.7rem;
  }
  .pd-info {
    padding-right: 0;
  }
  .pd-eyebrow {
    margin-bottom: 4px;
    font-size: 0.7rem;
  }
  .pd-title {
    font-size: 1.12rem;
  }
  .pd-title-si {
    font-size: 0.95rem;
    margin-top: 2px;
  }
  .pd-byline {
    margin-top: 6px;
    font-size: 0.82rem;
  }
  .pd-price-row {
    margin-top: 10px;
    gap: 6px 8px;
  }
  .pd-price {
    font-size: 1.35rem;
  }
  .pd-was {
    font-size: 0.85rem;
  }
  .pd-save {
    font-size: 0.72rem;
  }
  .pd-stock {
    font-size: 0.78rem;
  }
  /* Actions live in the sticky bottom bar on phones */
  .pd-actions,
  .pd-whatsapp-link {
    display: none;
  }
  .pd-assurances {
    margin-top: 16px;
    padding-top: 12px;
    gap: 8px;
    font-size: 0.74rem;
  }
  .pd-assurances li {
    flex-direction: column;
    text-align: center;
    gap: 4px;
  }
  .pd-section {
    margin-top: 20px;
    padding-top: 18px;
  }
  .pd-specs {
    grid-template-columns: minmax(0, 1fr);
  }
  .pd-specs > div {
    grid-template-columns: 96px minmax(0, 1fr);
    font-size: 0.86rem;
  }
  .pd-related-rail {
    grid-auto-columns: 118px;
    gap: 12px;
  }

  #detail_modal .modal-mobile-action-bar .btn-modal-m-cart {
    background: var(--g-cta);
    text-decoration: none;
  }
  #detail_modal .modal-mobile-action-bar .btn-modal-m-buy {
    flex: 0 0 auto;
    padding: 0 14px;
    background: transparent;
    color: var(--g-text);
    border: 1px solid var(--g-line-strong);
  }
}

/* Phones: the assurance strip spans the full width under the cover + info pair */
@media (max-width: 768px) {
  .pd-assurances {
    margin-left: calc(-108px - 14px);
  }
}

#detail_modal .modal-close-btn:focus-visible,
.pd-btn:focus-visible,
.pd-related-card:focus-visible {
  outline: 2px solid var(--g-accent);
  outline-offset: 2px;
}
#detail_modal .modal-close-btn:focus:not(:focus-visible) {
  outline: none;
}

.toast-action {
  margin-left: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid currentColor;
  background: transparent;
  color: inherit;
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
}

/* ==================== POP-UP POLISH ==================== */
/* Cart quantity: real tap targets */
.cart-item-qty {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--g-line-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
  height: 34px;
}
.cart-item-qty .qty-btn { width: 34px; height: 34px; font-size: 0.9rem; }
.cart-item-qty span { min-width: 28px; text-align: center; font-weight: 700; }

/* Checkout: title clears the close button; Place Order stays reachable */
.checkout-modal-box { position: relative; }
.checkout-modal-box h2 { padding-right: 48px; }
#checkout_form button[type="submit"] {
  position: sticky;
  bottom: 0;
  box-shadow: 0 -10px 20px 6px var(--g-surface-elevated);
}

@media (max-width: 768px) {
  /* Checkout as a full-height sheet on phones */
  #checkout_modal { align-items: flex-end; padding: 0; }
  .checkout-modal-box {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 94vh !important;
    max-height: 94dvh !important;
    border-radius: 20px 20px 0 0 !important;
    padding: 18px 16px calc(16px + env(safe-area-inset-bottom, 0px)) !important;
  }
  .checkout-modal-box h2 { font-size: 1.2rem; }
  /* Toasts at the top on phones: the bottom holds the nav bar and action buttons */
  .toast-container { top: 12px; bottom: auto; left: 12px; right: 12px; }
  .toast { width: 100%; }
}

#checkout_form [aria-invalid="true"] {
  border-color: var(--g-danger);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}

/* ==================== ACCOUNT, WISHLIST & NOTIFICATIONS (account.js) ==================== */
/* Buttons with display set elsewhere still hide when JS sets [hidden] */
.nav-icon-badge[hidden], .bnav-badge[hidden],
.header-actions [hidden], .sb-form-error[hidden] {
  display: none !important;
}

.nav-account-icon { position: relative; }
.nav-account-icon.is-active,
.nav-account-icon:hover { color: var(--g-accent); }

.nav-icon-badge,
.mobile-bottom-nav .bottom-nav-item .bnav-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--g-danger);
  color: #ffffff;
  font-size: 0.66rem;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
  border: 2px solid var(--g-surface-elevated);
  box-sizing: content-box;
}
.mobile-bottom-nav .bottom-nav-item .bnav-badge {
  display: block; /* the older .bnav-badge rule above starts hidden */
  top: 4px;
  right: calc(50% - 22px);
}

/* Account button: avatar + "Hello, Nimal / Account"; the red badge counts unread notifications */
.nav-account-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 14px 0 5px;
  border-radius: var(--radius-full);
  border: 1px solid var(--g-line);
  background: var(--g-surface-elevated);
  color: var(--g-text);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  text-align: left;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.nav-account-btn:hover { border-color: var(--g-accent); box-shadow: var(--shadow-md); }
.nav-account-avatar {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--g-accent-tint);
  color: var(--g-accent-text);
  font-size: 1.05rem;
  font-weight: 800;
}
.nav-account-avatar.is-signed-in { background: var(--g-cta); color: #ffffff; font-size: 0.95rem; }
.nav-account-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; max-width: 120px; }
.nav-account-text small {
  font-size: 0.7rem;
  color: var(--g-muted2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-account-text strong { font-size: 0.86rem; font-weight: 700; }
/* On the avatar's outer corner, clear of the "Hello, ..." text */
.nav-account-btn .nav-icon-badge { top: -5px; left: -5px; right: auto; }

@media (max-width: 1240px) {
  /* Until the header reaches its full width: avatar only, so the centred menu keeps its breathing room */
  .nav-account-btn { width: 44px; padding: 0; justify-content: center; }
  .nav-account-text { display: none; }
  .nav-account-btn .nav-icon-badge { left: auto; right: -5px; }
}
@media (max-width: 992px) {
  /* Phones: wishlist and account live in the bottom bar */
  .header-actions .nav-account-icon,
  .header-actions .nav-account-btn { display: none !important; }
}

/* Heart on book covers */
.book-wish-btn {
  position: absolute;
  top: auto;
  right: auto;
  bottom: 8px;
  left: 8px;
  z-index: 3;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--g-line);
  background: var(--g-veil);
  backdrop-filter: blur(6px);
  color: var(--g-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.14);
  transition: transform 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.book-wish-btn:hover { transform: scale(1.08); color: var(--g-danger); }
.book-wish-btn.is-active { color: var(--g-danger); }

/* Heart in the product popup */
.pd-btn-wish {
  flex: 0 1 auto;
  border: 1px solid var(--g-line-strong);
  background: transparent;
  color: var(--g-text);
}
.pd-btn-wish:hover,
.pd-btn-wish.is-active { border-color: var(--g-danger); color: var(--g-danger); }

/* Side panel shared by account, wishlist and notifications */
.sb-panel-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  z-index: 1320;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.sb-panel-backdrop.active { opacity: 1; pointer-events: auto; }
.sb-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 420px;
  background: var(--g-surface-elevated);
  color: var(--g-text);
  box-shadow: var(--shadow-lg);
  z-index: 1330;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  visibility: hidden;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s;
}
.sb-panel.active { transform: translateX(0); visibility: visible; }
body.sb-panel-open { overflow: hidden; }
.sb-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--g-line);
}
.sb-panel-header h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 1.1rem;
}
.sb-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px calc(24px + env(safe-area-inset-bottom, 0px));
}

.sb-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  margin-bottom: 18px;
  border-radius: var(--radius-md);
  background: var(--g-hover-strong);
}
.sb-tab {
  height: 38px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--g-muted2);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
}
.sb-tab.active { background: var(--g-surface-elevated); color: var(--g-text); box-shadow: var(--shadow-sm); }
.sb-form .cart-checkout-btn { width: 100%; margin-top: 6px; }
.sb-form .checkout-error { margin: 4px 0 10px; }
.sb-form-note, .sb-muted {
  font-size: 0.84rem;
  color: var(--g-muted2);
  margin: 12px 0 0;
}
.sb-form-note a { color: var(--g-accent-text); font-weight: 600; }
.sb-benefits {
  list-style: none;
  margin: 22px 0 0;
  padding: 16px 0 0;
  border-top: 1px solid var(--g-line);
  display: grid;
  gap: 10px;
  font-size: 0.88rem;
  color: var(--g-soft);
}
.sb-benefits li { display: flex; align-items: center; gap: 10px; }
.sb-benefits i { color: var(--g-accent); font-size: 1.15rem; }

.sb-empty {
  text-align: center;
  padding: 48px 12px;
  color: var(--g-muted2);
}
.sb-empty > i { font-size: 3.2rem; color: var(--g-faint); margin-bottom: 10px; }
.sb-empty h3 { color: var(--g-text); font-size: 1.05rem; margin: 0 0 6px; }
.sb-empty p { font-size: 0.88rem; margin: 0 0 18px; }
.sb-empty .cart-checkout-btn { width: 100%; }
.sb-loading { padding: 24px 0; text-align: center; color: var(--g-muted2); font-size: 0.88rem; }
.sb-note {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 10px 12px;
  margin: 0 0 14px;
  border-radius: var(--radius-sm);
  background: var(--g-accent-tint);
  color: var(--g-soft);
  font-size: 0.84rem;
}

.sb-profile { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.sb-profile strong { display: block; font-size: 1rem; }
.sb-profile small { color: var(--g-muted2); font-size: 0.82rem; word-break: break-all; }
.sb-avatar {
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--g-cta);
  color: #ffffff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1.2rem;
}
.sb-links { display: grid; gap: 6px; margin-bottom: 20px; }
.sb-links button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--g-line);
  border-radius: var(--radius-md);
  background: var(--g-surface);
  color: var(--g-text);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}
.sb-links button:hover { border-color: var(--g-accent); }
.sb-links i { font-size: 1.15rem; color: var(--g-accent); }
.sb-count, .sb-pill { margin-left: auto; font-size: 0.8rem; }
.sb-count { color: var(--g-muted2); }
.sb-pill {
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--g-danger);
  color: #ffffff;
  font-weight: 700;
}
.sb-section-title { font-size: 0.95rem; margin: 0 0 10px; }
.sb-order {
  padding: 12px 14px;
  border: 1px solid var(--g-line);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
  background: var(--g-surface);
}
.sb-order[open] { border-color: var(--g-accent-line); }
.sb-order-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; cursor: pointer; list-style: none; }
.sb-order-head::-webkit-details-marker { display: none; }
.sb-order-head:focus-visible { outline: 2px solid var(--g-accent); outline-offset: 3px; border-radius: 6px; }
.sb-order-id { display: grid; gap: 2px; min-width: 0; }
.sb-order-id strong { font-size: 0.92rem; }
.sb-order small { color: var(--g-muted2); font-size: 0.8rem; }
/* order tracker: four steps, filled up to where the order is */
.sb-track { list-style: none; margin: 14px 0 4px; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
.sb-track li { display: grid; gap: 4px; align-content: start; min-width: 0; }
.sb-track-bar { height: 5px; border-radius: 3px; background: var(--g-hover-strong); }
.sb-track li.is-done .sb-track-bar { background: var(--g-accent); }
.sb-track.is-stopped li.is-done .sb-track-bar { background: var(--g-muted); }
.sb-track-label { font-size: 0.72rem; line-height: 1.25; color: var(--g-muted); }
.sb-track li.is-done .sb-track-label { color: var(--g-text); }
.sb-track li.is-current .sb-track-label { font-weight: 700; color: var(--g-accent-text); }
.sb-track-date { font-size: 0.68rem; color: var(--g-muted); }
.sb-order-note { margin: 8px 0 0; font-size: 0.82rem; color: var(--g-soft); }
.sb-order-items { list-style: none; margin: 10px 0 0; padding: 8px 0 0; border-top: 1px solid var(--g-line); display: grid; gap: 4px; font-size: 0.84rem; color: var(--g-soft); }
.sb-order-items li { display: flex; justify-content: space-between; gap: 10px; }
.sb-order-items li span:first-child { min-width: 0; overflow-wrap: anywhere; }
.sb-order-items li span:last-child { white-space: nowrap; }
.sb-order-meta { margin: 8px 0 0; display: grid; gap: 3px; font-size: 0.82rem; }
.sb-order-meta div { display: flex; justify-content: space-between; gap: 10px; }
.sb-order-meta dt { color: var(--g-muted); }
.sb-order-meta dd { margin: 0; text-align: right; color: var(--g-soft); overflow-wrap: anywhere; }
.sb-order-meta .is-total dt, .sb-order-meta .is-total dd { color: var(--g-text); font-weight: 700; }
.sb-order-meta .is-saving dt, .sb-order-meta .is-saving dd { color: var(--g-positive); }
.sb-status {
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.74rem;
  font-weight: 700;
  background: var(--g-hover-strong);
  color: var(--g-soft);
}
.sb-status-processing { background: var(--g-accent-tint); color: var(--g-accent-text); }
.sb-status-paid { background: var(--g-positive-tint); color: var(--g-positive); }
.sb-status-pending-payment { background: #fef3c7; color: #92400e; }
.sb-status-delivered { background: var(--g-positive-tint); color: var(--g-positive); }
.sb-status-cancelled { background: var(--g-danger-tint); color: var(--g-danger); }
.sb-status-payment-failed { background: var(--g-danger-tint); color: var(--g-danger); }
.sb-status-pending { background: var(--g-hover-strong); color: var(--g-soft); }
.sb-signout {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  padding: 8px 0;
  border: none;
  background: none;
  color: var(--g-danger);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
}

.sb-wish-item { align-items: flex-start; }
.sb-wish-title {
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  background: none;
  color: var(--g-text);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sb-wish-title:hover { color: var(--g-accent); }
.sb-was { text-decoration: line-through; color: var(--g-muted2); margin-left: 6px; }
.sb-wish-cart {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  height: 32px;
  padding: 0 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--g-cta);
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}
.sb-wish-cart:hover { background: var(--g-cta-hover); }
.sb-out { display: inline-block; margin-top: 8px; font-size: 0.8rem; font-weight: 600; color: var(--g-warning); }

.sb-notify-list { display: grid; gap: 6px; }
.sb-notify {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--g-line);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--g-text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.sb-notify:hover { border-color: var(--g-accent); }
.sb-notify.unread { background: var(--g-accent-tint); border-color: var(--g-accent-line); }
.sb-notify > i {
  display: grid; place-items: center; flex-shrink: 0;
  width: 36px; height: 36px; border-radius: 50%;
  font-size: 1.15rem; color: var(--g-accent-text); background: var(--g-accent-tint);
}
.sb-notify.unread > i { background: var(--g-surface); }
.sb-notify > span { min-width: 0; overflow-wrap: anywhere; }
/* unread marker */
.sb-notify.unread::after {
  content: ""; position: absolute; top: 14px; right: 12px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--g-accent);
}
.sb-notify.unread > span { padding-right: 14px; }
.sb-notify:focus-visible { outline: 2px solid var(--g-accent); outline-offset: 2px; }
.sb-notify strong { display: block; font-size: 0.9rem; }
.sb-notify small { display: block; margin-top: 2px; color: var(--g-soft); font-size: 0.82rem; }
.sb-notify em { display: block; margin-top: 4px; color: var(--g-muted); font-size: 0.75rem; font-style: normal; }

.sb-form-intro { font-size: 0.9rem; color: var(--g-soft); margin: 0 0 16px; }
.sb-field-hint { display: block; margin-top: 4px; font-size: 0.78rem; color: var(--g-muted2); }
.sb-note-ok { background: var(--g-positive-tint); }
.sb-note-ok i { color: var(--g-positive); }

/* Account panel: edit details / change password */
.sb-details { margin-top: 12px; border: 1px solid var(--g-line); border-radius: var(--radius-md); }
.sb-details summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  list-style: none;
}
.sb-details summary::-webkit-details-marker { display: none; }
.sb-details summary i { color: var(--g-accent); }
.sb-details[open] summary { border-bottom: 1px solid var(--g-line); }
.sb-details .sb-form { padding: 14px; }

/* Phone menu: account + wishlist row at the top of the drawer */
.drawer-account {
  padding: 14px 18px;
  border-bottom: 1px solid var(--g-line);
  background: var(--g-surface);
}
.drawer-account-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--g-accent-line);
  border-radius: var(--radius-md);
  background: var(--g-accent-tint);
  color: var(--g-text);
  text-align: left;
  cursor: pointer;
}
.drawer-account-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.drawer-account-text strong { font-size: 0.95rem; }
.drawer-account-text small { font-size: 0.78rem; color: var(--g-muted2); }
.drawer-account-caret { color: var(--g-muted2); }
.drawer-account .bnav-badge,
.drawer-wish-count {
  display: block;
  position: static;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--g-danger);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 20px;
  text-align: center;
  box-sizing: border-box;
}
.drawer-wish-count { margin-left: auto; background: var(--g-hover-strong); color: var(--g-text); }
.drawer-wish-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid var(--g-line);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--g-text);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
}
.drawer-wish-btn i { color: var(--g-danger); font-size: 1.15rem; }
.drawer-wish-count[hidden], .drawer-account .bnav-badge[hidden] { display: none !important; }

/* Cart: a round icon like Search and Wishlist; the red count shows once something is in it */
/* Solid accent: the one filled button in the header, so the cart stays easy to find */
.nav-cart-btn {
  position: relative;
  color: #ffffff;
  background: var(--g-cta);
  border-color: var(--g-cta);
  box-shadow: 0 2px 10px rgba(93, 82, 148, 0.30);
}
.nav-cart-btn:hover {
  color: #ffffff;
  background: var(--g-cta-hover);
  border-color: var(--g-cta-hover);
  box-shadow: 0 4px 14px rgba(93, 82, 148, 0.40);
}
.nav-cart-btn .nav-icon-badge { top: -5px; right: -5px; }
@media (max-width: 992px) {
  /* Phones: round menu and cart buttons frame the logo */
  .mobile-menu-btn { border-radius: 50%; }
  .header-actions .nav-cart-btn { display: inline-flex; }
}

/* ==================== UX PASS: touch targets, overlays, product view ==================== */
/* Product view: the wishlist heart sits on the cover, as on the catalog cards */
.pd-cover-wish { top: 10px; right: 10px; width: 38px; height: 38px; font-size: 1.15rem; }
.pd-btn-wish { flex: 1 1 160px; }

/* Phones: the product bar holds quantity, Add to cart and Buy now, which fit from 320px up */
@media (max-width: 992px) {
  .pd-whatsapp-link { display: inline-flex; margin-top: 10px; }
  #detail_modal .modal-mobile-action-bar { gap: 8px; }
  .modal-m-stepper { height: 44px; flex-shrink: 0; }
  .modal-m-stepper button { width: 36px; }
  .modal-m-stepper input { width: 28px; }
  .btn-modal-m-cart, .btn-modal-m-buy { height: 44px; min-width: 0; }
  #detail_modal .modal-mobile-action-bar .btn-modal-m-notify {
    flex: 1 1 0;
    gap: 6px;
  }
  #detail_modal .modal-mobile-action-bar .btn-modal-m-notify.is-active {
    color: var(--g-danger);
    border-color: var(--g-danger);
  }
}
@media (max-width: 360px) {
  .btn-modal-m-cart i { display: none; }
  #detail_modal .modal-mobile-action-bar .btn-modal-m-buy { padding: 0 10px; }
}

/* Comfortable tap targets */
.cart-remove-btn {
  width: 40px;
  height: 40px;
  margin: -8px -10px 0 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 1.1rem;
}
.cart-remove-btn:hover { background: var(--g-danger-tint); }
.toast-action { min-height: 32px; padding: 6px 14px; }
.slider-dot { position: relative; }
.slider-dot::after { content: ""; position: absolute; inset: -12px -6px; }

/* Messages shown while a panel, the cart or a pop-up is open stay clear of its header and buttons */
@media (max-width: 768px) {
  body.sb-panel-open .toast-container,
  body.cart-open .toast-container {
    top: calc(72px + env(safe-area-inset-top, 0px));
  }
  body.modal-open .toast-container {
    top: auto;
    bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  }
}

/* Bottom bar: badges beside the icon, not on it */
.mobile-bottom-nav .bottom-nav-item .bnav-badge { top: 2px; right: calc(50% - 27px); }

/* Touch screens: no "stuck" hover colours after a tap */
@media (hover: none) {
  .mobile-bottom-nav .bottom-nav-item:hover:not(.active) { color: var(--g-muted2); }
  .book-wish-btn:hover { transform: none; }
  .book-wish-btn:hover:not(.is-active) { color: var(--g-soft); }
  .nav-icon-btn:hover, .nav-cart-btn:hover { transform: none; }
}

/* Keyboard users see where they are */
.book-wish-btn:focus-visible,
.nav-account-btn:focus-visible,
.nav-icon-btn:focus-visible,
.drawer-account-btn:focus-visible,
.drawer-wish-btn:focus-visible,
.sb-panel button:focus-visible,
.cart-remove-btn:focus-visible {
  outline: 2px solid var(--g-accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .sb-panel, .sb-panel-backdrop, .book-wish-btn { transition: none; }
}
@media (max-width: 768px) {
  /* Small covers on phones: a lighter heart that leaves the artwork visible */
  .pd-cover-wish { top: 6px; right: 6px; width: 30px; height: 30px; font-size: 0.95rem; }
  .pd-ribbon { top: 6px; left: 6px; }
}

/* Prices stay whole on narrow cards: the old price drops under the new one instead of splitting */
.book-price-row { flex-wrap: wrap; column-gap: 6px; row-gap: 0; }
.book-price, .book-was-price { white-space: nowrap; }
/* A long author name (kept on one line) must not widen its card: that made its cover taller and
   the rail stretched every other card to match, leaving blank space above the prices */
.book-card { min-width: 0; }
.book-card > * { min-width: 0; }
/* Tablets and large phones in landscape: as many ~180px columns as fit (3 at 768px, 4 near 900px),
   instead of two oversized cards per row */
@media (min-width: 560px) and (max-width: 992px) {
  .catalog-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
}

/* Desktop header: logo | nav | actions on a three-column grid whose side columns are equal, so the
   menu sits on the page's centre line even though the action buttons are wider than the logo */
@media (min-width: 993px) {
  .grantha-main-header {
    display: grid;
    grid-template-columns: minmax(max-content, 1fr) auto minmax(max-content, 1fr);
    /* the minimum space between the menu and whatever sits either side of it */
    column-gap: 48px;
  }
  .grantha-main-header .grantha-logo { justify-self: start; }
  .grantha-main-header .navbar-menu { flex: none; margin: 0; gap: 4px; justify-content: center; }
  .grantha-main-header .nav-item { padding: 7px 12px; }
  .grantha-main-header .header-actions { justify-self: end; gap: 8px; }
}

/* ==================== CATEGORY MENU: Stationery & Gifts column, live counts ==================== */
/* Six groups as three columns on two rows: names stay on one line instead of wrapping three times */
.mega-menu-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px 28px;
  padding: 24px 28px;
  max-height: min(72vh, 600px);
}
span.mega-col-title { cursor: default; }
span.mega-col-title:hover { color: var(--g-text); }
.mega-links li a { gap: 8px; }
.mega-links li a > span { flex-shrink: 0; }
.mega-links .mega-group a { color: var(--g-text); font-weight: 600; }
.mega-links .mega-group:not(:first-child) { margin-top: 6px; }
/* Not stocked yet: visible (so shoppers know it's coming) but clearly not a link */
[data-cat].is-soon { cursor: default; opacity: 0.6; }
.mega-links li a.is-soon:hover { background: none; transform: none; color: var(--g-muted); }
.drawer-nav-link.is-soon .mega-badge { margin-left: auto; }
.catalog-coming-soon {
  grid-column: 1 / -1;
  text-align: center;
  padding: 56px 20px;
  border: 1px dashed var(--g-line-strong);
  border-radius: var(--radius-lg);
  color: var(--g-muted2);
}
.catalog-coming-soon > i { font-size: 3rem; color: var(--g-accent); }
.catalog-coming-soon h3 { margin: 10px 0 6px; color: var(--g-text); font-size: 1.25rem; }
.catalog-coming-soon p { max-width: 460px; margin: 0 auto 18px; font-size: 0.92rem; }
.catalog-coming-soon-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.catalog-coming-soon-actions .pd-btn { flex: 0 1 auto; }

/* Rails: "View all" next to the arrows; on phones the arrows hide and the link stays */
.section-actions { display: flex; align-items: center; gap: 14px; }
@media (max-width: 768px) {
  .book-rail-section .section-header { flex-wrap: nowrap; align-items: flex-end; }
  .book-rail-section .section-heading { min-width: 0; }
  .section-actions .section-link { padding: 8px 0; }
}

/* Product view: WhatsApp ordering as a clear secondary button, not an underlined sentence */
.pd-whatsapp-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding: 9px 16px;
  border: 1px solid rgba(22, 163, 74, 0.35);
  border-radius: var(--radius-full);
  background: rgba(22, 163, 74, 0.08);
  color: #15803d;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.pd-whatsapp-link i { color: #16a34a; font-size: 1.15rem; }
.pd-whatsapp-link:hover,
.pd-whatsapp-link:focus-visible {
  background: #16a34a;
  border-color: #16a34a;
  color: #ffffff;
  text-decoration: none;
}
.pd-whatsapp-link:hover i,
.pd-whatsapp-link:focus-visible i { color: #ffffff; }
html[data-theme="dark"] .pd-whatsapp-link { color: #4ade80; border-color: rgba(74, 222, 128, 0.35); background: rgba(74, 222, 128, 0.08); }
html[data-theme="dark"] .pd-whatsapp-link i { color: #4ade80; }

/* ==================== LOADING SCREEN (first visit) ==================== */
.page-loader {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: grid;
  place-items: center;
  background: var(--g-bg);
  transition: opacity 0.4s ease, visibility 0.4s ease;
  /* failsafe: if app.js never runs, the page still shows */
  animation: page-loader-failsafe 0s linear 4s forwards;
}
.page-loader.is-done { opacity: 0; visibility: hidden; pointer-events: none; }
@keyframes page-loader-failsafe { to { opacity: 0; visibility: hidden; pointer-events: none; } }
.page-loader-inner { display: flex; flex-direction: column; align-items: center; gap: 22px; padding: 24px; }
.page-loader-logo { width: min(220px, 60vw); height: auto; animation: page-loader-breathe 1.8s ease-in-out infinite; }
.page-loader-logo-dark { display: none; }
html[data-theme="dark"] .page-loader-logo-light { display: none; }
html[data-theme="dark"] .page-loader-logo-dark { display: block; }
@keyframes page-loader-breathe { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.82; transform: scale(0.97); } }
.page-loader-track {
  position: relative;
  width: min(240px, 64vw);
  height: 4px;
  border-radius: 999px;
  background: var(--g-hover-strong);
  overflow: hidden;
}
.page-loader-bar {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--g-accent), var(--g-cta));
  transform: scaleX(0.04);
  transform-origin: left center;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
/* a soft sheen running along the filled part */
.page-loader-bar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  transform: translateX(-100%);
  animation: page-loader-sheen 1.1s ease-in-out infinite;
}
@keyframes page-loader-sheen { to { transform: translateX(100%); } }
.page-loader-text { margin: 0; font-size: 0.85rem; font-weight: 500; letter-spacing: 0.02em; color: var(--g-muted2); }

/* ==================== TOP PROGRESS BAR (catalog / book loading) ==================== */
.top-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 2500;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.top-progress.is-active { opacity: 1; }
.top-progress-bar {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--g-accent), var(--g-cta));
  box-shadow: 0 0 10px var(--g-accent-line);
  transform: scaleX(0);
  transform-origin: left center;
}
/* creeps towards 85% while waiting, then completes */
.top-progress.is-active .top-progress-bar { animation: top-progress-creep 2.5s cubic-bezier(0.1, 0.6, 0.3, 1) forwards; }
.top-progress.is-done .top-progress-bar { animation: none; transform: scaleX(1); transition: transform 0.2s ease; }
.top-progress.is-done { opacity: 0; transition-delay: 0.2s; }
@keyframes top-progress-creep { from { transform: scaleX(0.05); } to { transform: scaleX(0.85); } }

@media (prefers-reduced-motion: reduce) {
  .page-loader-logo, .page-loader-bar::after { animation: none; }
  .top-progress.is-active .top-progress-bar { animation: none; transform: scaleX(0.6); }
}

.pd-whatsapp-link { white-space: nowrap; max-width: 100%; }

/* ==================== TRENDING NOW & BESTSELLERS: SHARED LAYOUT ====================
   Both panels sit in one grid and share its two rows (subgrid), so their headers are
   the same height and the two lists start on the same line whatever the subtitle length.
   Every row is the same height; the panels go one above the other below 760px. */
.split-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: auto auto;
  column-gap: 24px;
  row-gap: 0;
  align-items: stretch;
}
.trending-widget {
  display: grid;
  grid-row: span 2;
  grid-template-rows: subgrid;
  grid-template-columns: minmax(0, 1fr); /* long titles ellipsize instead of widening the panel */
  align-content: start;
  padding: 24px;
}
.trending-widget .section-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  column-gap: 16px;
  margin: 0;
  padding-bottom: 18px;
}
.trending-widget .section-heading { min-width: 0; }
.trending-widget .section-heading h2 { font-size: 1.45rem; margin: 0; }
.trending-widget .section-subtitle {
  display: block;
  margin-top: 4px;
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--g-muted);
}
.trending-widget .section-link {
  margin-top: 22px; /* lines up with the heading, not the small kicker above it */
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--g-accent-tint);
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}
.trending-widget .section-link:hover { text-decoration: none; background: var(--g-accent-line); }

.trending-list { gap: 10px; align-content: start; margin: 0; padding: 0; }
.trending-item {
  position: relative;
  min-height: 88px;
  box-sizing: border-box;
  gap: 14px;
  padding: 10px 14px 10px 10px;
}
.trending-item:focus-within { outline: 2px solid var(--g-accent); outline-offset: 2px; }
.trending-rank {
  width: 30px;
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
}
.trending-thumb { width: 46px; height: 68px; border-radius: 4px; }
.trending-info { display: flex; flex-direction: column; gap: 2px; }
.trending-title {
  display: block;
  font-size: 0.92rem;
  font-weight: 650;
  line-height: 1.3;
  color: var(--g-text);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}
/* The title link covers the whole row, so the row is one link for mouse, touch and keyboard */
.trending-title::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.trending-title:focus-visible { outline: none; }
.trending-author {
  font-size: 0.78rem;
  line-height: 1.3;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.trending-author:empty::before { content: "\00a0"; }
.trending-sub { margin-top: 4px; gap: 8px; }
.trending-meta-left { gap: 8px; }
.trending-price { font-size: 0.9rem; }
.trending-move { font-size: 0.68rem; padding: 2px 7px; border-radius: 4px; }
.trending-move.is-stock { background: var(--g-positive-tint); color: var(--g-positive); }
.trending-move.is-out { background: var(--g-hover-strong); color: var(--g-muted); }
.trending-stat { font-size: 0.74rem; }

/* Small laptops and tablets: still side by side, a little tighter */
@media (max-width: 1100px) {
  .split-grid { column-gap: 18px; }
  .trending-widget { padding: 20px 18px; }
  .trending-widget .section-heading h2 { font-size: 1.3rem; }
  .trending-item { gap: 12px; padding: 9px 12px 9px 8px; }
  .trending-rank { width: 24px; font-size: 0.98rem; }
}
@media (max-width: 900px) {
  /* Narrow columns: the link moves under the subtitle instead of squeezing the heading */
  .trending-widget .section-header { grid-template-columns: minmax(0, 1fr); }
  .trending-widget .section-link { justify-self: start; margin-top: 10px; }
  .trending-stat { display: none; }
}

/* Phones and small tablets: one panel above the other */
@media (max-width: 760px) {
  .split-grid { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; row-gap: 20px; }
  .trending-widget { display: block; grid-row: auto; padding: 18px 16px; border-radius: var(--radius-md); }
  .trending-widget .section-header { grid-template-columns: minmax(0, 1fr) auto; padding-bottom: 14px; }
  .trending-widget .section-link { justify-self: end; margin-top: 18px; padding: 5px 10px; }
  .trending-widget .section-heading h2 { font-size: 1.25rem; }
  .trending-widget .section-subtitle { font-size: 0.8rem; }
  .trending-stat { display: inline-flex; }
  .trending-list { gap: 8px; }
  .trending-item { min-height: 80px; gap: 10px; padding: 8px 12px 8px 6px; }
  .trending-rank { width: 24px; font-size: 0.92rem; }
  .trending-thumb { width: 42px; height: 62px; }
  .trending-title { font-size: 0.87rem; }
  .trending-author { font-size: 0.74rem; }
  .trending-price { font-size: 0.85rem; }
  .trending-move { font-size: 0.64rem; padding: 2px 6px; }
}
@media (max-width: 380px) {
  .trending-widget { padding: 16px 12px; }
  .trending-widget .section-link { margin-top: 16px; padding: 4px 9px; font-size: 0.78rem; }
  .trending-item { min-height: 74px; gap: 8px; padding: 7px 10px 7px 4px; }
  .trending-rank { width: 20px; font-size: 0.85rem; }
  .trending-thumb { width: 38px; height: 56px; }
  .trending-stat { display: none; }
}

/* ==================== SECTION HEADERS: ONE PATTERN EVERYWHERE ====================
   Kicker, heading and subtitle on the left; "View all" as a pill on the right, level with
   the heading (rails, Trending and Bestsellers all match). */
.section-subtitle { display: block; line-height: 1.45; }
.section-header .section-link {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--g-accent-tint);
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}
.section-header .section-link:hover { text-decoration: none; background: var(--g-accent-line); }

/* Book cards: the author sits right under a one-line title and prices line up along the bottom */
.book-title { height: auto; min-height: 0; }
.book-price-row { padding-top: 2px; }

/* Trending / Bestsellers tabs only exist on phones */
.split-tabs { display: none; }

@media (max-width: 760px) {
  /* Rails and catalog headers: same grid as the Trending panels */
  .book-rail-section .section-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    column-gap: 12px;
    margin-bottom: 14px;
  }
  .book-rail-section .section-actions { margin-top: 20px; }
  .section-header .section-link { min-height: 0; padding: 5px 10px; font-size: 0.8rem; }
  .section-actions .section-link { padding: 5px 10px; }
  .section-subtitle {
    font-size: 0.8rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .section-heading h2 { font-size: 1.25rem; line-height: 1.25; }

  /* One list at a time: a segmented switch replaces the two stacked panels */
  .split-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 4px;
    margin-bottom: 12px;
    border-radius: 999px;
    background: var(--g-hover-strong);
  }
  .split-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 40px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--g-muted);
    font: inherit;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
  }
  .split-tab[aria-selected="true"] {
    background: var(--g-surface-elevated);
    color: var(--g-accent-text);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
  }
  html[data-theme="dark"] .split-tab[aria-selected="true"] { color: var(--g-text); }
  .split-tab:focus-visible { outline: 2px solid var(--g-accent); outline-offset: 2px; }
  .split-grid[data-active="trending"] [data-split-panel="bestsellers"],
  .split-grid[data-active="bestsellers"] [data-split-panel="trending"] { display: none; }
  /* The tab already names the list, so the panel starts with its subtitle and "View all" */
  .trending-widget .section-kicker,
  .trending-widget .section-heading h2 { display: none; }
  .trending-widget .section-header { align-items: center; }
  .trending-widget .section-subtitle { margin-top: 0; }
  .trending-widget .section-link { margin-top: 0; }

  /* Pagination fits on one line: arrows instead of "Prev"/"Next" words */
  .pagination-wrap { flex-wrap: nowrap; gap: 6px; }
  .page-btn { min-width: 40px; min-height: 40px; padding: 6px 10px; display: inline-flex; align-items: center; justify-content: center; }
  .page-btn-label { display: none; }

  /* Delivery / payment promises: a compact 2 × 2 grid */
  .services-bar { padding: 24px 16px; }
  .services-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .service-card {
    flex-direction: column;
    gap: 8px;
    padding: 14px 12px;
    border: 1px solid var(--g-line);
    border-radius: var(--radius-md);
    background: var(--g-surface-elevated);
  }
  .service-icon { width: 36px; height: 36px; font-size: 1.15rem; }
  .service-title { font-size: 0.86rem; line-height: 1.25; }
  .service-body { font-size: 0.76rem; line-height: 1.4; }

  /* Footer: link groups as clean, accessible tiles on tablet and stacked cleanly on phone */
  .gf-main { gap: 24px; padding: 28px 16px; margin-bottom: 8px; }
  .gf-brand p { margin: 10px 0 14px; max-width: 100%; }
  .gf-contact { gap: 8px; font-size: 0.84rem; }
  .gf-col h3 { margin-bottom: 12px; font-size: 0.92rem; font-weight: 700; color: var(--g-text); }
  .gf-col ul { display: grid; grid-template-columns: 1fr; gap: 6px; }
  @media (min-width: 480px) and (max-width: 768px) {
    .gf-col ul { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  }
  .gf-col li { display: flex; }
  .grantha-footer .gf-col ul a {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 40px;
    padding: 8px 12px;
    border: 1px solid var(--g-line);
    border-radius: var(--radius-sm);
    background: var(--g-surface);
    font-size: 0.8rem;
    line-height: 1.35;
    color: var(--g-text);
    transition: all 0.15s ease;
  }
  .grantha-footer .gf-col ul a:hover {
    border-color: var(--g-accent-line);
    background: var(--g-hover);
    color: var(--g-accent);
  }
  .gf-pay-bar {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
    padding: 18px 16px calc(20px + env(safe-area-inset-bottom, 0px));
  }
}

@media (max-width: 380px) {
  .split-tab { font-size: 0.82rem; gap: 4px; }
  .services-grid { gap: 8px; }
  .service-card { padding: 12px 10px; }
  .page-btn { min-width: 36px; padding: 6px 8px; }
}

/* ==================== CATALOG PAGE BAR ====================
   Prev · 1 … 4 5 [6] 7 8 … 220 · Next, then "Go to page [ ] of 220". app.js (renderPagination)
   marks the pages next to the current one is-near (1 away) and is-far (2 away) so small
   screens can drop them; the first and last pages always stay. */
.pagination-wrap { flex-direction: column; gap: 14px; }
.page-list { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px; }
.page-btn { color: var(--g-text); font-variant-numeric: tabular-nums; min-width: 40px; }
.page-btn.active { color: #ffffff; }
.page-btn:focus-visible,
.page-jump-input:focus-visible { outline: 2px solid var(--g-accent); outline-offset: 2px; }
.page-gap { min-width: 20px; text-align: center; color: var(--g-muted); font-weight: 600; user-select: none; }
.page-jump { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 0.86rem; color: var(--g-muted2); }
.page-jump label { font-weight: 500; }
.page-jump-input {
  width: 72px; padding: 7px 8px; text-align: center;
  background: var(--g-surface); color: var(--g-text);
  border: 1px solid var(--g-line); border-radius: var(--radius-sm);
  font: inherit; font-weight: 600; font-variant-numeric: tabular-nums;
  -moz-appearance: textfield; appearance: textfield;
}
.page-jump-input::-webkit-outer-spin-button,
.page-jump-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.page-jump-input:hover { border-color: var(--g-accent); }
.page-jump-input.is-invalid { border-color: var(--g-danger); animation: page-jump-shake 0.3s ease; }
.page-jump-total { font-variant-numeric: tabular-nums; }
.page-jump-go { min-width: 0; padding: 7px 14px; font-weight: 600; }
@keyframes page-jump-shake {
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}

@media (max-width: 760px) {
  .page-list { flex-wrap: nowrap; gap: 6px; }
  .page-btn.is-far { display: none; }
  .page-gap { min-width: 14px; }
  .page-jump-input { min-height: 40px; font-size: 16px; } /* 16px stops iOS zooming in */
  .page-jump-go { min-height: 40px; }
}
@media (max-width: 520px) {
  .page-btn.is-near { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .page-jump-input.is-invalid { animation: none; }
}

/* ==================== FILTER CHIPS & SORT CONTROL ====================
   Chips: rounded tags in the accent tint; the whole chip is the remove button (app.js
   renderActiveFilterBar). The sort control and the phone "Filters" button share one
   rounded 40px shape so the catalog toolbar reads as one set. */
.active-filters-bar {
  gap: 8px 10px;
  padding: 10px 12px;
  background: var(--g-surface-elevated);
  border: 1px solid var(--g-line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.active-filters-bar .active-filter-label {
  display: inline-flex; align-items: center; gap: 6px;
  margin-right: 2px;
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--g-muted2);
}
.active-filters-bar .active-filter-label i { color: var(--g-accent); font-size: 0.95rem; }

.active-filter-chip {
  display: inline-flex; align-items: center; gap: 7px;
  max-width: 100%;
  min-height: 34px;
  padding: 4px 6px 4px 12px;
  border-radius: var(--radius-full);
  background: var(--g-accent-tint);
  border: 1px solid transparent;
  color: var(--g-text);
  font: inherit; font-size: 0.84rem; font-weight: 600; line-height: 1.2;
  cursor: pointer;
  box-shadow: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.active-filter-chip .chip-icon { color: var(--g-accent); font-size: 0.95rem; flex-shrink: 0; }
.active-filter-chip .chip-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.active-filter-chip .chip-x {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--g-surface-elevated);
  color: var(--g-muted2); font-size: 0.75rem;
  transition: background 0.15s ease, color 0.15s ease;
}
.active-filter-chip:hover { border-color: var(--g-accent-line); }
.active-filter-chip:hover .chip-x { background: var(--g-danger); color: #ffffff; }
.active-filter-chip:focus-visible { outline: 2px solid var(--g-accent); outline-offset: 2px; }

.active-filters-bar .active-filters-clear {
  display: inline-flex; align-items: center; gap: 5px;
  min-height: 34px; padding: 4px 10px;
  margin-left: auto;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
}
.active-filters-bar .active-filters-clear:focus-visible { outline: 2px solid var(--g-accent); outline-offset: 2px; }

/* Sort control */
.sort-control-group { display: flex; align-items: center; gap: 8px; }
.sort-label {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.85rem; font-weight: 600; color: var(--g-muted2); white-space: nowrap;
}
.sort-label i { color: var(--g-accent); }
.sort-select-wrap { position: relative; display: inline-flex; align-items: center; min-width: 0; }
.sort-select {
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  min-height: 40px;
  padding: 8px 38px 8px 16px;
  border-radius: var(--radius-full);
  background: var(--g-surface-elevated);
  border: 1px solid var(--g-line);
  color: var(--g-text);
  font: inherit; font-size: 0.86rem; font-weight: 600;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.sort-select:hover { border-color: var(--g-accent-line); }
.sort-select:focus-visible { outline: none; border-color: var(--g-accent); box-shadow: 0 0 0 3px var(--g-accent-tint); }
.sort-select option { background: var(--g-surface-elevated); color: var(--g-text); }
.sort-caret {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  color: var(--g-accent); font-size: 0.9rem; pointer-events: none;
}

/* The phone "Filters" button in the same shape */
.mobile-filter-btn {
  min-height: 40px;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  background: var(--g-surface-elevated);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease;
}
.mobile-filter-btn i { color: var(--g-accent); }
.mobile-filter-btn:hover { border-color: var(--g-accent-line); }
.mobile-filter-btn:focus-visible { outline: 2px solid var(--g-accent); outline-offset: 2px; }

@media (max-width: 760px) {
  .sort-control-group .sort-label { display: none; }
  .sort-select-wrap { flex: 1; }
  .sort-select { width: 100%; min-height: 42px; font-size: 16px; text-overflow: ellipsis; } /* 16px: no iOS zoom */
  .active-filters-bar { padding: 10px; }
  .active-filters-bar .active-filter-label { display: none; } /* the Filters button above says it */
  .active-filter-chip { min-height: 38px; }
  .active-filter-chip .chip-x { width: 26px; height: 26px; font-size: 0.82rem; }
  .active-filters-bar .active-filters-clear { min-height: 38px; }
}
@media (prefers-reduced-motion: reduce) {
  .active-filter-chip, .active-filter-chip .chip-x, .sort-select, .mobile-filter-btn { transition: none; }
}

/* ==================== FILTERS: AUTHOR / PUBLISHER SEARCH & DISCOUNT LEVELS ==================== */
.filter-search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  padding: 0 10px;
  min-height: 36px;
  border: 1px solid var(--g-line);
  border-radius: var(--radius-sm);
  background: var(--g-surface-elevated);
  color: var(--g-muted2);
  cursor: text;
}
.filter-search-field:focus-within { border-color: var(--g-accent); box-shadow: 0 0 0 3px var(--g-accent-tint); }
.filter-search-field input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--g-text);
  font: inherit;
  font-size: 0.84rem;
}
.filter-empty-note { margin: 6px 6px 0; font-size: 0.78rem; color: var(--g-muted2); }
@media (max-width: 992px) {
  .filter-search-field input { font-size: 16px; } /* no iOS zoom on focus */
}

/* Trending tags are links now (real addresses); keep them looking like the chips */
a.quick-tag { display: inline-flex; align-items: center; text-decoration: none; white-space: nowrap; flex-shrink: 0; }
a.quick-tag:hover { text-decoration: none; }

/* ==================== MOBILE HERO: CALMER SPACING ==================== */
.home-search-subtitle-short { display: none; }
@media (max-width: 768px) {
  .home-search { margin: 12px auto 8px; }
  /* The shop's name is already in the header logo */
  .hero-badge-pill { display: none; }
  .home-search-title { font-size: 1.35rem; line-height: 1.2; margin-bottom: 6px; }
  .home-search-subtitle { margin: 0 auto 12px; font-size: 0.82rem; line-height: 1.4; }
  .home-search-subtitle-long { display: none; }
  .home-search-subtitle-short { display: inline; }
  .home-search-container { margin-bottom: 10px; }
  .quick-search-tags { margin: 0 -16px 10px; padding: 2px 16px 4px; gap: 8px; }
  .home-search-meta { gap: 4px 16px; margin-top: 0; }
  /* One line of stats; the Sinhala/Singlish hint is shown in the search placeholder */
  .home-search-hint { display: none !important; }
  .hero-slider-section { margin-bottom: 18px; }
}
@media (max-width: 380px) {
  .home-search-title { font-size: 1.36rem; }
}

/* ==================== TAGLINES (KICKERS): ACCENT TEXT AFTER A SHORT LINE ====================
   One look for every small label above a heading, matching the hero banners' kicker:
   no pill, border or tint, just accent-coloured capitals led by a short line. Centred
   taglines get a line on both sides. */
.section-kicker,
.kicker-tag,
.hero-badge-pill,
.info-badge,
.pd-eyebrow,
.drawer-section-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  color: var(--g-accent);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1.3;
  text-transform: uppercase;
}
.section-kicker.kicker-deal { color: #e11d48; }
.section-kicker > i,
.kicker-tag > i,
.hero-badge-pill > i,
.info-badge > i { display: none; }
.section-kicker::before,
.kicker-tag::before,
.kicker-tag::after,
.hero-badge-pill::before,
.hero-badge-pill::after,
.info-badge::before,
.info-badge::after,
.pd-eyebrow::before,
.drawer-section-title::before {
  content: "";
  flex-shrink: 0;
  width: 22px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
}
.hero-badge-pill,
.info-badge { font-size: 0.74rem; margin-bottom: 14px; }
.pd-eyebrow { display: inline-flex; }
.pd-eyebrow:hover { text-decoration: none; opacity: 0.8; }
html[data-theme="dark"] .section-kicker.kicker-deal { color: #fb7185; }

/* ==================== MOBILE MENU (DRAWER): COMPACT AND EASY TO SCAN ==================== */
.mobile-drawer { width: 300px; max-width: 86vw; }
.mobile-drawer-header { padding: 10px 12px 10px 18px; background: var(--g-surface); }
.mobile-drawer-header .drawer-logo img { height: 28px !important; }
.drawer-close-btn { width: 36px; height: 36px; border: 0; background: var(--g-hover); }

.drawer-account { display: flex; align-items: stretch; gap: 8px; padding: 12px 14px; }
.drawer-account-btn {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--g-line);
  border-radius: var(--radius-md);
  background: var(--g-hover);
  text-align: left;
}
.drawer-account-text strong,
.drawer-account-text small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drawer-account-text strong { font-size: 0.92rem; font-weight: 700; color: var(--g-text); }
.drawer-account-text small { font-size: 0.76rem; color: var(--g-muted2); white-space: normal; line-height: 1.3; }
.drawer-wish-btn {
  position: relative;
  flex: 0 0 50px;
  width: 50px;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--g-line);
  border-radius: var(--radius-md);
  background: var(--g-hover);
}
.drawer-wish-btn i { font-size: 1.25rem; color: var(--g-accent); }
.drawer-wish-count {
  position: absolute;
  top: 5px;
  right: 5px;
  min-width: 17px;
  height: 17px;
  margin: 0;
  padding: 0 4px;
  line-height: 17px;
  font-size: 0.62rem;
  background: var(--g-danger);
  color: #ffffff;
}

.mobile-drawer-content { padding: 14px 14px 28px; }
.drawer-quick { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 18px; }
.drawer-quick-link {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid var(--g-line);
  border-radius: var(--radius-md);
  background: var(--g-surface-elevated);
  color: var(--g-text);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s ease;
}
.drawer-quick-link i { color: var(--g-accent); font-size: 1.15rem; flex-shrink: 0; }
.drawer-quick-link.is-deal i { color: var(--g-accent); }
.drawer-quick-link:hover { text-decoration: none; background: var(--g-hover); color: var(--g-accent); border-color: var(--g-accent-line); }

.drawer-section-title { margin: 16px 0 8px 4px; font-size: 0.74rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--g-muted2); }
.mobile-drawer-nav { display: flex; flex-direction: column; gap: 2px; margin-bottom: 18px; }
.drawer-nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 42px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--g-text);
  text-decoration: none;
  transition: all 0.15s ease;
}
.drawer-nav-link:hover {
  background: var(--g-hover);
  color: var(--g-accent);
}
.drawer-nav-link i { font-size: 1.2rem; color: var(--g-accent); width: 22px; flex-shrink: 0; text-align: center; }
.drawer-nav-link span { display: flex; align-items: baseline; justify-content: space-between; width: 100%; gap: 8px; }
.drawer-nav-link small { margin-left: auto; color: var(--g-muted2); font-size: 0.76rem; font-weight: 400; white-space: nowrap; }

.drawer-help { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 16px; }
.drawer-help-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid var(--g-line);
  border-radius: var(--radius-md);
  background: var(--g-surface-elevated);
  color: var(--g-text);
  font-size: 0.84rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s ease;
}
.drawer-help-btn i { color: var(--g-accent); font-size: 1.15rem; }
.drawer-help-btn.is-wa i { color: #25d366; }
.drawer-help-btn:hover { text-decoration: none; border-color: var(--g-accent-line); background: var(--g-hover); }

.drawer-info-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 6px;
  padding: 14px 0 0;
  border-top: 1px solid var(--g-line);
}
.drawer-info-links a {
  padding: 6px 10px;
  border-radius: var(--radius-full);
  background: var(--g-hover);
  color: var(--g-muted2);
  font-size: 0.78rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.15s ease;
}
.drawer-info-links a:hover { color: var(--g-accent); background: var(--g-hover-strong); text-decoration: none; }
.drawer-theme-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding: 14px 4px 0;
  border-top: 1px solid var(--g-line);
  color: var(--g-muted2);
  font-size: 0.82rem;
  font-weight: 600;
}
.drawer-theme-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px 14px;
  border: 1px solid var(--g-line);
  border-radius: var(--radius-full);
  background: var(--g-surface-elevated);
  color: var(--g-text);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.drawer-theme-btn:hover {
  background: var(--g-hover);
  border-color: var(--g-accent-line);
}
.drawer-quick-link:focus-visible,
.drawer-help-btn:focus-visible,
.drawer-info-links a:focus-visible,
.drawer-theme-btn:focus-visible { outline: 2px solid var(--g-accent); outline-offset: 2px; }

/* Trending tags: accent text links divided by thin lines, after a "— TRENDING" kicker
   (no pill borders or tinted backgrounds), on every screen size */
.quick-search-tags { gap: 0; row-gap: 4px; }
.quick-search-tags .quick-tag,
.quick-search-tags a.quick-tag {
  position: relative;
  height: auto;
  min-height: 32px;
  padding: 4px 12px;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  color: var(--g-accent-text, var(--g-accent));
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0;
  transform: none;
}
.quick-search-tags .quick-tag + .quick-tag::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 1px;
  height: 14px;
  background: var(--g-line-strong);
  transform: translateY(-50%);
}
.quick-search-tags .quick-tag:hover,
.quick-search-tags .quick-tag:focus-visible {
  background: none;
  color: var(--g-accent);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
  transform: none;
}
.quick-search-tags .quick-tag:active { background: none; color: var(--g-accent); transform: none; }
@media (max-width: 768px) {
  .quick-search-tags { margin-bottom: 12px; }
  .quick-search-tags .quick-tag { min-height: 36px; padding: 4px 11px; font-size: 0.84rem; }
}
.quick-search-tags .quick-tag.is-line-start::before { display: none; }

/* "View all →" links: plain accent text (no tinted pill), underlined on hover like the tags */
.section-header .section-link,
.trending-widget .section-link {
  padding-left: 0;
  padding-right: 0;
  border-radius: 0;
  background: none;
  color: var(--g-accent);
}
.section-header .section-link:hover,
.trending-widget .section-link:hover {
  background: none;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
}

/* Info and blog page heroes sit on the page like the homepage hero: no box, border or wash */
.info-hero { background: none; border: 0; border-radius: 0; padding-top: 24px; padding-bottom: 8px; }
@media (max-width: 480px) {
  .hero-badge-pill,
  .info-badge,
  .kicker-tag { gap: 8px; font-size: 0.66rem; letter-spacing: 0.07em; text-align: center; }
  .hero-badge-pill::before, .hero-badge-pill::after,
  .info-badge::before, .info-badge::after,
  .kicker-tag::before, .kicker-tag::after { width: 14px; }
}

/* ==================== HERO + BANNER IN ONE SCREEN ====================
   The search hero takes its spacing from the screen height, and app.js (fitHeroBanner) sets
   --hero-fit-h to the room left under it, so the whole banner shows without scrolling. The
   banner keeps its own ratio (16:5, or 3:2 on phones) and narrows instead of being cropped,
   but never below a readable size. */
.hero-slider-wrap.sb-hero-frame {
  max-width: max(820px, calc(var(--hero-fit-h, 2000px) * 16 / 5));
  margin-inline: auto;
}
@media (max-width: 640px) {
  .hero-slider-wrap.sb-hero-frame {
    width: 100%;
    max-width: min(100%, calc(var(--hero-fit-h, 2000px) * 16 / 9));
    margin-inline: auto;
  }
}

@media (min-width: 769px) {
  .home-search {
    max-width: 1280px; /* room for the trending tags on one line */
    margin: clamp(14px, 3.2vh, 40px) auto clamp(14px, 2.6vh, 32px);
  }
  .home-search .hero-badge-pill { margin-bottom: clamp(8px, 1.6vh, 16px); }
  .home-search-title {
    font-size: clamp(1.9rem, min(1.1rem + 1.9vw, 5.6vh), 2.75rem);
    line-height: 1.12;
    margin-bottom: clamp(6px, 1.2vh, 12px);
  }
  .home-search-subtitle {
    max-width: 680px;
    margin: 0 auto clamp(12px, 2.4vh, 26px);
    font-size: 1rem;
    line-height: 1.5;
  }
  .home-search-container { max-width: 760px; margin: 0 auto clamp(10px, 1.8vh, 18px); }
  .quick-search-tags { margin-bottom: clamp(6px, 1.4vh, 16px); }
  .hero-slider-section { margin-bottom: 40px; }
}

/* Short phones: the stats line goes and spacing tightens so the banner still fits */
@media (max-width: 768px) and (max-height: 720px) {
  .home-search { margin: 12px auto 12px; }
  .home-search-title { font-size: 1.32rem; margin-bottom: 6px; }
  .home-search-subtitle { margin-bottom: 12px; font-size: 0.84rem; }
  .home-search-container { margin-bottom: 10px; }
  .quick-search-tags { margin-bottom: 4px; }
  .home-search-meta { display: none; }
}
@media (min-width: 769px) {
  .quick-search-tags a.quick-tag { padding: 4px 8px; font-size: 0.83rem; }
}
/* Laptop-height screens: the stats line makes way for the banner (the title and tags say it) */
@media (min-width: 769px) and (max-height: 820px) {
  .home-search-meta { display: none; }
  .quick-search-tags { margin-bottom: 0; }
}

/* ==================== PHONES: TRENDING / BEST SELLERS AS A SWIPE CAROUSEL ====================
   Below 760px each panel shows its books as a row of cover cards you swipe through (the
   next card peeks in), with the rank on the cover, instead of a tall list of rows. */
@media (max-width: 760px) {
  .trending-widget { padding: 16px 0 12px; }
  .trending-widget .section-header { padding: 0 16px 12px; }
  .trending-list {
    display: flex !important;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 12px;
    padding: 2px 16px 8px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 16px;
    scrollbar-width: none;
  }
  .trending-list::-webkit-scrollbar { display: none; }
  .trending-item {
    flex: 0 0 138px;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    min-height: 0;
    padding: 8px;
    scroll-snap-align: start;
  }
  .trending-thumb {
    width: 100%;
    height: auto;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    border-radius: 6px;
  }
  .trending-rank {
    position: absolute;
    top: 14px;
    left: 14px;
    z-index: 1;
    width: auto;
    padding: 3px 7px;
    border-radius: 6px;
    background: var(--g-cta);
    color: #ffffff !important;
    font-size: 0.72rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.22);
  }
  .trending-info { gap: 2px; min-width: 0; }
  .trending-title {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    min-height: 2.6em;
    white-space: normal;
    font-size: 0.84rem;
  }
  .trending-sub { flex-direction: column; align-items: flex-start; gap: 4px; margin-top: 4px; }
  .trending-meta-left { flex-wrap: wrap; gap: 4px 6px; }
  .trending-stat { display: none !important; }
}
@media (max-width: 380px) {
  .trending-item { flex-basis: 128px; }
}

/* Hero tagline on phones: back, on one line ("Sankha Books · Kiribathgoda") */
.hero-tagline-short { display: none; }
@media (max-width: 768px) {
  .home-search .hero-badge-pill { display: inline-flex; margin-bottom: 8px; }
  .hero-tagline-long { display: none; }
  .hero-tagline-short { display: inline; }
}
@media (max-width: 760px) {
  /* A one-line author name must not widen the card (flex items default to their text width) */
  .trending-item { min-width: 0; width: 138px; max-width: 138px; }
  .trending-info, .trending-sub, .trending-meta-left { min-width: 0; max-width: 100%; }
}
@media (max-width: 380px) {
  .trending-item { width: 128px; max-width: 128px; }
}

/* ==================== RANK RIBBON & SAVINGS PILL ====================
   The cover shows the book and, in ranked rails, a bookmark ribbon with its place (gold,
   silver and bronze for the top three). What the shopper saves sits under the price as a
   green "Save Rs. 90 · 10%" pill: rupees first, beside the number being compared, and green
   because it is a gain. Hovering or focusing a card lifts the pill with a light sheen. */
.book-rank-ribbon {
  position: absolute;
  top: 0;
  left: 10px;
  z-index: 2;
  min-width: 28px;
  padding: 7px 6px 12px;
  border-radius: 0;
  box-shadow: none;
  background: var(--g-cta);
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 800;
  line-height: 1;
  text-align: center;
  font-variant-numeric: tabular-nums;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 74%, 0 100%);
}
.book-rank-ribbon[data-rank="1"] { background: linear-gradient(180deg, #f59e0b, #d97706); }
.book-rank-ribbon[data-rank="2"] { background: linear-gradient(180deg, #94a3b8, #64748b); }
.book-rank-ribbon[data-rank="3"] { background: linear-gradient(180deg, #d08a4f, #a35a24); }

@media (max-width: 480px) {
  .book-rank-ribbon { left: 8px; min-width: 26px; padding: 6px 5px 11px; font-size: 0.74rem; }
}
/* Phone carousel: the rank is the same bookmark ribbon as on the book rails */
@media (max-width: 760px) {
  .trending-rank {
    top: 8px;
    left: 16px;
    min-width: 28px;
    padding: 7px 5px 12px;
    border-radius: 0;
    box-shadow: none;
    text-align: center;
    font-size: 0.74rem;
    line-height: 1;
    clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 74%, 0 100%);
  }
  .trending-item:nth-child(1) .trending-rank { background: linear-gradient(180deg, #f59e0b, #d97706); }
  .trending-item:nth-child(2) .trending-rank { background: linear-gradient(180deg, #94a3b8, #64748b); }
  .trending-item:nth-child(3) .trending-rank { background: linear-gradient(180deg, #d08a4f, #a35a24); }
}

/* ==================== CATALOG TOOLBAR: FILTERS + SORT AS ONE MATCHED PAIR ====================
   Same height, border, radius and type on every screen. Phones and tablets (filters in a
   sheet) put them side by side across the full width: Filters sized to its words, Sort
   taking the rest. Desktop keeps "Sort by" + the select on the right of the heading. */
.mobile-filter-btn,
.sort-select {
  min-height: 44px;
  border: 1px solid var(--g-line-strong);
  border-radius: var(--radius-full);
  background: var(--g-surface-elevated);
  box-shadow: none;
  color: var(--g-text);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.2;
}
.sort-select { min-width: 200px; padding: 10px 42px 10px 18px; }
.mobile-filter-btn { gap: 8px; padding: 10px 18px; }
.mobile-filter-btn:hover,
.sort-select:hover { border-color: var(--g-accent); }
.mobile-filter-btn .filter-count-badge { margin-left: 2px; }
@media (max-width: 992px) {
  .catalog-header-bar { flex-wrap: wrap; row-gap: 14px; }
  .catalog-controls {
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
    width: 100%;
  }
  .sort-control-group { min-width: 0; width: 100%; }
  .sort-control-group .sort-label { display: none; }
  .sort-select-wrap { flex: 1; width: 100%; }
  .sort-select { width: 100%; min-width: 0; border-radius: var(--radius-full); padding: 10px 42px 10px 16px; }
}
/* 16px text inside form fields stops phones zooming in when they are tapped */
@media (max-width: 760px) {
  .mobile-filter-btn, .sort-select { font-size: 16px; min-height: 46px; }
}

/* Filter sheet: even rhythm between sections, rounded price shortcuts like the other pills */
.filter-widget { margin-bottom: 18px; padding-bottom: 18px; }
@media (max-width: 992px) {
  .filter-show-more { min-height: 40px; }
}
@media (max-width: 992px) {
  /* The sheet body already spaces its sections (gap); no extra margin on top of it */
  .filter-sidebar-scroll-body .filter-widget { margin-bottom: 0; }
}

/* Carousel dots (phones): where you are in a book rail or the Trending / Best Sellers list */
.carousel-dots { display: none; }
@media (max-width: 760px) {
  .carousel-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 2px 0 6px;
  }
  .carousel-dots[hidden] { display: none; }
  .carousel-dot {
    width: 7px;
    height: 7px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: var(--g-line-strong);
    cursor: pointer;
    transition: width 0.25s ease, background 0.25s ease;
  }
  .carousel-dot.is-active { width: 20px; background: var(--g-accent); }
  /* a bigger invisible tap area around each small dot */
  .carousel-dot { position: relative; }
  .carousel-dot::after { content: ""; position: absolute; inset: -8px -3px; }
}
@media (prefers-reduced-motion: reduce) {
  .carousel-dot { transition: none; }
}

/* ==================== TYPE SCALE: FLUID AND NEVER TOO SMALL ====================
   Headings grow smoothly with the screen instead of jumping at breakpoints, and no
   readable text drops below ~11.5px on any device. */
.section-heading h2 { font-size: clamp(1.25rem, 1rem + 1.1vw, 1.7rem); line-height: 1.2; }
.catalog-title-group h1, .catalog-title-group h2 { font-size: clamp(1.35rem, 1.05rem + 1.2vw, 1.85rem); line-height: 1.2; }
.info-title { font-size: clamp(1.6rem, 1.1rem + 2.2vw, 2.4rem); line-height: 1.15; }
.trending-widget .section-heading h2 { font-size: clamp(1.2rem, 1rem + 0.8vw, 1.45rem); }
.trending-move { font-size: 0.72rem; }
.price-val-label { font-size: 0.72rem; }
.section-kicker { font-size: 0.74rem; }
@media (max-width: 480px) {
  .hero-badge-pill,
  .info-badge,
  .kicker-tag { font-size: 0.72rem; letter-spacing: 0.06em; }
  /* Long centred taglines may wrap to two lines on the narrowest phones; keep them tidy */
  .info-badge { max-width: 100%; flex-wrap: wrap; justify-content: center; row-gap: 4px; }
}
.trending-widget .section-kicker { font-size: 0.74rem; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Inline "-N%" badge (desktop Trending / Best Sellers rows) */
.book-off {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 4px;
  background: #dc2626;
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
html[data-theme="dark"] .book-off { background: #ef4444; }
.trending-meta-left .book-off { margin-left: 2px; }

/* ==================== PAGINATION: COMPACT ON PHONES ==================== */
@media (max-width: 760px) {
  .pagination-wrap { gap: 10px; margin-top: 18px; }
  .page-list { gap: 4px; }
  .page-btn {
    min-width: 36px;
    min-height: 36px;
    padding: 0 8px;
    border-radius: 999px;
    font-size: 0.85rem;
  }
  .page-btn i { font-size: 0.95rem; }
  .page-gap { min-width: 12px; font-size: 0.85rem; }
  .page-jump { gap: 6px; font-size: 0.8rem; }
  .page-jump label { font-weight: 500; }
  .page-jump-input {
    width: 54px;
    min-height: 34px;
    padding: 4px 6px;
    border-radius: 999px;
    font-size: 16px; /* stops phones zooming in on tap */
  }
  .page-jump-go { min-height: 34px; padding: 0 14px; font-size: 0.8rem; }
}
.page-jump-short { display: none; }
@media (max-width: 760px) {
  .page-jump-long { display: none; }
  .page-jump-short { display: inline; }
}
.trending-was { font-size: 0.78rem; }
.trending-meta-left { flex-wrap: wrap; row-gap: 2px; }

/* ==================== SEARCH KEYWORDS: DESKTOP ROW, PHONE TICKER ====================
   Desktop: the keyword track is invisible to layout, so the keywords stay one
   centred row. Phones: the keyword track, which app.js (initTagTicker) glides along as a loop; it
   fades out at both edges and can be swiped by hand. */
.quick-tags-track { display: contents; }
@media (max-width: 768px) {
  .home-search .quick-search-tags {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0;
    width: calc(100% + 32px);
    max-width: none;
    margin: 0 -16px 12px;
    padding: 0;
    overflow: visible;
    -webkit-mask-image: none;
    mask-image: none;
  }
  .quick-tags-track {
    display: flex;
    flex: 1;
    flex-wrap: nowrap;
    align-items: center;
    min-width: 0;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 16px, #000 calc(100% - 16px), transparent 100%);
    mask-image: linear-gradient(to right, transparent 0, #000 16px, #000 calc(100% - 16px), transparent 100%);
  }
  .quick-tags-track::-webkit-scrollbar { display: none; }
  .quick-tags-track .quick-tag { flex: 0 0 auto; }
}

/* ==================== DISCOUNT RIBBON & ONE-LINE PRICES ====================
   A discount is a red "-N%" ribbon that wraps the card's right edge: it sticks out past the
   border with a darker folded tail, just under the heart, and slides out from behind the
   card when it appears. Prices sit on one line: the selling price large and bold, the
   crossed-out original smaller and muted beside it (it wraps under only if a phone card is
   too narrow for both). The rupee saving is shown only at checkout. */
.book-card { position: relative; overflow: visible; }
.book-off-ribbon {
  position: absolute;
  top: 12px;
  right: -7px;
  z-index: 3;
  padding: 4px 9px 4px 10px;
  border-radius: 4px 0 0 4px;
  background: linear-gradient(180deg, #ef4444, #dc2626);
  color: #ffffff;
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  box-shadow: -2px 3px 8px rgba(0, 0, 0, 0.18);
  pointer-events: none;
  animation: ribbon-slide 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) 0.1s both;
}
/* the fold: the part of the ribbon that turns round the card's edge */
.book-off-ribbon::after {
  content: "";
  position: absolute;
  top: 100%;
  right: 0;
  border-style: solid;
  border-width: 7px 7px 0 0;
  border-color: #991b1b transparent transparent transparent;
}
@keyframes ribbon-slide {
  from { transform: translateX(-12px); opacity: 0; }
  to { transform: none; opacity: 1; }
}
html[data-theme="dark"] .book-off-ribbon::after { border-top-color: #7f1d1d; }

.book-price-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 7px;
  row-gap: 0;
  padding-top: 2px;
}
.book-price { font-size: 1.02rem; font-weight: 800; letter-spacing: -0.01em; }
.book-price-row .book-was-price { font-size: 0.76rem; font-weight: 500; color: var(--g-muted2); }

/* Rails scroll sideways and clip at their edges: a little room so the ribbon's tip shows */
.book-rail { padding-right: 10px; }

/* Trending / Best Sellers: the inline badge in the desktop rows; on the phone carousel
   cards the same ribbon as the book cards */
.trending-off-ribbon { display: none; }
@media (max-width: 768px) {
  .book-off-ribbon { top: 10px; right: -5px; padding: 3px 8px 3px 9px; font-size: 0.72rem; }
  .book-off-ribbon::after { border-width: 6px 6px 0 0; }
  .book-price { font-size: 0.95rem; }
  .book-price-row { column-gap: 5px; }
  .book-price-row .book-was-price { font-size: 0.7rem; }
  .trending-item { overflow: visible; }
  .trending-off-ribbon {
    display: block !important;
    position: absolute;
    top: 10px;
    right: -5px;
    z-index: 3;
    padding: 3px 8px 3px 9px;
    font-size: 0.72rem;
  }
  .trending-off-ribbon::after { border-width: 6px 6px 0 0; }
  .trending-meta-left .book-off { display: none; }
  .trending-meta-left { flex-wrap: wrap; align-items: baseline; column-gap: 5px; }
  .trending-meta-left .trending-price { font-size: 0.95rem; font-weight: 800; }
  .trending-meta-left .trending-was { font-size: 0.7rem; }
  .trending-list { padding-right: 22px; }
  .trending-meta-left .trending-price { font-size: 0.88rem; letter-spacing: -0.01em; }
  .trending-meta-left .trending-was { font-size: 0.66rem; }
}
@media (prefers-reduced-motion: reduce) {
  .book-off-ribbon { animation: none; }
}
@media (max-width: 380px) {
  /* Small phones: carousel cards keep the width both prices need on one line */
  .trending-item { width: 140px; max-width: 140px; flex-basis: 140px; }
  .book-rail .book-card { flex: 0 0 146px; }
  .book-rail .book-price { font-size: 0.92rem; }
}
@media (max-width: 340px) {
  .book-price { font-size: 0.9rem; }
  .book-price-row { column-gap: 4px; }
  .book-price-row .book-was-price { font-size: 0.68rem; }
}

/* ==================== CARD CORNERS: RANK TOP-LEFT, DISCOUNT TOP-RIGHT, HEART BOTTOM-LEFT, CART BOTTOM-RIGHT ====================
   Covers have balanced corners on both desktop and mobile:
   - Rank bookmark (when present): top-left
   - Discount ribbon: top-right (wrapping card edge)
   - Wishlist heart: bottom-left (34px circular icon button)
   - Add to cart: bottom-right (matching 34px circular icon button)
*/
.book-card .book-off-ribbon { top: 12px; right: -7px; }
.book-wish-btn { top: auto; right: auto; bottom: 8px; left: 8px; }
.book-quick-cart { top: auto; bottom: 8px; left: auto; right: 8px; }

@media (max-width: 768px) {
  .book-card .book-off-ribbon { top: 10px; right: -5px; }
  .book-wish-btn {
    top: auto;
    right: auto;
    bottom: 8px;
    left: 8px;
    width: 34px;
    height: 34px;
  }
  .book-quick-cart {
    opacity: 1;
    transform: none;
    top: auto;
    bottom: 8px;
    left: auto;
    right: 8px;
    width: 34px;
    height: 34px;
  }
}

/* ==================== HEADER MENU BUTTON: A PLAIN ICON ====================
   The phone menu button was a bordered, shadowed circle louder than anything else in the
   header; now it is a quiet icon button the same size as the cart, which stays the one
   solid button. */
.mobile-menu-btn,
.grantha-header .mobile-menu-btn {
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--g-text);
}
.mobile-menu-btn i { font-size: 1.55rem; }
.mobile-menu-btn:hover,
.mobile-menu-btn:focus-visible { background: var(--g-hover); }
.mobile-menu-btn:focus-visible { outline: 2px solid var(--g-accent); outline-offset: 2px; }

/* ==================== ICONS: ONE ACCENT COLOUR ====================
   Icons are line icons in the brand accent, not a mix of orange, red and green that read
   like emoji. (Prices, discounts and errors keep their meaning colours.) */

.drawer-wish-btn i,
.drawer-quick-link.is-deal i,
.drawer-help-btn.is-wa i,
.pd-whatsapp-link i,
.contact-channel-icon.wa { color: var(--g-accent); }
.contact-channel-icon.wa { background: var(--g-accent-tint); }
.mega-badge { background: var(--g-accent-tint); color: var(--g-accent-text); }

/* ==================== TAGLINES: ONLY WHERE A PAGE STARTS ====================
   The lined label introduces a page (home hero, info pages, blog). Section headings speak
   for themselves, so their kickers go; small group labels (Top categories, menu headings)
   are plain small capitals without the line. */
.section-heading > .section-kicker,
.catalog-title-group > .section-kicker,
.trending-widget .section-kicker { display: none; }
.kicker-tag::before,
.kicker-tag::after,
.drawer-section-title::before { display: none; }
.drawer-section-title { color: var(--g-muted); letter-spacing: 0.08em; }
.kicker-tag { color: var(--g-muted2); letter-spacing: 0.1em; }
/* With the kicker gone, "View all" lines up with the heading itself */
.trending-widget .section-link { margin-top: 4px; }

/* ==================== NEWSLETTER BAND (footer of every page) ==================== */
.hp-field { position: absolute !important; left: -9999px; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.gf-newsletter {
  max-width: var(--max-width);
  margin: 0 auto 36px;
  padding: 0 0 32px;
  border-bottom: 1px solid var(--g-line);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px 32px;
}
.gf-newsletter-text { flex: 1 1 300px; }
.gf-newsletter-text h3 { margin: 0 0 6px; font-size: 1.15rem; font-weight: 800; color: var(--g-text); }
.gf-newsletter-text p { margin: 0; color: var(--g-muted2); font-size: 0.9rem; line-height: 1.55; }
.gf-newsletter-form { flex: 1 1 360px; max-width: 480px; display: flex; flex-wrap: wrap; gap: 8px; position: relative; }
.gf-newsletter-form input[type="email"] {
  flex: 1 1 200px; min-width: 0; padding: 11px 14px; font-size: 0.95rem;
  border: 1px solid var(--g-line-strong); border-radius: var(--radius-sm, 8px);
  background: var(--g-surface); color: var(--g-text);
}
.gf-newsletter-form input[type="email"]:focus { outline: 2px solid var(--g-accent-line); outline-offset: 1px; border-color: var(--g-accent); }
.gf-newsletter-form button {
  display: inline-flex; align-items: center; gap: 6px; padding: 11px 18px; border: 0; cursor: pointer;
  border-radius: var(--radius-sm, 8px); background: var(--g-cta); color: #fff; font-weight: 700; font-size: 0.92rem;
}
.gf-newsletter-form button:hover { background: var(--g-cta-hover); }
.gf-newsletter-form button:disabled { opacity: 0.6; cursor: wait; }
.gf-newsletter-status { flex-basis: 100%; margin: 0; min-height: 1.2em; font-size: 0.85rem; color: var(--g-positive); }
.gf-newsletter-status.is-error { color: var(--g-danger); }
@media (max-width: 760px) {
  .gf-newsletter { text-align: center; padding: 0 0 26px; margin-bottom: 28px; }
  .gf-newsletter-form { max-width: none; }
  .gf-newsletter-form button { flex: 1 1 100%; justify-content: center; }
}

/* ==================== CONTACT FORM ==================== */
.contact-help { display: block; margin-top: 6px; font-size: 0.8rem; color: var(--g-muted); }
.contact-check, .sb-check {
  display: flex; align-items: flex-start; gap: 8px; margin: 4px 0 14px; font-size: 0.88rem; color: var(--g-soft2); cursor: pointer;
}
.contact-check input, .sb-check input { margin-top: 3px; accent-color: var(--g-accent); }
.contact-wa-alt {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 12px;
  color: var(--g-accent-text); font-size: 0.88rem; font-weight: 600; text-decoration: none;
}
.contact-wa-alt:hover { text-decoration: underline; }
.contact-status { margin-top: 12px; font-size: 0.9rem; line-height: 1.5; }
.contact-status.is-ok { color: var(--g-positive); }
.contact-status.is-error { color: var(--g-danger); }
.contact-submit-btn:disabled { opacity: 0.6; cursor: wait; }

/* ==================== READER REVIEWS (product page) ==================== */
.pd-stars { display: inline-flex; gap: 1px; color: #d4a017; font-size: 1rem; vertical-align: -2px; }
.pd-reviews-summary { display: inline-flex; align-items: center; gap: 6px; }
.pd-review-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.pd-review { padding: 12px 14px; border: 1px solid var(--g-line); border-radius: var(--radius-sm, 8px); background: var(--g-surface); }
.pd-review-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 0.9rem; }
.pd-review p { margin: 8px 0 0; color: var(--g-soft); font-size: 0.93rem; line-height: 1.6; white-space: pre-line; overflow-wrap: anywhere; }
.pd-review-verified { display: inline-flex; align-items: center; gap: 4px; font-size: 0.78rem; color: var(--g-positive); }

/* ==================== MESSAGE PAGES (newsletter confirm/unsubscribe, rate your books) ==================== */
.message-hero { max-width: 720px; margin-left: auto; margin-right: auto; }
.message-body { margin-top: 14px; color: var(--g-soft); font-size: 1rem; line-height: 1.65; }
.message-body form { margin-top: 10px; }
.message-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 11px 20px; border: 0; cursor: pointer;
  border-radius: var(--radius-sm, 8px); background: var(--g-cta); color: #fff !important; font-weight: 700; font-size: 0.95rem;
  text-decoration: none;
}
.message-btn:hover { background: var(--g-cta-hover); }
.review-form { display: grid; gap: 14px; text-align: left; margin-top: 18px; }
.review-book {
  display: flex; gap: 14px; margin: 0; padding: 14px; min-width: 0;
  border: 1px solid var(--g-line); border-radius: var(--radius-md, 12px); background: var(--g-surface);
}
.review-book img { width: 72px; height: 108px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
.review-book-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.review-book-name { padding: 0; font-weight: 700; color: var(--g-text); line-height: 1.35; }
.review-book-author { font-size: 0.85rem; color: var(--g-muted); }
.review-book textarea, .review-name input {
  width: 100%; padding: 9px 11px; font: inherit; font-size: 0.92rem;
  border: 1px solid var(--g-line-strong); border-radius: var(--radius-sm, 8px); background: var(--g-surface-elevated); color: var(--g-text);
}
.review-name { display: grid; gap: 6px; font-size: 0.9rem; color: var(--g-soft2); }
.review-status { margin: 0; min-height: 1.3em; font-weight: 600; color: var(--g-accent-text); }
/* 5 radios drawn right-to-left so hovering a star lights it and the ones before it */
.star-input { display: inline-flex; flex-direction: row-reverse; justify-content: flex-end; gap: 2px; }
.star-input input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.star-input label { cursor: pointer; font-size: 1.7rem; line-height: 1; color: var(--g-line-strong); transition: color 0.1s ease, transform 0.1s ease; }
.star-input label:hover, .star-input label:hover ~ label,
.star-input input:checked ~ label { color: #d4a017; }
.star-input input:focus-visible + label { outline: 2px solid var(--g-accent); outline-offset: 2px; border-radius: 4px; }
@media (max-width: 480px) {
  .review-book { padding: 12px; gap: 10px; }
  .review-book img { width: 56px; height: 84px; }
}

/* ==================== NO ZOOM-ON-FOCUS (phones) ====================
   iPhone Safari zooms in when a text field under 16px is focused and stays zoomed. Every field that
   brings up the keyboard gets 16px on touch screens and narrow windows; pinch-zoom stays allowed. */
@media (pointer: coarse), (max-width: 760px) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="color"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="image"]),
  select,
  textarea {
    font-size: 16px !important;
  }
}
