/* ==========================================================================
   AROYA — Master Responsive Design System & Mobile Optimization
   Covers viewports: 320px, 360px, 375px, 390px, 414px, 480px, 600px, 768px, 1024px
   ========================================================================== */

/* --------------------------------------------------------------------------
   0. Global Responsive Base & Utilities
   -------------------------------------------------------------------------- */
html, body {
  max-width: 100vw;
  overflow-x: hidden !important;
  position: relative;
}

.table-responsive-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 1.5rem;
  border-radius: var(--radius-xl);
  border: 1.5px solid var(--color-border);
}

.table-responsive-wrapper table {
  min-width: 600px;
  width: 100%;
}

.form-row-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-row-3col {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 1rem;
}

/* --------------------------------------------------------------------------
   1. Breakpoint: 1024px and below (Laptops, Tablets in Landscape)
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 3rem;
    text-align: center;
  }

  .hero-desc {
    margin-left: auto;
    margin-right: auto;
  }

  .hero-cta-group {
    justify-content: center;
  }

  .hero-badges-row {
    justify-content: center;
  }

  .hero-visual {
    max-width: 580px;
    margin: 0 auto;
    width: 100%;
  }

  .farm-story-grid {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }

  .farm-image-wrapper img {
    height: 360px;
  }

  .founder-story-grid {
    grid-template-columns: 1fr;
    gap: 3rem;
  }

  .founder-visual-card {
    max-width: 480px;
    margin: 0 auto;
    width: 100%;
  }

  .founder-highlights-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .footer-grid {
    grid-template-columns: 1.5fr 1fr 1fr;
    gap: 2.5rem;
  }

  /* Shop layout */
  .shop-layout {
    grid-template-columns: 1fr !important;
  }

  .shop-sidebar {
    display: none;
  }

  .mobile-filter-trigger {
    display: inline-flex !important;
  }

  .featured-journal-spotlight {
    grid-template-columns: 1fr !important;
  }
}

