/* 
 * mobile-first.css
 * 
 * A mobile-first CSS file for the Msunduzi Hospice website.
 * Base styles are optimized for mobile devices (single column, touch-friendly).
 * Media queries progressively enhance the layout for tablets and desktops.
 * Colors are preserved from the original design.
 */

/* =========================================
   1. RESET & BASE TYPOGRAPHY
   ========================================= */
html {
    font-size: 100%;
    /* 1rem = 16px by default */
    scroll-behavior: smooth;
    /* Smooth scrolling for anchor links */
    box-sizing: border-box;
}

*,
*::before,
*::after {
    box-sizing: inherit;
    /* Ensure consistent box-sizing */
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    color: #2A2A2A;
    /* Dark gray for readability */
    background-color: #FEFEFE;
    /* Off-white background */
    font-size: 1rem;
    /* 16px */
    line-height: 1.5;
    /* Comfortable line height */
    overflow-x: hidden;
}

/* Container for centering content with side padding */
.container {
    max-width: 1400px;
    /* Limit width on large screens */
    margin: 0 auto;
    /* Center horizontally */
    padding: 0 1.25rem;
    /* 20px left/right padding on mobile */
}

/* Responsive images by default */
img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    /* Soft corners */
}

/* Headings */
h1,
h2,
h3,
h4,
h5,
h6 {
    line-height: 1.2;
    margin-top: 0;
    margin-bottom: 1rem;
}

/* =========================================
   2. COLOR UTILITIES (keep brand colors)
   ========================================= */
.text-teal {
    color: #0d9488;
}

.text-coral {
    color: #f4a261;
}

.text-blue {
    color: #3498db;
}

.text-green {
    color: #2ecc71;
}

.text-purple {
    color: #9b59b6;
}

.text-orange {
    color: #e67e22;
}

.bg-teal-light {
    background-color: #e0f2fe;
}

.bg-coral-light {
    background-color: #fef7f0;
}

.bg-blue-light {
    background-color: #eaf5fc;
}

.bg-green-light {
    background-color: #eafaf1;
}

.bg-purple-light {
    background-color: #f5f0f8;
}

.bg-orange-light {
    background-color: #fdf2e9;
}

/* =========================================
   3. BUTTONS – mobile first (full width)
   ========================================= */
.btn {
    display: block;
    /* Full width on mobile */
    width: 100%;
    text-align: center;
    text-decoration: none;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    white-space: normal;
    /* Allow text to wrap */
    transition: background-color 0.3s, color 0.3s;
    line-height: 1.3;
    margin-bottom: 0.5rem;
    /* Spacing when stacked */
    box-sizing: border-box;
}

/* Primary button (teal) */
.btn-primary {
    background-color: #0d9488;
    color: #fff;
}

.btn-primary:hover {
    background-color: #0f766e;
}

/* Outline button (coral border) */
.btn-outline {
    background-color: transparent;
    border: 2px solid #f4a261;
    color: #f4a261;
}

.btn-outline:hover {
    background-color: #fef7f0;
}

/* Icons inside buttons – scale with font */
.icon,
.icon-heart,
.btn .icon-heart {
    max-width: 1em;
    max-height: 1em;
    vertical-align: -0.125em;
    /* Align with text baseline */
}

.icon-heart {
    color: #f4a261;
    /* Coral heart icon */
}

/* =========================================
   4. HEADER – mobile first (sticky, hamburger menu)
   ========================================= */
.header {
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    flex-wrap: wrap;
    /* Allow active menus to wrap */
    position: relative;
}

/* Logo area */
.logo {
    display: flex;
    align-items: center;
}

.logo img {
    height: 40px;
    /* Smaller on mobile */
    margin-right: 10px;
}

.logo-text h1 {
    font-size: 18px;
    margin: 0;
}

.logo-text p {
    font-size: 12px;
    margin: 0;
    color: #555;
}

/* Hamburger toggle button – visible on mobile */
.mobile-menu-toggle {
    display: block;
    /* Shown only on mobile (hidden on desktop via media query) */
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #333;
    padding: 5px;
}

