/* =========================================================
   ISLAMIC LIGHT
   Family & Married Life Website
   Homepage Styles
   File: home-page.css
   ========================================================= */


/* =========================================================
   1. HOMEPAGE VARIABLES (LIGHT & DARK THEME)
   ========================================================= */

:root {
    --home-primary: #00695c;
    --home-primary-dark: #004d40;
    --home-primary-light: #00897b;

    --home-accent: #c9a227;
    --home-accent-light: #f5ecd0;

    --home-text: #263238;
    --home-text-light: #607d8b;

    --home-bg: #ffffff;
    --home-bg-soft: #f7faf9;
    --home-bg-green: #eef7f4;
    --home-card-bg: #ffffff;

    --home-hero-bg: linear-gradient(135deg, #eef8f5 0%, #ffffff 55%, #f7f2df 100%);
    --home-hero-circle-1: rgba(0, 105, 92, 0.06);
    --home-hero-circle-2: rgba(201, 162, 39, 0.07);

    --home-border: #e2e8e6;

    --home-container: 1200px;

    --home-radius-sm: 8px;
    --home-radius-md: 14px;
    --home-radius-lg: 20px;

    --home-shadow-sm: 0 3px 12px rgba(0, 0, 0, 0.06);
    --home-shadow-md: 0 8px 28px rgba(0, 0, 0, 0.09);
    --home-shadow-lg: 0 16px 45px rgba(0, 0, 0, 0.12);

    --home-transition: 0.25s ease;
}

/* Dark Mode Variables via Class or System Preference */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --home-primary: #26a69a;
        --home-primary-dark: #80cbc4;
        --home-primary-light: #4db6ac;

        --home-accent: #ffd54f;
        --home-accent-light: #3e3822;

        --home-text: #eceff1;
        --home-text-light: #b0bec5;

        --home-bg: #12181b;
        --home-bg-soft: #1a2226;
        --home-bg-green: #152423;
        --home-card-bg: #1e282d;

        --home-hero-bg: linear-gradient(135deg, #101c1a 0%, #12181b 55%, #1f1b12 100%);
        --home-hero-circle-1: rgba(38, 166, 154, 0.12);
        --home-hero-circle-2: rgba(255, 213, 79, 0.08);

        --home-border: #2c3b42;

        --home-shadow-sm: 0 3px 12px rgba(0, 0, 0, 0.35);
        --home-shadow-md: 0 8px 28px rgba(0, 0, 0, 0.45);
        --home-shadow-lg: 0 16px 45px rgba(0, 0, 0, 0.55);
    }
}

body.dark-mode,
[data-theme="dark"] {
    --home-primary: #26a69a;
    --home-primary-dark: #80cbc4;
    --home-primary-light: #4db6ac;

    --home-accent: #ffd54f;
    --home-accent-light: #3e3822;

    --home-text: #eceff1;
    --home-text-light: #b0bec5;

    --home-bg: #12181b;
    --home-bg-soft: #1a2226;
    --home-bg-green: #152423;
    --home-card-bg: #1e282d;

    --home-hero-bg: linear-gradient(135deg, #101c1a 0%, #12181b 55%, #1f1b12 100%);
    --home-hero-circle-1: rgba(38, 166, 154, 0.12);
    --home-hero-circle-2: rgba(255, 213, 79, 0.08);

    --home-border: #2c3b42;

    --home-shadow-sm: 0 3px 12px rgba(0, 0, 0, 0.35);
    --home-shadow-md: 0 8px 28px rgba(0, 0, 0, 0.45);
    --home-shadow-lg: 0 16px 45px rgba(0, 0, 0, 0.55);
}


/* =========================================================
   2. GENERAL HOMEPAGE RESET & OVERFLOW FIX
   ========================================================= */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    max-width: 100%;
    overflow-x: hidden; /* Fix horizontal scrollbar */
    background-color: var(--home-bg);
    color: var(--home-text);
}

main {
    width: 100%;
    overflow-x: clip; /* Extra protection against side overflowing elements */
}

.container {
    width: min(100% - 40px, var(--home-container));
    margin: 0 auto;
}

