/* Mobile Optimization CSS for Glory House Society */
/* This file contains mobile-specific improvements and fixes */

/* ========================================
   BASE MOBILE IMPROVEMENTS
   ======================================== */

/* Hide burger button on desktop */
@media screen and (min-width: 992px) {
  .menu-button {
    display: none !important;
  }
}

/* Improve touch targets for mobile */
@media screen and (max-width: 767px) {
  /* Ensure all interactive elements are at least 44px (Apple's guideline) */
  a, button, input, select, textarea {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  /* Better text readability on mobile */
  body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
  }

  /* Prevent horizontal scroll */
  html, body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
  }

  /* Improve touch scrolling */
  * {
    -webkit-overflow-scrolling: touch;
  }
}

/* ========================================
   NAVIGATION IMPROVEMENTS
   ======================================== */

@media screen and (max-width: 991px) {
  /* Mobile menu button */
  .menu-button {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding: 0.75rem;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 1000;
    position: relative;
  }

  /* Burger icon */
  .menu-icon {
    width: 24px;
    height: 18px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }

  .menu-icon span {
    display: block;
    width: 100%;
    height: 2px;
    background-color: var(--contrast--primary-black);
    transition: all 0.3s ease;
    border-radius: 2px;
  }

  /* Burger animation when menu is open */
  .menu-button.menu-open .menu-icon span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
  }

  .menu-button.menu-open .menu-icon span:nth-child(2) {
    opacity: 0;
  }

  .menu-button.menu-open .menu-icon span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
  }

  /* Hide desktop menu items */
  .menu-item-wrapper.tablet-none {
    display: none;
  }

  /* Nav menu mobile positioning */
  .nav-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    background-color: var(--background--warm);
    padding-top: 5rem;
    padding-bottom: 2rem;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    z-index: 999;
  }

  /* Show menu when open */
  .nav-menu.mobile-menu-open {
    transform: translateX(0);
  }

  /* Nav grid adjustments */
  .nav-menu-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }
}

@media screen and (max-width: 767px) {
  /* Mobile menu improvements */
  .navbar {
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .navbar-logo {
    max-width: 60%;
    height: auto;
  }

  .nav-item-wrapper {
    border-bottom: 1px solid var(--outline--primary-black-0-20);
  }

  .menu-item-text {
    font-size: 1.25rem;
  }

  /* Language switcher mobile */
  .lang-switcher-compact {
    position: fixed;
    bottom: 2rem;
    right: 1.25rem;
    z-index: 1000;
  }

  .lang-button {
    min-width: 44px;
    min-height: 44px;
    padding: 0.5rem 1rem;
  }

  /* Show nested menu items on mobile */
  .mobail-none {
    display: block !important;
  }

  /* Mobile language switcher */
  .mobile-only-lang {
    display: block;
    border-top: 1px solid var(--outline--primary-black-0-20);
    padding: 2rem 1.5rem;
    margin-top: 1rem;
  }

  .lang-switcher-mobile {
    display: flex;
    gap: 1rem;
    justify-content: center;
    align-items: center;
  }

  .lang-switcher-mobile .lang-button {
    min-width: 80px;
    min-height: 48px;
    padding: 0.875rem 1.5rem;
    background: transparent;
    border: 2px solid var(--contrast--primary-black);
    border-radius: 8px;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--contrast--primary-black);
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
  }

  .lang-switcher-mobile .lang-button:hover {
    background: rgba(0, 0, 0, 0.05);
    transform: translateY(-2px);
  }

  .lang-switcher-mobile .lang-button.active {
    background: var(--contrast--primary-black);
    color: var(--contrast--primary);
    border-color: var(--contrast--primary-black);
  }

  .lang-switcher-mobile .lang-button:active {
    transform: translateY(0);
  }

  /* Hide mobile lang switcher on desktop */
  @media screen and (min-width: 992px) {
    .mobile-only-lang {
      display: none !important;
    }
  }
}

/* ========================================
   HERO SECTION MOBILE
   ======================================== */

@media screen and (max-width: 767px) {
  .section.full-screen {
    height: 100vh;
    height: 100svh; /* Use small viewport height for mobile */
    min-height: 600px;
  }

  .banner-grid {
    padding: 1rem;
  }

  .position-absolute-bottom {
    padding-bottom: 2rem;
  }

  /* Hero text improvements */
  h1 {
    font-size: 2.25rem;
    line-height: 1.15;
    margin-bottom: 1rem;
  }

  .paragraph.color-text-primary {
    font-size: 0.95rem;
    line-height: 1.5;
  }
}

/* ========================================
   BUTTONS AND FORMS MOBILE
   ======================================== */