/* Navigation menu – hidden by default on mobile */
.nav-menu,
.header-buttons {
    display: none;
    width: 100%;
}

/* When menu is active (JS toggles .active class) */
.nav-menu.active {
    display: flex;
    flex-direction: column;
    background-color: #fff;
    padding: 1rem 0 0 0;
    order: 3;
    /* Place below header row */
}

.nav-menu.active a {
    display: block;
    padding: 1rem 1.25rem;
    text-decoration: none;
    color: #333;
    font-weight: 500;
    border-bottom: 1px solid #f0f0f0;
}

.header-buttons.active {
    display: flex;
    flex-direction: column;
    background: #fff;
    padding: 1rem 1.25rem;
    box-shadow: 0 10px 10px rgba(0, 0, 0, 0.05);
    order: 4;
    /* Stack after nav-menu */
}

.header-buttons.active .btn {
    width: 100%;
    /* Buttons full width in dropdown */
}

/* =========================================
   5. HERO SECTION – mobile first (single column)
   ========================================= */
/* =========================================
   HERO SECTION – Carousel with Rounded Corners (Fixed Clipping & Overflow)
   ========================================= */
.hero {
    background: linear-gradient(to bottom right, #f0fdfa, #e0f2fe);
    padding: 3rem 0;
    overflow-x: hidden;
    /* Contain any potential overflow */
}

.hero-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.hero-text h1 {
    font-size: 2.25rem;
    word-break: break-word;
}

.hero-text p {
    font-size: 1rem;
    margin-bottom: 1.5rem;
}

.hero-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
}

.hero-stats {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #ddd;
}

.stat {
    text-align: center;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: #0d9488;
}

/* Hero image container – positioning only, no clipping */
.hero-image {
    position: relative;
    margin-top: 1rem;
}

/* Carousel wrapper – handles clipping and rounded corners */
.carousel-container {
    overflow: hidden;
    border-radius: 12px;
    width: 100%;
    max-width: 100%;
}

/* Carousel itself */
.carousel {
    display: flex;
    width: 100%;
}

/* Track for infinite scroll */
.carousel-track {
    display: flex;
    width: max-content;
    animation: scroll var(--duration, 20s) linear infinite;
}

/* Each slide – now with rounded corners and constrained width */
.carousel-slide {
    flex-shrink: 0;
    border-radius: 12px;
    overflow: hidden;
    max-width: 100%;
    /* Prevents slide from overflowing container */
}

/* Images fill the slide, no extra rounding */
.carousel-slide img {
    height: 400px;
    width: auto;
    max-width: none;
    object-fit: cover;
    display: block;
}

@keyframes scroll {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-50%);
    }
}