.hero-section,
.intro-section,
.categories-section,
.latest-articles-section,
.guidance-section,
.cta-section {
    width: 100%;
    position: relative;
}


/* =========================================================
   3. SECTION COMMON STYLES
   ========================================================= */

.section-heading {
    max-width: 760px;
    margin: 0 auto 42px;
    text-align: center;
}

.section-label {
    display: inline-block;
    margin-bottom: 10px;
    color: var(--home-primary);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.section-heading h2 {
    margin: 0;
    color: var(--home-primary-dark);
    font-size: clamp(1.65rem, 3vw, 2.35rem);
    line-height: 1.35;
    font-weight: 700;
}

.section-heading p {
    margin: 14px auto 0;
    max-width: 650px;
    color: var(--home-text-light);
    font-size: 1rem;
    line-height: 1.9;
}


/* =========================================================
   4. HERO SECTION
   ========================================================= */

.hero-section {
    position: relative;
    overflow: hidden;
    background: var(--home-hero-bg);
}

.hero-section::before {
    content: "";
    position: absolute;
    width: 360px;
    height: 360px;
    top: -180px;
    right: -120px;
    border-radius: 50%;
    background: var(--home-hero-circle-1);
    pointer-events: none;
}

.hero-section::after {
    content: "";
    position: absolute;
    width: 260px;
    height: 260px;
    bottom: -150px;
    left: -90px;
    border-radius: 50%;
    background: var(--home-hero-circle-2);
    pointer-events: none;
}

.hero-container {
    position: relative;
    z-index: 1;
    width: min(100% - 40px, var(--home-container));
    min-height: 520px;
    margin: 0 auto;
    display: flex;
    align-items: center;
}

.hero-content {
    width: min(100%, 800px);
    padding: 78px 0;
}

.hero-label {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    margin-bottom: 18px;
    padding: 6px 13px;
    color: var(--home-primary-dark);
    background: rgba(0, 105, 92, 0.08);
    border: 1px solid rgba(0, 105, 92, 0.12);
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
}

body.dark-mode .hero-label,
[data-theme="dark"] .hero-label {
    background: rgba(38, 166, 154, 0.15);
    border-color: rgba(38, 166, 154, 0.25);
}

.hero-content h1 {
    max-width: 850px;
    margin: 0;
    color: var(--home-primary-dark);
    font-size: clamp(2.2rem, 5vw, 4rem);
    line-height: 1.22;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.hero-description {
    max-width: 720px;
    margin: 22px 0 0;
    color: var(--home-text-light);
    font-size: clamp(1rem, 2vw, 1.12rem);
    line-height: 1.95;
}

.hero-actions {
    margin-top: 32px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}


/* =========================================================
   5. HERO BUTTONS
   ========================================================= */

.primary-button,
.secondary-button,
.cta-button,
.view-all-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 10px 20px;
    border-radius: 9px;
    font-size: 0.92rem;
    font-weight: 700;
    text-decoration: none;
    transition:
        color var(--home-transition),
        background-color var(--home-transition),
        border-color var(--home-transition),
        transform var(--home-transition),
        box-shadow var(--home-transition);
}

.primary-button {
    color: #ffffff;
    background: var(--home-primary);
    border: 1px solid var(--home-primary);
    box-shadow: 0 5px 14px rgba(0, 105, 92, 0.18);
}

.primary-button:hover,
.primary-button:focus-visible {
    color: #ffffff;
    background: var(--home-primary-dark);
    border-color: var(--home-primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 77, 64, 0.22);
}

.secondary-button {
    color: var(--home-primary-dark);
    background: var(--home-card-bg);
    border: 1px solid var(--home-border);
}

.secondary-button:hover,
.secondary-button:focus-visible {
    color: var(--home-primary);
    border-color: var(--home-primary);
    background: var(--home-bg-green);
    transform: translateY(-2px);
}


/* =========================================================
   6. INTRODUCTION SECTION
   ========================================================= */

.intro-section {
    padding: 88px 0;
    background: var(--home-bg);
}

.intro-content {
    width: min(100%, 850px);
    margin: 0 auto;
    padding: 34px 38px;
    background: var(--home-bg-soft);
    border: 1px solid var(--home-border);
    border-radius: var(--home-radius-lg);
    box-shadow: var(--home-shadow-sm);
}

.intro-content p {
    margin: 0;
    color: var(--home-text);
    font-size: 1rem;
    line-height: 2;
}

.intro-content p + p {
    margin-top: 18px;
}


/* =========================================================
   7. CATEGORIES SECTION
   ========================================================= */

.categories-section {
    padding: 90px 0;
    background: var(--home-bg-soft);
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 22px;
}

.category-card {
    position: relative;
    padding: 28px;
    background: var(--home-card-bg);
    border: 1px solid var(--home-border);
    border-radius: var(--home-radius-md);
    box-shadow: var(--home-shadow-sm);
    transition:
        transform var(--home-transition),
        box-shadow var(--home-transition),
        border-color var(--home-transition);
}

.category-card:hover {
    transform: translateY(-5px);
    border-color: rgba(0, 105, 92, 0.35);
    box-shadow: var(--home-shadow-md);
}

.category-icon {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    color: var(--home-primary);
    background: var(--home-bg-green);
    border-radius: 13px;
    font-size: 1.45rem;
    font-weight: 600;
}

.category-card h3 {
    margin: 0;
    color: var(--home-primary-dark);
    font-size: 1.15rem;
    line-height: 1.5;
}

.category-card p {
    margin: 12px 0 20px;
    color: var(--home-text-light);
    font-size: 0.92rem;
    line-height: 1.85;
}

.category-card a {
    display: inline-flex;
    align-items: center;
    color: var(--home-primary);
    font-size: 0.88rem;
    font-weight: 700;
    text-decoration: none;
    transition:
        color var(--home-transition),
        transform var(--home-transition);
}

.category-card a::after {
    content: "→";
    margin-left: 7px;
    transition: transform var(--home-transition);
}

.category-card a:hover,
.category-card a:focus-visible {
    color: var(--home-primary-dark);
    transform: translateX(2px);
}

.category-card a:hover::after,
.category-card a:focus-visible::after {
    transform: translateX(3px);
}


/* =========================================================
   8. LATEST ARTICLES
   ========================================================= */

.latest-articles-section {
    padding: 90px 0;
    background: var(--home-bg);
}

.article-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
}

