/* =====================================================
   PUSPAGA — Comprehensive Responsive Stylesheet
   Breakpoints:
   - Ultra-Small Mobile: ≤ 360px
   - Small Mobile: ≤ 576px
   - Small Tablet / Phablet: 577px – 768px
   - Tablet / iPad: 769px – 992px
   - Desktop / Laptop: 993px – 1399px
   - Large Desktop / Ultra-wide: ≥ 1400px
   ===================================================== */

/* =====================================================
   GLOBAL RESPONSIVE BASE & OVERFLOW SAFETY
   ===================================================== */
html, body {
  overflow-x: hidden;
  max-width: 100vw;
}

img, video, iframe, canvas, svg {
  max-width: 100%;
}

.container {
  width: 100%;
  box-sizing: border-box;
}

/* Align utilities */
.align-center {
  align-items: center;
}

/* =====================================================
   LARGE DESKTOP / ULTRA-WIDE (≥1400px)
   ===================================================== */
@media (min-width: 1400px) {
  :root {
    --container-max: 1320px;
  }
}

/* =====================================================
   DESKTOP / LAPTOP (993px – 1399px)
   ===================================================== */
@media (min-width: 993px) {
  .hamburger { display: none !important; }
  .mobile-nav { display: none !important; }
  .main-nav { display: flex; }
}

/* =====================================================
   TABLET & MOBILE (≤992px)
   ===================================================== */
@media (max-width: 992px) {
  :root {
    --space-2xl: 72px;
    --space-xl: 48px;
    --header-height: 68px;
  }

  .container { padding: 0 var(--space-md); }

  /* Header Navigation */
  .main-nav { display: none; }
  .hamburger { display: flex; align-items: center; justify-content: center; }
  .header-cta .btn-primary { display: none; }

  /* Hero Section */
  .hero {
    min-height: auto;
    padding: var(--space-xl) 0;
  }
  .hero-grid {
    grid-template-columns: 1fr;
    gap: var(--space-lg);
  }
  .hero-image-wrap { order: -1; }
  .hero-image { max-width: 480px; width: 100%; margin: 0 auto; }
  .hero-float-card.card-tl { top: 10px; left: 0; }
  .hero-float-card.card-br { bottom: 10px; right: 0; }

  /* Grids Breakdown */
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: repeat(2, 1fr); }

  /* About & FAQ & Contact */
  .about-grid,
  .faq-grid,
  .contact-grid {
    grid-template-columns: 1fr;
    gap: var(--space-lg);
  }
  .faq-sidebar { position: static; }
  .consult-grid { max-width: 100%; grid-template-columns: 1fr; }

  /* Footer */
  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
  }

  /* Flow Steps */
  .flow-steps {
    flex-wrap: wrap;
    gap: var(--space-md);
  }
  .flow-steps::before { display: none; }
  .flow-step { flex: 0 0 calc(50% - (var(--space-md) / 2)); }

  /* Topbar */
  .topbar-right { display: none; }

  /* Mobile Nav Height & Positioning */
  .mobile-nav {
    top: calc(var(--topbar-height) + var(--header-height));
    max-height: calc(100vh - (var(--topbar-height) + var(--header-height)));
    overflow-y: auto;
  }

  body.topbar-hidden .mobile-nav {
    top: var(--header-height);
    max-height: calc(100vh - var(--header-height));
  }
}

/* =====================================================
   PHABLET & SMALL TABLET (577px – 768px)
   ===================================================== */
@media (min-width: 577px) and (max-width: 768px) {
  .hero-title { font-size: clamp(28px, 4vw, 36px); }
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .hero-actions { flex-direction: row; flex-wrap: wrap; }
  .privacy-card-banner { flex-direction: row; gap: 20px; }
}

/* =====================================================
   MOBILE (≤576px)
   ===================================================== */
