/**
 * Capstone Foundation Theme - Main Stylesheet
 * Modern, minimalistic, premium design
 *
 * @package Capstone_Foundation
 */

/* ============================================
   Base Reset and CSS Variables
   ============================================ */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
}

:root {
    --primary-color: #00b3db;
    --accent-color: #b3cf35;
    --dark-color: #153449;
    --light-color: #f8fafc;
    --text-color: #333;
    --text-light: #475569;
    --border-color: #e2e8f0;
    --spacing-unit: 1rem;
    --border-radius: 12px;
    --border-radius-small: 6px;
    --transition: color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                  background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                  border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                  opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                  transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                  box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --header-height: 120px;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-height) + 20px);
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: white;
    min-height: 100vh;
    min-height: 100svh;
    padding-top: var(--header-height);
}

.site {
    position: relative;
    min-height: 100vh;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    margin-bottom: var(--spacing-unit);
    color: var(--dark-color);
    font-weight: 700;
    line-height: 1.2;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: all 0.3s ease;
}

a:hover {
    color: var(--accent-color);
}

img {
    max-width: 100%;
    height: auto;
}

p {
    margin-bottom: var(--spacing-unit);
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-unit);
}

/* ============================================
   Accessibility
   ============================================ */
.skip-link {
    position: absolute;
    left: -9999px;
    top: 20px;
    z-index: 999999;
    text-decoration: underline;
}

.skip-link:focus {
    color: var(--dark-color);
    background-color: var(--light-color);
    left: 6px;
    padding: 8px 16px;
    text-decoration: none;
}

.screen-reader-text,
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* ============================================
   Site Header
   ============================================ */
.site-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    position: fixed;
    width: 100%;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: var(--header-height);
    display: flex;
    align-items: center;
    transition: height 0.3s ease;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.site-branding {
    display: flex;
    align-items: center;
}

.custom-logo {
    width: clamp(160px, 20vw, 250px);
    height: auto;
    transition: transform 0.3s ease;
}

.custom-logo:hover {
    transform: scale(1.05);
}

/* ============================================
   Navigation
   ============================================ */
.main-navigation {
    display: flex;
    align-items: center;
}

.main-navigation ul {
    display: flex;
    list-style: none;
    gap: clamp(1rem, 2vw, 2rem);
    margin: 0;
    padding: 0;
}

.main-navigation a {
    color: var(--dark-color);
    font-weight: 500;
    font-size: 1rem;
    padding: 0.5rem 0;
    position: relative;
    transition: all 0.3s ease;
}

.main-navigation a:hover {
    color: var(--primary-color);
}

.main-navigation a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 0;
    background-color: var(--primary-color);
    transition: width 0.3s ease;
}

.main-navigation a:hover::after {
    width: 100%;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    font-size: 1.5rem;
    color: var(--dark-color);
    min-width: 48px;
    min-height: 48px;
}

/* ============================================
   Hero Section
   ============================================ */
.hero {
    position: relative;
    width: 100%;
    height: 100vh;
    height: 100svh;
    min-height: 500px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    margin-bottom: 0;
}

.scroll-indicator {
    position: absolute;
    bottom: 12vh;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    color: var(--dark-color);
    opacity: 0;
    transition: opacity 0.8s ease;
}

.scroll-indicator.visible {
    opacity: 0.45;
}

.scroll-text {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.scroll-mouse {
    opacity: 0.7;
}

.scroll-chevron {
    animation: scrollBounce 2s ease-in-out infinite;
}

@keyframes scrollBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(4px); }
}

.hero-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}


#hero-lottie {
    width: 100%;
    height: 100%;
    transform: scale(0.7) translateY(-5%);
    will-change: transform;
}

@media (max-width: 1200px) {
    #hero-lottie {
        transform: scale(0.85) translateY(-3%);
    }
}

@media (max-width: 1024px) {
    #hero-lottie {
        transform: scale(1.15) translateY(-5%);
    }
}

@media (max-width: 768px) {
    #hero-lottie {
        transform: scale(1.3) translateY(-5%);
    }
}

@media (max-width: 480px) {
    #hero-lottie {
        transform: scale(1.5) translateY(-3%);
    }
}

.hero .container {
    position: relative;
    z-index: 2;
    text-align: center;
    color: var(--dark-color);
    max-width: 1200px;
    padding: 0 2rem;
}

.hero-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-top: 0;
    min-height: auto;
    margin-top: clamp(2rem, 6vh, 6rem);
}

