/* =========================================================
   responsive.css — Mobile overflow fixes.
   Loaded LAST so it overrides earlier rules.
   ========================================================= */

/* ---------------------------------------------------------
   1. Global: prevent horizontal overflow entirely
   --------------------------------------------------------- */
html {
    overflow-x: hidden;
    max-width: 100%;
}

body {
    overflow-x: hidden;
    max-width: 100vw;
    position: relative;
    overflow-wrap: break-word;
    word-wrap: break-word;
    -webkit-hyphens: auto;
    hyphens: auto;
}

/* Every element respects the viewport */
*, *::before, *::after {
    box-sizing: border-box;
}

img, video, iframe, svg, canvas {
    max-width: 100%;
    height: auto;
}

/* ---------------------------------------------------------
   2. Containers: responsive padding
   --------------------------------------------------------- */
.container {
    width: 100%;
    max-width: 100%;
    padding-inline: 1rem;
}

@media (max-width: 700px) {
    .container {
        padding-inline: 0.75rem;
    }
}

/* ---------------------------------------------------------
   3. Hero: prevent gradient from overflowing
   --------------------------------------------------------- */
.hero {
    /* Limit the radial gradient so it doesn't bleed past the viewport */
    background:
        radial-gradient(600px 300px at 100% 0%,
            var(--color-primary-soft) 0%,
            transparent 60%),
        var(--color-bg) !important;
    padding: 2rem 0 !important;
    overflow: hidden;
}

@media (max-width: 900px) {
    .hero-inner {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }

    .hero-title {
        font-size: 1.75rem !important;
        line-height: 1.35;
    }

    .hero-subtitle {
        font-size: 1rem !important;
    }

    .hero-visual {
        aspect-ratio: 16 / 9 !important;
        font-size: 3rem !important;
        max-width: 100% !important;
    }
}

/* ---------------------------------------------------------
   4. Feature grids: one column on mobile
   --------------------------------------------------------- */
@media (max-width: 700px) {
    .feature-grid,
    .stat-grid,
    .kpi-grid,
    .news-grid,
    .report-links,
    .report-charts {
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
    }

    .report-chart-wide {
        grid-column: 1 !important;
    }
}

/* ---------------------------------------------------------
   5. CTA band: prevent horizontal overflow
   --------------------------------------------------------- */
.cta {
    padding: 1.5rem 1rem !important;
    margin-inline: 0;
}

.cta h2 {
    font-size: 1.35rem !important;
}

@media (max-width: 700px) {
    .cta {
        padding: 1.5rem 1rem !important;
    }
}

/* ---------------------------------------------------------
   6. Cards: shrink padding on mobile
   --------------------------------------------------------- */
@media (max-width: 700px) {
    .card {
        padding: 1rem !important;
    }
    .card-title {
        font-size: 1rem !important;
    }
    .card-text {
        font-size: 0.9rem;
    }
}

/* ---------------------------------------------------------
   7. Persian long words: allow wrapping
   --------------------------------------------------------- */
h1, h2, h3, h4, h5, h6, p, a, span, li, td, th, .card-title, .hero-title {
    overflow-wrap: break-word;
    word-break: break-word;
}

/* ---------------------------------------------------------
   8. Buttons: responsive size
   --------------------------------------------------------- */
@media (max-width: 700px) {
    .btn-lg {
        padding: 0.75rem 1.25rem !important;
        font-size: 1rem !important;
        width: 100%;
        max-width: 100%;
    }
}

.hero-actions {
    flex-wrap: wrap;
    gap: 0.75rem;
    max-width: 100%;
}

@media (max-width: 500px) {
    .hero-actions {
        flex-direction: column;
        align-items: stretch;
    }
    .hero-actions .btn {
        width: 100%;
    }
}

/* ---------------------------------------------------------
   9. Section spacing on mobile
   --------------------------------------------------------- */
@media (max-width: 700px) {
    .section {
        padding: 1.5rem 0 !important;
    }
    .section-head {
        margin-bottom: 1.25rem !important;
    }
    .section-head h2 {
        font-size: 1.35rem !important;
    }
    .section-head p {
        font-size: 0.9rem;
    }
}

/* ---------------------------------------------------------
   10. Header: prevent long brand from overflowing
   --------------------------------------------------------- */
@media (max-width: 500px) {
    .site-header .container {
        padding-inline: 0.75rem;
    }
    .header-actions {
        gap: 0.25rem;
    }
    .header-actions .btn {
        padding: 6px 10px !important;
        font-size: 0.75rem !important;
    }
}

/* ---------------------------------------------------------
   11. Footer: stack columns
   --------------------------------------------------------- */
@media (max-width: 700px) {
    .site-footer {
        padding: 1.5rem 0 1rem !important;
        margin-top: 2rem !important;
    }
    .site-footer-grid {
        grid-template-columns: 1fr !important;
        gap: 1.25rem !important;
    }
    .site-footer-bottom {
        font-size: 0.75rem;
    }
}

/* ---------------------------------------------------------
   12. Catch-all: any element with a fixed width > 100%
   --------------------------------------------------------- */
[style*="width:"] {
    max-width: 100% !important;
}