/**
 * GSB Helmet — Premium design system layer (loads after site.css)
 * Dual theme: html.gsb-theme-light | html.gsb-theme-dark + body.gsb-dark
 * Goals: clarity, conversion, WCAG-friendly contrast, subtle depth
 */

/* ------------------------------------------------------------------
   Semantic tokens (extend Lovable palette; safe fallbacks)
------------------------------------------------------------------- */
:root,
html.gsb-theme-light {
  color-scheme: light;
  --ds-font-sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ds-font-display: "Oswald", "Barlow Condensed", system-ui, sans-serif;
  --ds-radius-sm: 0.375rem;
  --ds-radius-md: 0.625rem;
  --ds-radius-lg: 1rem;
  --ds-radius-xl: 1.25rem;
  --ds-ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ds-ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ds-duration: 0.22s;
  --ds-header-h: 4.5rem;
  --ds-surface-glass: color-mix(in srgb, var(--card) 82%, transparent);
  --ds-shadow-hero: 0 24px 80px color-mix(in srgb, var(--primary) 12%, transparent);
  --ds-shadow-elevated: 0 12px 40px color-mix(in srgb, #000 8%, transparent);
  --ds-success: #15803d;
  --ds-warning: #ca8a04;
}

html.gsb-theme-dark,
body.gsb-dark {
  color-scheme: dark;
  --ds-shadow-hero: 0 28px 90px rgba(0, 0, 0, 0.55);
  --ds-shadow-elevated: 0 16px 48px rgba(0, 0, 0, 0.5);
  --ds-surface-glass: color-mix(in srgb, var(--card) 75%, transparent);
}

/* Typography scale & rendering */
body {
  font-family: var(--ds-font-sans);
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern" 1, "liga" 1;
}

h1, .gsb-products-title, .gsb-cart-page-title, .gsb-checkout-title {
  font-family: var(--ds-font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Skip link (accessibility) */
.gsb-skip-link {
  position: absolute;
  left: 0.75rem;
  top: 0.75rem;
  z-index: 100002;
  padding: 0.5rem 1rem;
  background: var(--primary);
  color: var(--primary-foreground) !important;
  font-weight: 600;
  border-radius: var(--ds-radius-md);
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform var(--ds-duration) var(--ds-ease-out);
}
.gsb-skip-link:focus {
  transform: translateY(0);
  outline: 2px solid var(--ring, var(--primary));
  outline-offset: 2px;
}

/* Glass header */
.gsb-header-wrap {
  backdrop-filter: saturate(1.2) blur(12px);
  -webkit-backdrop-filter: saturate(1.2) blur(12px);
  background: color-mix(in srgb, var(--card) 92%, transparent) !important;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 85%, transparent) !important;
  box-shadow: 0 1px 0 color-mix(in srgb, var(--foreground) 4%, transparent) !important;
}
body.gsb-dark .gsb-header-wrap {
  background: color-mix(in srgb, #0b0b0b 88%, transparent) !important;
}

/* Nav dropdown — mega feel */
.gsb-nav-dropdown {
  border-radius: var(--ds-radius-lg) !important;
  box-shadow: var(--ds-shadow-elevated) !important;
  padding: 0.75rem 0 !important;
  border: 1px solid var(--border) !important;
  min-width: 14rem;
}
.gsb-nav-dropdown a {
  transition: background var(--ds-duration) var(--ds-ease-out), color var(--ds-duration);
}

/* Search overlay panel */
.gsb-search-overlay-panel {
  border-radius: var(--ds-radius-xl) !important;
  box-shadow: var(--ds-shadow-elevated) !important;
}

/* ------------------------------------------------------------------
   Hero — premium hero band + value proposition
------------------------------------------------------------------- */
.gsb-hero {
  position: relative;
  overflow: hidden;
  padding: clamp(2.5rem, 6vw, 4.5rem) 0 clamp(3rem, 7vw, 5rem);
  background:
    radial-gradient(ellipse 120% 80% at 50% -20%, color-mix(in srgb, var(--primary) 12%, transparent), transparent 55%),
    var(--gradient-dark, linear-gradient(180deg, var(--background) 0%, color-mix(in srgb, var(--muted) 55%, var(--background)) 100%));
}
body.gsb-dark .gsb-hero {
  background:
    radial-gradient(ellipse 100% 60% at 80% 0%, color-mix(in srgb, var(--primary) 18%, transparent), transparent 50%),
    var(--gradient-dark);
}
.gsb-hero-pills {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}
.gsb-pill--isi {
  border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
  background: color-mix(in srgb, var(--primary) 8%, transparent);
}

.gsb-hero-inner {
  position: relative;
  z-index: 1;
}
.gsb-hero h1 {
  font-size: clamp(2rem, 5.5vw, 3.35rem);
  line-height: 1.05;
  max-width: 14ch;
}
.gsb-hero .lead {
  font-size: clamp(1rem, 2.2vw, 1.2rem);
  line-height: 1.55;
  max-width: 36ch;
  color: var(--muted-foreground);
}
.gsb-hero-image {
  filter: drop-shadow(var(--ds-shadow-hero));
}
.gsb-hero-image img {
  transition: transform 0.6s var(--ds-ease-out);
}
.gsb-hero:hover .gsb-hero-image img {
  transform: translateY(-4px) scale(1.02);
}
@media (prefers-reduced-motion: reduce) {
  .gsb-hero:hover .gsb-hero-image img { transform: none; }
}

.gsb-hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem 2rem;
  margin-top: 1.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
.gsb-hero-stats .stat-value {
  font-family: var(--ds-font-display);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.gsb-hero-stats .stat-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted-foreground);
}
.gsb-hero-trust {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.25rem;
}
.gsb-hero-trust-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.35rem 0.65rem;
  border-radius: var(--ds-radius-md);
  background: color-mix(in srgb, var(--card) 90%, var(--primary) 6%);
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  color: var(--foreground);
}
.gsb-hero-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-top: 1.25rem;
}
.gsb-hero-trust-item i {
  color: var(--primary);
}

