/* Phone fixes for the standalone module landing pages (templates/modules/*_landing.html).
   Linked after each page's own <style>, so rules here win at equal specificity. */

@media (max-width: 768px) {
    /* Footer: the 4-column grid (2fr 1fr 1fr 1.5fr) never collapsed */
    footer .container { grid-template-columns: 1fr 1fr !important; gap: 24px !important; }
    footer .container > :first-child { grid-column: 1 / -1; }

    /* Stats: 3rem numbers in 2 columns were wider than the screen */
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 16px !important; }
    .stat-box h3 { font-size: 2rem !important; }
    .stat-box p { font-size: 0.95rem !important; }

    /* Grids built with minmax(280px…) or fixed columns: one column on phones */
    .features-grid, .feature-grid, .modules-grid, .topics-grid, .content-grid, .steps-grid,
    .how-it-works-grid, .benefits-grid, .pricing-grid, .levels-grid, .games-grid {
        grid-template-columns: minmax(0, 1fr) !important;
    }
    .feature-card, .topic-card, .step-card, .benefit-card { min-width: 0 !important; }

    /* Long words / URLs must wrap instead of widening the page */
    h1, h2, h3, p, li { overflow-wrap: anywhere; }
    img, video, iframe, table { max-width: 100%; }
}

@media (max-width: 575.98px) {
    /* Header: keep only Login + the sign-up button (last two items) */
    nav .container { padding: 0 12px !important; gap: 8px; }
    .logo { font-size: 1rem !important; white-space: nowrap; }
    .nav-links { gap: 8px !important; }
    .nav-links li:not(:nth-last-child(-n+2)) { display: none; }
    .nav-links a { font-size: 0.85rem !important; white-space: nowrap; }
    .nav-links .btn-outline, .nav-links .btn-primary { padding: 7px 10px !important; }

    footer .container { grid-template-columns: 1fr !important; }
}

@media (max-width: 359.98px) {
    .logo span, .logo { font-size: 0.9rem !important; }
    .nav-links .btn-outline { display: none; }
}

/* Inline-styled grids in a few pages (this file is only linked from landing pages) */
@media (max-width: 768px) {
    .career-grid,
    [style*="grid-template-columns: repeat(4, 1fr)"],
    [style*="grid-template-columns: repeat(5, 1fr)"],
    [style*="grid-template-columns: repeat(6, 1fr)"] { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
    [style*="grid-template-columns: 1fr 1fr"],
    [style*="grid-template-columns: 2fr 1fr"],
    [style*="grid-template-columns: 1fr 2fr"] { grid-template-columns: minmax(0, 1fr) !important; }
}
@media (max-width: 575.98px) {
    .career-grid,
    [style*="grid-template-columns: repeat(4, 1fr)"],
    [style*="grid-template-columns: repeat(5, 1fr)"] { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
    /* 3-up text cards: one per row */
    [style*="grid-template-columns: repeat(3, 1fr)"] { grid-template-columns: minmax(0, 1fr) !important; }
}

/* Safety net for decorative shapes positioned past the edge */
html, body { overflow-x: clip; }