/* --------------------------------------------------------------------------
   2. Breakpoint: 768px and below (Tablets Portrait & Phablets)
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  /* Announcement bar */
  .announcement-bar {
    font-size: 0.78rem;
    padding: 0.5rem 0.75rem;
    line-height: 1.4;
  }

  /* Header & Navigation */
  .header {
    position: sticky;
    top: 0;
    z-index: 995;
  }

  .navbar {
    height: 68px;
  }

  .logo-img {
    height: 40px;
    max-width: 130px;
  }

  .nav-actions {
    gap: 0.5rem;
  }

  .icon-btn {
    width: 36px;
    height: 36px;
    font-size: 0.9rem;
  }

  .icon-btn svg {
    width: 18px;
    height: 18px;
  }

  .badge-count {
    top: -3px;
    right: -3px;
    font-size: 0.7rem;
    min-width: 16px;
    height: 16px;
  }

  /* Slide-in Mobile Nav Drawer */
  .nav-links {
    position: fixed;
    top: 0;
    left: -100%;
    width: 85%;
    max-width: 340px;
    height: 100vh;
    height: 100dvh;
    background: var(--color-ivory);
    flex-direction: column;
    align-items: stretch;
    padding: 5rem 1.75rem 2.5rem;
    box-shadow: 15px 0 40px rgba(14, 59, 46, 0.25);
    z-index: 998;
    transition: left 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
    gap: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border-right: 2px solid var(--color-gold);
  }

  .nav-links.open {
    left: 0;
  }

  .nav-links li {
    width: 100%;
  }

  .nav-link {
    font-size: 1.15rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    border-bottom: 1px solid var(--color-border);
    padding: 0.9rem 0;
  }

  .nav-link::after {
    display: none;
  }

  .nav-link.active {
    color: var(--color-gold);
  }

  .hamburger-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    width: 38px;
    height: 38px;
  }

  .hamburger-btn.open span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
  }

  .hamburger-btn.open span:nth-child(2) {
    opacity: 0;
  }

  .hamburger-btn.open span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
  }

  /* Nav Backdrop */
  .nav-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(6, 61, 43, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 997;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }

  .nav-backdrop.open {
    opacity: 1;
    pointer-events: auto;
  }

  /* Section Spacing */
  .section-padding {
    padding-top: 3.5rem;
    padding-bottom: 3.5rem;
  }

  .section-padding-sm {
    padding-top: 2rem;
    padding-bottom: 2rem;
  }

  .section-title-wrapper {
    margin-bottom: 2.25rem;
  }

  /* Vibe Switcher Bar on Tablet/Mobile */
  .vibe-switcher-container {
    align-items: center;
    margin-bottom: 2rem;
  }

  .vibe-switcher-tabs {
    max-width: 100%;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    justify-content: flex-start;
    padding: 0.35rem 0.5rem;
    scrollbar-width: none;
  }

  .vibe-switcher-tabs::-webkit-scrollbar {
    display: none;
  }

  .vibe-tab-btn {
    flex-shrink: 0;
    font-size: 0.82rem;
    padding: 0.45rem 0.85rem;
    white-space: nowrap;
  }

  /* Hero Section */
  .hero {
    padding: 2.5rem 0 3.5rem;
  }

  .hero-tagline {
    font-size: 1.35rem;
  }

  .hero-title {
    font-size: clamp(2.4rem, 6vw, 3.25rem);
    margin-bottom: 1rem;
  }

  .hero-desc {
    font-size: 1.05rem;
    margin-bottom: 1.75rem;
  }

  /* Hero Collage Visual Constraint */
  .hero-visual {
    max-width: 480px;
    margin: 0 auto;
    padding: 0 0.5rem;
  }

  .hero-collage-wrapper {
    padding: 1.5rem 0;
  }

  .collage-polaroid-card {
    width: 160px;
    right: -8px;
    bottom: -15px;
    padding: 0.5rem 0.5rem 0.7rem 0.5rem;
  }

  .polaroid-img {
    height: 120px;
  }

  .polaroid-caption {
    font-size: 0.9rem;
  }

  .collage-doodle-sticker {
    font-size: 1rem;
    left: -10px;
    top: 25%;
    padding: 0.45rem 0.75rem;
  }

  .collage-handwritten-note {
    font-size: 1.15rem;
    right: 5px;
    top: -12px;
  }

  .floating-pill.pill-top {
    left: auto;
    right: 0;
    top: -12px;
  }

  .floating-pill.pill-bottom {
    left: 0;
    bottom: -12px;
  }

  /* Benefits Strip */
  .benefits-strip {
    padding: 1.25rem 0;
  }

  .benefits-scroller {
    justify-content: flex-start;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.25rem;
    flex-wrap: nowrap;
    gap: 1.5rem;
  }

  .benefit-item {
    flex-shrink: 0;
    white-space: nowrap;
    font-size: 0.85rem;
  }

  /* Categories Grid */
  .categories-grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
  }

  /* Products Grid */
  .products-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.5rem;
  }

  /* Ingredients Library Preview */
  .ingredients-grid-preview {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
  }

  #ingredientsLibraryGrid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)) !important;
    gap: 1rem !important;
  }

  /* Reels Horizontal Scroller */
  .reels-container {
    display: flex !important;
    gap: 1.25rem !important;
    overflow-x: auto !important;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding: 0.5rem 0.25rem 1.5rem !important;
  }

  .reel-card {
    flex: 0 0 230px !important;
    height: 380px !important;
    scroll-snap-align: start;
  }

  /* Founder Highlights */
  .founder-highlights-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }

  /* Testimonials */
  .testimonials-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  /* Blog / Journal Grid */
  .journal-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .featured-journal-spotlight {
    grid-template-columns: 1fr !important;
  }

  .featured-journal-spotlight > div:first-child {
    padding: 2rem 1.5rem !important;
  }

  /* Community Banner */
  .community-banner {
    padding: 3.5rem 0;
  }

  .community-banner-box {
    padding: 2.5rem 1.5rem;
  }

  /* Footer */
  .footer {
    padding: 3.5rem 0 1.5rem;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 2.25rem;
    margin-bottom: 2.5rem;
  }

  .footer-bottom {
    flex-direction: column;
    text-align: center;
    gap: 0.75rem;
    padding-top: 1.5rem;
  }

  /* Product Detail Page */
  .product-detail-grid {
    grid-template-columns: 1fr !important;
    gap: 2.5rem !important;
  }

  .gallery-wrapper {
    max-width: 500px;
    margin: 0 auto;
    width: 100%;
  }

  /* Cart Page */
  .cart-grid {
    grid-template-columns: 1fr !important;
    gap: 2rem !important;
  }

  /* Checkout Page */
  .checkout-grid {
    grid-template-columns: 1fr !important;
    gap: 2rem !important;
  }

  /* Contact Page */
  .contact-main-grid {
    grid-template-columns: 1fr !important;
    gap: 2.5rem !important;
  }

  /* Form Row Grids */
  .form-row-2col,
  .form-row-3col {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  /* Modals */
  .modal-content {
    max-width: calc(100vw - 2rem);
    padding: 1.75rem 1.25rem;
    border-radius: var(--radius-lg);
  }
}