/* Primary CTA */
.btn-primary.gsb-btn-modern,
.gsb-btn-modern {
  border-radius: var(--ds-radius-md);
  padding: 0.65rem 1.35rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.8125rem;
  transition: transform var(--ds-duration) var(--ds-ease-spring), box-shadow var(--ds-duration), filter var(--ds-duration);
  box-shadow: 0 4px 14px color-mix(in srgb, var(--primary) 35%, transparent);
}
.btn-primary.gsb-btn-modern:hover,
.gsb-btn-modern:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}
.gsb-btn-modern--ghost {
  background: transparent !important;
  color: var(--foreground) !important;
  border: 1px solid var(--border) !important;
  box-shadow: none !important;
}
.gsb-btn-modern--ghost:hover {
  border-color: var(--primary) !important;
  color: var(--primary) !important;
}

/* Section titles */
.gsb-section-title {
  font-family: var(--ds-font-display);
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* ------------------------------------------------------------------
   Product cards — elevation, hover, micro-interactions
------------------------------------------------------------------- */
.gsb-vortex-card,
.gsb-product-card {
  border-radius: var(--ds-radius-lg) !important;
  border: 1px solid color-mix(in srgb, var(--border) 92%, transparent) !important;
  transition: box-shadow var(--ds-duration) var(--ds-ease-out), border-color var(--ds-duration), transform var(--ds-duration) var(--ds-ease-out);
}
.gsb-vortex-card:hover,
.gsb-product-card:hover {
  box-shadow: var(--ds-shadow-elevated) !important;
  border-color: color-mix(in srgb, var(--primary) 25%, var(--border)) !important;
  transform: translateY(-3px);
}
@media (prefers-reduced-motion: reduce) {
  .gsb-vortex-card:hover,
  .gsb-product-card:hover { transform: none; }
}

.gsb-vortex-media {
  border-radius: var(--ds-radius-lg) var(--ds-radius-lg) 0 0;
}
.gsb-vortex-add-btn {
  border-radius: var(--ds-radius-md) !important;
  transition: transform var(--ds-duration) var(--ds-ease-spring), filter var(--ds-duration);
}
.gsb-vortex-add-btn:active {
  transform: scale(0.98);
}
.gsb-vortex-view-btn {
  border-radius: var(--ds-radius-md) !important;
  font-size: 0.95rem;
  transition: transform var(--ds-duration), border-color var(--ds-duration), color var(--ds-duration);
}

/* Wishlist — top-right on card media */
.gsb-vortex-media > .gsb-wishlist-inline-form {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  z-index: 4;
  margin: 0;
}
.gsb-vortex-media .gsb-wishlist-inline-btn,
.gsb-wishlist-card-btn.gsb-wishlist-inline-btn {
  width: 2.35rem;
  height: 2.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--card) 94%, transparent);
  backdrop-filter: blur(8px);
  transition: transform var(--ds-duration) var(--ds-ease-spring), color var(--ds-duration), border-color var(--ds-duration);
}
.gsb-vortex-media .gsb-wishlist-inline-btn:hover {
  transform: scale(1.06);
  color: var(--primary);
  border-color: color-mix(in srgb, var(--primary) 45%, transparent);
}