@media screen and (max-width: 767px) {
  /* Button improvements */
  .button-wrapper {
    width: 100%;
    justify-content: center;
    padding: 1rem 1.5rem;
    text-align: center;
  }

  .button-wrapper.secondary {
    width: 100%;
    display: block;
    text-align: center;
  }

  /* Form improvements */
  .member-modal {
    padding: 0;
  }

  .modal-content {
    width: 100%;
    max-width: 100%;
    margin: 0;
    border-radius: 0;
    max-height: 100vh;
    overflow-y: auto;
  }

  .modal-header {
    padding: 1.5rem 1.25rem;
    position: sticky;
    top: 0;
    background: var(--contrast--primary);
    z-index: 10;
  }

  .modal-header h2 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
  }

  .modal-body {
    padding: 1.25rem;
  }

  .form-group {
    margin-bottom: 1.25rem;
  }

  .form-input,
  .form-select,
  .form-textarea {
    width: 100%;
    font-size: 16px; /* Prevents zoom on iOS */
    padding: 0.875rem;
    min-height: 44px;
  }

  .form-textarea {
    min-height: 120px;
  }

  .form-submit {
    width: 100%;
    min-height: 50px;
    font-size: 1.125rem;
    padding: 1rem;
  }

  /* Form row improvements */
  .form-row {
    flex-direction: column;
    gap: 1.25rem;
  }

  .form-row .form-group {
    width: 100%;
    margin-bottom: 0;
  }

  /* Checkbox grid improvements */
  .checkbox-group-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .checkbox-label {
    padding: 0.75rem;
    min-height: 44px;
  }

  /* Modal close button */
  .modal-close {
    min-width: 44px;
    min-height: 44px;
    padding: 0.5rem;
  }
}

/* ========================================
   CONTENT SECTIONS MOBILE
   ======================================== */

@media screen and (max-width: 767px) {
  /* Section padding adjustments */
  .padding-6 {
    padding-top: 3rem;
    padding-bottom: 3rem;
  }

  /* Grid improvements */
  .sticky-grid,
  .grid-template-columns,
  .grid-template-inverse,
  .three-columns,
  .two-columns {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  /* Image improvements */
  .cover-image {
    width: 100%;
    height: auto;
    max-height: 300px;
    object-fit: cover;
  }

  /* What We Do section - make images stack vertically */
  .wf-layout-layout {
    display: flex !important;
    flex-direction: column !important;
    gap: 1rem !important;
  }

  .wf-layout-layout .w-layout-cell {
    width: 100% !important;
  }

  .wf-layout-layout .w-layout-cell img {
    width: 100%;
    height: auto;
    max-width: 100%;
  }

  .sticky-image._1,
  .sticky-image._2,
  .sticky-image._3 {
    margin-top: 1rem;
    position: relative;
    top: 0;
  }

  /* Card improvements */
  .info-card {
    padding: 1.25rem;
    min-height: auto;
  }

  .info-card-icon {
    width: 2rem;
    height: 2rem;
  }

  /* Description wrapper improvements */
  .description-wrapper {
    padding: 0;
  }

  .padding-right-4-5,
  .padding-left-4-5 {
    padding-left: 0;
    padding-right: 0;
  }
}

/* ========================================
   FOOTER MOBILE
   ======================================== */

@media screen and (max-width: 767px) {
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
    text-align: center;
  }

  .left-column,
  .right-column {
    justify-content: center;
  }

  .gap-2-horizontal {
    justify-content: center;
    flex-wrap: wrap;
  }

  .gap-2-social-icons {
    justify-content: center;
  }

  .paragraph-secondary {
    font-size: 0.875rem;
  }
}

/* ========================================
   UTILITY CLASSES FOR MOBILE
   ======================================== */

@media screen and (max-width: 767px) {
  /* Hide on mobile */
  .mobile-hide {
    display: none !important;
  }

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

  /* Full width on mobile */
  .mobile-full-width {
    width: 100% !important;
  }

  /* Text center on mobile */
  .mobile-text-center {
    text-align: center !important;
  }

  /* Spacing utilities */
  .mobile-margin-top {
    margin-top: 2rem !important;
  }

  .mobile-margin-bottom {
    margin-bottom: 2rem !important;
  }

  .mobile-padding {
    padding: 1.25rem !important;
  }
}

/* ========================================
   LANDSCAPE MOBILE FIXES
   ======================================== */

@media screen and (max-width: 767px) and (orientation: landscape) {
  .section.full-screen {
    height: auto;
    min-height: 100vh;
  }

  .nav-menu {
    height: auto;
    max-height: 100vh;
    overflow-y: auto;
  }
}

/* ========================================
   SMALL MOBILE DEVICES (< 375px)
   ======================================== */

@media screen and (max-width: 374px) {
  h1 {
    font-size: 1.875rem;
  }

  h2 {
    font-size: 1.75rem;
  }

  h3 {
    font-size: 1.5rem;
  }

  .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .padding-6 {
    padding-top: 2.5rem;
    padding-bottom: 2.5rem;
  }

  .navbar-logo {
    max-width: 50%;
  }
}

/* ========================================
   ACCESSIBILITY IMPROVEMENTS
   ======================================== */

/* Focus visible for keyboard navigation */
@media screen and (max-width: 767px) {
  a:focus-visible,
  button:focus-visible,
  input:focus-visible,
  select:focus-visible,
  textarea:focus-visible {
    outline: 2px solid var(--brand--light);
    outline-offset: 2px;
  }

  /* Remove tap highlight on mobile */
  * {
    -webkit-tap-highlight-color: transparent;
  }

  /* Better active states */
  a:active,
  button:active {
    opacity: 0.7;
  }
}

/* ========================================
   PERFORMANCE OPTIMIZATIONS
   ======================================== */

@media screen and (max-width: 767px) {
  /* Reduce motion for users who prefer it */
  @media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
    }
  }

  /* Optimize images loading */
  img {
    max-width: 100%;
    height: auto;
  }

  /* Optimize video for mobile */
  video {
    max-width: 100%;
    height: auto;
  }
}