/* ═══════════════════════════════════════════════════════════
   ALPHA HOSPITAL SOLUTIONS — RESPONSIVE.CSS
   Systematic breakpoint system — mobile-first layout fixes.
═══════════════════════════════════════════════════════════ */

/* ── Global overflow guard ── */
/* overflow-x: clip on html prevents viewport-level horizontal scroll WITHOUT
   creating a scroll container, so position:fixed elements (FABs, toasts, nav
   overlay) remain positioned relative to the true viewport. */
html { overflow-x: clip; }
body { overflow-x: hidden; }

/* ══════════════════════════════════════════
   NARROW DESKTOP  (max 1200px)
══════════════════════════════════════════ */
@media (max-width: 1200px) {
  .contact-grid { gap: 32px; }
  .contact-form { padding: 32px; }
  .cinfo-card   { padding: 26px; }
}

/* ══════════════════════════════════════════
   TABLET  (max 1024px)
══════════════════════════════════════════ */
@media (max-width: 1024px) {
  .footer-grid      { grid-template-columns: 1fr 1fr; gap: 40px; }
  .about-grid       { grid-template-columns: 1fr; gap: 40px; }
  .about-infographic{ max-width: 560px; margin: 0 auto; padding: 28px; }

  .contact-grid { grid-template-columns: 1fr; gap: 28px; }
  .contact-info { max-width: 600px; margin: 0 auto; }
  .contact-form { padding: 28px; max-width: 600px; margin: 0 auto; }
  .cinfo-card   { padding: 22px; }

  .process-connector { display: none; }
  .process-steps     { gap: 24px; }
  .process-step      { max-width: 200px; }
}

/* ══════════════════════════════════════════
   MOBILE LARGE  (max 768px)
══════════════════════════════════════════ */
@media (max-width: 768px) {
  :root { --nav-h: 64px; }

  /* ── Navigation ── */
  .nav-links {
    position: fixed; inset: 0; top: var(--nav-h);
    background: rgba(14,30,51,0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    flex-direction: column;
    align-items: center; justify-content: flex-start;
    padding: 28px 20px;
    gap: 4px;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.4,0,0.2,1);
    z-index: 999;
    overflow-y: auto;  /* scrollable when many links */
  }
  .nav-links.open { transform: translateX(0); }
  .nav-link {
    font-size: 17px; padding: 14px 20px;
    width: 100%; text-align: center;
    border-radius: var(--radius-md);
  }
  /* Push toggle to the far right — nav-links is position:fixed so it leaves
     the flex flow; without this the toggle collapses right after the logo. */
  .nav-toggle  { display: flex; margin-left: auto; }
  .nav-actions { display: none; }

  /* Mobile dropdown */
  .has-dropdown .dropdown {
    position: static; opacity: 1; pointer-events: all; transform: none;
    background: rgba(255,255,255,0.05); border: none;
    border-radius: var(--radius-md); margin-top: 4px; display: none;
  }
  .has-dropdown.mobile-open .dropdown { display: block; }

  /* ── Hero ── */
  .hero-content      { padding: 0 20px; padding-top: calc(var(--nav-h) + 24px); }
  .hero-badge        { font-size: 12px; padding: 7px 16px; margin-bottom: 20px; }
  .hero-title        { letter-spacing: -1px; }
  .hero-title-accent { letter-spacing: -1px; }
  .hero-subtitle     { font-size: 15px; margin-bottom: 28px; }
  .hero-cta          { margin-bottom: 32px; flex-direction: column; align-items: center; }
  .btn-primary, .btn-outline { width: 100%; max-width: 320px; justify-content: center; }
  .hero-trust        { display: none; }

  /* Hero counters — compact horizontal strip */
  .hero-counters { gap: 0; padding: 16px 8px; border-radius: var(--radius-lg); }
  .counter-item  { padding: 0 10px; }
  .counter-item .counter-num { font-size: clamp(26px, 6.5vw, 44px); }
  .counter-suffix              { font-size: clamp(16px, 4vw, 28px); }
  .counter-divider             { height: 36px; }
  .counter-item p              { font-size: 10px; letter-spacing: 1px; }

  /* ── Sections ── */
  .section         { padding: 56px 0; }
  .container       { padding: 0 16px; }
  .section-header  { margin-bottom: 36px; }
  .section-title   { letter-spacing: -1px; }
  .section-desc    { font-size: 15px; }

  /* ── About ── */
  .about-infographic { padding: 22px; border-radius: var(--radius-lg); }
  .ainfo-stats       { grid-template-columns: 1fr 1fr; }
  .ainfo-stat strong { font-size: 28px; }
  .about-stats-card  { position: static; margin-top: 20px; justify-content: center; }

  /* ── Services ── */
  .services-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
  .service-card  { padding: 28px 22px; }

  /* ── Approvals ── */
  .approvals-grid { grid-template-columns: 1fr 1fr; gap: 14px; }
  .approval-card  { padding: 24px 16px; }

  /* ── Projects ── */
  .projects-masonry { grid-template-columns: 1fr 1fr; gap: 14px; }
  .project-filters  { gap: 8px; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
  .filter-btn       { padding: 8px 16px; font-size: 12px; flex-shrink: 0; }

  /* ── Process ── */
  .process-steps    { flex-direction: column; align-items: center; gap: 28px; }
  .process-connector{ display: none; }
  .process-step     { max-width: 100%; }

  /* ── Why ── */
  .why-grid { grid-template-columns: 1fr 1fr; gap: 16px; }
  .why-card { padding: 28px 20px; }

  /* ── Reviews ── */
  .review-stats      { padding: 20px 16px; gap: 20px; border-radius: var(--radius-lg); }
  .rstat-item strong { font-size: 28px; }
  .review-card       { width: 300px; padding: 22px; }

  /* ── Contact ── */
  .cinfo-card  { padding: 18px; margin-bottom: 16px; }
  .contact-form{
    padding: 24px 18px;
    border-radius: var(--radius-lg);
    width: 100%;
    overflow: hidden;   /* prevent any child from bleeding outside rounded card */
  }
  /* Collapse all form rows to single column on mobile */
  .form-row {
    grid-template-columns: 1fr;
    gap: 0;
  }
  /* Ensure inputs never wider than their form-group */
  .form-group input,
  .form-group select,
  .form-group textarea { width: 100%; box-sizing: border-box; }
  .form-actions{ flex-direction: column; gap: 10px; }
  .form-actions .btn-primary,
  .form-actions .btn-outline {
    flex: 1 1 100%; min-width: unset; width: 100%; justify-content: center;
  }
  .form-toast {
    left: 12px; right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom, 0px) + 4px);
    max-width: unset;
  }

  /* ── Gallery ── */
  .gallery-masonry { columns: 2; column-gap: 12px; }
  .gallery-item    { margin-bottom: 12px; }

  /* ── Footer ── */
  .footer-grid { grid-template-columns: 1fr; gap: 28px; }
  .footer-main { padding: 40px 0 24px; }

  /* ── FAB — icon-only circles, safe-area aware ── */
  .fab-group {
    right: 14px;
    bottom: 14px;
    /* Respect iPhone home indicator / Android nav bar */
    bottom: max(14px, env(safe-area-inset-bottom, 0px) + 4px);
    gap: 8px;
  }
  .fab       { height: 46px; width: 46px; padding: 0; justify-content: center; border-radius: 50%; }
  .fab-label { display: none; }

  /* ── Modal ── */
  .modal-card { border-radius: var(--radius-lg); }
  .modal-body { padding: 20px; }
}

