/*
  LastPick - Responsive Styles
  This file contains all responsive media queries.
*/

/* ======================================================================== */
/* MOBILE & TABLET (< 1024px) */
/* ======================================================================== */
@media (max-width: 767px) {
  /* Stack two-column layouts on mobile */
  .our-story-grid {
    grid-template-columns: 1fr;
    gap: var(--space-lg);
  }
}

@media (max-width: 1023px) {
  .product-grid {
    grid-template-columns: 1fr; 
  }

  .product-heading {
    max-width: 14ch;
  }

  .image-frame {
    min-height: clamp(320px, 58vw, 500px);
  }

  .gallery-grid {
    display: flex; /* Change to flex for horizontal scrolling */
    gap: var(--space-md);
    overflow-x: auto;
    padding: 4px var(--gutter) 24px; /* Padding for scrollbar and visual offset */
    margin-inline: calc(var(--gutter) * -1); /* Negative margin to extend to screen edges */
    scroll-padding-inline: var(--gutter); /* Ensures snapped items have correct padding */
    scroll-snap-type: x mandatory; /* Snap scrolling */
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  .gallery-card {
    flex: 0 0 90%; /* REFINEMENT: Show only 10% of the next card for a cleaner look. */
    aspect-ratio: 4 / 5; /* Maintain aspect ratio */
    scroll-snap-align: start;
    scroll-snap-stop: always;
  }

  .gallery-card::after {
    background: linear-gradient(180deg, transparent 34%, rgba(8, 56, 38, 0.22) 58%, rgba(8, 56, 38, 0.92) 100%);
  }

  .gallery-caption {
    align-items: end;
  }

  .gallery-caption p {
    max-width: 72%;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.34);
  }
}