.hero h1 {
    color: #00b3db;
    font-size: clamp(1.5rem, 3.5vw, 2.5rem);
    font-weight: 700;
    margin-bottom: 0.5rem;
    line-height: 1.1;
    opacity: 0;
    transition: opacity 0.3s ease;
    will-change: color, opacity;
}

.hero .tagline {
    color: var(--dark-color);
    font-size: clamp(0.9rem, 1.8vw, 1.1rem);
    margin-bottom: 0.5rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Reveal hero text once fonts are loaded */
.fonts-loaded .hero h1,
.fonts-loaded .hero .tagline {
    opacity: 1;
}

.hero-cta-hidden {
    margin-top: 1.5rem;
    background: var(--primary-color);
    color: white;
    padding: 1rem 2.5rem;
    border-radius: 100px;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    text-decoration: none;
    display: inline-block;
    opacity: 0;
    visibility: hidden;
}

/* ============================================
   Sections (General)
   ============================================ */
section {
    padding: clamp(5rem, 10vw, 8rem) 0;
    position: relative;
}

.section-alt {
    background: var(--light-color);
}

.section-title {
    font-size: clamp(1.5rem, 3.5vw, 2.5rem);
    text-align: center;
    margin-bottom: 2.5rem;
    color: var(--dark-color);
    font-weight: 700;
    position: relative;
}

.section-title::after {
    content: '';
    display: block;
    width: 50px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    border-radius: 2px;
    margin: 1rem auto 0;
}

/* ============================================
   About Section
   ============================================ */
.about-section {
    background: white;
    position: relative;
    z-index: 10;
    margin-top: -2rem;
    padding-top: clamp(5rem, 10vw, 8rem);
    padding-bottom: clamp(5rem, 10vw, 8rem);
}

.about-grid {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 3rem;
    align-items: stretch;
    margin-top: 2rem;
}

.about-text p {
    text-align: left;
    font-size: clamp(1rem, 1.5vw, 1.125rem);
    color: var(--text-light);
    line-height: 1.8;
    margin: 0;
    text-wrap: pretty;
}

.about-image {
    overflow: hidden;
    border-radius: var(--border-radius);
}

.about-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ============================================
   Impact Section
   ============================================ */
.impact-section {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.impact-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.stat-box {
    background: white;
    padding: clamp(2rem, 4vw, 3rem) clamp(1.5rem, 3vw, 2rem);
    border-radius: var(--border-radius);
    text-align: center;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--border-color);
}

.stat-box:hover {
    transform: translateY(-8px);
}

.stat-number {
    font-size: clamp(2.5rem, 5vw, 3.5rem);
    font-weight: 400;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    line-height: 1;
}

.stat-label {
    font-size: 1.1rem;
    color: var(--text-color);
    font-weight: 500;
}

/* ============================================
   Donate Section
   ============================================ */
#donate {
    background: white url('../images/Support%20Our%20Mission%20background.svg') no-repeat center bottom;
    background-size: 20% auto;
    padding-bottom: clamp(8rem, 14vw, 14rem);
}

.donate-split {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    z-index: 1;
    gap: 2rem;
}

.donate-text {
    text-align: left;
    width: 100%;
    text-wrap: pretty;
}

.donate-text .section-title {
    text-align: center;
}

.donate-text .section-title::after {
    margin: 1rem auto 0;
}

.donate-text p {
    font-size: clamp(1rem, 1.5vw, 1.125rem);
    color: var(--text-light);
    line-height: 1.8;
    margin-bottom: 1.25rem;
}

.donate-cta-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: clamp(2rem, 5vw, 4rem);
}

.donate-cta-wrap .btn {
    padding: 1.1rem 2.5rem;
    font-size: 0.9rem;
}

/* ============================================
   Newsletter Section
   ============================================ */
.newsletter-content {
    text-align: left;
    text-wrap: pretty;
}

.newsletter-content .section-title {
    text-align: center;
}

.newsletter-content p {
    font-size: 1.125rem;
    color: var(--text-light);
    margin-bottom: 2rem;
}

.newsletter-form {
    display: flex;
    gap: 1rem;
    max-width: 480px;
    margin: 0 auto;
}

.newsletter-form input[type="email"] {
    flex: 1;
    padding: 0.875rem 1.25rem;
    border: 2px solid var(--border-color);
    border-radius: 100px;
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    min-height: 48px;
}

.newsletter-form input[type="email"]:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: -2px;
    border-color: var(--primary-color);
}

/* ============================================
   Buttons
   ============================================ */
@property --draw {
    syntax: '<percentage>';
    initial-value: 0%;
    inherits: false;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.875rem 2rem;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    border: none;
    border-radius: 100px;
    cursor: pointer;
    text-decoration: none;
    min-height: 48px;
    position: relative;
}