/* ══════════════════════════════════════════
   MOBILE SMALL  (max 480px)
══════════════════════════════════════════ */
@media (max-width: 480px) {
  /* ── Sections ── */
  .section        { padding: 44px 0; }
  .container      { padding: 0 14px; }
  .section-header { margin-bottom: 28px; }
  .section-title  { letter-spacing: -0.5px; }
  .section-desc   { font-size: 14px; }
  .section-label  { font-size: 10px; letter-spacing: 2px; }

  /* ── Hero ── */
  .hero-content      { padding: 0 14px; padding-top: calc(var(--nav-h) + 8px); }
  .hero-badge        { font-size: 10px; padding: 6px 12px; margin-bottom: 12px; }
  .hero-title        { font-size: clamp(26px, 7.5vw, 42px); letter-spacing: -0.5px; }
  .hero-title-accent { letter-spacing: -0.5px; }
  .hero-subtitle     { font-size: 14px; line-height: 1.6; margin-bottom: 16px; }
  .hero-cta          { margin-bottom: 18px; gap: 10px; }
  .btn-primary, .btn-outline { max-width: 280px; padding: 13px 24px; font-size: 14px; }

  /* Hero counters — 2×2 grid on small screens to prevent overflow.
     Kept compact so the card clears the fixed FAB stack in the initial viewport. */
  .hero-counters {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    padding: 0;
    border-radius: var(--radius-md);
    overflow: hidden;
  }
  .counter-divider { display: none !important; }
  .counter-item {
    padding: 13px 8px;
    border-right:  1px solid rgba(255,255,255,0.08);
    border-bottom: 1px solid rgba(255,255,255,0.08);
  }
  /* nth-child targets DOM positions (dividers are odd children, items 1,3,5,7) */
  .counter-item:nth-child(3) { border-right: none; }           /* top-right  */
  .counter-item:nth-child(5) { border-bottom: none; }          /* bottom-left */
  .counter-item:nth-child(7) { border-right: none; border-bottom: none; } /* bottom-right */
  .counter-item .counter-num { font-size: 26px; }
  .counter-suffix             { font-size: 17px; }
  .counter-item p             { font-size: 9px; letter-spacing: 0.8px; margin-top: 4px; }

  /* ── About ── */
  .about-infographic { padding: 18px; border-radius: var(--radius-md); }
  .ainfo-top         { gap: 12px; padding-bottom: 16px; margin-bottom: 16px; }
  .ainfo-logo-wrap   { width: 48px; height: 48px; }
  .ainfo-top-text h3 { font-size: 14px; line-height: 1.3; }
  .ainfo-top-text p  { font-size: 12px; }
  .ainfo-stats       { gap: 10px; margin-bottom: 16px; }
  .ainfo-stat        { padding: 14px 10px; }
  .ainfo-stat strong { font-size: 22px; }
  .ainfo-stat em     { font-size: 10px; }
  .ainfo-badge       { padding: 12px; }
  .ainfo-badge p     { font-size: 12px; }

  /* ── Services ── */
  .services-grid { grid-template-columns: 1fr; gap: 12px; }
  .service-card  { padding: 24px 18px; border-radius: var(--radius-md); }
  .service-icon  { font-size: 30px; margin-bottom: 12px; }
  .service-card h3 { font-size: 16px; }
  .service-card p  { font-size: 14px; }

  /* ── Approvals ── */
  .approvals-grid { grid-template-columns: 1fr; gap: 10px; }
  .approval-card  { padding: 22px 16px; }

  /* ── Projects ── */
  .projects-masonry { grid-template-columns: 1fr; gap: 12px; }
  .filter-btn       { padding: 7px 14px; font-size: 11px; }

  /* ── Why ── */
  .why-grid { grid-template-columns: 1fr; gap: 10px; }
  .why-card { padding: 22px 18px; border-radius: var(--radius-md); }
  .why-icon { font-size: 30px; margin-bottom: 12px; }
  .why-card h3 { font-size: 16px; }

  /* ── Reviews ── */
  .review-stats      { flex-wrap: wrap; gap: 14px; padding: 16px 12px; }
  .rstat-item strong { font-size: 24px; }
  .review-card       { width: 260px; padding: 18px; }

  /* ── Contact ── */
  .cinfo-card   { padding: 14px; margin-bottom: 10px; }
  .contact-form { padding: 18px 14px; border-radius: var(--radius-md); width: 100%; }
  .form-actions .btn-primary,
  .form-actions .btn-outline { min-width: unset; width: 100%; justify-content: center; }
  .form-toast {
    left: 10px; right: 10px;
    bottom: max(10px, env(safe-area-inset-bottom, 0px) + 4px);
  }

  /* ── Gallery ── */
  .gallery-masonry { columns: 1; column-gap: 0; }
  .gallery-item    { margin-bottom: 10px; border-radius: var(--radius-sm); }

  /* ── Footer ── */
  .footer-main { padding: 32px 0 20px; }

  /* ── Nav ── */
  .nav-container { padding: 0 14px; }

  /* ── Intro loader ── */
  .intro-logo-wrap { width: 100px; height: 100px; }
  .intro-logo-img  { width: 86px; height: 86px; }
  .intro-title     { font-size: 11px; letter-spacing: 3px; }

  /* ── FAB — extra-compact on small screens so it clears the hero counters ── */
  .fab-group { gap: 6px; }
  .fab       { height: 42px; width: 42px; }
}

