/* ==========================================================================
   R.R. INFRAPROJECTS — Responsive Breakpoints
   Version: 1.0.0
   Breakpoints: 1200px, 992px, 768px, 576px
   ========================================================================== */

/* --------------------------------------------------------------------------
   BREAKPOINT: 1200px — Large Desktops → Standard Desktops
   Reduce container padding, slight typography adjustments
   -------------------------------------------------------------------------- */
@media (max-width: 1200px) {
  :root {
    --container-padding: 2rem;
    --section-padding: 80px;
  }

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

  h1 {
    font-size: var(--fs-4xl);
  }

  h2 {
    font-size: var(--fs-3xl);
  }

  .hero-title {
    font-size: var(--fs-5xl);
  }

  .section-title {
    font-size: var(--fs-3xl);
  }

  /* Slightly smaller footer columns */
  .footer-grid {
    gap: var(--space-xl);
  }

  /* Profile download section */
  .profile-download {
    padding: var(--space-2xl);
  }

  .profile-download-preview .preview-mockup {
    width: 240px;
    height: 330px;
  }

  /* Stats row */
  .stats-row {
    padding: var(--space-2xl) var(--space-lg);
  }

  .stat-card .stat-number {
    font-size: var(--fs-4xl);
  }
}

/* --------------------------------------------------------------------------
   BREAKPOINT: 992px — Tablets (Landscape) & Small Desktops
   Stack grids to 2-col, reduce heading sizes
   -------------------------------------------------------------------------- */
@media (max-width: 992px) {
  :root {
    --section-padding: 70px;
    --navbar-height: 70px;
  }

  h1 {
    font-size: var(--fs-3xl);
  }

  h2 {
    font-size: var(--fs-2xl);
  }

  h3 {
    font-size: var(--fs-xl);
  }

  .hero-title {
    font-size: var(--fs-4xl);
  }

  .hero-subtitle {
    font-size: var(--fs-base);
  }

  .section-title {
    font-size: var(--fs-2xl);
  }

  /* Hide header CTA on tablet and mobile to prevent navbar crowding */
  .nav-cta,
  .navbar-cta,
  a.navbar-cta,
  a.nav-cta {
    display: none !important;
  }

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

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

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

  /* Projects grid */
  .projects-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .projects-grid .project-card.wide {
    grid-column: span 1;
  }

  /* Service detail — stack */
  .service-detail {
    grid-template-columns: 1fr;
    gap: var(--space-xl);
  }

  .service-detail:nth-child(even) {
    direction: ltr;
  }

  .service-detail-image img {
    height: 280px;
  }

  /* About grid */
  .about-grid {
    grid-template-columns: 1fr;
    gap: var(--space-xl);
  }

  .about-content {
    padding-left: 0;
  }

  .about-image {
    max-height: 400px;
  }

  /* Stats row → 2-col */
  .stats-row {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-lg);
  }

  .stats-row .stat-divider {
    display: none;
  }

  /* Timeline */
  .timeline::before {
    left: 30px;
  }

  .timeline-item {
    grid-template-columns: 1fr;
    padding-left: 60px;
  }

  .timeline-item::before {
    left: 30px;
  }

  .timeline-item:nth-child(even) .timeline-content {
    grid-column: 1;
  }

  /* Vision & Mission */
  .vision-mission {
    grid-template-columns: 1fr;
  }

  /* Contact grid */
  .contact-grid {
    grid-template-columns: 1fr;
    gap: var(--space-xl);
  }

  /* Footer grid: 4-col → 2-col */
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-xl);
  }

  .footer-about {
    grid-column: 1 / -1;
  }

  /* Profile download */
  .profile-download {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .profile-download-content .section-subtitle::after {
    left: 50%;
    transform: translateX(-50%);
  }

  .profile-download-preview {
    order: -1;
  }

  .profile-download-preview .preview-mockup {
    transform: none;
    width: 220px;
    height: 300px;
  }

  .profile-download-preview .preview-mockup:hover {
    transform: none;
  }
}

