/*
 * Mobile Experience Enhancements for 2026 Standards
 * Optimized for modern mobile devices and best practices
 */

/* ========================================
   Global Base Styles (safe for all viewports)
   ======================================== */

/* Improve touch scrolling */
html {
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
  touch-action: manipulation;
}

body {
  /* Prevent horizontal scroll on mobile */
  overflow-x: hidden;
  /* Improve text rendering on mobile */
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* Responsive images by default */
img {
  max-width: 100%;
  height: auto;
}

/* Lazy loading support - only fade in below-the-fold images */
img[loading="lazy"] {
  transition: opacity 0.3s;
}

img[loading="lazy"].loaded {
  opacity: 1;
}

/* ========================================
   Performance Optimizations
   ======================================== */

/* Reduce motion for better performance and accessibility */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ========================================
   Mobile-Specific Utility Classes
   ======================================== */

/* Show only on mobile */
.mobile-show {
  display: none !important;
}

/* ========================================
   Accessibility Improvements (all viewports)
   ======================================== */

/* Focus states for touch devices */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus {
  outline: 3px solid #33647e;
  outline-offset: 2px;
}

/* Improve focus visibility on dark backgrounds */
.menuzord-menu a:focus {
  outline-color: #ffffff;
  background-color: rgba(255, 255, 255, 0.1);
}

/* Skip to content link */
.skip-to-content {
  position: absolute;
  top: -100px;
  left: 0;
  background: #33647e;
  color: white;
  padding: 12px 24px;
  z-index: 9999;
  transition: top 0.3s;
  text-decoration: none;
  font-weight: bold;
}

.skip-to-content:focus {
  top: 0;
  outline: 3px solid #ffffff;
}

/* Improve button contrast for better accessibility */
.btn,
button[type="submit"],
input[type="submit"] {
  font-weight: 600;
  transition: all 0.3s ease;
}

.btn:focus,
button[type="submit"]:focus,
input[type="submit"]:focus {
  outline: 3px solid #33647e;
  outline-offset: 2px;
  transform: scale(1.02);
}

/* Improve link visibility */
a {
  transition: color 0.2s ease;
}

/* Better focus for social media icons */
.social-icon a:focus {
  outline: 3px solid #ffffff;
  outline-offset: 4px;
  transform: scale(1.1);
}

/* ========================================
   Tablet Optimizations (768px - 991px)
   ======================================== */

@media only screen and (min-width: 768px) and (max-width: 991px) {
  /* Touch targets still important on tablets */
  .btn,
  button {
    min-height: 44px;
    min-width: 44px;
  }

  /* Better use of tablet space */
  .container {
    max-width: 720px;
  }
}

/* ========================================
   Mobile Styles (max-width: 767px)
   ======================================== */

@media only screen and (max-width: 767px) {

  /* --- Touch Target Optimization (48x48px minimum) --- */
  .btn,
  button,
  [type="button"],
  [type="submit"],
  input[type="submit"],
  .button {
    min-height: 48px;
    min-width: 48px;
    padding: 12px 24px;
  }

  /* Form control touch targets */
  input,
  select,
  textarea {
    min-height: 48px;
    font-size: 16px; /* Prevents iOS zoom on focus */
  }

  /* --- Mobile Typography --- */
  body {
    font-size: 16px;
    line-height: 1.6;
    color: #222;
  }

  h1 {
    font-size: clamp(32px, 8vw, 56px);
    line-height: 1.2;
    margin-bottom: 16px;
  }

  h2 {
    font-size: clamp(28px, 6vw, 44px);
    line-height: 1.3;
    margin-bottom: 14px;
  }

  h3 {
    font-size: clamp(24px, 5vw, 36px);
    line-height: 1.35;
    margin-bottom: 12px;
  }

  h4 {
    font-size: clamp(20px, 4vw, 28px);
    line-height: 1.4;
    margin-bottom: 10px;
  }

  h5 {
    font-size: clamp(18px, 3.5vw, 22px);
    line-height: 1.45;
    margin-bottom: 8px;
  }

  p {
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 16px;
  }

  ul, ol {
    padding-left: 20px;
    margin-bottom: 16px;
  }

  li {
    margin-bottom: 8px;
  }

  /* Better heading visibility */
  h1, h2, h3, h4, h5, h6 {
    color: #111;
  }

  /* Improve link contrast */
  a:not(.btn) {
    text-decoration-skip-ink: auto;
  }

  /* --- Mobile Spacing and Layout --- */
  section {
    padding: 40px 16px !important;
  }

  .container {
    padding-left: 16px;
    padding-right: 16px;
  }

  .card,
  .panel,
  .box {
    margin-bottom: 16px;
  }

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

  img {
    margin-bottom: 16px;
  }

  /* Carousel images should not have extra margin */
  .carousel-inner img {
    margin-bottom: 0;
    width: 100%;
  }

  /* --- Mobile Navigation --- */
  .menuzord-menu {
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .menuzord-menu > li {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  .menuzord-menu > li > a {
    padding: 16px 20px;
    font-size: 18px;
    min-height: 48px;
    display: block;
  }

  .menuzord-menu ul.dropdown {
    position: static;
    width: 100%;
    box-shadow: none;
  }

  .nav-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
  }

  /* Enhanced hamburger menu icon */
  .menuzord .showhide {
    display: block !important;
    width: 48px;
    height: 48px;
    padding: 14px 0 0;
    cursor: pointer;
    position: relative;
  }

  .menuzord .showhide em {
    width: 24px;
    height: 3px;
    margin: 4px auto 0;
    background: #fff;
    transition: all 0.3s ease;
    display: block;
    float: none;
  }

  /* Improve mobile menu visibility - use brand color */
  .menuzord-responsive .menuzord-menu {
    background: var(--lovin-blue-1, #051c2c);
    backdrop-filter: blur(10px);
  }

  /* Better brand logo sizing on mobile */
  .menuzord-responsive .menuzord-brand {
    max-width: 220px;
  }

  .menuzord-responsive .menuzord-brand img {
    max-height: 60px;
    width: auto;
  }

  /* --- Background Images on Mobile --- */
  .parallax,
  .bg-image {
    background-attachment: scroll !important;
    background-size: cover;
    background-position: center;
  }

  /* Fix inline background-attachment:fixed on mobile (iOS ignores it) */
  #responsiveDesign {
    background-attachment: scroll !important;
  }

  /* --- Utility Classes --- */
  .mobile-hide {
    display: none !important;
  }

  .mobile-show {
    display: block !important;
  }

  .mobile-text-center {
    text-align: center !important;
  }

  .mobile-text-left {
    text-align: left !important;
  }

  /* --- Form Enhancements --- */
  input[type="text"],
  input[type="email"],
  input[type="tel"],
  input[type="number"],
  select,
  textarea {
    width: 100%;
    font-size: 16px;
    padding: 14px 16px;
    border-radius: 4px;
    appearance: none;
    -webkit-appearance: none;
  }

  textarea {
    min-height: 120px;
    resize: vertical;
  }

  select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
  }

  input[type="checkbox"],
  input[type="radio"] {
    min-width: 24px;
    min-height: 24px;
    margin-right: 12px;
  }

  .form-group button,
  .form-group input[type="submit"] {
    width: 100%;
    margin-top: 8px;
  }

  /* ========================================
     Hero Section: reduce height, brand overlay
     ======================================== */

  #site-header.header-fullscreen {
    height: 60vh !important;
    min-height: 350px;
  }

  /* Brand overlay on hero - Lovin Blue 1 */
  #site-header .overlay-01.parallax-hero::after {
    background-color: rgba(5, 28, 44, 0.5);
  }

  /* ========================================
     Content Density & Flow Refinements
     ======================================== */

  /* --- About Section: constrain image, let text flow --- */
  #about .col-md-6:first-child img {
    max-width: 80%;
    margin: 0 auto 20px;
  }

  /* --- Portfolio Grid: stack vertically, hide hover overlays --- */
  .portfolio-masonry {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .portfolio-masonry .portfolio-item {
    width: 100% !important;
    float: none !important;
  }

  /* Keep portfolio hover descriptions visible on mobile */
  .portfolio-masonry .portfolio-hover {
    opacity: 1 !important;
    background-color: rgba(5, 28, 44, 0.65);
  }

  /* --- CTA7 Banner: compact --- */
  .cta7 {
    padding: 20px 16px !important;
  }

  /* --- Features Section: truncate long paragraphs --- */
  #services-small .service-desc p {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 14px;
  }

  #services-small .col-md-4 {
    margin-bottom: 24px;
  }

  /* --- Hide redundant "Handmade with love" CTA on mobile --- */
  #cta-8 {
    display: none;
  }

  /* --- Fun Facts: tighten spacing --- */
  #funfacts {
    padding: 30px 16px !important;
  }

  #funfacts .fact {
    margin-bottom: 16px;
    text-align: center;
  }

  #funfacts .col-xs-6 {
    margin-bottom: 12px;
  }

  /* --- Ingredients: scrollable container with fade hint --- */
  #services .row {
    max-height: 600px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
  }

  #services .row::after {
    content: "Scroll for more ingredients \2193";
    display: block;
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    padding: 12px;
    background: linear-gradient(transparent, #ffffff 40%);
    color: #33647e;
    font-weight: 600;
    font-size: 14px;
    pointer-events: none;
  }

  #services .service-item {
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
  }

  #services .service-item p {
    font-size: 14px;
    margin-bottom: 4px;
  }

  #services .service-item .icon {
    display: none;
  }

  /* --- Pricing / Buy Now: prominent CTA --- */
  #pricing a.btn-cal-default {
    display: block;
    width: 100%;
    margin: 16px 0;
    text-align: center;
    font-size: 18px !important;
    padding: 16px 24px !important;
  }

  #pricing .col-sm-6 {
    width: 100%;
    float: none;
  }

  #pricing .subscribe-image {
    display: none;
  }

  /* --- Custom Diet CTA: compact --- */
  #cta-1 {
    padding: 30px 16px !important;
  }

  #cta-1 h5 {
    font-size: 15px;
  }

  /* --- General Info / Progress Bars: scrollable with hint --- */
  #level .col-md-6:last-child {
    display: none;
  }

  #level .col-md-6:first-child {
    width: 100%;
  }

  #level .section-content {
    max-height: 400px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
  }

  #level .section-content::after {
    content: "Scroll for more info \2193";
    display: block;
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    padding: 12px;
    background: linear-gradient(transparent, rgba(243,243,243,0.95) 40%);
    color: #33647e;
    font-weight: 600;
    font-size: 14px;
    pointer-events: none;
  }

  #level .cta-content h5 {
    font-size: 14px !important;
    line-height: 1.5;
  }

  #level .cta-content {
    padding: 5px !important;
  }

  /* --- Newsletter / Contact Forms: stack columns --- */
  #subscribe .col-sm-6 {
    width: 100%;
    float: none;
  }

  /* --- Footer: compact --- */
  #footer-widgets {
    padding: 24px 16px !important;
  }

  #footer-widgets .content-wrap.widget-gallery {
    display: none;
  }

  #footer-widgets .col-md-2 {
    display: none;
  }

  #footer-widgets br {
    display: none;
  }

  #footer {
    padding: 16px !important;
  }

  #footer .copyright {
    font-size: 13px;
  }
}

/* ========================================
   Small Phone Optimizations (< 480px)
   ======================================== */

@media only screen and (max-width: 480px) {
  h1 {
    font-size: clamp(28px, 7vw, 48px);
  }

  section {
    padding: 32px 12px !important;
  }

  .container {
    padding-left: 12px;
    padding-right: 12px;
  }

  .btn {
    padding: 10px 20px;
    font-size: 14px;
  }
}

/* ========================================
   Large Phone / Small Tablet (481px - 767px)
   ======================================== */

@media only screen and (min-width: 481px) and (max-width: 767px) {
  .container {
    max-width: 100%;
  }

  section {
    padding: 48px 20px !important;
  }
}