/* ══════════════════════════════════════════
   EXTRA SMALL  (max 360px)
══════════════════════════════════════════ */
@media (max-width: 360px) {
  .container    { padding: 0 12px; }
  .hero-title   { font-size: 24px; }
  .section-title{ font-size: 26px; }
  .counter-item .counter-num { font-size: 22px; }
  .counter-suffix             { font-size: 14px; }
  .contact-form { padding: 16px 12px; }
  .cinfo-card   { padding: 12px; }
  .service-card { padding: 20px 14px; }
  .why-card     { padding: 18px 14px; }
}

/* ══════════════════════════════════════════
   WIDE DESKTOP  (min 1440px)
══════════════════════════════════════════ */
@media (min-width: 1440px) {
  .container     { max-width: 1360px; }
  .hero-title    { font-size: 80px; }
  .section-title { font-size: 52px; }
  .contact-form  { padding: 40px; }
  .cinfo-card    { padding: 32px; }
}

/* ── Smooth-scroll offset for sticky header ── */
[id] { scroll-margin-top: calc(var(--nav-h) + 16px); }

/* ── Print ── */
@media print {
  .site-header, .intro-loader, .fab-group,
  .cursor-dot, .cursor-ring, .mouse-glow { display: none !important; }
  .section { padding: 32px 0; }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reviews-track { animation: none; }
}

/* ── Touch — suppress hover transforms ── */
@media (hover: none) {
  .service-card:hover { transform: none; box-shadow: var(--shadow-sm); }
  .why-card:hover     { transform: none; }
  .project-card:hover { transform: none; box-shadow: var(--shadow-sm); }
  .fab:hover          { transform: none; }
}