/* --------------------------------------------------------------------------
   BREAKPOINT: 768px — Tablets (Portrait) & Large Phones
   Mobile nav, single-column grids, reduced section padding
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  :root {
    --section-padding: 60px;
    --container-padding: 1.25rem;
    --navbar-height: 65px;
  }

  h1 {
    font-size: var(--fs-2xl);
  }

  h2 {
    font-size: var(--fs-xl);
  }

  h3 {
    font-size: var(--fs-lg);
  }

  h4 {
    font-size: var(--fs-md);
  }

  .section-title {
    font-size: var(--fs-xl);
  }

  .section-description {
    font-size: var(--fs-base);
  }

  .lead {
    font-size: var(--fs-base);
  }

  /* Mobile Navigation */
  .nav-links {
    display: none;
  }

  .nav-cta,
  .navbar-cta {
    display: none !important;
  }

  .nav-toggle {
    display: flex;
  }

  /* Hero */
  .hero {
    min-height: 100vh;
    padding: var(--space-5xl) 0 var(--space-3xl);
  }

  .hero-title {
    font-size: var(--fs-3xl);
    margin-bottom: var(--space-lg);
  }

  .hero-subtitle {
    font-size: var(--fs-sm);
    margin-bottom: var(--space-xl);
  }

  .hero-tagline {
    font-size: var(--fs-xs);
    letter-spacing: 0.15em;
  }

  .hero-buttons {
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
  }

  .hero-buttons .btn {
    width: 100%;
    max-width: 300px;
    justify-content: center;
  }

  /* All grids → 1-col */
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
    gap: var(--space-lg);
  }

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

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

  .projects-grid .project-card.tall {
    grid-row: span 1;
  }

  /* Project card — always show overlay on mobile */
  .project-overlay {
    opacity: 1;
    background: linear-gradient(
      180deg,
      transparent 40%,
      rgba(7, 27, 52, 0.85) 100%
    );
  }

  /* Stats row → 2-col remains or stack */
  .stats-row {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
    padding: var(--space-xl);
  }

  .stat-card {
    padding: var(--space-lg);
  }

  .stat-card .stat-number {
    font-size: var(--fs-3xl);
  }

  /* About features → 1-col */
  .about-features {
    grid-template-columns: 1fr;
  }

  /* Timeline */
  .timeline-item {
    padding-left: 50px;
  }

  .timeline::before {
    left: 20px;
  }

  .timeline-item::before {
    left: 20px;
    width: 12px;
    height: 12px;
  }

  .timeline-content {
    padding: var(--space-lg);
  }

  /* Contact */
  .form-row {
    grid-template-columns: 1fr;
  }

  .contact-form {
    padding: var(--space-xl);
  }

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

  .footer-about {
    grid-column: 1;
  }

  .footer-bottom {
    flex-direction: column;
    gap: var(--space-md);
    text-align: center;
  }

  .footer-bottom-links {
    justify-content: center;
    flex-wrap: wrap;
    gap: var(--space-md);
  }

  /* Profile download */
  .profile-download {
    padding: var(--space-xl);
    border-radius: var(--radius-md);
  }

  .profile-download-content h3 {
    font-size: var(--fs-xl);
  }

  /* Cards spacing */
  .service-card-content {
    padding: var(--space-lg);
  }

  .team-card-photo {
    height: 250px;
  }

  .team-card-info {
    padding: var(--space-lg);
  }

  /* Project filters — scrollable */
  .project-filters {
    justify-content: flex-start;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: var(--space-sm);
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

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

  .project-filters .filter-btn {
    flex-shrink: 0;
    padding: 8px 18px;
  }

  /* Back to top — smaller */
  .back-to-top {
    width: 42px;
    height: 42px;
    bottom: 20px;
    right: 20px;
    font-size: var(--fs-base);
  }

  /* Section header adjustments */
  .section-header {
    margin-bottom: var(--space-2xl);
  }

  /* Blockquote */
  blockquote {
    padding: var(--space-md) var(--space-lg);
    font-size: var(--fs-base);
  }
}

