/* ===== Mobile First Enhancements ===== */

/* Mobile (480px - 767px) */
@media (max-width: 767px) {
  /* Enhanced Mobile Loading Screen */
  .loading-screen {
    padding: var(--spacing-md);
  }

  .loading-logo i {
    font-size: 3rem;
  }

  .loading-logo span {
    font-size: 1.5rem;
  }

  .loading-text {
    font-size: 1rem;
  }

  .loading-progress {
    width: 150px;
  }

  /* Mobile Navigation */
  .nav-container {
    padding: 0 var(--spacing-sm);
  }

  .nav-logo {
    font-size: 1.2rem;
  }

  .nav-logo i {
    font-size: 1.5rem;
  }

  /* The navigation itself is handled once, at 1199px — see "Navigation" near
     the end of this file. It used to be duplicated here and at 767px with
     conflicting slide directions. */

  /* Mobile Hero Section */
  .hero-section {
    min-height: 90vh;
    padding: var(--spacing-xl) var(--spacing-md);
  }

  .hero-title {
    font-size: 2rem;
    line-height: 1.2;
    margin-bottom: var(--spacing-lg);
  }

  .hero-subtitle {
    font-size: 1rem;
    line-height: 1.6;
  }

  .hero-actions {
    flex-direction: column;
    gap: var(--spacing-md);
    width: 100%;
  }

  .hero-actions .btn {
    width: 100%;
    justify-content: center;
    padding: var(--spacing-lg);
    font-size: 1.1rem;
  }

  /* Mobile Cards Grid */
  .about-grid,
  .services-grid,
  .hospitals-grid,
  .testimonials-grid {
    grid-template-columns: 1fr;
    gap: var(--spacing-lg);
  }

  .network-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-md);
  }

  /* Mobile Cards */
  .about-card,
  .stat-card,
  .oncology-card,
  .service-card,
  .hospital-card,
  .story-card {
    padding: var(--spacing-xl);
    margin-bottom: var(--spacing-md);
  }

  /* Mobile Sections */
  .service-category,
  .journey-features,
  .journey-cta,
  .network-stats-section {
    padding: var(--spacing-lg) 0;
  }

  .section-header {
    text-align: center;
    margin-bottom: var(--spacing-xl);
  }

  .section-title {
    font-size: 1.8rem;
    margin-bottom: var(--spacing-md);
  }

  .section-subtitle {
    font-size: 1rem;
    padding: 0 var(--spacing-md);
  }

  /* Mobile CTA */
  .journey-cta {
    text-align: center;
  }

  .cta-content h2 {
    font-size: 1.5rem;
  }

  .cta-buttons {
    flex-direction: column;
    gap: var(--spacing-sm);
  }

  .cta-buttons .btn {
    width: 100%;
    justify-content: center;
  }

  /* Mobile Touch Optimizations */
  .btn {
    min-height: 44px;
    touch-action: manipulation;
  }

  .nav-link {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Mobile Animations */
  .scroll-animate {
    transform: translateY(20px);
  }

  .scroll-animate.animate-in {
    transform: translateY(0);
  }
}

/* Small Mobile (320px - 479px) */
@media (max-width: 479px) {
  .container {
    padding: 0 var(--spacing-sm);
  }

  /* Extra Small Loading Screen */
  .loading-logo i {
    font-size: 2.5rem;
  }

  .loading-logo span {
    font-size: 1.2rem;
  }

  .loading-text {
    font-size: 0.9rem;
  }

  /* Extra Small Navigation */
  .nav-logo {
    font-size: 1rem;
  }

  .nav-logo i {
    font-size: 1.2rem;
  }

  .nav-menu {
    width: 90%;
    max-width: 280px;
  }

  /* Extra Small Hero */
  .hero-title {
    font-size: 1.8rem;
  }

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

  /* Extra Small Cards */
  .about-card,
  .stat-card,
  .oncology-card,
  .service-card,
  .hospital-card,
  .story-card {
    padding: var(--spacing-lg);
  }

  .network-stats {
    grid-template-columns: 1fr;
  }

  /* Extra Small Sections */
  .section-title {
    font-size: 1.5rem;
  }

  .cta-content h2 {
    font-size: 1.3rem;
  }

  /* Extra Small Buttons */
  .btn {
    padding: var(--spacing-md) var(--spacing-lg);
    font-size: 0.95rem;
  }
}