/* Wishlist page — remove (same corner slot as heart on PLP) */
.gsb-vortex-media > .gsb-wishlist-remove-form {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  z-index: 4;
  margin: 0;
}
.gsb-wishlist-remove-btn {
  width: 2.35rem;
  height: 2.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--card) 94%, transparent);
  backdrop-filter: blur(8px);
  color: var(--foreground);
  cursor: pointer;
  transition: transform var(--ds-duration) var(--ds-ease-spring), color var(--ds-duration), border-color var(--ds-duration);
}
.gsb-wishlist-remove-btn:hover {
  transform: scale(1.06);
  color: #e11d48;
  border-color: color-mix(in srgb, #e11d48 45%, transparent);
}
body.gsb-dark .gsb-wishlist-remove-btn {
  background: rgba(30, 30, 35, 0.95);
}

.gsb-vortex-actions {
  flex-wrap: wrap;
  justify-content: stretch;
}

/* ------------------------------------------------------------------
   Product detail — sticky buy box, trust strip
------------------------------------------------------------------- */
@media (min-width: 992px) {
  .gsb-product-buy-sticky {
    position: sticky;
    top: calc(var(--ds-header-h) + 1rem);
    align-self: flex-start;
  }
}

.gsb-pdp-trust {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.gsb-pdp-trust li {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.4rem 0.65rem;
  border-radius: var(--ds-radius-sm);
  background: color-mix(in srgb, var(--muted) 55%, transparent);
  border: 1px solid var(--border);
  color: var(--muted-foreground);
}
.gsb-pdp-trust li i {
  color: var(--primary);
  font-size: 0.95rem;
}

.gsb-product-detail .gsb-product-price {
  font-family: var(--ds-font-display);
  font-size: clamp(1.55rem, 3vw, 2rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--foreground);
}

.gsb-detail-actions {
  gap: 0.65rem;
}
.gsb-btn-cart,
.gsb-btn-buy {
  min-height: 48px;
  padding-left: 1.25rem !important;
  padding-right: 1.25rem !important;
  transition: transform var(--ds-duration), filter var(--ds-duration), box-shadow var(--ds-duration);
}
.gsb-btn-cart:hover { box-shadow: 0 6px 20px color-mix(in srgb, var(--primary) 35%, transparent); }

/* Gallery */
.gsb-product-gallery {
  border-radius: var(--ds-radius-xl) !important;
}
.gsb-gallery-thumb {
  transition: border-color var(--ds-duration), transform var(--ds-duration);
}
.gsb-gallery-thumb:hover {
  transform: scale(1.03);
}

/* ------------------------------------------------------------------
   Cart & checkout — rhythm, focus, mobile
------------------------------------------------------------------- */
.gsb-cart-page,
.gsb-checkout {
  padding-bottom: 3rem;
}
.gsb-cart-layout,
.gsb-checkout-grid {
  gap: clamp(1.25rem, 3vw, 2rem) !important;
}
.gsb-cart-card,
.gsb-checkout-summary-card {
  border-radius: var(--ds-radius-xl) !important;
}
.gsb-checkout-section {
  border-radius: var(--ds-radius-lg) !important;
  padding: 1.25rem 1.35rem !important;
}
.gsb-checkout-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.gsb-checkout-section h2 {
  font-family: var(--ds-font-display);
  font-size: 1.15rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: 0;
  color: var(--muted-foreground);
}

/* Form controls */
.form-control:focus,
.form-select:focus,
.gsb-filter-input:focus,
.gsb-sort-select:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent) !important;
}

/* Footer */
.gsb-footer {
  border-top: 1px solid var(--border);
  margin-top: clamp(2rem, 5vw, 4rem);
}

/* Filters panel */
.gsb-filter-sidebar summary {
  border-radius: var(--ds-radius-md);
  transition: background var(--ds-duration);
}

/* Reveal */
.gsb-reveal-up {
  animation: gsbRevealUp 0.7s var(--ds-ease-out) both;
}
@keyframes gsbRevealUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@media (prefers-reduced-motion: reduce) {
  .gsb-reveal-up { animation: none; opacity: 1; }
}