/* --------------------------------------------------------------------------
   BREAKPOINT: 576px — Small Phones
   Further reduce fonts, full-width buttons
   -------------------------------------------------------------------------- */
@media (max-width: 576px) {
  :root {
    --section-padding: 50px;
    --container-padding: 1rem;
  }

  body {
    font-size: var(--fs-sm);
  }

  h1 {
    font-size: var(--fs-xl);
  }

  h2 {
    font-size: var(--fs-lg);
  }

  h3 {
    font-size: var(--fs-md);
  }

  .section-title {
    font-size: var(--fs-lg);
  }

  .section-subtitle {
    font-size: var(--fs-xs);
    letter-spacing: 0.1em;
  }

  /* Hero — compact */
  .hero-title {
    font-size: var(--fs-2xl);
  }

  .hero-subtitle {
    font-size: var(--fs-sm);
  }

  /* Full-width buttons */
  .btn {
    width: 100%;
    padding: 12px 24px;
    font-size: var(--fs-xs);
  }

  .btn-sm {
    padding: 10px 20px;
  }

  .btn-lg {
    padding: 14px 28px;
    font-size: var(--fs-sm);
  }

  /* Cards */
  .service-card-image {
    height: 180px;
  }

  .service-card-content {
    padding: var(--space-md);
  }

  .service-card-icon {
    width: 48px;
    height: 48px;
    font-size: var(--fs-lg);
  }

  .team-card-photo {
    height: 220px;
  }

  .project-card {
    aspect-ratio: 16 / 10;
  }

  /* Stats row → single column */
  .stats-row {
    grid-template-columns: 1fr;
    gap: var(--space-sm);
    padding: var(--space-lg);
  }

  .stat-card .stat-number {
    font-size: var(--fs-2xl);
  }

  .stat-card .stat-label {
    font-size: var(--fs-xs);
  }

  /* Contact form */
  .contact-form {
    padding: var(--space-lg);
  }

  .contact-form h3 {
    font-size: var(--fs-lg);
  }

  .form-group input,
  .form-group textarea,
  .form-group select {
    padding: 12px 14px;
    font-size: var(--fs-sm);
  }

  .form-group label {
    font-size: var(--fs-xs);
  }

  /* Contact info card */
  .contact-info-card {
    padding: var(--space-lg);
    gap: var(--space-md);
  }

  .contact-info-card .info-icon {
    width: 44px;
    height: 44px;
    min-width: 44px;
    font-size: var(--fs-base);
  }

  /* WhatsApp button full-width */
  .whatsapp-btn {
    width: 100%;
    padding: 12px 24px;
    font-size: var(--fs-xs);
  }

  /* Footer */
  .footer {
    padding-top: var(--space-2xl);
  }

  .footer-grid {
    gap: var(--space-lg);
  }

  .footer-column h4,
  .footer-col h4,
  .footer-heading {
    font-size: var(--fs-sm);
    margin-bottom: var(--space-md);
  }

  .footer-social a {
    width: 36px;
    height: 36px;
  }

  .footer-bottom p {
    font-size: var(--fs-xs);
  }

  .footer-bottom-links a {
    font-size: var(--fs-xs);
  }

  /* Profile download */
  .profile-download {
    padding: var(--space-lg);
  }

  .profile-download-content h3 {
    font-size: var(--fs-lg);
  }

  .profile-download-preview .preview-mockup {
    width: 180px;
    height: 250px;
  }

  /* Vision & Mission cards */
  .vision-mission-card {
    padding: var(--space-lg);
  }

  .vision-mission-card .card-icon {
    width: 48px;
    height: 48px;
    font-size: var(--fs-lg);
  }

  /* Timeline */
  .timeline-item {
    padding-left: 40px;
    margin-bottom: var(--space-lg);
  }

  .timeline::before {
    left: 15px;
  }

  .timeline-item::before {
    left: 15px;
    width: 10px;
    height: 10px;
  }

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

  .timeline-year {
    font-size: var(--fs-lg);
  }

  /* Back to top */
  .back-to-top {
    width: 38px;
    height: 38px;
    bottom: 15px;
    right: 15px;
    font-size: var(--fs-sm);
  }

  /* Scroll progress — slightly thicker for visibility */
  .scroll-progress {
    height: 2px;
  }

  /* Section header */
  .section-header {
    margin-bottom: var(--space-xl);
  }

  /* Mobile nav links */
  .nav-mobile a {
    font-size: var(--fs-xl);
  }

  /* Divider */
  .divider {
    width: 40px;
    height: 2px;
  }

  /* About image badge */
  .about-image-badge {
    padding: var(--space-md) var(--space-lg);
    bottom: var(--space-md);
    right: var(--space-md);
  }

  .about-image-badge .badge-number {
    font-size: var(--fs-2xl);
  }

  .about-image-badge .badge-text {
    font-size: 0.65rem;
  }

  /* Service detail */
  .service-detail-image img {
    height: 220px;
  }

  .service-detail-content .service-number {
    font-size: var(--fs-3xl);
  }

  /* Project filters */
  .project-filters .filter-btn {
    padding: 6px 14px;
    font-size: var(--fs-xs);
  }

  /* Page loader */
  .page-loader .loader-spinner {
    width: 36px;
    height: 36px;
  }

  .page-loader .loader-text {
    font-size: var(--fs-xs);
  }
}

