/* 
 * Charity of Mary Godfrey - Stylesheet
 * WCAG 2.2 AA compliant, mobile-first, accessible design
 */

/* CSS Reset & Base Styles */
:root {
    /* Colour palette - high contrast for accessibility */
    --primary: #2c5530;       /* Deep green - traditional, trustworthy */
    --primary-dark: #1e3a23;
    --primary-light: #4a7c59;
    --secondary: #8b4513;     /* Warm brown - comforting, traditional */
    --secondary-light: #a65e29;
    --accent: #d4a76a;        /* Warm gold - highlights */
    --light: #f8f5f0;         /* Warm off-white background */
    --dark: #333333;          /* High contrast text */
    --gray: #6c757d;
    --gray-light: #e9ecef;
    --danger: #dc3545;
    --success: #28a745;
    
    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;
    
    /* Typography */
    --font-primary: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    --font-serif: Georgia, 'Times New Roman', Times, serif;
    --font-size-xs: 0.875rem;
    --font-size-sm: 1rem;
    --font-size-md: 1.125rem;
    --font-size-lg: 1.5rem;
    --font-size-xl: 2rem;
    --font-size-2xl: 2.5rem;
    --line-height: 1.6;
    
    /* Border radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 16px;
    
    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.1);
    
    /* Transitions */
    --transition: all 0.3s ease;
}

/* Base reset */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    scroll-padding-top: 5rem; /* Account for fixed header */
}

body {
    font-family: var(--font-primary);
    line-height: var(--line-height);
    color: var(--dark);
    background-color: var(--light);
    overflow-x: hidden;
}

/* WCAG 2.2 AA: Ensure focus indicators are visible and not obscured */
:focus {
    outline: 3px solid var(--primary);
    outline-offset: 3px;
}

:focus:not(:focus-visible) {
    outline: none;
}

:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 3px;
}

/* Skip link for keyboard users */
.skip-link {
    position: absolute;
    top: -3rem;
    left: 0;
    background: var(--primary);
    color: white;
    padding: var(--space-sm) var(--space-md);
    text-decoration: none;
    z-index: 1000;
    border-radius: 0 0 var(--radius-md) 0;
}

.skip-link:focus {
    top: 0;
    outline: 3px solid var(--accent);
}

/* Typography */
h1, h2, h3, h4 {
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: var(--space-md);
    color: var(--primary-dark);
}

h1 {
    font-size: var(--font-size-2xl);
    color: var(--primary);
}

h2 {
    font-size: var(--font-size-xl);
    position: relative;
    padding-bottom: var(--space-sm);
}

h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 3rem;
    height: 3px;
    background-color: var(--accent);
}

h3 {
    font-size: var(--font-size-lg);
    color: var(--secondary);
}

p {
    margin-bottom: var(--space-md);
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* Buttons - WCAG 2.2 AA: Minimum target size 24px (we use 44px for touch) */
.btn {
    display: inline-block;
    padding: var(--space-md) var(--space-xl);
    font-weight: 600;
    text-align: center;
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    min-height: 44px; /* WCAG 2.5.8 Target Size (Minimum) */
    min-width: 44px;
    font-size: var(--font-size-sm);
}

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

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--primary-dark);
    color: white;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

