/* ============================================================
   responsive.css — Universal Cross-Device Responsive Framework
   Supports: Mobile (320px–480px), Large Phones/Foldables (481px–768px),
   Tablets (769px–1024px), Laptops/Desktops (1025px–1600px),
   and 4K/TV/Ultra-Wide Displays (1601px–3840px+)
   ============================================================ */

/* ── 1. GLOBAL ROOT & CONTAINER CONSTRAINTS ── */
:root {
  --container-max-w: 1240px;
  --container-px: clamp(16px, 3vw, 24px);
}

.container {
  width: 100% !important;
  max-width: var(--container-max-w) !important;
  padding-left: var(--container-px) !important;
  padding-right: var(--container-px) !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

/* Fluid Typography Helpers */
h1, .h1 { font-size: clamp(2rem, 5vw, 3.2rem); }
h2, .h2 { font-size: clamp(1.6rem, 3.5vw, 2.4rem); }
h3, .h3 { font-size: clamp(1.25rem, 2.5vw, 1.75rem); }
h4, .h4 { font-size: clamp(1.05rem, 2vw, 1.35rem); }

/* Prevent horizontal overflow globally without breaking sticky headers */
body {
  overflow-x: hidden;
  max-width: 100vw;
}

/* Touch targets optimization */
button, a.btn, a.btn-accent, .nav-link, .mode-tab-btn, .quick-tool-btn {
  touch-action: manipulation;
}

/* ── 2. LAPTOP, DESKTOP & 4K TELEVISION DISPLAYS (>= 1025px) ── */
/* Laptop L layout (3 columns, 1240px centered container) is maintained for all large screens */
@media (min-width: 1025px) {
  .courses-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 28px !important;
    max-width: 1240px !important;
    margin: 0 auto !important;
  }
}

/* ── 3. TABLETS & COMPACT LAPTOPS (769px – 1024px) ── */
@media (max-width: 1024px) {
  :root {
    --nav-height: 68px;
  }

  .section-dark,
  .section-surface,
  .courses-section,
  #tutorial {
    padding: 60px 0 !important;
  }

  .courses-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 22px !important;
  }

  .hero-stats {
    gap: 36px;
    margin-top: 48px;
  }

  /* Course player layout adjustments */
  .course-player-row {
    row-gap: 24px;
  }
}

/* ── 5. LARGE PHONES, FOLDABLES & SMALL TABLETS (577px – 768px) ── */
@media (max-width: 768px) {
  :root {
    --nav-height: 62px;
  }

  body {
    padding-top: 62px;
  }

  .section-dark,
  .section-surface,
  .courses-section,
  #tutorial {
    padding: 48px 0 !important;
  }

  .section-title {
    font-size: 1.85rem !important;
  }

  .section-sub {
    font-size: 0.92rem !important;
  }

  /* Hero Section */
  .hero-section {
    min-height: auto !important;
    padding-top: 40px !important;
    padding-bottom: 50px !important;
    background-attachment: scroll !important;
  }

  .hero-subtitle {
    font-size: 2.4rem !important;
    margin-bottom: 12px !important;
  }

  .hero-animated-text {
    font-size: 1.25rem !important;
    min-height: 1.8rem !important;
    margin-bottom: 16px !important;
  }

  .hero-description {
    font-size: 0.92rem !important;
    line-height: 1.7 !important;
    margin-bottom: 24px !important;
  }

  .headline-btn {
    font-size: 0.8rem !important;
    padding: 6px 16px !important;
  }

  /* 2x2 Hero Stats Grid */
  .hero-stats {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 20px 24px !important;
    margin-top: 36px !important;
    padding-top: 24px !important;
  }

  .stat-num {
    font-size: 1.6rem !important;
  }

  .stat-label {
    font-size: 0.7rem !important;
  }

  /* Course Cards Grid */
  .courses-grid {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
  }

  .course-card .card-body {
    padding: 18px !important;
  }

  /* Why aCloudShalla grid */
  .why-card {
    padding: 24px 18px !important;
  }

  /* CTA Banner Box */
  .cta-card-box {
    padding: 32px 18px !important;
  }

  /* Footer */
  .site-footer {
    padding: 48px 0 24px !important;
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 32px 20px !important;
  }

  .footer-grid > div:first-child {
    grid-column: 1 / -1;
  }

  .footer-bottom {
    flex-direction: column !important;
    text-align: center !important;
    gap: 12px !important;
    padding-top: 20px !important;
  }

  /* Content Pages (Blog, Notes, Apps, About) */
  .page-hero {
    padding: 42px 0 32px !important;
  }

  .page-hero-title {
    font-size: 2.1rem !important;
  }

  .page-hero-sub {
    font-size: 0.92rem !important;
  }
}

/* ── 6. COMPACT MOBILE PHONES (<= 576px) ── */
@media (max-width: 576px) {
  :root {
    --container-px: 14px;
    --nav-height: 58px;
  }

  body {
    padding-top: 58px;
    font-size: 14.5px;
  }

  .hero-subtitle {
    font-size: 2rem !important;
  }

  .hero-btn, .btn-accent {
    width: 100% !important;
    padding: 12px 24px !important;
    font-size: 0.92rem !important;
  }

  /* Footer 1-column on mobile */
  .footer-grid {
    grid-template-columns: 1fr !important;
    gap: 28px !important;
  }

  .footer-socials {
    justify-content: flex-start;
  }

  /* Course player on mobile */
  .aws-breadcrumb {
    padding: 8px 0 !important;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .aws-breadcrumb::-webkit-scrollbar { display: none; }

  .breadcrumb-list {
    flex-wrap: nowrap !important;
  }

  .aws-hero {
    padding: 32px 0 28px !important;
    min-height: auto !important;
  }

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

  .aws-stats-inner {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 14px !important;
  }

  .aws-stat-divider {
    display: none !important;
  }

  .aws-stat-item {
    padding: 4px 0 !important;
  }

  .aws-next-bar {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 10px !important;
  }

  .aws-next-btn {
    width: 100% !important;
    text-align: center !important;
  }

  .course-sections {
    margin-top: 18px !important;
  }
}

/* ── 7. EXTRA-COMPACT PHONES (<= 380px: iPhone SE / Galaxy Fold) ── */
@media (max-width: 380px) {
  .hero-subtitle {
    font-size: 1.75rem !important;
  }

  .hero-animated-text {
    font-size: 1.1rem !important;
  }

  .stat-num {
    font-size: 1.35rem !important;
  }

  .headline-btn {
    font-size: 0.72rem !important;
    padding: 5px 12px !important;
  }

  .course-card-banner {
    height: 180px !important;
  }

  /* Scale complex card banners on ultra-narrow screens */
  .banner-sql-pro,
  .banner-python-v2,
  .banner-aws-arch,
  .banner-linux-v2 {
    transform: scale(0.92);
    transform-origin: center center;
  }
}