.article-card {
    overflow: hidden;
    background: var(--home-card-bg);
    border: 1px solid var(--home-border);
    border-radius: var(--home-radius-md);
    box-shadow: var(--home-shadow-sm);
    transition:
        transform var(--home-transition),
        box-shadow var(--home-transition),
        border-color var(--home-transition);
}

.article-card:hover {
    transform: translateY(-5px);
    border-color: rgba(0, 105, 92, 0.35);
    box-shadow: var(--home-shadow-md);
}


/* =========================================================
   9. ARTICLE IMAGE
   ========================================================= */

.article-image-link {
    display: block;
    overflow: hidden;
    background: var(--home-bg-soft);
    aspect-ratio: 1200 / 630;
}

.article-image-link img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    transition: transform 0.45s ease;
}

.article-card:hover .article-image-link img {
    transform: scale(1.04);
}


/* =========================================================
   10. ARTICLE CONTENT
   ========================================================= */

.article-content {
    padding: 23px;
}

.article-category {
    display: inline-block;
    margin-bottom: 10px;
    color: var(--home-primary);
    font-size: 0.76rem;
    font-weight: 700;
}

.article-content h3 {
    margin: 0;
}

.article-content h3 a {
    color: var(--home-primary-dark);
    font-size: 1.12rem;
    line-height: 1.55;
    font-weight: 700;
    text-decoration: none;
    transition: color var(--home-transition);
}

.article-content h3 a:hover,
.article-content h3 a:focus-visible {
    color: var(--home-primary);
}

.article-content p {
    margin: 11px 0 18px;
    color: var(--home-text-light);
    font-size: 0.9rem;
    line-height: 1.8;
}

.read-more {
    display: inline-flex;
    align-items: center;
    color: var(--home-primary);
    font-size: 0.86rem;
    font-weight: 700;
    text-decoration: none;
    transition:
        color var(--home-transition),
        transform var(--home-transition);
}