/* ------------------------------------------------------------------
   Featured grid — reviews row (match PLP / detail)
------------------------------------------------------------------- */
.gsb-featured-section .gsb-product-rating--compact {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.15rem;
  margin: 0.35rem 0 0.5rem;
  min-height: 1.35rem;
}
.gsb-featured-section .gsb-product-rating--compact .gsb-star {
  font-size: 0.95rem;
}
.gsb-rating-meta {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--foreground);
  margin-left: 0.35rem;
}
.gsb-rating-meta .gsb-rating-count {
  font-weight: 500;
  color: var(--muted-foreground);
}
.gsb-rating-meta--muted {
  font-weight: 500;
  color: var(--muted-foreground);
  font-size: 0.8rem;
  margin-left: 0.25rem;
}

/* ------------------------------------------------------------------
   View all products — solid CTA (light + dark)
------------------------------------------------------------------- */
.gsb-btn-view-all {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.7rem 1.85rem;
  font-family: var(--ds-font-display, Oswald, sans-serif);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 0.8125rem;
  text-decoration: none !important;
  border-radius: var(--ds-radius-md, 0.5rem);
  background: var(--primary);
  color: var(--primary-foreground) !important;
  border: 1px solid var(--primary);
  box-shadow: 0 4px 18px color-mix(in srgb, var(--primary) 32%, transparent);
  transition: filter 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.gsb-btn-view-all:hover {
  filter: brightness(1.06);
  color: var(--primary-foreground) !important;
  transform: translateY(-1px);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--primary) 38%, transparent);
}
.gsb-btn-view-all:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}
html.gsb-theme-dark .gsb-btn-view-all,
body.gsb-dark .gsb-btn-view-all {
  background: var(--primary);
  color: #fff !important;
  border-color: color-mix(in srgb, var(--primary) 90%, #fff 10%);
}

/* ------------------------------------------------------------------
   Dark mode — product cards (fix grey image wells + card surface)
------------------------------------------------------------------- */
body.gsb-dark .gsb-product-grid .gsb-card-img {
  background: color-mix(in srgb, var(--secondary) 75%, #0a0a0a) !important;
}
body.gsb-dark .gsb-vortex-media {
  background: color-mix(in srgb, var(--secondary) 88%, #000 12%) !important;
}
body.gsb-dark .gsb-vortex-card,
body.gsb-dark .gsb-card.gsb-vortex-card {
  background: var(--gradient-card, var(--card)) !important;
  border-color: var(--border) !important;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4) !important;
}
body.gsb-dark .gsb-vortex-product-grid .gsb-card-body .name,
body.gsb-dark .gsb-vortex-product-grid .gsb-card-body .price {
  color: var(--foreground) !important;
}
body.gsb-dark .gsb-vortex-product-grid .gsb-card-body .cert {
  color: var(--muted-foreground) !important;
}
body.gsb-dark .gsb-vortex-product-grid .gsb-card-body .category {
  color: var(--primary) !important;
}
body.gsb-dark .gsb-featured-section .gsb-section-subtitle {
  color: var(--muted-foreground);
}
body.gsb-dark .gsb-featured-section .gsb-rating-meta {
  color: var(--foreground);
}

/* Focus visible for custom buttons */
.gsb-theme-toggle:focus-visible,
.gsb-vortex-view-btn:focus-visible,
.gsb-wishlist-card-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ------------------------------------------------------------------
   Back to top (arrow — niche se upar)
------------------------------------------------------------------- */
.gsb-back-to-top {
  position: fixed;
  left: max(14px, env(safe-area-inset-left));
  bottom: max(1.25rem, env(safe-area-inset-bottom));
  right: auto;
  z-index: 1198;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--border) 90%, transparent);
  background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--foreground);
  box-shadow: var(--ds-shadow-elevated, 0 8px 24px rgba(0, 0, 0, 0.12));
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  padding: 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.25s var(--ds-ease-out, ease), transform 0.25s var(--ds-ease-out, ease),
    background 0.2s, border-color 0.2s, color 0.2s;
  pointer-events: none;
}
.gsb-back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}
.gsb-back-to-top:hover {
  background: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
}
.gsb-back-to-top:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}
@media (max-width: 575.98px) {
  .gsb-back-to-top {
    width: 2.75rem;
    height: 2.75rem;
    font-size: 1.1rem;
  }
}
@media (prefers-reduced-motion: reduce) {
  .gsb-back-to-top {
    transition: opacity 0.2s, visibility 0.2s;
    transform: none;
  }
  .gsb-back-to-top.is-visible {
    transform: none;
  }
}