/* Large Desktop (1200px and up) */
@media (min-width: 1200px) {
  .container {
    max-width: 1400px;
  }

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

  .section-title {
    font-size: 3rem;
  }
}

/* Desktop (992px - 1199px) */
@media (max-width: 1199px) {
  .container {
    max-width: 960px;
  }

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

  .section-title {
    font-size: 2.25rem;
  }

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

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

  /* ===== Navigation =====
     The single place the bar turns into a drawer. Nine English links plus the
     brand need 1294px on one line; below 1200px there is no honest way to show
     them, so the whole row becomes the slide-in menu instead of wrapping.
     This used to live in two separate 767px blocks that disagreed on which
     side the drawer came from. */
  .mobile-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .nav-menu {
    position: fixed;
    top: 0;
    inset-inline-start: -100%;
    width: 80%;
    max-width: 300px;
    height: 100vh;
    background: var(--white);
    box-shadow: var(--shadow-xl);
    transition: inset-inline-start var(--transition-normal);
    z-index: var(--z-modal);
    overflow-y: auto;
    align-items: stretch;
  }

  .nav-menu.active {
    inset-inline-start: 0;
  }

  .nav-list {
    flex-direction: column;
    padding: var(--spacing-xl) var(--spacing-lg);
    gap: 0;
    width: 100%;
    align-items: stretch;
  }

  .nav-item {
    border-bottom: 1px solid var(--gray-200);
  }

  .nav-link {
    display: block;
    padding: var(--spacing-lg) 0;
    font-size: 1rem;
    white-space: normal;
  }

  .nav-actions {
    flex-direction: column;
    gap: var(--spacing-sm);
    padding: var(--spacing-lg);
    border-top: 1px solid var(--gray-200);
  }
}

/* Tablet (768px - 991px) */
@media (max-width: 991px) {
  .container {
    max-width: 720px;
  }

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

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

  .section-title {
    font-size: 2rem;
  }

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

  /* No .nav-list/.nav-link sizing here any more: below 1200px the row is a
     drawer, and these were quietly cancelling its column layout. */

  .hero-actions {
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-md);
  }

  .about-grid,
  .services-grid,
  .contact-options {
    grid-template-columns: 1fr;
  }

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

  .oncology-grid {
    grid-template-columns: 1fr;
  }

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

  .journey-timeline::before {
    right: 30px;
  }

  /* The badge belongs on the timeline rule, level with the card's heading.
     It had no `top`, so as an absolutely positioned child of a flex item with
     align-items:center it fell back to its static position — the vertical
     middle of the card — and landed on the paragraph text. `left` was measured
     from the item box, which already starts 60px in, so it also sat on the
     card's edge instead of on the line 60px to its left. */
  .timeline-marker {
    inset-inline-start: -30px;
    top: 14px;
    transform: translateX(50%);
  }

  .timeline-item {
    flex-direction: row !important;
    margin-inline-start: 60px;
    align-items: flex-start;
  }

  .timeline-content {
    width: 100%;
    margin: 0 !important;
  }

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