/* --------------------------------------------------------------------------
   3. Breakpoint: 600px and below (Standard Mobile Devices)
   -------------------------------------------------------------------------- */
@media (max-width: 600px) {
  .container {
    padding-left: 1.15rem;
    padding-right: 1.15rem;
  }

  /* Buttons */
  .btn-lg {
    padding: 0.95rem 1.75rem;
    font-size: 1rem;
  }

  /* Hero Section */
  .hero-title {
    font-size: clamp(2.1rem, 7.5vw, 2.75rem);
  }

  .hero-cta-group {
    flex-direction: column;
    width: 100%;
    gap: 0.75rem;
  }

  .hero-cta-group .btn {
    width: 100%;
  }

  .hero-badges-row {
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
  }

  .hero-badge-pill {
    width: 100%;
    justify-content: center;
  }

  /* Categories Grid: 2 Clean Columns */
  .categories-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  .category-card {
    padding: 1.25rem 0.75rem;
  }

  .category-icon-wrap {
    width: 56px;
    height: 56px;
    margin-bottom: 0.75rem;
  }

  .category-icon-wrap img {
    width: 34px;
    height: 34px;
  }

  .category-name {
    font-size: 0.88rem;
  }

  /* Single Column Product Cards on Mobile */
  .products-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .product-image-wrap {
    min-height: 220px;
    padding: 1.5rem 1rem;
  }

  .product-image-wrap img {
    max-height: 190px;
  }

  .product-info {
    padding: 1.25rem;
  }

  .product-name {
    font-size: 1.25rem;
  }

  /* Ingredients Library */
  .ingredients-grid-preview,
  #ingredientsLibraryGrid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.75rem !important;
  }

  .ingredient-card {
    padding: 1.15rem 0.65rem;
  }

  .ingredient-img {
    width: 72px;
    height: 72px;
    margin-bottom: 0.65rem;
  }

  .ingredient-name {
    font-size: 0.95rem;
  }

  /* Reels */
  .reel-card {
    flex: 0 0 210px !important;
    height: 350px !important;
  }

  /* Certifications Strip */
  .certifications-grid {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .cert-card {
    justify-content: center;
    border-radius: var(--radius-lg);
  }

  /* Habit Streak Tracker */
  .streak-card-container {
    padding: 1.75rem 1.15rem;
    border-radius: var(--radius-xl);
  }

  .streak-count-display {
    font-size: 3.5rem;
  }

  .streak-days-track {
    gap: 0.4rem;
    padding: 0.85rem 0.5rem;
    overflow-x: auto;
    justify-content: flex-start;
  }

  .streak-day-item {
    flex-shrink: 0;
  }

  .streak-day-dot {
    width: 38px;
    height: 38px;
    font-size: 0.85rem;
  }

  .streak-action-group {
    flex-direction: column;
    width: 100%;
  }

  .btn-log-streak,
  .btn-share-streak {
    width: 100%;
    justify-content: center;
  }

  .streak-rewards-grid {
    grid-template-columns: 1fr;
  }

  /* Newsletter Subscription Form */
  .subscribe-form {
    flex-direction: column;
    background: transparent;
    padding: 0;
    gap: 0.6rem;
  }

  .subscribe-input {
    background: var(--color-white);
    width: 100%;
    padding: 0.85rem 1.25rem;
  }

  .subscribe-form .btn {
    width: 100%;
  }

  /* Cart Drawer Full Width */
  .cart-drawer {
    max-width: 100%;
    width: 100%;
  }

  .cart-drawer-header,
  .cart-drawer-items,
  .cart-drawer-footer {
    padding: 1.15rem;
  }

  /* Floating Quiz Widget */
  .floating-quiz-trigger {
    bottom: 1.25rem;
    left: 1.25rem;
    padding: 0.55rem 1rem;
    font-size: 0.78rem;
  }

  /* Toast Notifications */
  .toast-container {
    bottom: 1rem;
    right: 1rem;
    left: 1rem;
  }

  .toast {
    max-width: 100%;
    font-size: 0.82rem;
    padding: 0.75rem 1rem;
  }

  /* Product Detail Page Controls */
  .gallery-thumb {
    width: 64px !important;
    height: 64px !important;
  }

  .tabs-container div[style*="overflow-x: auto"] {
    gap: 0.5rem !important;
  }

  .tab-btn {
    font-size: 0.9rem !important;
    padding: 0.6rem 0.85rem !important;
    white-space: nowrap;
  }
}