/* ======================================================================== */
/* MOBILE-SPECIFIC STYLES (< 680px) */
/* ======================================================================== */
@media (max-width: 680px) {
  .brand {
    position: relative;
    z-index: 42;
  }

  .site-header:not(.is-sticky) .menu-toggle {
    /* WHY: When header is not sticky, position toggle relative to the viewport for initial access. */
    position: fixed; /* Keep toggle accessible at top right */
    top: 16px;
    right: 18px;
    z-index: 44;
    display: inline-flex;
  }

  .nav-links {
    position: fixed; /* Mobile nav appears as a dropdown */
    top: 66px;
    right: 18px;
    z-index: 43;
    display: flex;
    min-width: 172px;
    flex-direction: column;
    align-items: stretch; 
    gap: 4px;
    border-radius: var(--radius-md);
    background: rgba(8, 56, 38, 0.94);
    padding: 10px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
  }

  .nav-open .nav-links {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  .nav-links a {
    padding: 10px 12px;
  }

  .site-header:not(.is-sticky) .brand {
    color: var(--warm-cream);
    text-shadow: 0 3px 16px rgba(4, 30, 20, 0.52);
  }

  .site-header:not(.is-sticky) .menu-toggle {
    box-shadow: 0 10px 26px rgba(4, 30, 20, 0.32);
  }

  .button {
    padding: 12px 22px;
  }

  .product-highlight,
  .our-story-section,
  .faq-accordion-section,
  .lifestyle-gallery,
  .site-footer { /* FIX: Apply mobile padding to the footer */
    padding-top: var(--section-y-mobile); /* Use new mobile specific padding variable */
    padding-bottom: var(--section-y-mobile); /* Use new mobile specific padding variable */
  }

  .product-grid {
    gap: var(--space-lg);
  }

  .image-frame {
    min-height: 240px;
    border-radius: var(--radius-md); /* FIX: Consistent border-radius. */
  }

  .image-frame img {
    padding: 16px; /* POLISH: Reduced padding slightly. */
  }

  .product-highlight .image-frame { /* REFINEMENT: Reduced container height for a more compact mobile layout. */
    min-height: clamp(280px, 65vw, 320px);
  }
  .product-highlight .image-frame img[src$="featured-bottle.webp"] {
    max-height: 80%; /* Increased bottle size for mobile viewport. */
  }

  .product-copy {
    gap: var(--content-block-gap-mobile); /* Use new mobile specific gap variable */
  }

  .product-buy {
    display: grid;
    grid-template-columns: 1fr; /* Stack price and button */
    justify-items: center; /* Center items */
    width: 100%;
    gap: var(--space-lg);
  }

  /* Center price wrapper content */
  .product-buy .price-wrapper { justify-content: center; }
  .product-buy .button {
    width: 90%; /* Make button 90% width */
    max-width: 300px; /* Optional: Limit max width for large screens */
  }

  .price {
    align-self: center;
  }

  .price-wrapper {
    gap: 0 6px;
  }

  .pack-cards {
    gap: var(--space-sm);
  }

  .pack-card {
    height: 100px;
    min-height: 0;
    padding: 8px 6px;
  }

  .pack-card img {
    width: 56px;
    height: 56px;
    aspect-ratio: 1 / 1;
  }

  .product-icons,
  .feature-cards {
    gap: var(--space-sm);
    grid-auto-rows: 1fr;
  }

  .feature-item,
  .feature-card {
    min-height: 56px;
    border-radius: var(--radius-sm);
    padding: 10px;
    font-size: 0.88rem;
  }

  .feature-card {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    align-items: center;
    column-gap: 10px;
    padding: 11px;
  }

  .feature-card h3 {
    font-size: 0.94rem;
    line-height: 1.16;
    overflow-wrap: normal;
  }

  .feature-icon,
  .icon-mark {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
  }

  .product-details-section {
    padding-top: calc(var(--header-height) + 24px);
    padding-bottom: 44px;
  }

  .product-details-section .product-copy {
    gap: 16px;
  }

  .product-details-section .image-frame {
    min-height: clamp(280px, 78vw, 340px);
  }

  .product-details-section .pack-cards {
    gap: var(--space-sm);
  }

  .product-details-section .pack-card {
    min-height: 92px;
    padding: 7px 5px;
  }

  .product-details-section .pack-card img {
    width: 50px;
    height: 50px;
  }

  .product-details-section .purchase-controls {
    gap: var(--space-md);
  }

  .product-details-section #product-buy-wrapper {
    max-width: 100%;
    gap: var(--space-sm);
  }

  /* FIX: Make purchase controls horizontal on mobile */
  .product-details-section .product-buy {
    grid-template-columns: auto 1fr;
    justify-items: stretch;
    align-items: center;
  }

  .product-details-section #buy-now-btn {
    width: 100%;
  }

  .product-details-section .product-icons {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-sm);
  }

  .product-details-section .feature-item {
    min-height: 42px;
    padding: 8px;
    font-size: 0.76rem;
  }

  .product-details-section .feature-icon {
    width: 20px;
    height: 20px;
    flex-basis: 20px;
  }

  .gallery-heading {
    align-items: start; /* Keep existing alignment */
    flex-direction: column;
    gap: var(--space-md);
  }

  .gallery-heading h2 {
    text-align: left;
  }

  .gallery-grid {
    gap: var(--content-block-gap-mobile); /* Use new mobile specific gap variable */
    padding-bottom: 16px;
    scrollbar-width: none;
  }

  .gallery-caption {
    right: 16px;
    bottom: 18px;
    left: 16px; /* Keep existing left position */
    gap: var(--space-sm);
  }

  .gallery-caption p {
    max-width: 78%;
    line-height: 1.28;
  }

  .accordion-trigger {
    min-height: auto;
    padding: 14px var(--space-md); /* POLISH: Reduced padding for a more compact feel. */
  }

  .accordion-title {
    font-size: 1.05rem; /* POLISH: Slightly larger for mobile readability. */
    gap: var(--space-md);
  }

  .accordion-number {
    font-size: 14px;
  }
  .accordion-content {
    padding: 12px var(--space-md) 16px calc(var(--space-md) + 36px + var(--space-md)); /* FIX: Adjusted padding for mobile. */
  }
  .accordion-content p {
    font-size: 0.95rem;
  }

  .hero {
    /* REFINEMENT: Reduced hero height by ~12% on mobile for a more compact feel. */
    min-height: clamp(480px, 60vh, 600px); /* FIX: Increased hero height for mobile */
  }

  .hero-content {
    max-width: 45%; /* REFINEMENT: Further reduced width to prevent text overlapping bottles. */
  }

  .product-heading {
    font-size: clamp(1.9rem, 7.5vw, 2.2rem); /* Keep as is */
  }

  .our-story-heading {
    font-size: clamp(2rem, 8vw, 2.5rem); /* FIX: Reduce font size to prevent wrapping */
  }

  .gallery-heading h2 {
    font-size: clamp(1.75rem, 7.5vw, 2.5rem); /* REFINEMENT: Further reduce font-size on small mobile to prevent wrapping */
  }

  .product-buy {
  }
  .product-highlight .image-frame {
    min-height: clamp(250px, 60vw, 310px);
  }

  .product-highlight .image-frame img[src$="featured-bottle.webp"] {
    width: min(72%, 260px); /* REFINEMENT: Slightly enlarged bottle for more presence. */
    max-height: 72%;
  }

  .product-highlight .product-buy {
    grid-template-columns: auto 1fr; /* Price and button side-by-side */
    justify-items: stretch; /* Stretch items to fill grid area */
    gap: var(--space-md);
  }

  .product-highlight .price-wrapper { justify-content: start; }

  .product-highlight .product-buy .button {
    min-width: 0;
    padding-inline: clamp(1rem, 5vw, 1.4rem);
    white-space: nowrap;
  }

  .pack-card {
    min-height: 100px;
  }

  .accordion-icon {
    width: 10px;
    height: 10px;
  }

  .accordion-content p {
    font-size: 1rem;
    line-height: 1.75;
  }
}