/* Mobile (576px - 767px) */
@media (max-width: 767px) {
  .container {
    max-width: 540px;
    padding: 0 var(--spacing-sm);
  }

  .hero-title {
    font-size: 2rem;
    line-height: 1.2;
  }

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

  .section-title {
    font-size: 1.75rem;
  }

  .section-subtitle {
    font-size: 1rem;
  }

  /* Mobile Sections */
  .hero-section {
    min-height: 90vh;
    padding: var(--spacing-2xl) 0;
  }

  .hero-content {
    padding: 0 var(--spacing-md);
  }

  .section-header {
    margin-bottom: var(--spacing-2xl);
    padding: 0 var(--spacing-md);
  }

  .about-card,
  .stat-card,
  .oncology-card,
  .service-card,
  .contact-card {
    padding: var(--spacing-lg);
    margin: 0 var(--spacing-md);
  }

  .about-icon,
  .oncology-icon,
  .service-icon,
  .contact-icon {
    width: 60px;
    height: 60px;
  }

  .about-icon i,
  .oncology-icon i,
  .service-icon i,
  .contact-icon i {
    font-size: 1.5rem;
  }

  .network-stats {
    grid-template-columns: 1fr;
    gap: var(--spacing-md);
  }

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

  .timeline-item {
    margin-inline-start: 40px;
    margin-bottom: var(--spacing-lg);
  }

  .journey-timeline::before {
    right: 20px;
  }

  .timeline-marker {
    width: 40px;
    height: 40px;
    inset-inline-start: -20px;
    top: 12px;
    font-size: 1rem;
  }

  .timeline-content {
    padding: var(--spacing-md);
  }

  /* The bottom value is not decoration: the chat launcher is fixed at
     bottom 20px and is 52px tall at this width, so without a reserve the
     Privacy/Terms row ends up underneath it for anyone scrolled to the end of
     the page. style.css reserves it; this rule is loaded afterwards and used
     to reset the whole padding shorthand, which silently undid that. */
  .footer {
    padding: var(--spacing-2xl) 0 88px;
  }

  .footer-content {
    grid-template-columns: 1fr;
    gap: var(--spacing-xl);
    text-align: center;
  }

  .footer-social {
    justify-content: center;
  }

  .footer-contact {
    align-items: center;
  }

  .back-to-top {
    width: 45px;
    height: 45px;
  }

  /* RTL Adjustments */
  body[dir="rtl"] .journey-timeline::before {
    right: auto;
    left: 20px;
  }

  body[dir="rtl"] .back-to-top {
    left: auto;
    right: var(--spacing-md);
  }
}

/* Small Mobile (480px and below) */
@media (max-width: 480px) {
  .container {
    max-width: 100%;
    padding: 0 var(--spacing-sm);
  }

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

  .section-title {
    font-size: 1.5rem;
  }

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

  .hero-actions {
    width: 100%;
  }

  .btn {
    width: 100%;
    justify-content: center;
    padding: var(--spacing-md) var(--spacing-lg);
  }

  .about-card,
  .stat-card,
  .oncology-card,
  .service-card,
  .contact-card {
    padding: var(--spacing-md);
    margin: 0 var(--spacing-sm);
  }

  .about-icon,
  .oncology-icon,
  .service-icon,
  .contact-icon {
    width: 50px;
    height: 50px;
  }

  .about-icon i,
  .oncology-icon i,
  .service-icon i,
  .contact-icon i {
    font-size: 1.25rem;
  }

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

  .timeline-item {
    margin-right: 30px;
  }

  .journey-timeline::before {
    right: 15px;
  }

  .timeline-marker {
    width: 30px;
    height: 30px;
    right: 15px;
    font-size: 0.875rem;
  }

  .timeline-content {
    padding: var(--spacing-sm);
  }

  .timeline-content h3 {
    font-size: 1rem;
  }

  .timeline-content p {
    font-size: 0.8rem;
  }

  /* 48px launcher + 20px inset + margin at this width — same reason as the
     767px block above. */
  .footer {
    padding: var(--spacing-xl) 0 84px;
  }

  .footer-section h3 {
    font-size: 1rem;
  }

  .footer-logo {
    font-size: 1.125rem;
  }

  .footer-logo i {
    font-size: 1.25rem;
  }

  .back-to-top {
    width: 40px;
    height: 40px;
  }

  /* RTL Small Mobile */
  body[dir="rtl"] .timeline-item {
    margin-right: 0;
    margin-left: 30px;
  }

  body[dir="rtl"] .journey-timeline::before {
    right: auto;
    left: 15px;
  }

  body[dir="rtl"] .timeline-marker {
    right: auto;
    left: 15px;
  }

  body[dir="rtl"] .back-to-top {
    left: auto;
    right: var(--spacing-sm);
  }
}

