/*
 * RESPONSIVE & ACCESSIBILITY FIXES
 * For In Joy Living Theme
 * 
 * ADD THIS TO: assets/css/main.css (end of file)
 * OR: Create new file assets/css/responsive.css and enqueue in functions.php
 */

/* ═══════════════════════════════════════════════
   BROWSER COMPATIBILITY & ACCESSIBILITY FIXES
═══════════════════════════════════════════════ */

:root {
  /* Improved color contrast for accessibility */
  --mid-accessible: #4a3f38;  /* Darker version for better WCAG AA compliance */
}

/* Vendor prefixes for backdrop blur */
nav {
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

/* Font fallback for when Google Fonts fails */
@font-face {
  font-family: 'Jost-Fallback';
  src: local('-apple-system'), local('BlinkMacSystemFont'), local('Segoe UI'), local('Roboto');
}

body {
  font-family: var(--sans), -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ═══════════════════════════════════════════════
   MOBILE NAVIGATION FIX (< 768px)
═══════════════════════════════════════════════ */

@media (max-width: 768px) {

  /* Navigation Container — flex row, space-between */
  nav {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    flex-wrap: nowrap !important;
    padding: 10px 16px !important;
    position: relative;
  }

  /* Hamburger on the LEFT — shown on mobile */
  .nav-mobile-toggle {
    display: flex !important;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    flex-shrink: 0;
  }

  .nav-mobile-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text);
    transition: all 0.3s ease;
  }

  /* Hamburger animation when active */
  .nav-mobile-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 7px);
  }
  .nav-mobile-toggle.active span:nth-child(2) {
    opacity: 0;
  }
  .nav-mobile-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -7px);
  }

  /* Logo CENTERED absolutely so it stays truly centered */
  .nav-logo {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    order: 2;
    font-size: 1rem;
    width: auto;
    margin: 0;
  }

  a.custom-logo-link {
    width: 60px !important;
    height: 60px !important;
  }
.footer-top {
    padding-bottom: 30px;
}
  /* Icons on the RIGHT */
  .nav-icons {
    display: flex;
    align-items: center;
    gap: 12px;
    order: 3;
    flex-shrink: 0;
  }

  /* Hide account label text on mobile, keep icon */
  .nav-account-label {
    display: none;
  }

  /* Navigation Links — drop down below nav on mobile */
  .nav-links {
    display: none !important;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--warm-white, #f5f0e8);
    flex-direction: column !important;
    gap: 0;
    width: 100%;
    margin: 0;
    padding: 12px 20px;
    border-top: 1px solid rgba(196, 168, 130, 0.2);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    z-index: 100;
  }

  /* Show menu when active */
  .nav-links.active {
    display: flex !important;
  }

  /* Mobile menu link styling */
  .nav-links a {
    padding: 12px 0;
    font-size: 0.85rem;
    border-bottom: 1px solid rgba(196, 168, 130, 0.1);
  }
  .nav-links li:last-child a {
    border-bottom: none;
  }

  body nav {
    padding: 10px 16px !important;
  }

}

@media (max-width: 768px) {
  .wcu-reasons-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
  }

    .products-grid-slider {

    display: flex !important;
    overflow-x: auto;
    scroll-behavior: smooth;
    gap: 12px;
    padding: 0 36px; /* space for buttons */
    -webkit-overflow-scrolling: touch;
  }

  .products-grid-slider::-webkit-scrollbar {
    display: none;
  }

  .products-grid-slider .product-card {
    flex: 0 0 70%; /* 👈 1.5 slides */
  }
  a.story-link {
    margin-top: 10px !important;
  }

}

/* Hide mobile toggle on desktop */
@media (min-width: 769px) {
  .nav-mobile-toggle {
    display: none !important;
  }

  .nav-links {
    display: flex !important;
  }
}

/* ═══════════════════════════════════════════════
   HERO SECTION RESPONSIVE FIX
═══════════════════════════════════════════════ */

@media (max-width: 768px) {
  .newsletter h2 br,
  .story-content br,
  h1.hero-title br {
    display: none !important;
}
  .hero {
    grid-template-columns: 1fr;
    min-height: auto;
    padding-top: 120px;
  }

  .hero-left {
    padding: 40px 20px 0px 20px;
    order: 2;
  }

  .hero-right {
    order: 1;
    min-height: 300px;
  }

  .hero-title {
    font-size: clamp(1.8rem, 5vw, 2.8rem);
    margin-bottom: 24px;
  }

  .hero-sub {
    font-size: 0.9rem;
    max-width: 100%;
    margin-bottom: 32px;
  }

  .hero-badge {
    bottom: 20px;
    right: 20px;
    width: auto;
  }

}

/* Tablet size - 2 column layout may work */
@media (min-width: 769px) and (max-width: 1024px) {
  
  .hero {
    grid-template-columns: 1fr 1fr;
  }

  .hero-left {
    padding: 60px 40px;
  }

  .hero-title {
    font-size: clamp(2.5rem, 4.5vw, 3.5rem);
  }

}

/* ═══════════════════════════════════════════════
   PRODUCT GRID RESPONSIVE FIX
═══════════════════════════════════════════════ */

@media (max-width: 480px) {
  
  .products {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px;
  }

  .products .product {
    text-align: center;
  }

}

@media (min-width: 481px) and (max-width: 768px) {
  
  .products {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 16px;
  }

}