/* Stroke-draw border — draws on hover, draws off on leave */
.btn::before {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: inherit;
    border: 1px solid var(--accent-color);
    --draw: 0%;
    mask: conic-gradient(from 0deg, #000 var(--draw), transparent 0);
    -webkit-mask: conic-gradient(from 0deg, #000 var(--draw), transparent 0);
    transition: --draw 0.5s ease-out;
}

/* White stroke on dark backgrounds */
.site-footer .btn::before,
.dark-bg .btn::before,
#hero-cta::before {
    border-color: white;
}

.btn:hover::before {
    --draw: 100%;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    color: white;
}


/* ============================================
   Footer
   ============================================ */
.site-footer {
    background: var(--dark-color);
    color: white;
    padding: 3rem 0 1rem;
    position: relative;
}

.footer-widgets {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    margin-bottom: 2rem;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.footer-widget h3 {
    color: white;
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    font-weight: 600;
    position: relative;
}

.footer-widget h3::after {
    content: '';
    position: absolute;
    bottom: -0.5rem;
    left: 0;
    width: 40px;
    height: 2px;
    background: var(--accent-color);
}

.footer-widget p {
    color: #ccc;
    line-height: 1.6;
    margin-bottom: 1rem;
    text-align: left;
    font-size: 0.9rem;
}

.footer-widget.contact-info p {
    margin-bottom: 0.4rem;
    line-height: 1.4;
}

.footer-widgets > div:nth-child(2) {
    display: flex;
    justify-content: center;
}

.footer-widgets > div:nth-child(2) .footer-widget {
    text-align: left;
}

.footer-widget a {
    color: #ccc;
    transition: var(--transition);
}

.footer-widget a:hover {
    color: var(--accent-color);
}

.foundation-name-footer {
    color: var(--accent-color);
}

.external-links {
    margin-top: 1rem;
}

.external-links a {
    color: var(--accent-color);
    text-decoration: none;
    transition: var(--transition);
    font-size: 0.9rem;
}

.external-links a:hover {
    color: white;
}

.footer-social {
    margin-top: 1.5rem;
}

.social-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50px;
    color: white;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition);
    background: rgba(255, 255, 255, 0.05);
}

.social-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: rgba(0, 179, 219, 0.08);
    transform: translateY(-2px);
}

.social-btn svg {
    flex-shrink: 0;
}

/* ============================================
   Back to Top
   ============================================ */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    font-size: 24px;
    border: none;
    text-decoration: none;
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background-color: var(--accent-color);
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* ============================================
   Animations
   ============================================ */

.fade-up {
    opacity: 0;
    transform: translateY(20px);
}

.fade-up.visible {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

/* ============================================
   Focus Styles (Accessibility)
   ============================================ */
.btn:focus-visible,
input:focus-visible,
textarea:focus-visible,
a:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* ============================================
   Responsive Design
   Breakpoints:
   - 480px  : small mobile
   - 768px  : tablet / large mobile
   - 1024px : small desktop / landscape tablet
   - 1440px : large desktop
   ============================================ */

/* --- Tablet & below (≤ 1024px) --- */
@media (max-width: 1024px) {
    :root {
        --header-height: 100px;
    }

    section {
        padding: clamp(3rem, 8vw, 5rem) 0;
    }

    .hero {
        height: 100vh;
        height: 100svh;
        min-height: 500px;
        padding: 0 1rem;
    }

    .impact-stats {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 1.5rem;
    }

    .about-grid {
        gap: 2rem;
    }

    .hero-content {
        margin-top: 0;
    }

    .custom-logo {
        width: 200px;
    }

    #donate {
        background-size: 30% auto;
    }
}

