/* ==========================================================================
   ST. LUKE'S APOTHECARY - DESIGN SYSTEM & STYLESHEET
   ========================================================================== */

/* --- Design Tokens --- */
:root {
  /* Colors */
  --bg-color: #FAF8F5;          /* Warm soft cream */
  --surface-color: #FFFFFF;     /* Pure white for cards/modals */
  --border-color: #EAE5DD;      /* Very soft warm gray border */
  --text-primary: #1C1917;      /* Deep warm charcoal */
  --text-secondary: #78716C;    /* Muted stone taupe */
  --text-tertiary: #A8A29E;     /* Light stone gray */
  --accent-color: #5F6656;      /* Minimalist botanical sage green */
  --accent-color-hover: #484E42;/* Darker sage for active/hover */
  --accent-light: #F2EFE9;      /* Light cream gray for backgrounds */
  --whatsapp-color: #25D366;    /* Official WhatsApp Green */
  --line-color: #06C755;        /* Official LINE Green */
  
  /* Fonts */
  --font-serif: 'Plus Jakarta Sans', sans-serif;
  --font-sans: 'Plus Jakarta Sans', sans-serif;

  /* Layout & Spacing */
  --max-width: 1100px;
  --header-height: 80px;
  --transition-smooth: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
  --transition-fast: all 0.2s ease;
}

/* --- Base Resets & Defaults --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  max-width: 100%;
  overflow-x: clip; /* clip prevents horizontal scrolling without breaking position: sticky on mobile! */
}

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
  transition: var(--transition-fast);
}

button, input {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: none;
}

button {
  cursor: pointer;
}

ul {
  list-style: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* --- Global Scrollbar --- */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-color);
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}



/* --- Header Section --- */
.site-header {
  height: var(--header-height);
  background-color: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
}

.header-container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand-logo a {
  display: flex;
  align-items: center;
}

.logo-img {
  height: 56px;
  width: auto;
  object-fit: contain;
  display: block;
}

/* Search Wrapper */
.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 40px;
  padding: 8px 16px;
  width: 320px;
  transition: var(--transition-smooth);
}

.search-wrapper:focus-within {
  border-color: var(--text-secondary);
  width: 360px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
}

.search-icon {
  width: 18px;
  height: 18px;
  color: var(--text-secondary);
  margin-right: 8px;
  flex-shrink: 0;
}

#search-input {
  width: 100%;
  outline: none;
  font-size: 14px;
  font-weight: 400;
}

#search-input::placeholder {
  color: var(--text-tertiary);
}

.clear-search-btn {
  font-size: 18px;
  color: var(--text-secondary);
  padding: 0 4px;
  line-height: 1;
}

.clear-search-btn:hover {
  color: var(--text-primary);
}

/* --- Catalog Main Container --- */
.catalog-main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 60px 40px 100px 40px;
}

/* Hero Section */
.catalog-intro {
  text-align: center;
  max-width: 680px;
  margin: 0 auto 50px auto;
}

.intro-title {
  font-family: var(--font-serif);
  font-size: 48px;
  font-weight: 300;
  letter-spacing: -0.01em;
  line-height: 1.2;
  color: var(--text-primary);
  margin-bottom: 16px;
}



/* --- Toolbar (Filters + Info) --- */
.toolbar-section {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  padding-top: 12px;
  padding-bottom: 16px;
  margin-bottom: 40px;
  flex-wrap: wrap;
  gap: 20px;
  position: sticky;
  top: var(--header-height);
  background-color: #FAF8F5; /* Page beige background to cover scrolling cards */
  z-index: 90;
  transition: var(--transition-fast);
}

.category-filters-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}

.category-filters {
  display: flex;
  gap: 32px;
  white-space: nowrap;
}

.filter-btn {
  font-size: 13px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-secondary);
  padding: 8px 0;
  position: relative;
  transition: var(--transition-fast);
}

.filter-btn::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 1.5px;
  background-color: var(--text-primary);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}

.filter-btn:hover {
  color: var(--text-primary);
}

.filter-btn:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

.filter-btn.active {
  color: var(--text-primary);
  font-weight: 600;
}

.filter-btn.active::after {
  transform: scaleX(1);
}

.results-count {
  font-size: 13px;
  color: var(--text-secondary);
  font-style: italic;
}

/* --- Product Grid --- */
.products-section {
  position: relative;
  min-height: 400px;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 40px 24px;
}

