/*!
 * responsive-fixes.css — Akshara Training
 * Version: 1.1  (2026-04-23)
 * Changelog:
 *   v1.1 — Fix horizontal overflow on 6 syllabus pages (.layout container +
 *          sidebar min-width reset).
 *   v1.0 — Initial mobile polish (breakpoints, tap targets, flyout collapse).
 * Purpose: Mobile polish layered on top of each page's inline <style>.
 * Loaded AFTER <style> so later-cascade wins when specificity is equal.
 * Scope: 27 in-scope HTML pages (all non-mockup files).
 * Upload to: https://aksharatraining.com/responsive-fixes.css
 */

/* ── 1. Font fallback stack ── fixes FOIT when Google Fonts is slow */
body,
input, select, textarea, button {
  font-family: 'Roboto', 'Poppins', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
}

/* ── 2. Prevent accidental horizontal scroll on any page ── */
html, body { overflow-x: hidden; }
img, video, iframe { max-width: 100%; height: auto; }

/* ── 3. Tablet & small-laptop (up to 900px) ── */
@media (max-width: 900px) {
  .sidebar { position: static; top: auto; } /* un-stick sticky sidebar on tablet */
}

/* ── 4. Phone landscape / small tablet (up to 600px) ── */
@media (max-width: 600px) {
  /* Collapse ALL known layout-grid containers to single column
     (v1.1: added .layout — was missing, caused 2 pages to overflow) */
  .page-wrap,
  .layout,
  .main-layout {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  /* v1.1: Defensive reset — sidebar / main must never exceed container.
     min-width:0 is the magic fix for CSS-Grid children that refuse
     to shrink below their intrinsic content width. */
  .sidebar,
  .sidebar-box,
  .main,
  aside,
  main {
    max-width: 100% !important;
    min-width: 0 !important;
    width: auto !important;
    box-sizing: border-box;
  }
  .sidebar-nav,
  .sidebar-title,
  .cta-box {
    max-width: 100% !important;
    min-width: 0 !important;
  }

  /* Sidebar drops to top of content on syllabus pages */
  .sidebar { margin-bottom: 20px; }

  /* Hero shrinks gracefully */
  .hero { padding: 70px 16px; }
  .hero h1 { font-size: 32px; line-height: 1.25; }
  .hero p  { font-size: 17px; }

  /* Course card grid → 1 col */
  .courses { grid-template-columns: 1fr !important; gap: 14px; }

  /* Section padding reduced */
  section { padding: 40px 16px; }
}

/* ── 5. Phone portrait (up to 480px) — TOUCH TARGET FIXES ── */
@media (max-width: 480px) {
  /* Minimum 44×44 CSS-px tap targets (WCAG 2.5.5) */
  nav a,
  .menu-item > a,
  .sidebar-nav a,
  .course-link,
  .flyout .course-link,
  .btn,
  .btn-syllabus,
  .popup-close,
  .module-toggle {
    min-height: 44px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
  }

  /* Header: logo + nav reflow comfortably */
  header .logo { font-size: 22px; margin-left: 12px; }
  nav { margin-right: 12px; }
  nav a { margin: 0 8px; font-size: 14px; }

  /* Hero compact */
  .hero { padding: 50px 14px; }
  .hero h1 { font-size: 26px; }
  .hero p  { font-size: 15px; }
  .hero .btn { padding: 14px 24px; font-size: 16px; }

  /* Index.html flyouts: collapse to inline list — no hover/tap panels */
  .flyout {
    position: static !important;
    opacity: 1 !important;
    pointer-events: all !important;
    transform: none !important;
    box-shadow: none !important;
    border: none !important;
    padding: 4px 0 8px !important;
    background: #fafcff !important;
  }
  .menu-item.js-open .flyout,
  .menu-item:hover .flyout { transform: none !important; }
  .tap-hint { display: none !important; } /* no longer needed */

  /* Popup modal fills phone screen better */
  .popup-card { width: 94vw; max-height: 88vh; overflow-y: auto; }

  /* Tables scroll horizontally instead of breaking layout */
  .tools-table,
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* ── 6. Very small phones (up to 380px) ── */
@media (max-width: 380px) {
  .hero h1 { font-size: 22px; }
  .hero p  { font-size: 14px; }
  header .logo { font-size: 19px; }
  nav a { font-size: 13px; margin: 0 6px; }
  .count-badge { font-size: 10px; }
}

/* ── 7. Accessibility: respect reduced-motion preference ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