.read-more::after {
    content: "→";
    margin-left: 6px;
    transition: transform var(--home-transition);
}

.read-more:hover,
.read-more:focus-visible {
    color: var(--home-primary-dark);
    transform: translateX(2px);
}

.read-more:hover::after,
.read-more:focus-visible::after {
    transform: translateX(3px);
}


/* =========================================================
   11. SECTION ACTION
   ========================================================= */

.section-action {
    margin-top: 38px;
    display: flex;
    justify-content: center;
}

.view-all-button {
    color: var(--home-primary);
    background: var(--home-card-bg);
    border: 1px solid var(--home-primary);
}

.view-all-button:hover,
.view-all-button:focus-visible {
    color: #ffffff;
    background: var(--home-primary);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 105, 92, 0.18);
}


/* =========================================================
   12. QURAN & HADITH GUIDANCE
   ========================================================= */

.guidance-section {
    padding: 90px 0;
    background: var(--home-bg-green);
}

.guidance-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
}

.guidance-card {
    padding: 34px;
    background: var(--home-card-bg);
    border: 1px solid var(--home-border);
    border-radius: var(--home-radius-md);
    box-shadow: var(--home-shadow-sm);
    transition:
        transform var(--home-transition),
        box-shadow var(--home-transition);
}

.guidance-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--home-shadow-md);
}

.guidance-card h3 {
    margin: 0;
    color: var(--home-primary-dark);
    font-size: 1.25rem;
}

.guidance-card p {
    margin: 13px 0 20px;
    color: var(--home-text-light);
    font-size: 0.94rem;
    line-height: 1.9;
}

.guidance-card a {
    display: inline-flex;
    align-items: center;
    color: var(--home-primary);
    font-size: 0.88rem;
    font-weight: 700;
    text-decoration: none;
}

.guidance-card a::after {
    content: "→";
    margin-left: 7px;
    transition: transform var(--home-transition);
}

.guidance-card a:hover,
.guidance-card a:focus-visible {
    color: var(--home-primary-dark);
}

.guidance-card a:hover::after,
.guidance-card a:focus-visible::after {
    transform: translateX(3px);
}


/* =========================================================
   13. CALL TO ACTION
   ========================================================= */