/* Landscape Orientation Adjustments */
@media (max-height: 600px) and (orientation: landscape) {
  .hero-section {
    min-height: 100vh;
  }

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

  .hero-subtitle {
    font-size: 1rem;
    margin-bottom: var(--spacing-lg);
  }

  .section-header {
    margin-bottom: var(--spacing-lg);
  }

  .about-section,
  .network-preview-section,
  .oncology-preview-section,
  .services-preview-section,
  .journey-preview-section,
  .contact-preview-section {
    padding: var(--spacing-xl) 0;
  }
}

/* High DPI Screens */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .hero-background {
    background-size: cover;
  }

  .about-icon,
  .oncology-icon,
  .service-icon,
  .contact-icon {
    background-image: none;
  }
}

/* Print Styles */
@media print {
  .header,
  .footer,
  .back-to-top,
  .mobile-menu-toggle,
  .theme-toggle,
  .language-switcher {
    display: none !important;
  }

  .hero-section {
    min-height: 0;
    padding: var(--spacing-lg) 0;
  }

  .section-header {
    margin-bottom: var(--spacing-lg);
  }

  .about-section,
  .network-preview-section,
  .oncology-preview-section,
  .services-preview-section,
  .journey-preview-section,
  .contact-preview-section {
    padding: var(--spacing-lg) 0;
  }

  body {
    color: var(--black);
    background: var(--white);
  }

  .about-card,
  .stat-card,
  .oncology-card,
  .service-card,
  .contact-card {
    box-shadow: none;
    border: 1px solid var(--gray-300);
    break-inside: avoid;
  }

  .timeline-item {
    break-inside: avoid;
  }
}

/* Accessibility - Reduced Motion */
@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;
  }

  .hero-section {
    background-attachment: scroll;
  }
}

/* Focus Visible for Better Accessibility */
@media (hover: hover) and (pointer: fine) {
  .btn:focus-visible,
  .nav-link:focus-visible,
  .theme-toggle:focus-visible,
  .back-to-top:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
  }
}

/* Touch Devices */
@media (hover: none) and (pointer: coarse) {
  .nav-link:hover,
  .btn:hover,
  .about-card:hover,
  .stat-card:hover,
  .oncology-card:hover,
  .service-card:hover,
  .contact-card:hover,
  .timeline-content:hover {
    transform: none;
  }

  .nav-link:active,
  .btn:active {
    transform: scale(0.95);
  }
}

/* ===== Content first, animation second =====
   aos.css sets [data-aos^=fade]{opacity:0} the moment it parses, so on a slow
   connection 51 blocks on the homepage stay invisible until aos.js has
   downloaded and run — the visitor gets a mostly blank page and leaves.
   Everything stays visible until the library is genuinely ready; main.js adds
   .aos-ready on <html> in the same tick it calls AOS.init(), so there is no
   frame where content is hidden without something about to reveal it.
   The doubled attribute selector is deliberate: it outranks aos.css's own
   [data-aos^=fade][data-aos^=fade] regardless of stylesheet order. */
html:not(.aos-ready) [data-aos][data-aos] {
  opacity: 1;
  transform: none;
}

/* Someone who asked the system for less motion should never wait on an
   animation to read the page. */
@media (prefers-reduced-motion: reduce) {
  [data-aos][data-aos] {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}