@media (max-width: 576px) {
  :root {
    --space-2xl: 52px;
    --space-xl: 36px;
    --space-lg: 24px;
    --space-md: 16px;
    --space-sm: 12px;
    --header-height: 64px;
  }

  .container { padding: 0 var(--space-sm); }

  /* Topbar */
  .topbar { font-size: 11px; }
  .topbar-content { justify-content: center; text-align: center; }

  /* Header Logo & Brand */
  .header-single-logo {
    height: 40px;
    max-height: 44px;
  }
  .logo-name {
    font-size: 13px;
    letter-spacing: 0.2px;
  }
  .logo-sub {
    font-size: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
  }

  /* Hero */
  .hero { padding: var(--space-lg) 0; }
  .hero-title { font-size: clamp(24px, 6.5vw, 30px); }
  .hero-desc { font-size: 14px; line-height: 1.6; }
  .hero-actions { flex-direction: column; align-items: stretch; gap: 10px; }
  .hero-actions .btn,
  .btn-full-mobile { width: 100%; display: flex; justify-content: center; text-align: center; min-height: 48px; box-sizing: border-box; }
  .hero-badges { justify-content: center; flex-wrap: wrap; gap: 8px; }
  .hero-float-card { display: none; }

  /* Sections */
  .section { padding: var(--space-xl) 0; }
  .section-header { margin-bottom: var(--space-lg); }
  .section-title { font-size: clamp(22px, 5.5vw, 26px); }
  .section-desc { font-size: 15px; }

  /* All Grids collapse to 1 column */
  .grid-2,
  .grid-3,
  .grid-4,
  .consult-grid,
  .flow-card-grid {
    grid-template-columns: 1fr !important;
    gap: var(--space-md);
  }

  /* Cards */
  .card, .service-card, .step-card-box, .flow-card {
    padding: var(--space-md);
  }

  /* Privacy Banner */
  .privacy-card,
  .privacy-card-banner {
    flex-direction: column;
    text-align: center;
    align-items: center;
    padding: var(--space-md);
  }

  /* CTA */
  .cta-actions { flex-direction: column; gap: 10px; }
  .cta-actions .btn { width: 100%; justify-content: center; }

  /* Emergency */
  .emergency-inner { gap: var(--space-sm); flex-direction: column; text-align: center; }

  /* FAQ */
  .faq-question { padding: var(--space-sm); font-size: 14px; min-height: 44px; }
  .faq-answer-inner { padding: 0 var(--space-sm) var(--space-sm); }

  /* Contact */
  .contact-socials { flex-wrap: wrap; justify-content: center; }

  /* Flow Steps */
  .flow-step { flex: 0 0 100%; }

  /* Footer */
  .footer-grid { grid-template-columns: 1fr; gap: var(--space-md); }
  .footer-bottom { flex-direction: column; align-items: center; text-align: center; gap: 12px; }
  .footer-bottom-links { flex-wrap: wrap; justify-content: center; gap: var(--space-sm); }

  /* Floating Action Buttons Safe Positioning */
  .floating-whatsapp { bottom: 16px; right: 16px; z-index: 999; }
  .wa-btn { width: 48px; height: 48px; min-width: 48px; min-height: 48px; }
  .back-to-top { bottom: 16px; left: 16px; width: 44px; height: 44px; min-width: 44px; min-height: 44px; z-index: 999; }

  /* Forms & Inputs */
  input[type="text"],
  input[type="email"],
  input[type="tel"],
  input[type="date"],
  select,
  textarea {
    font-size: 16px !important; /* Prevents iOS auto-zoom on input focus */
    min-height: 44px;
  }

  /* Filter */
  .filter-bar { flex-direction: column; align-items: stretch; }
  .search-box { min-width: 100%; }

  /* Topics */
  .topics-grid { gap: var(--space-xs); flex-wrap: wrap; }
  .topic-chip { font-size: 12px; padding: 8px 12px; }

  /* Page hero */
  .page-hero, .konsultasi-hero { padding: var(--space-lg) 0; }
  .page-hero-title { font-size: 24px; }

  /* Map iframe */
  .map-placeholder,
  .map-wrap iframe { height: 240px; }
}

/* =====================================================
   ULTRA-SMALL MOBILE (≤360px)
   ===================================================== */
@media (max-width: 360px) {
  :root {
    --space-sm: 8px;
    --space-md: 12px;
    --space-lg: 20px;
    --space-xl: 28px;
  }

  .container { padding: 0 10px; }

  /* Header Logo on ultra-small screens */
  .logo-sub { display: none; }
  .header-single-logo { height: 34px; }
  .logo-name { font-size: 12px; }
  .hamburger { padding: 6px; }

  /* Hero & Headings */
  .hero-title { font-size: 22px; }
  .section-title { font-size: 20px; }
  .hero-desc { font-size: 13px; }
  .typewriter-wrap { font-size: 12px; }

  /* Badges */
  .hero-badge { font-size: 11px; padding: 4px 8px; }
  .hero-badge-item { font-size: 12px; padding: 6px 10px; }

  /* CTA Buttons */
  .btn { padding: 10px 16px; font-size: 14px; min-height: 44px; }
  .btn-lg { padding: 12px 18px; font-size: 15px; }

  /* Cards & Spacing */
  .card, .service-card, .step-card-box, .flow-card {
    padding: 12px;
    border-radius: 12px;
  }

  /* Floating Action Buttons */
  .floating-whatsapp { bottom: 12px; right: 12px; }
  .wa-btn { width: 44px; height: 44px; }
  .back-to-top { bottom: 12px; left: 12px; width: 40px; height: 40px; }
}

/* =====================================================
   REDUCED MOTION & ACCESSIBILITY
   ===================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* =====================================================
   PRINT
   ===================================================== */
@media print {
  .site-header,
  .topbar,
  .floating-whatsapp,
  .back-to-top,
  .mobile-nav { display: none !important; }

  body { color: #000; background: #fff; padding-top: 0 !important; }
  .hero { min-height: auto; padding: 24px 0; }
  .card { box-shadow: none; border: 1px solid #ddd; }
}
