/* =============================================
   AFTR6 — Mobile-First Responsive Overhaul
   =============================================
   Comprehensive mobile optimization for a social-media-driven
   audience (Instagram/TikTok referrals, primarily mobile users).

   Key mobile priorities:
   1. Touch-friendly tap targets (minimum 44px)
   2. Readable typography without zooming
   3. Thumb-reachable CTAs
   4. Fast-feeling interactions
   5. Optimized content hierarchy for small screens
   6. Smooth scroll performance
   ============================================= */

/* ===== GLOBAL MOBILE TOUCH OPTIMIZATION ===== */

/* Ensure smooth scrolling on iOS */
html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

/* Prevent content shift on mobile keyboards */
body {
  min-height: 100vh;
  min-height: -webkit-fill-available;
}

/* All interactive elements: minimum tap target */
a, button, select, input, textarea,
.faq-question, .gallery-filter, .gallery-item,
.gallery-masonry-item {
  -webkit-tap-highlight-color: rgba(62, 180, 137, 0.15);
}

/* ===== TABLET (max-width: 1024px) ===== */
@media (max-width: 1024px) {

  .section-padding {
    padding: 80px 0;
  }

  .section-header {
    margin-bottom: 48px;
  }

  .section-header h2 {
    font-size: clamp(2rem, 4.5vw, 3.5rem);
  }

  .hero-title {
    font-size: clamp(2.8rem, 7vw, 5rem);
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
  }

  .services-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ===== MOBILE LANDSCAPE / LARGE PHONE (max-width: 768px) ===== */
@media (max-width: 768px) {

  /* --- Typography --- */
  .section-header h2 {
    font-size: clamp(1.8rem, 6vw, 2.8rem);
    line-height: 1.15;
  }

  .section-header p {
    font-size: 0.95rem;
    max-width: 100%;
    padding: 0 8px;
  }

  .section-padding {
    padding: 64px 0;
  }

  .container {
    padding: 0 16px;
  }

  /* --- Hero Section --- */
  .hero-section {
    min-height: 85vh;
    min-height: 85svh; /* Small viewport height for mobile browsers */
  }

  .hero-content {
    padding: 0 16px;
    max-width: 100%;
  }

  .hero-eyebrow {
    font-size: 0.65rem;
    letter-spacing: 0.15em;
    margin-bottom: 12px;
  }

  .hero-title {
    font-size: clamp(2.2rem, 10vw, 3.5rem);
    margin-bottom: 16px;
  }

  .hero-subtitle {
    font-size: 0.95rem;
    max-width: 100%;
    margin-bottom: 28px;
    line-height: 1.7;
  }

  /* Hero buttons stack on mobile */
  .hero-content > div:last-child {
    flex-direction: column;
    align-items: center;
    gap: 12px !important;
    width: 100%;
  }

  /* --- Buttons — Full width on mobile --- */
  .btn-primary,
  .btn-secondary {
    width: 100%;
    justify-content: center;
    padding: 16px 28px;
    font-size: 0.9rem;
    min-height: 52px; /* Touch target */
  }

  /* Inline buttons (non-hero) side by side */
  .reveal > a.btn-primary,
  .reveal > a.btn-secondary {
    width: auto;
    min-width: 200px;
  }

  /* --- Navigation --- */
  .site-header {
    padding: 12px 0;
  }

  .site-logo {
    font-size: 1.5rem;
  }

  .primary-nav {
    width: 100%;
    right: -100%;
    padding: 80px 24px 32px;
    gap: 0;
  }

  .primary-nav a {
    font-size: 1.1rem;
    padding: 16px 0;
    width: 100%;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    min-height: 52px;
    display: flex;
    align-items: center;
  }

  .primary-nav .nav-cta {
    margin-top: 20px;
    text-align: center;
    width: 100%;
    justify-content: center;
    min-height: 52px;
  }

  .mobile-toggle {
    padding: 10px;
    margin: -10px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* --- Trust/Benefit Cards --- */
  .trust-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .trust-card {
    padding: 28px 20px;
    text-align: left;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 16px;
  }

  .trust-icon {
    font-size: 1.8rem;
    margin-bottom: 0;
    flex-shrink: 0;
  }

  .trust-card h3 {
    font-size: 1rem;
    margin-bottom: 6px;
  }

  .trust-card p {
    font-size: 0.88rem;
  }

  /* --- Service Cards --- */
  .services-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .service-card {
    padding: 24px 20px;
  }

  .service-card h3 {
    font-size: 1.15rem;
  }

  /* --- Stat Cards --- */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .stat-card {
    padding: 28px 16px;
  }

  .stat-number {
    font-size: 2.5rem;
  }

  .stat-label {
    font-size: 0.78rem;
  }

  /* --- Step Cards --- */
  .steps-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .step-card {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 16px;
    text-align: left;
    padding: 24px 20px;
  }

  .step-number {
    font-size: 2.5rem;
    margin-bottom: 0;
    min-width: 60px;
    flex-shrink: 0;
    text-align: center;
  }

  .step-card h3 {
    font-size: 1rem;
    margin-bottom: 6px;
  }

  .step-card p {
    font-size: 0.88rem;
  }

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

  .testimonial-card {
    padding: 24px 20px;
  }

  .testimonial-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
  }

  .testimonial-card p {
    font-size: 0.92rem;
    line-height: 1.7;
  }

  /* --- Package Cards --- */
  .packages-featured-grid,
  .packages-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .package-card {
    padding: 28px 24px;
  }

  .package-name {
    font-size: 1.4rem;
  }

  .package-price {
    font-size: 2.4rem;
    margin-bottom: 20px;
  }

  .package-features li {
    font-size: 0.88rem;
    padding: 8px 0;
  }

  .package-card .btn-primary {
    min-height: 52px;
    font-size: 0.88rem;
  }

  /* Featured card: remove excessive visual weight on mobile */
  .package-card--featured {
    order: -1; /* Show featured first on mobile */
  }

  /* --- Gallery --- */
  .gallery-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .gallery-item:first-child {
    grid-column: 1 / -1;
    aspect-ratio: 16/9;
  }

  .gallery-item {
    aspect-ratio: 1/1;
    border-radius: 8px;
  }

  .gallery-masonry {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .gallery-masonry-item {
    aspect-ratio: 1/1;
    border-radius: 8px;
  }

  .gallery-filters {
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    justify-content: flex-start;
    padding: 0 16px;
    scrollbar-width: none;
    -ms-overflow-style: none;
    margin-left: -16px;
    margin-right: -16px;
  }

  .gallery-filters::-webkit-scrollbar {
    display: none;
  }

  .gallery-filter {
    white-space: nowrap;
    flex-shrink: 0;
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  /* --- FAQ --- */
  .faq-question {
    padding: 16px 16px;
    font-size: 0.92rem;
    min-height: 52px;
    gap: 12px;
  }

  .faq-question span {
    flex: 1;
    padding-right: 8px;
  }

  .faq-toggle {
    width: 32px;
    height: 32px;
    min-width: 32px;
    font-size: 1.4rem;
  }

  .faq-answer p {
    padding: 0 16px 16px;
    font-size: 0.9rem;
  }

  /* --- Booking Form --- */
  .booking-wrapper {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .booking-info h2 {
    font-size: clamp(1.8rem, 6vw, 2.5rem);
  }

  .booking-form-box {
    padding: 24px 16px;
    border-radius: 16px;
  }

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

  .form-group label {
    font-size: 0.8rem;
    margin-bottom: 5px;
  }

  .form-group input,
  .form-group select,
  .form-group textarea {
    padding: 14px 14px;
    font-size: 16px; /* Prevents iOS zoom on focus */
    min-height: 48px;
    border-radius: 10px;
  }

  .form-group textarea {
    min-height: 90px;
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .form-submit {
    min-height: 52px;
    font-size: 0.95rem;
    margin-top: 12px;
  }

  /* --- Contact Page --- */
  .contact-wrapper {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .contact-form-col .booking-form-box {
    padding: 24px 16px;
  }

  .contact-sidebar {
    padding: 28px 20px;
  }

  .contact-detail {
    padding: 14px 0;
    gap: 12px;
  }

  .contact-detail-icon {
    font-size: 1.1rem;
  }

  /* --- About Page --- */
  .about-grid {
    grid-template-columns: 1fr;
    gap: 32px;
    padding: 32px 0;
  }

  .about-image {
    order: -1; /* Show image first on mobile */
    border-radius: 12px;
  }

  .about-image img {
    border-radius: 12px;
    max-height: 300px;
  }

  .team-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .team-card {
    padding: 24px 20px;
  }

  .team-avatar {
    width: 64px;
    height: 64px;
    font-size: 1.4rem;
  }

  /* --- Values Grid --- */
  .values-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .value-card {
    padding: 24px 20px;
    text-align: left;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 16px;
  }

  .value-icon {
    font-size: 1.8rem;
    margin-bottom: 0;
    flex-shrink: 0;
  }

  /* --- Add-ons Table --- */
  .addons-table-wrapper {
    margin: 0 -16px;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  .addons-table {
    font-size: 0.85rem;
  }

  .addons-table th,
  .addons-table td {
    padding: 12px 14px;
  }

  .addons-table td:nth-child(3) {
    display: none; /* Hide description column on mobile, save space */
  }

  .addons-table th:nth-child(3) {
    display: none;
  }

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

  .footer-brand p {
    max-width: 100%;
  }

  .footer-col {
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  }

  .footer-col:last-child {
    border-bottom: none;
  }

  .footer-col a {
    padding: 8px 0;
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  .footer-bottom {
    flex-direction: column;
    gap: 16px;
    text-align: center;
  }

  .footer-socials a {
    width: 44px;
    height: 44px;
    font-size: 1rem;
  }

  /* --- CTA Banner --- */
  .cta-banner {
    padding: 80px 0 60px;
  }

  .cta-banner h2 {
    font-size: clamp(2rem, 7vw, 3rem);
  }

  /* --- Page Heroes --- */
  .page-hero {
    padding: 120px 0 60px;
  }

  .page-hero h1 {
    font-size: clamp(1.8rem, 7vw, 3rem);
    padding: 0 8px;
  }

  .page-hero p {
    font-size: 0.95rem;
    max-width: 100%;
    padding: 0 8px;
  }

  /* --- Floating CTA --- */
  .float-cta {
    bottom: 16px;
    right: 16px;
    left: 16px;
    text-align: center;
    padding: 16px 20px;
    font-size: 0.88rem;
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
  }

  /* --- Service area badges --- */
  .page-hero ~ .section-padding [style*="border-radius: 50px"] {
    font-size: 0.82rem !important;
    padding: 8px 14px !important;
  }
}

/* ===== SMALL PHONE (max-width: 480px) ===== */
@media (max-width: 480px) {

  .container {
    padding: 0 14px;
  }

  .section-padding {
    padding: 52px 0;
  }

  /* --- Hero --- */
  .hero-section {
    min-height: 80vh;
    min-height: 80svh;
  }

  .hero-eyebrow {
    font-size: 0.58rem;
    letter-spacing: 0.1em;
  }

  .hero-title {
    font-size: clamp(2rem, 12vw, 3rem);
  }

  .hero-subtitle {
    font-size: 0.9rem;
  }

  .hero-content::after {
    height: 30px;
    margin-top: 32px;
  }

  /* --- Section Headers --- */
  .section-header h2 {
    font-size: clamp(1.6rem, 7vw, 2.2rem);
  }

  .section-header {
    margin-bottom: 36px;
  }

  /* --- Stats: 2x2 grid --- */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .stat-card {
    padding: 20px 12px;
  }

  .stat-number {
    font-size: 2rem;
  }

  .stat-label {
    font-size: 0.72rem;
  }

  /* --- Gallery: Single column --- */
  .gallery-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .gallery-masonry {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .gallery-masonry-item,
  .gallery-item {
    aspect-ratio: 16/10;
  }

  .gallery-item:first-child {
    aspect-ratio: 16/10;
  }

  /* --- Packages --- */
  .package-card {
    padding: 24px 18px;
  }

  .package-price {
    font-size: 2rem;
  }

  .package-name {
    font-size: 1.2rem;
  }

  /* --- Page Hero --- */
  .page-hero {
    padding: 110px 0 48px;
  }

  .page-hero h1 {
    font-size: clamp(1.6rem, 8vw, 2.5rem);
  }

  /* --- About Image --- */
  .about-image img {
    max-height: 220px;
  }

  /* --- Booking --- */
  .booking-info h2 {
    font-size: clamp(1.5rem, 7vw, 2rem);
  }

  .booking-form-box {
    padding: 20px 14px;
  }

  /* --- CTA Banner --- */
  .cta-banner {
    padding: 60px 0 48px;
  }

  .cta-banner h2 {
    font-size: clamp(1.6rem, 8vw, 2.5rem);
    margin-bottom: 20px;
  }

  /* --- Footer --- */
  .site-footer {
    padding: 40px 0 20px;
  }

  .footer-grid {
    gap: 24px;
  }

  /* --- Portfolio --- */
  .portfolio-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

/* ===== VERY SMALL SCREENS (max-width: 360px) ===== */
@media (max-width: 360px) {

  .container {
    padding: 0 12px;
  }

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

  .btn-primary,
  .btn-secondary {
    padding: 14px 16px;
    font-size: 0.82rem;
  }

  .package-card {
    padding: 20px 14px;
  }

  .package-price {
    font-size: 1.8rem;
  }

  .site-logo {
    font-size: 1.3rem;
  }

  .stat-number {
    font-size: 1.7rem;
  }

  .gallery-filter {
    padding: 6px 10px;
    font-size: 0.75rem;
  }
}

/* ===== SAFE AREA INSETS (Notch / Dynamic Island / Gesture Bar) ===== */
@supports (padding: env(safe-area-inset-bottom)) {
  .site-header {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }

  .float-cta {
    bottom: calc(16px + env(safe-area-inset-bottom));
  }

  .site-footer {
    padding-bottom: calc(30px + env(safe-area-inset-bottom));
  }

  .primary-nav {
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* ===== LANDSCAPE MODE PHONE ===== */
@media (max-width: 768px) and (orientation: landscape) {
  .hero-section {
    min-height: 100vh;
    min-height: 100svh;
  }

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

  .hero-subtitle {
    font-size: 0.88rem;
    margin-bottom: 20px;
  }

  .hero-content > div:last-child {
    flex-direction: row;
    gap: 12px !important;
  }

  .btn-primary,
  .btn-secondary {
    width: auto;
    min-width: 160px;
  }

  .page-hero {
    padding: 100px 0 48px;
  }
}

/* ===== DARK MODE / HIGH CONTRAST ===== */
@media (prefers-contrast: high) {
  .trust-card,
  .service-card,
  .step-card,
  .testimonial-card,
  .package-card,
  .value-card {
    border-color: rgba(255, 255, 255, 0.2);
  }

  .btn-primary {
    border-color: rgba(62, 180, 137, 0.8);
  }
}

/* ===== TOUCH DEVICE: DISABLE STICKY HOVER STATES ===== */
/* Prevents the "stuck hover" bug on mobile Safari/Chrome */
@media (hover: none) and (pointer: coarse) {
  .trust-card:hover,
  .service-card:hover,
  .step-card:hover,
  .testimonial-card:hover,
  .package-card:hover,
  .value-card:hover,
  .addon-card:hover,
  .stat-card:hover {
    transform: none;
    box-shadow: none;
    border-color: rgba(255, 255, 255, 0.06);
  }

  .service-card:hover::before {
    transform: scaleX(0);
  }

  .gallery-item:hover img,
  .gallery-masonry-item:hover img {
    transform: none;
  }

  .gallery-item:hover::after,
  .gallery-masonry-item:hover .gallery-masonry-overlay {
    opacity: 0;
  }

  .footer-col a:hover {
    padding-left: 0;
    transform: none;
  }

  /* Active state for touch feedback instead of hover */
  .trust-card:active,
  .service-card:active,
  .package-card:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
  }

  .btn-primary:active,
  .btn-secondary:active {
    transform: scale(0.96);
    transition: transform 0.1s ease;
  }

  /* Simplify animations for battery life */
  .hero-section::after,
  .trust-section::before,
  .services-section::before,
  .testimonials-section::before,
  .faq-section::before,
  .stat-card::before {
    animation: none;
  }

  .package-badge {
    animation: none;
    background: var(--gradient-green);
  }

  .package-card--featured {
    animation: none;
  }
}

/* ===== MOBILE: BOTTOM STICKY CTA BAR ===== */
/* Shows a fixed "Get Quote" bar at the very bottom on phones */
@media (max-width: 768px) {
  .float-cta.visible {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    border-radius: 0;
    z-index: 999;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
    padding: 16px 24px;
    min-height: 56px;
    font-size: 0.9rem;
  }

  /* Add bottom padding to body so content isn't hidden behind sticky CTA */
  body.is-mobile {
    padding-bottom: 56px;
  }
}