/* Floating card – adjusted for better text fit */
.floating-card {
    position: absolute;
    bottom: -1.5rem;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    /* Wider on mobile */
    max-width: 300px;
    /* Cap on larger screens */
    background-color: #fff;
    padding: 0.75rem;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.floating-card .btn {
    width: 100%;
    margin-bottom: 0;
    padding: 0.5rem;
    font-size: 0.9rem;
    /* Slightly smaller text */
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    /* Prevent wrapping if possible */
}

.floating-card .btn .icon-heart {
    width: 20px;
    height: 20px;
    margin-right: 8px;
}

/* On very small screens, allow button text to wrap */
@media (max-width: 480px) {
    .floating-card .btn {
        white-space: normal;
        font-size: 0.85rem;
    }
}

/* =========================================
   6. ABOUT SECTION – mobile first (single column)
   ========================================= */
.about-section {
    padding: 3rem 0;
}

.about-section .section-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Quote styling */
.quote {
    font-size: 1.125rem;
    font-style: italic;
    color: #555;
    margin-bottom: 0.5rem;
}

.quote-author {
    font-size: 0.875rem;
    color: #777;
    margin-bottom: 1.5rem;
}

/* Benefit items (icon + text) */
.benefit {
    display: flex;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.benefit-icon {
    width: 40px;
    margin-right: 15px;
    color: #0d9488;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.benefit h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.125rem;
}

.benefit p {
    margin: 0;
    color: #555;
}

/* About image with overlay card */
.about-image {
    position: relative;
    margin-bottom: 2rem;
    /* Space for overlay */
}

.about-image img {
    width: 100%;
    border-radius: 20px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

/* Overlay card – centered on mobile */
.overlay-card {
    position: absolute;
    bottom: -2rem;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    background-color: #fff;
    padding: 1rem;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    z-index: 10;
}

.overlay-card .card-number {
    font-size: 2rem;
    font-weight: 700;
    color: #0d9488;
    line-height: 1;
}

.overlay-card .card-label {
    font-weight: 600;
    font-size: 1rem;
    margin-top: 0.25rem;
}

.overlay-card .card-subtext {
    font-size: 0.85rem;
    color: #555;
    margin-top: 0.25rem;
}

/* =========================================
   7. SERVICES SECTION – mobile first (cards stack)
   ========================================= */
.services-section {
    padding: 3rem 0;
    background-color: #f8fafc;
    /* Light gray background */
}

.section-header {
    text-align: center;
    margin-bottom: 2rem;
}

.section-header h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.section-header p {
    font-size: 1rem;
    color: #555;
    max-width: 700px;
    margin: 0 auto;
}

/* Services grid – stacked on mobile */
.services-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Service card */
.service-card {
    background-color: #fff;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.service-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    background-color: #e0f2fe;
    /* Light teal */
}

.service-icon img {
    width: 28px;
    height: 28px;
}

.service-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.service-card p {
    color: #555;
    margin: 0;
}

/* =========================================
   8. SUPPORTERS SECTION – mobile first (flex wrap)
   ========================================= */
.supporters-section {
    /* Add class to HTML if needed */
    padding: 3rem 0;
}

.supporters-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    justify-content: center;
    align-items: center;
}

.supporters-grid img {
    height: 80px;
    /* Smaller on mobile */
    width: auto;
    object-fit: contain;
    filter: grayscale(0%);
    /* Keep original colors */
    transition: filter 0.3s;
}

.supporters-grid img:hover {
    filter: grayscale(0%);
    /* No grayscale on hover */
}

/* =========================================
   9. HOW TO HELP SECTION – mobile first
   ========================================= */
.how-to-help-section {
    padding: 3rem 0;
    background-color: #f0fdfa;
    /* Light teal background */
    text-align: center;
}

.how-to-help-content h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.how-to-help-text {
    font-size: 1rem;
    color: #555;
    max-width: 800px;
    margin: 0 auto 1.5rem;
}

.how-to-help-actions .btn {
    display: inline-block;
    /* Override .btn default block on mobile? */
    width: auto;
    /* Let button size to content */
    margin: 0 auto;
}

/* =========================================
   10. FOOTER – mobile first (stacked)
   ========================================= */
.footer {
    background-color: #2c3e50;
    color: #ecf0f1;
    padding: 3rem 0 0 0;
}

.footer a {
    color: #bdc3c7;
    text-decoration: none;
    transition: color 0.3s;
}

.footer a:hover {
    color: #fff;
}

/* Footer content – stacked on mobile */
.footer-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h4 {
    font-size: 1.125rem;
    margin-bottom: 1rem;
    color: #fff;
}

.footer-section p {
    color: #bdc3c7;
    line-height: 1.6;
}

/* Social media icons */
.social-media {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

.social-media a {
    width: 35px;
    height: 35px;
    background: #34495e;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
}

.social-media a:hover {
    background: #0d9488;
}

.social-media img {
    width: 20px;
    height: 20px;
}

/* Footer bottom (copyright, links) */
.footer-bottom {
    border-top: 1px solid #34495e;
    padding: 1.5rem 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    text-align: center;
    font-size: 0.875rem;
    color: #bdc3c7;
}

.footer-bottom-links a {
    margin: 0 0.5rem;
}

/* =========================================
   11. MEDIA QUERIES – Progressive Enhancement
   ========================================= */

/* Tablets (min-width: 768px) */
@media (min-width: 768px) {

    /* Increase vertical spacing */
    section {
        padding: 4rem 0;
    }

    .hero {
        padding: 4rem 0;
    }

    /* Hero stats become horizontal */
    .hero-stats {
        flex-direction: row;
        justify-content: space-around;
        border-top: none;
        padding-top: 0;
    }


    /* Floating card moves to bottom-left corner */
    .floating-card {
        bottom: -20px;
        left: -20px;
        transform: none;
        width: auto;
        padding: 1rem;
    }

    .floating-card .btn {
        padding: 0.5rem 1rem;
    }

    /* Overlay card moves to bottom-left */
    .overlay-card {
        bottom: -20px;
        left: -20px;
        transform: none;
        width: auto;
        padding: 1.5rem;
        align-items: flex-start;
        text-align: left;
    }

    /* Switch from flex column to grid (2 columns) for various grids */
    .services-grid,
    .blog-grid,
    /* if used */
    .events-grid,
    /* if used */
    .help-grid,
    /* if used */
    .resources-grid,
    /* if used */
    .footer-content {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
    }

    /* Buttons become inline-block (auto width) */
    .hero-buttons {
        flex-direction: row;
    }

    .btn {
        display: inline-block;
        width: auto;
        margin-right: 1rem;
        margin-bottom: 0;
    }
}

/* Laptops/Desktops (min-width: 992px) */
@media (min-width: 992px) {
    section {
        padding: 5rem 0;
    }

    .hero {
        padding: 5rem 0;
    }

    /* Hide hamburger and show full navigation */
    .mobile-menu-toggle {
        display: none;
    }

    .nav-menu,
    .header-buttons {
        display: flex !important;
        /* Override any JS inline styles */
        flex-direction: row;
        width: auto;
        background: transparent;
        box-shadow: none;
        padding: 0;
        order: 0;
        /* Reset order */
    }

    .nav-menu a {
        margin: 0 15px;
        padding: 0;
        border: none;
        text-decoration: none;
        color: #2A2A2A;
    }

    .header-buttons .btn {
        margin-left: 10px;
    }

    /* Logo larger on desktop */
    .logo img {
        height: 50px;
    }

    .logo-text h1 {
        font-size: 20px;
    }

    .logo-text p {
        font-size: 14px;
    }

    /* Hero and About become 2-column grid */
    .hero-content,
    .about-section .section-content {
        display: grid;
        grid-template-columns: 1fr 1fr;
        align-items: center;
    }

    .carousel-container {
        max-width: 45vw;
    }

    /* Larger heading on desktop */
    .hero-text h1 {
        font-size: clamp(2.5rem, 5vw, 3.5rem);
    }

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

    /* Footer becomes 4 columns */
    .footer-content {
        grid-template-columns: repeat(4, 1fr);
    }

    /* Footer bottom horizontal */
    .footer-bottom {
        flex-direction: row;
        justify-content: space-between;
        text-align: left;
    }
}

/* =========================================
   12. ADDITIONAL UTILITIES
   ========================================= */
/* Ensure all sections have proper spacing and no overflow */
* {
    overflow-wrap: break-word;
}

/* Supporters section – make images slightly larger on desktop */
@media (min-width: 768px) {
    .supporters-grid img {
        height: 100px;
    }
}

/* =========================================
   13. POPUP / MODAL
   ========================================= */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: #fff;
    padding: 2.5rem;
    border-radius: 16px;
    max-width: 600px;
    width: 100%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    position: relative;
    text-align: center;
    border-top: 6px solid #0d9488;
}

.modal-content h2 {
    color: #0d9488;
    margin-bottom: 1rem;
    font-size: 1.75rem;
}

.modal-content p {
    color: #555;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

.close-button {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 1.5rem;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    transition: color 0.3s;
    line-height: 1;
}

.close-button:hover {
    color: #2A2A2A;
}

/* Specific styling for the hero button in the modal */
.modal-content .hero.button {
    background-color: #f4a261;
    color: #fff;
    padding: 1rem 2rem;
    font-size: 1.25rem;
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(244, 162, 97, 0.4);
    transition: transform 0.3s, box-shadow 0.3s;
    display: inline-block;
    text-transform: uppercase;
    font-weight: 700;
    text-decoration: none;
    margin-top: 1rem;
}

.modal-content .hero.button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(244, 162, 97, 0.6);
    background-color: #e7904f;
    color: #fff;
}