/* --- Product Card Design --- */
.product-card {
  display: flex;
  flex-direction: column;
  background: transparent;
  transition: var(--transition-smooth);
  animation: fadeInUp 0.6s cubic-bezier(0.25, 1, 0.5, 1) forwards;
  opacity: 0;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.product-image-container {
  position: relative;
  aspect-ratio: 1 / 1;
  background-color: #FFFFFF;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  transition: var(--transition-smooth);
}

.product-card-image {
  max-height: 90%;
  max-width: 90%;
  object-fit: contain;
  transition: transform 0.8s cubic-bezier(0.25, 1, 0.5, 1);
}

/* Card Hover States */
.product-card:hover .product-image-container {
  border-color: var(--text-tertiary);
  box-shadow: 0 15px 40px rgba(95, 102, 86, 0.05);
}

.product-card:hover .product-card-image {
  transform: scale(1.04);
}

/* Product Info */
.product-info {
  padding-top: 16px;
  display: flex;
  flex-direction: column;
}

.product-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.product-card-category {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-secondary);
}

.product-card-sizes {
  font-size: 11px;
  color: var(--text-tertiary);
}

.product-card-title {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
}

.product-card-price {
  font-size: 15px;
  font-weight: 600;
  color: var(--accent-color);
  margin-top: 8px;
  font-family: var(--font-sans);
}

/* Skeleton Loading Animation */
.skeleton-loader-grid {
  display: contents;
}

.skeleton-card {
  aspect-ratio: 1 / 1.3;
  background: linear-gradient(90deg, #f2efe9 25%, #e8e3dc 50%, #f2efe9 75%);
  background-size: 200% 100%;
  animation: loadingPulse 1.5s infinite;
  border-radius: 4px;
  grid-column: span 1;
}

@keyframes loadingPulse {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Empty State Styling */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  max-width: 400px;
  margin: 0 auto;
}

.empty-icon {
  width: 48px;
  height: 48px;
  color: var(--text-tertiary);
  margin-bottom: 16px;
}

.empty-state h3 {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 400;
  margin-bottom: 8px;
}

.empty-state p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 24px;
}

.btn-primary {
  display: inline-block;
  background-color: var(--accent-color);
  color: var(--surface-color);
  padding: 12px 28px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border-radius: 4px;
  transition: var(--transition-fast);
}

.btn-primary:hover {
  background-color: var(--accent-color-hover);
}

/* Cleaned up modal space */
}



/* --- Footer Section --- */
.site-footer {
  background-color: #1C1917;
  color: #ECEAE4;
  border-top: 1px solid #2E2A27;
  padding: 80px 40px 0 40px;
}

.footer-container {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 5fr 3fr 4fr;
  gap: 60px;
  padding-bottom: 60px;
}

.footer-brand .logo-main {
  color: #FFFFFF;
  display: block;
  margin-bottom: 12px;
}

.footer-desc {
  color: #A8A29E;
  font-size: 14px;
  max-width: 320px;
  font-weight: 300;
}

.footer-links h4, .footer-contact h4 {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: #FFFFFF;
  margin-bottom: 20px;
}

.footer-links ul {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.footer-links a {
  color: #A8A29E;
  font-size: 14px;
  transition: var(--transition-fast);
}

.footer-links a:hover {
  color: #FFFFFF;
  padding-left: 4px;
}

.footer-contact p {
  color: #A8A29E;
  font-size: 14px;
  margin-bottom: 12px;
  font-weight: 300;
}

.footer-contact a {
  color: #FFFFFF;
  font-weight: 500;
}

.footer-contact a:hover {
  text-decoration: underline;
}

.footer-socials {
  margin-top: 20px;
  font-size: 13px;
  color: #78716C;
}

.footer-socials a {
  color: #A8A29E;
  font-weight: 600;
  margin-left: 6px;
}

.footer-socials a:hover {
  color: #FFFFFF;
}

.footer-bottom {
  border-top: 1px solid #2E2A27;
  text-align: center;
  padding: 30px 20px;
  font-size: 12px;
  color: #78716C;
  max-width: var(--max-width);
  margin: 0 auto;
}

/* --- Responsive Adaptations --- */

@media (max-width: 1100px) {
  .products-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 900px) {
  .products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 24px 16px;
  }
  
  .footer-container {
    grid-template-columns: 1fr;
    gap: 40px;
  }
  
  .modal-content-grid {
    grid-template-columns: 1fr;
  }
  
  .modal-image-panel {
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    padding: 30px;
  }
  
  .modal-info-panel {
    padding: 30px;
  }
  
  .modal-close-btn {
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    font-size: 28px;
  }
  
  .catalog-main {
    padding: 40px 20px 80px 20px;
  }
  
  .header-container {
    padding: 0 20px;
  }
  
  .intro-title {
    font-size: 36px;
  }
}