/* --- Tablet & large mobile (≤ 768px) --- */
@media (max-width: 768px) {
    :root {
        --header-height: 100px;
    }

    .menu-toggle {
        display: block;
    }

    .main-navigation ul {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: white;
        box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
        flex-direction: column;
        gap: 0;
        padding: 1rem;
    }

    .main-navigation ul.active {
        display: flex;
    }

    .main-navigation li {
        width: 100%;
        text-align: center;
        border-bottom: 1px solid var(--border-color);
    }

    .main-navigation li:last-child {
        border-bottom: none;
    }

    .main-navigation a {
        display: flex;
        padding: 1rem;
        width: 100%;
        min-height: 48px;
        align-items: center;
        justify-content: center;
    }

    .hero {
        height: 100vh;
        height: 100svh;
        min-height: 480px;
    }

    .hero .container {
        padding: 0 1.25rem;
    }

    .hero h1 {
        font-size: clamp(1.3rem, 5vw, 2rem);
    }

    .hero .tagline {
        font-size: clamp(0.85rem, 2.5vw, 1rem);
    }

    .hero-cta-hidden {
        padding: 0.875rem 2rem;
        font-size: 0.8rem;
    }

    .scroll-indicator {
        bottom: 8vh;
    }

    .about-grid {
        grid-template-columns: 1fr;
    }

    .about-image {
        order: -1;
        max-height: 300px;
    }

    .about-image img {
        max-height: 300px;
    }

    .impact-stats {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .stat-box {
        padding: 2rem 1.5rem;
    }

    .donate-text p {
        font-size: 1rem;
    }

    #donate {
        background-size: 45% auto;
    }

    .newsletter-form {
        flex-direction: column;
    }

    .newsletter-form input[type="email"],
    .newsletter-form button {
        width: 100%;
    }

    .footer-widgets {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }

    .footer-widget h3::after {
        left: 50%;
        transform: translateX(-50%);
    }

    .footer-widget p {
        text-align: center;
    }

    .footer-widgets > div:nth-child(2) {
        justify-content: center;
    }

    .footer-widgets > div:nth-child(2) .footer-widget {
        text-align: center;
    }

    .back-to-top {
        bottom: 1rem;
        right: 1rem;
        width: 48px;
        height: 48px;
    }
}

/* --- Small mobile (≤ 480px) --- */
@media (max-width: 480px) {
    :root {
        --header-height: 80px;
        --spacing-unit: 0.875rem;
    }

    .container {
        padding: 0 1rem;
    }

    .custom-logo {
        width: 160px;
    }

    .hero {
        min-height: 420px;
    }

    .hero h1 {
        font-size: clamp(1.2rem, 6vw, 1.5rem);
    }

    .section-title {
        font-size: clamp(1.3rem, 5vw, 1.8rem);
    }

    .stat-box {
        padding: 1.5rem 1rem;
    }

    .stat-number {
        font-size: 2.25rem;
    }

    .btn {
        padding: 0.75rem 1.5rem;
        font-size: 0.8rem;
    }

    #donate {
        background-size: 60% auto;
    }

    .footer-widgets {
        gap: 1.5rem;
    }

    .social-btn {
        width: 100%;
        justify-content: center;
    }
}

/* --- Landscape phones --- */
@media (max-height: 500px) and (orientation: landscape) {
    .hero {
        min-height: 100vh;
        min-height: 100svh;
    }

    .hero-content {
        margin-top: 1rem;
    }

    .scroll-indicator {
        display: none;
    }

    body {
        padding-top: 60px;
    }
}

/* --- Landscape tablets (e.g. iPad landscape ~768-820px height) --- */
@media (min-width: 768px) and (max-height: 820px) and (orientation: landscape) {
    .hero {
        height: calc(100svh - var(--header-height));
        min-height: 400px;
    }

    #hero-lottie {
        transform: scale(0.85) translateY(-10%);
    }

    .scroll-indicator {
        bottom: 3rem;
    }
}

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
    .scroll-chevron {
        animation: none;
    }

    .fade-up {
        opacity: 1;
        transform: none;
    }
}

/* --- Print styles --- */
@media print {
    .site-header,
    .menu-toggle,
    .back-to-top,
    .scroll-indicator,
    #hero-lottie,
    .hero-bg {
        display: none !important;
    }

    body {
        padding-top: 0;
        color: #000;
        background: #fff;
    }

    .hero {
        height: auto;
        min-height: auto;
        background: #fff;
    }

    .hero h1,
    .hero .tagline,
    .hero-cta-hidden {
        opacity: 1 !important;
        visibility: visible !important;
        color: #000 !important;
    }

    .fade-up {
        opacity: 1 !important;
        transform: none !important;
    }

    section {
        padding: 2rem 0;
        break-inside: avoid;
    }

    a[href]::after {
        content: ' (' attr(href) ')';
        font-size: 0.8em;
        color: #666;
    }

    a[href^="#"]::after {
        content: '';
    }
}

/* ============================================
   High Contrast
   ============================================ */
@media (prefers-contrast: high) {
    .btn {
        border: 2px solid currentColor;
    }
}

/* ============================================
   404 Page
   ============================================ */
.error-404-container {
    text-align: center;
    min-height: 40vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.error-404-message {
    font-size: 1.125rem;
    color: var(--text-light);
    margin-bottom: 2rem;
}