/* --------------------------------------------------------------------------
   EXTRA SMALL: 400px — Very small screens
   -------------------------------------------------------------------------- */
@media (max-width: 400px) {
  :root {
    --container-padding: 0.75rem;
  }

  .hero-title {
    font-size: var(--fs-xl);
  }

  .hero-tagline {
    font-size: 0.65rem;
    letter-spacing: 0.1em;
  }

  .navbar-logo .logo-text {
    font-size: var(--fs-lg);
  }

  .navbar-logo img {
    height: 35px;
  }
}

/* --------------------------------------------------------------------------
   LANDSCAPE ORIENTATION — Phones
   -------------------------------------------------------------------------- */
@media (max-width: 768px) and (orientation: landscape) {
  .hero {
    min-height: auto;
    padding: var(--space-3xl) 0;
  }

  .hero-title {
    font-size: var(--fs-2xl);
  }

  .hero-subtitle {
    margin-bottom: var(--space-lg);
  }

  .hero-buttons {
    flex-direction: row;
    gap: var(--space-sm);
  }

  .hero-buttons .btn {
    width: auto;
    max-width: none;
  }
}

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

  .animate-on-scroll,
  .fade-in-left,
  .fade-in-right,
  .fade-in-up,
  .scale-in {
    opacity: 1;
    transform: none;
  }

  .page-loader .loader-spinner {
    animation: none;
    border-color: var(--color-accent);
  }
}

/* --------------------------------------------------------------------------
   HIGH CONTRAST — Accessibility
   -------------------------------------------------------------------------- */
@media (prefers-contrast: high) {
  :root {
    --color-text-light: #4B5563;
    --color-border: #9CA3AF;
    --shadow-card: 0 0 0 1px var(--color-border);
    --shadow-card-hover: 0 0 0 2px var(--color-accent);
  }

  .nav-links a,
  .footer-links a,
  .footer-contact-item p,
  .footer-about p {
    color: rgba(255, 255, 255, 0.9);
  }

  .btn-outline {
    border-width: 3px;
  }
}

/* --------------------------------------------------------------------------
   DARK MODE — Optional support
   -------------------------------------------------------------------------- */
@media (prefers-color-scheme: dark) {
  /* Only apply if body has .auto-theme class */
  body.auto-theme {
    --color-secondary: #0F1923;
    --color-supporting: #1A2332;
    --color-text-dark: #E5E7EB;
    --color-text-light: #9CA3AF;
    --color-border: #2D3748;
  }
}