/* --------------------------------------------------------------------------
   4. Breakpoint: 480px and below (Compact Mobile Phones)
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
  .hero-collage-wrapper {
    position: relative;
    max-width: 100%;
    padding: 1rem 0;
  }

  /* Constrain floating collage stickers to avoid horizontal page overflow */
  .collage-polaroid-card {
    width: 135px;
    right: -4px;
    bottom: -10px;
    padding: 0.4rem 0.4rem 0.55rem 0.4rem;
    transform: rotate(4deg);
  }

  .polaroid-img {
    height: 100px;
  }

  .polaroid-caption {
    font-size: 0.78rem;
    margin-top: 0.3rem;
  }

  .collage-doodle-sticker {
    font-size: 0.85rem;
    left: -4px;
    top: 20%;
    padding: 0.35rem 0.55rem;
    line-height: 1.2;
    transform: rotate(-5deg);
  }

  .collage-handwritten-note {
    font-size: 1.05rem;
    right: 2px;
    top: -10px;
  }

  .floating-pill {
    padding: 0.45rem 0.75rem;
    border-radius: var(--radius-md);
    gap: 0.5rem;
  }

  .floating-pill-icon {
    width: 28px;
    height: 28px;
    font-size: 0.85rem;
  }

  .floating-pill-text strong {
    font-size: 0.75rem;
  }

  .floating-pill-text span {
    font-size: 0.68rem;
  }

  /* Hotspots */
  .hero-hotspot-btn {
    width: 26px;
    height: 26px;
    font-size: 0.95rem;
  }

  .hotspot-tooltip {
    font-size: 0.72rem;
    padding: 0.45rem 0.75rem;
    max-width: 220px;
    white-space: normal;
  }

  /* Steeping Timer */
  .steeping-timer-box {
    padding: 2rem 1.25rem !important;
  }

  /* Cart Page Elements */
  #couponCodeInput {
    min-width: 100% !important;
  }

  #applyCouponBtn {
    width: 100% !important;
  }

  /* Checkout Step Indicator */
  .checkout-steps-bar {
    gap: 0.75rem !important;
    font-size: 0.78rem !important;
  }
}

/* --------------------------------------------------------------------------
   5. Breakpoint: 360px and below (Smallest Mobile Phones)
   -------------------------------------------------------------------------- */
@media (max-width: 360px) {
  .container {
    padding-left: 0.85rem;
    padding-right: 0.85rem;
  }

  .navbar {
    height: 62px;
  }

  .logo-img {
    height: 34px;
    max-width: 105px;
  }

  .nav-actions {
    gap: 0.3rem;
  }

  .icon-btn {
    width: 32px;
    height: 32px;
  }

  .icon-btn svg {
    width: 16px;
    height: 16px;
  }

  .hero-title {
    font-size: 1.95rem;
  }

  .categories-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }

  .category-card {
    padding: 1rem 0.5rem;
  }

  .gallery-thumb {
    width: 54px !important;
    height: 54px !important;
  }
}

/* --------------------------------------------------------------------------
   6. Mobile Filter Drawer for Shop Page
   -------------------------------------------------------------------------- */
.mobile-filter-drawer {
  position: fixed;
  inset: 0;
  background: rgba(6, 61, 43, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 998;
  display: flex;
  justify-content: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.mobile-filter-drawer.open {
  opacity: 1;
  pointer-events: auto;
}

.mobile-filter-content {
  width: 88%;
  max-width: 340px;
  height: 100%;
  height: 100dvh;
  background: var(--color-white);
  padding: 2rem 1.5rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.15);
}

.mobile-filter-drawer.open .mobile-filter-content {
  transform: translateX(0);
}