@media (min-width: 769px) and (max-width: 1024px) {
  
  .products {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 20px;
  }

}

@media (min-width: 1025px) {
  
  .products {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 24px;
  }

}

/* ═══════════════════════════════════════════════
   FORM STYLING (MISSING)
═══════════════════════════════════════════════ */

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="url"],
input[type="date"],
textarea,
select {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--stone);
  border-radius: 4px;
  font-family: var(--sans);
  font-size: 1rem;
  background: white;
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="tel"]:focus,
input[type="url"]:focus,
input[type="date"]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--clay);
  box-shadow: 0 0 0 3px rgba(196, 168, 130, 0.1);
}

textarea {
  resize: vertical;
  min-height: 120px;
  font-family: var(--sans);
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: 400;
  color: var(--text);
}

.form-group {
  margin-bottom: 24px;
}

/* ═══════════════════════════════════════════════
   ACCESSIBILITY IMPROVEMENTS
═══════════════════════════════════════════════ */

/* Better color contrast for navigation */
.nav-links a {
  color: var(--mid-accessible);
}

.nav-links a:hover {
  color: var(--text);
}

/* Visible focus states for keyboard navigation */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--clay);
  outline-offset: 2px;
}

/* Skip to main content link (for accessibility) */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--text);
  color: var(--warm-white);
  padding: 12px 16px;
  text-decoration: none;
  z-index: 200;
}

.skip-link:focus {
  top: 0;
}

/* ═══════════════════════════════════════════════
   MARQUEE ANIMATION OPTIMIZATION
═══════════════════════════════════════════════ */

.marquee-track {
  will-change: transform;
  transform: translateZ(0);  /* GPU acceleration hint */
  backface-visibility: hidden;
}

/* Reduce animation on low-power devices */
@media (prefers-reduced-motion: reduce) {
  
  .marquee-track {
    animation: none !important;
  }

  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }

}

/* ═══════════════════════════════════════════════
   BUTTON CONSISTENCY & IMPROVED STYLING
═══════════════════════════════════════════════ */

.btn-primary,
.btn-outline,
button {
  font-family: var(--sans);
  cursor: pointer;
  border: none;
  border-radius: 0;
  transition: all 0.3s ease;
  display: inline-block;
  text-align: center;
  text-decoration: none;
  user-select: none;
}

.btn-primary {
  padding: 14px 36px;
  background: var(--text);
  color: var(--warm-white);
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.btn-primary:hover {
  background: var(--mid);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.btn-outline {
  padding: 14px 36px;
  border: 1px solid var(--text);
  background: transparent;
  color: var(--text);
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.btn-outline:hover {
  background: var(--text);
  color: var(--warm-white);
  transform: translateY(-2px);
}

/* Disabled state */
.btn-primary:disabled,
.btn-outline:disabled,
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ═══════════════════════════════════════════════
   RESPONSIVE IMAGES
═══════════════════════════════════════════════ */

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

picture {
  display: block;
}

/* Prevent horizontal scrolling on mobile */
body, html {
  overflow-x: hidden;
}

/* ═══════════════════════════════════════════════
   TABLE RESPONSIVE LAYOUT
═══════════════════════════════════════════════ */

@media (max-width: 768px) {
  
  table {
    font-size: 0.85rem;
  }

  table th,
  table td {
    padding: 8px 12px;
  }

}

/* ═══════════════════════════════════════════════
   FOOTER RESPONSIVE
═══════════════════════════════════════════════ */

@media (max-width: 768px) {
  
  footer {
    padding: 40px 20px;
  }

  .footer-columns {
    grid-template-columns: 1fr;
    gap: 32px;
  }

}

/* ═══════════════════════════════════════════════
   MARQUEE RESPONSIVE
═══════════════════════════════════════════════ */

@media (max-width: 768px) {
  
  .marquee-item {
    font-size: 0.85rem;
  }

}

/* ═══════════════════════════════════════════════
   HIDE/SHOW ELEMENTS BY SCREEN SIZE
═══════════════════════════════════════════════ */

.hide-mobile {
  display: none;
}

.hide-desktop {
  display: block;
}

@media (min-width: 769px) {
  .hide-mobile {
    display: block;
  }

  .hide-desktop {
    display: none;
  }
}

/* ═══════════════════════════════════════════════
   WOOCOMMERCE CART/CHECKOUT MOBILE FIX
═══════════════════════════════════════════════ */

@media (max-width: 768px) {
  
  .woocommerce form .col-1,
  .woocommerce form .col-2 {
    width: 100%;
    margin-right: 0;
  }

  .woocommerce table.shop_table {
    font-size: 0.85rem;
  }

  .woocommerce table.shop_table thead {
    display: none;
  }

  .woocommerce table.shop_table tbody tr {
    display: block;
    margin-bottom: 20px;
    border: 1px solid var(--stone);
    padding: 16px;
  }

  .woocommerce table.shop_table tbody td {
    display: block;
    text-align: right;
    padding-bottom: 8px;
    border: none;
  }

  .woocommerce table.shop_table tbody td:before {
    content: attr(data-title);
    float: left;
    font-weight: 500;
  }

}

/* ═══════════════════════════════════════════════
   PRINT STYLES
═══════════════════════════════════════════════ */

@media print {
  nav, footer, .nav-icons, .cart-count {
    display: none;
  }

  body {
    background: white;
    color: black;
  }

  a {
    color: black;
    text-decoration: underline;
  }
}