.btn-secondary:hover,
.btn-secondary:focus {
    background-color: var(--secondary-light);
    color: white;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-outline {
    background-color: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-outline:hover,
.btn-outline:focus {
    background-color: var(--primary);
    color: white;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-large {
    padding: var(--space-lg) var(--space-2xl);
    font-size: var(--font-size-md);
}

/* Container */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

/* Header & Navigation */
.header {
    background-color: white;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: var(--space-md) 0;
}

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

/* Logo */
.logo {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    text-decoration: none;
}

.logo:hover .logo-title {
    color: var(--primary-dark);
}

.logo:hover .logo-tagline {
    color: var(--gray);
}

.logo-icon {
    font-size: 2.5rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border-radius: 50%;
    flex-shrink: 0;
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-title {
    font-size: var(--font-size-lg);
    margin: 0;
    color: var(--primary);
    line-height: 1.2;
    transition: var(--transition);
}

.logo-tagline {
    font-size: var(--font-size-xs);
    color: var(--gray);
    font-weight: 400;
    line-height: 1.2;
    transition: var(--transition);
}

/* Hamburger menu */
.nav-toggle {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    width: 2rem;
    height: 2rem;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 10;
}

.hamburger {
    width: 2rem;
    height: 3px;
    background: var(--primary);
    border-radius: var(--radius-sm);
    position: relative;
    transition: var(--transition);
}

.nav-toggle[aria-expanded="true"] .hamburger {
    background: transparent;
}

.nav-toggle[aria-expanded="true"] .hamburger::before {
    transform: rotate(45deg);
    top: 0;
}

.nav-toggle[aria-expanded="true"] .hamburger::after {
    transform: rotate(-45deg);
    bottom: 0;
}

.hamburger::before,
.hamburger::after {
    content: '';
    position: absolute;
    width: 2rem;
    height: 3px;
    background: var(--primary);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.hamburger::before {
    top: -8px;
}

.hamburger::after {
    bottom: -8px;
}

/* Navigation */
.nav {
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    max-width: 300px;
    height: 100vh;
    background-color: white;
    box-shadow: var(--shadow-lg);
    padding: var(--space-xl) var(--space-lg);
    transition: var(--transition);
    z-index: 5;
    overflow-y: auto;
}

.nav[data-visible="true"] {
    right: 0;
}

/* Mobile menu overlay */
.nav-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 4;
}

.nav[data-visible="true"] + .nav-overlay {
    display: block;
}

.nav-list {
    list-style: none;
}

.nav-list li {
    margin-bottom: var(--space-lg);
}

.nav-link {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--dark);
    padding: var(--space-sm) 0;
    display: block;
    position: relative;
    transition: var(--transition);
    word-break: break-word;
}

.nav-link:hover,
.nav-link:focus {
    color: var(--primary);
    text-decoration: none;
}

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

.nav-link:hover::after,
.nav-link:focus::after {
    width: 100%;
}

/* Hero Section */
.hero {
    padding: var(--space-2xl) 0;
    background: linear-gradient(135deg, var(--light) 0%, #e8e2d6 100%);
}

.hero-content {
    display: flex;
    flex-direction: column;
    gap: var(--space-2xl);
}

.hero-title {
    font-size: var(--font-size-2xl);
    margin-bottom: var(--space-lg);
}

.hero-title::after {
    display: none;
}

.hero-description {
    font-size: var(--font-size-md);
    margin-bottom: var(--space-xl);
}

.hero-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.hero-image img {
    width: 100%;
    height: auto;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

/* Sections */
.section {
    padding: var(--space-2xl) 0;
}

.section-title {
    text-align: center;
    margin-bottom: var(--space-xl);
}

.section-title::after {
    left: 50%;
    transform: translateX(-50%);
}

/* About Section */
.about-content {
    display: flex;
    flex-direction: column;
    gap: var(--space-2xl);
}

.about-text p {
    font-size: var(--font-size-md);
}

.about-image img {
    width: 100%;
    height: auto;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

/* Who We Help Section */
.help-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.help-card {
    background: white;
    padding: var(--space-lg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    text-align: center;
    transition: var(--transition);
}

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

.help-icon {
    font-size: 3rem;
    margin-bottom: var(--space-md);
}

.help-note {
    background-color: var(--gray-light);
    padding: var(--space-lg);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--accent);
}

/* Grants Section */
.grants-content {
    display: flex;
    flex-direction: column;
    gap: var(--space-2xl);
}

.grants-text h3 {
    margin-top: var(--space-lg);
    margin-bottom: var(--space-md);
}

.grants-text ul,
.grants-text ol {
    margin-left: var(--space-lg);
    margin-bottom: var(--space-lg);
}

.grants-text li {
    margin-bottom: var(--space-sm);
}

.cta-box {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
    color: white;
    padding: var(--space-xl);
    border-radius: var(--radius-lg);
    margin-top: var(--space-xl);
    text-align: center;
}

.cta-box a {
    background-color: white;
    color: var(--primary);
    margin-top: var(--space-md);
}

.cta-box a:hover,
.cta-box a:focus {
    background-color: var(--light);
    color: var(--primary-dark);
}

.grants-image img {
    width: 100%;
    height: auto;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

/* Support Section */
.support-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-lg);
    margin: var(--space-xl) 0;
}

.support-card {
    background: white;
    padding: var(--space-lg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

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

.support-note {
    background-color: var(--gray-light);
    padding: var(--space-lg);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--secondary);
}

/* Governance Section */
.governance-content {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.governance-content a {
    font-weight: 600;
}

/* Contact Section */
.contact-content {
    display: flex;
    flex-direction: column;
    gap: var(--space-2xl);
}

.contact-info address {
    font-style: normal;
    margin-bottom: var(--space-lg);
}

.contact-info a {
    font-weight: 600;
}

.contact-image img {
    width: 100%;
    height: auto;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

/* Footer */
.footer {
    background-color: var(--primary-dark);
    color: white;
    padding: var(--space-2xl) 0;
}

.footer-content {
    display: flex;
    flex-direction: column;
    gap: var(--space-xl);
}

.footer-tagline {
    font-size: var(--font-size-lg);
    font-weight: 600;
    margin-bottom: var(--space-sm);
}

.footer-disclaimer {
    font-size: var(--font-size-sm);
    opacity: 0.8;
}

.footer-links h3 {
    color: white;
    margin-bottom: var(--space-md);
}

.footer-links ul {
    list-style: none;
}

.footer-links li {
    margin-bottom: var(--space-sm);
}

.footer-links a {
    color: var(--gray-light);
}

.footer-links a:hover,
.footer-links a:focus {
    color: white;
    text-decoration: underline;
}

.footer-credit a {
    color: var(--accent);
    font-weight: 600;
}

.footer-charity {
    font-size: var(--font-size-sm);
    opacity: 0.8;
    margin-top: var(--space-sm);
}

/* Very small screens (phones in portrait) */
@media (max-width: 374px) {
    .nav {
        width: 90%;
        max-width: 280px;
        padding: var(--space-lg) var(--space-md);
    }
    
    .nav-link {
        font-size: var(--font-size-md);
        line-height: 1.4;
        text-align: center;
    }
    
    .nav-list li {
        margin-bottom: var(--space-md);
    }
}

/* Small screens (phones in landscape and larger phones) */
@media (min-width: 375px) and (max-width: 767px) {
    .nav {
        width: 85%;
        max-width: 320px;
        padding: var(--space-xl) var(--space-lg);
    }
    
    .nav-link {
        font-size: var(--font-size-md);
        font-weight: 600;
        line-height: 1.5;
        padding: var(--space-sm) 0;
        text-align: center;
    }
    
    .nav-list li {
        margin-bottom: var(--space-lg);
    }
    
    .nav-link::after {
        left: 25%;
        width: 50%;
        transition: width 0.3s ease;
    }
    
    .nav-link:hover::after,
    .nav-link:focus::after {
        width: 100%;
        left: 0;
    }
}

/* Extra-small mobile tweaks */
@media (max-width: 600px) {
    .hero-buttons {
        flex-direction: column;
        align-items: stretch;
    }

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

/* Responsive Design for tablets and up */
@media (min-width: 768px) {
    :root {
        --font-size-lg: 1.75rem;
        --font-size-xl: 2.5rem;
        --font-size-2xl: 3rem;
    }
    
    .nav-toggle {
        display: none;
    }
    
    .nav {
        position: static;
        width: auto;
        height: auto;
        background: transparent;
        box-shadow: none;
        padding: 0;
        overflow-y: visible;
    }
    
    .nav[data-visible="true"] {
        right: auto;
    }
    
    .nav-overlay {
        display: none !important;
    }
    
    .nav-list {
        display: flex;
        gap: var(--space-lg);
        align-items: center;
    }
    
    .nav-list li {
        margin-bottom: 0;
    }
    
    .nav-link {
        font-size: var(--font-size-sm);
        padding: var(--space-sm) var(--space-md);
        white-space: nowrap;
    }
    
    .nav-link::after {
        bottom: -4px;
    }
    
    .logo-icon {
        font-size: 2.5rem;
        width: 3rem;
        height: 3rem;
    }
    
    .logo-title {
        font-size: var(--font-size-lg);
    }
    
    .logo-tagline {
        font-size: var(--font-size-sm);
    }
    
    .hero-content {
        flex-direction: row;
        align-items: center;
    }
    
    .hero-text {
        flex: 1;
    }
    
    .hero-image {
        flex: 1;
    }
    
    .hero-title {
        font-size: var(--font-size-2xl);
    }
    
    .about-content {
        flex-direction: row;
        align-items: center;
    }
    
    .about-text {
        flex: 1;
    }
    
    .about-image {
        flex: 1;
    }
    
    .help-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .grants-content {
        flex-direction: row;
        align-items: flex-start;
    }
    
    .grants-text {
        flex: 1;
    }
    
    .grants-image {
        flex: 1;
    }
    
    .support-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .contact-content {
        flex-direction: row;
        align-items: flex-start;
    }
    
    .contact-info {
        flex: 1;
    }
    
    .contact-image {
        flex: 1;
    }
    
    .footer-content {
        flex-direction: row;
        justify-content: space-between;
    }
    
    .footer-summary {
        flex: 2;
    }
    
    .footer-links {
        flex: 1;
    }
    
    .footer-credit {
        flex: 1;
    }
}

/* Medium desktop screens (768px-1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
    .header-content {
        flex-wrap: nowrap;
        min-width: 100%;
    }
    
    .logo {
        min-width: 200px;
        flex-shrink: 1;
    }
    
    .nav {
        min-width: 0;
        flex-shrink: 1;
    }
    
    .nav-list {
        gap: var(--space-lg);
    }
    
    .nav-link {
        font-size: var(--font-size-sm);
        padding: var(--space-sm) var(--space-md);
    }
}

@media (min-width: 1024px) {
    :root {
        --font-size-2xl: 3.5rem;
    }
    
    .container {
        padding: 0 var(--space-xl);
    }
    
    .hero {
        padding: var(--space-3xl) 0;
    }
    
    .section {
        padding: var(--space-3xl) 0;
    }

    .help-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .support-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Print styles */
@media print {
    .header,
    .nav-toggle,
    .footer {
        display: none;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.5;
        color: black;
        background: white;
    }
    
    a {
        color: black;
        text-decoration: underline;
    }
    
    .container {
        max-width: 100%;
        padding: 0;
    }
    
    .hero,
    .section {
        padding: 1cm 0;
    }
    
    .btn {
        display: none;
    }
    
    .hero-image img,
    .about-image img,
    .grants-image img,
    .contact-image img {
        display: none;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    html {
        scroll-behavior: auto;
    }
}