/* ======================================================================== */
/* TABLET-SPECIFIC STYLES (768px — 1023px) */
/* ======================================================================== */
@media (min-width: 768px) and (max-width: 1023px) {
  .product-grid,
  .product-details-section .product-grid,
  .brand-story-grid {
    grid-template-columns: 1fr 1fr;
    gap: clamp(1.5rem, 3.5vw, 2.25rem);
  }

  .our-story-image,
  #about-story .our-story-image {
    display: block;
  }

  .gallery-card {
    flex: 0 0 45%; /* On tablets, show more of the next card */
  }

  .floating-section {
    width: calc(100% - 48px);
    max-width: 960px; /* Match footer */
    padding: 48px 56px; /* Match footer */
    border-radius: 28px; /* Match footer */
  }
}

@media (max-width: 767px) {
  /*
    WHY: Reduces the visual "bulk" of the main hero heading on mobile, making it feel impactful yet more elegant.
  */

  /*
    WHY: Lightens all primary section headings for a more refined hierarchy and a less "heavy" feel while scrolling.
  */
  .our-story-heading,
  .product-heading,
  .lifestyle-gallery h2 {
    font-weight: 700;
  }

  /*
    WHY: A slight increase in line-height for paragraph text significantly improves readability and comfort on smaller, denser mobile screens.
  */
  p,
  li,
  .accordion-content p {
    line-height: 1.8; /* WHY: A slightly taller line-height further improves reading comfort on dense mobile screens. */
  }

  .our-story-content p {
    line-height: 1.8;
  }

  /*
    WHY: Increases font size and reduces letter-spacing for better readability on small screens without being oversized.
  */
  .section-label {
    font-size: 0.8rem; /* OLD: 0.76rem */
    letter-spacing: 0.2em; /* OLD: 0.24em */
  }
}

/* ======================================================================== */
/* LAPTOP & DESKTOP (> 1024px) */
/* ======================================================================== */
@media (min-width: 1024px) {
  .product-grid {
    grid-template-columns: minmax(0, 0.92fr) minmax(0, 1fr);
    gap: var(--space-xl);
  }

  .product-highlight .product-grid {
    column-gap: clamp(18px, 2.5vw, 30px);
    row-gap: clamp(12px, 1.6vw, 20px);
  }

  .hero {
    grid-template-columns: 0.42fr 0.58fr; /* 42% content, 58% image */
    align-items: center; /* Vertically center the grid content */
  }

  .hero-content {
    grid-column: 1 / 2; /* Position content in the first column */
    max-width: none; /* Remove max-width, now controlled by grid column */
    padding-left: clamp(4rem, 8vw, 8.5rem); /* Adjusted padding for better visual balance */
  }

  .floating-section {
    width: calc(100% - 72px);
    max-width: 1180px; /* Match footer */
    padding: 60px 72px; /* Match footer */
    border-radius: 30px; /* Match footer */
  }
}

@media (min-width: 768px) {
}

@media (min-width: 1440px) {
  .floating-section {
    width: calc(100% - 96px);
    max-width: 1360px; /* Match footer */
    padding: 72px 88px; /* Match footer */
    border-radius: 32px; /* Match footer */
  }
}