@media (max-width: 600px) {
  .site-header {
    height: auto;
    padding: 16px 0;
  }
  
  .header-container {
    flex-direction: column;
    gap: 16px;
    align-items: stretch;
  }
  
  .brand-logo {
    align-items: center;
    text-align: center;
  }
  
  .brand-logo a {
    align-items: center;
  }
  
  .search-wrapper {
    width: 100% !important;
  }
  
  .category-filters {
    gap: 20px;
  }
  
  .intro-title {
    font-size: 32px;
  }
  
  .detail-section-row {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

@media (max-width: 480px) {
  /* Scale grid to 2 columns */
  .products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px 12px;
  }
  
  .product-image-container {
    padding: 16px;
  }

  .product-card-title {
    font-size: 13px;
    line-height: 1.3;
    margin-top: 4px;
  }

  .product-card-price {
    font-size: 13px;
    margin-top: 4px;
  }

  .product-card-category {
    font-size: 9px;
    letter-spacing: 0.05em;
  }

  .product-card-sizes {
    font-size: 9px;
  }

  /* Compact Cooling Nodes for mobile (2 columns) */
  .cooling-level-container {
    gap: 3px;
    margin-top: 6px;
    margin-bottom: 2px;
  }

  .cooling-node {
    width: 12px;
    height: 12px;
    font-size: 8px;
  }

  .cooling-txt-label {
    font-size: 7px;
  }
  
  /* Make header and toolbar compact on mobile */
  :root {
    --header-height: 60px;
  }
  
  .logo-img {
    height: 40px;
  }
  
  .toolbar-section {
    padding-top: 8px;
    padding-bottom: 8px;
    margin-bottom: 20px;
  }

  /* Wrap categories as clean pill tags to prevent horizontal scrolling */
  .category-filters-container {
    overflow-x: visible;
    width: 100%;
  }

  .category-filters {
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 12px;
  }

  .filter-btn {
    font-size: 11px;
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    letter-spacing: 0.05em;
  }

  .filter-btn.active {
    background-color: var(--text-primary);
    color: var(--surface-color);
    border-color: var(--text-primary);
  }

  /* Reduce main content padding on mobile to prevent overflow */
  .catalog-main {
    padding: 20px 12px 60px 12px;
  }
}

/* --- Cooling Level Indicator --- */
.cooling-level-container {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  margin-bottom: 2px;
}

.cooling-txt-label {
  font-size: 9px;
  font-weight: 800;
  color: #0076FF; /* Snake Brand signature cooling blue */
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.cooling-node-wrapper {
  display: flex;
  align-items: center;
  gap: 4px;
}

.cooling-node {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background-color: var(--accent-light);
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  user-select: none;
}

.cooling-node.active {
  background-color: #0076FF;
  color: #FFFFFF;
}

/* --- Image Preview Modal --- */
.image-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(28, 25, 23, 0.45); /* Subtle dark glass overlay */
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

/* Persistent click active state (mobile/desktop click) */
.image-modal-backdrop.active {
  opacity: 1;
  pointer-events: auto; /* Intercept pointer events */
}

/* Hover-only active state (desktop hover) */
.image-modal-backdrop.hover-active {
  opacity: 1;
  pointer-events: none; /* Mouse passes through to card behind */
  background-color: rgba(28, 25, 23, 0.05); /* very light transparent tint */
  backdrop-filter: none; /* NO BLUR on hover */
}

.image-modal-backdrop.hover-active .image-modal-close {
  display: none; /* Hide close button on hover because mouse exit closes it */
}

.image-modal-container {
  background-color: #FFFFFF;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 24px;
  max-width: 360px;
  width: 90%;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.12);
  position: relative;
  transform: scale(0.95);
  transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}

.image-modal-backdrop.active .image-modal-container,
.image-modal-backdrop.hover-active .image-modal-container {
  transform: scale(1);
}

.image-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background-color: var(--bg-color);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
  z-index: 10;
}

.image-modal-close:hover {
  color: var(--text-primary);
  background-color: var(--border-color);
}

.image-modal-close svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2.5;
}

.image-modal-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

#image-modal-content {
  max-width: 100%;
  max-height: 280px;
  object-fit: contain;
  margin-bottom: 12px;
}

.image-modal-caption {
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  text-align: center;
}