.cta-section {
    position: relative;
    overflow: hidden;
    padding: 90px 0;
    background: linear-gradient(135deg, #004d40, #00695c);
}

body.dark-mode .cta-section,
[data-theme="dark"] .cta-section {
    background: linear-gradient(135deg, #091f1c, #003630);
}

.cta-section::before {
    content: "";
    position: absolute;
    width: 320px;
    height: 320px;
    top: -170px;
    right: -80px;
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 50%;
    pointer-events: none;
}

.cta-section::after {
    content: "";
    position: absolute;
    width: 240px;
    height: 240px;
    bottom: -150px;
    left: -70px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    pointer-events: none;
}

.cta-content {
    position: relative;
    z-index: 1;
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.cta-content .section-label {
    color: #e9d58d;
}

.cta-content h2 {
    margin: 0;
    color: #ffffff;
    font-size: clamp(1.7rem, 3vw, 2.45rem);
    line-height: 1.4;
}

.cta-content p {
    max-width: 680px;
    margin: 16px auto 0;
    color: #d5e7e3;
    font-size: 0.98rem;
    line-height: 1.9;
}

.cta-button {
    margin-top: 28px;
    color: #004d40;
    background: #ffffff;
    border: 1px solid #ffffff;
}

.cta-button:hover,
.cta-button:focus-visible {
    color: #004d40;
    background: #f5f5f5;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.16);
}


/* =========================================================
   14. GLOBAL FOCUS
   ========================================================= */

.hero-section a:focus-visible,
.intro-section a:focus-visible,
.categories-section a:focus-visible,
.latest-articles-section a:focus-visible,
.guidance-section a:focus-visible,
.cta-section a:focus-visible {
    outline: 3px solid rgba(201, 162, 39, 0.45);
    outline-offset: 3px;
}


/* =========================================================
   15. REDUCED MOTION
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
    .hero-section *,
    .intro-section *,
    .categories-section *,
    .latest-articles-section *,
    .guidance-section *,
    .cta-section * {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}


/* =========================================================
   16. TABLET RESPONSIVE
   ========================================================= */

@media (max-width: 1024px) {
    .container,
    .hero-container {
        width: min(100% - 32px, var(--home-container));
    }

    .category-grid,
    .article-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hero-container {
        min-height: 480px;
    }

    .hero-content {
        padding: 68px 0;
    }
}


/* =========================================================
   17. MOBILE RESPONSIVE
   ========================================================= */

@media (max-width: 768px) {
    .container,
    .hero-container {
        width: min(100% - 24px, var(--home-container));
    }

    .hero-container {
        min-height: auto;
    }

    .hero-content {
        padding: 64px 0;
    }

    .hero-content h1 {
        font-size: clamp(2rem, 8vw, 2.8rem);
        letter-spacing: -0.015em;
    }

    .hero-description {
        line-height: 1.85;
    }

    .hero-actions {
        margin-top: 26px;
        gap: 9px;
    }

    .primary-button,
    .secondary-button,
    .cta-button,
    .view-all-button {
        min-height: 44px;
        padding: 9px 17px;
    }

    .intro-section,
    .categories-section,
    .latest-articles-section,
    .guidance-section,
    .cta-section {
        padding: 68px 0;
    }

    .section-heading {
        margin-bottom: 32px;
    }

    .section-heading h2 {
        font-size: 1.75rem;
    }

    .section-heading p {
        font-size: 0.94rem;
        line-height: 1.8;
    }

    .intro-content {
        padding: 27px 24px;
    }

    .category-grid,
    .article-grid,
    .guidance-grid {
        grid-template-columns: 1fr;
    }

    .category-card,
    .guidance-card {
        padding: 26px;
    }

    .article-content {
        padding: 21px;
    }

    .cta-content h2 {
        font-size: 1.75rem;
    }
}


/* =========================================================
   18. SMALL MOBILE RESPONSIVE
   ========================================================= */

@media (max-width: 480px) {
    .container,
    .hero-container {
        width: min(100% - 20px, var(--home-container));
    }

    .hero-content {
        padding: 52px 0;
    }

    .hero-label {
        margin-bottom: 14px;
        font-size: 0.76rem;
    }

    .hero-content h1 {
        font-size: 2rem;
        line-height: 1.3;
    }

    .hero-description {
        margin-top: 17px;
        font-size: 0.94rem;
    }

    .hero-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .primary-button,
    .secondary-button {
        width: 100%;
    }

    .intro-section,
    .categories-section,
    .latest-articles-section,
    .guidance-section,
    .cta-section {
        padding: 56px 0;
    }

    .section-heading h2 {
        font-size: 1.55rem;
    }

    .section-heading p {
        font-size: 0.9rem;
    }

    .intro-content {
        padding: 23px 19px;
    }

    .intro-content p {
        font-size: 0.92rem;
        line-height: 1.9;
    }

    .category-card,
    .guidance-card {
        padding: 23px;
    }

    .category-card h3 {
        font-size: 1.08rem;
    }

    .category-card p,
    .guidance-card p,
    .article-content p {
        font-size: 0.88rem;
    }

    .article-content h3 a {
        font-size: 1.05rem;
    }

    .cta-content h2 {
        font-size: 1.55rem;
    }

    .cta-content p {
        font-size: 0.9rem;
    }

    .cta-button {
        width: 100%;
    }
}


/* =========================================================
   19. PRINT
   ========================================================= */

@media print {
    .hero-section,
    .intro-section,
    .categories-section,
    .latest-articles-section,
    .guidance-section,
    .cta-section {
        background: #ffffff !important;
        color: #000000 !important;
    }

    .hero-section::before,
    .hero-section::after,
    .cta-section::before,
    .cta-section::after {
        display: none;
    }

    .category-card,
    .article-card,
    .guidance-card,
    .intro-content {
        box-shadow: none;
        border: 1px solid #cccccc;
        background: #ffffff !important;
    }
}
