/* ============================================
   Olive Branch Pregnancy Center — Stylesheet
   Classic & Elegant | Navy + Warm Gold
   ============================================ */

/* ---------- CSS Custom Properties ---------- */
:root {
    --navy-950: #0a1628;
    --navy-900: #0f2136;
    --navy-800: #1B3A5C;
    --navy-700: #244d76;
    --navy-600: #2d5f8e;
    --navy-500: #3a7ab5;
    --gold-500: #C8A961;
    --gold-400: #d4b878;
    --gold-300: #e0c994;
    --gold-200: #e8d8b4;
    --gold-100: #f2e8d0;
    --cream-50: #faf8f5;
    --cream-100: #f5f0e8;
    --cream-200: #efe5d8;
    --stone-50: #f9f8f6;
    --stone-100: #f2f0ed;
    --stone-200: #e8e4df;
    --stone-300: #d4cfc8;
    --stone-400: #a8a096;
    --stone-500: #7a7168;
    --stone-600: #5c554e;
    --stone-700: #3d3832;
    --stone-800: #2a2622;
    --white: #ffffff;
    --font-serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
    --font-sans: 'Lato', 'Segoe UI', system-ui, sans-serif;
    --shadow-sm: 0 1px 3px rgba(10, 22, 40, 0.08);
    --shadow-md: 0 4px 16px rgba(10, 22, 40, 0.10);
    --shadow-lg: 0 8px 32px rgba(10, 22, 40, 0.12);
    --shadow-xl: 0 16px 48px rgba(10, 22, 40, 0.14);
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.7;
    color: var(--stone-700);
    background-color: var(--cream-50);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

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

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

a:hover {
    color: var(--gold-500);
}

ul {
    list-style: none;
}

/* ---------- Typography ---------- */
h1, h2, h3, h4 {
    font-family: var(--font-serif);
    font-weight: 500;
    line-height: 1.2;
    color: var(--navy-900);
}

/* ---------- Container ---------- */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ---------- Section Label ---------- */
.section-label {
    display: inline-block;
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--gold-500);
    margin-bottom: 12px;
}

.section-title {
    font-size: clamp(2rem, 4vw, 3rem);
    margin-bottom: 20px;
}

.section-subtitle {
    font-size: 1.1rem;
    color: var(--stone-500);
    max-width: 600px;
    line-height: 1.8;
}

/* ---------- Gold Text ---------- */
.gold-text {
    color: var(--gold-500);
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    padding: 14px 32px;
    border-radius: var(--radius-sm);
    border: 2px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: var(--gold-500);
    color: var(--navy-950);
    border-color: var(--gold-500);
}

.btn-primary:hover {
    background: var(--gold-400);
    border-color: var(--gold-400);
    color: var(--navy-950);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: transparent;
    color: var(--white);
    border-color: rgba(255, 255, 255, 0.5);
}

.btn-secondary:hover {
    background: var(--white);
    color: var(--navy-900);
    border-color: var(--white);
}

.btn-outline-light {
    background: transparent;
    color: var(--white);
    border-color: rgba(255, 255, 255, 0.6);
}

.btn-outline-light:hover {
    background: var(--white);
    color: var(--navy-900);
    border-color: var(--white);
}

.btn-full {
    width: 100%;
}

.btn-lg {
    padding: 16px 40px;
    font-size: 1rem;
}

/* ---------- Navigation ---------- */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(15, 33, 54, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(200, 169, 97, 0.15);
    transition: background var(--transition), box-shadow var(--transition);
}

.nav.scrolled {
    background: rgba(10, 22, 40, 0.98);
    box-shadow: var(--shadow-lg);
}

.nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 72px;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-serif);
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--white);
    text-decoration: none;
}

.nav-logo:hover {
    color: var(--gold-400);
}

.nav-logo-icon {
    color: var(--gold-500);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 32px;
}

.nav-links a {
    font-size: 0.9rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.8);
    letter-spacing: 0.02em;
    position: relative;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--gold-500);
    transition: width var(--transition);
}

.nav-links a:hover {
    color: var(--gold-400);
}

.nav-links a:hover::after {
    width: 100%;
}

.nav-cta {
    background: var(--gold-500) !important;
    color: var(--navy-950) !important;
    padding: 10px 24px;
    border-radius: var(--radius-sm) !important;
    font-weight: 600 !important;
}

.nav-cta::after {
    display: none !important;
}

.nav-cta:hover {
    background: var(--gold-400) !important;
    color: var(--navy-950) !important;
    transform: translateY(-1px);
}

/* Mobile Nav Toggle */
.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.nav-toggle-line {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--white);
    border-radius: 2px;
    transition: all var(--transition);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-line:nth-child(2) {
    opacity: 0;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-line:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* ---------- Hero ---------- */
.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    overflow: hidden;
    background: var(--navy-950);
}

.hero-bg {
    position: absolute;
    inset: 0;
    background: url('https://images.pexels.com/photos/29110703/pexels-photo-29110703.jpeg?auto=compress&cs=tinysrgb&fit=crop&w=1920&h=1080') center center / cover no-repeat;
    transform: scale(1.02);
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        rgba(10, 22, 40, 0.88) 0%,
        rgba(27, 58, 92, 0.82) 50%,
        rgba(10, 22, 40, 0.90) 100%
    );
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 820px;
    padding: 120px 24px 80px;
}

.hero-badge {
    display: inline-block;
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--gold-500);
    background: rgba(200, 169, 97, 0.12);
    border: 1px solid rgba(200, 169, 97, 0.3);
    padding: 8px 20px;
    border-radius: 50px;
    margin-bottom: 32px;
}

.hero-title {
    font-size: clamp(2.4rem, 5.5vw, 4.2rem);
    font-weight: 500;
    color: var(--white);
    line-height: 1.15;
    margin-bottom: 24px;
}

.hero-title .gold-text {
    color: var(--gold-400);
    font-style: italic;
}

.hero-subtitle {
    font-size: clamp(1rem, 1.8vw, 1.2rem);
    color: rgba(255, 255, 255, 0.78);
    line-height: 1.8;
    max-width: 620px;
    margin: 0 auto 40px;
}

.hero-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 48px;
}

.hero-trust {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
}

.hero-trust span {
    font-size: 0.85rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 0.04em;
}

.hero-trust span::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background: var(--gold-500);
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: middle;
}

.hero-scroll {
    position: absolute;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    color: rgba(255, 255, 255, 0.5);
    transition: color var(--transition);
    animation: scrollBounce 2s infinite;
}

.hero-scroll:hover {
    color: var(--gold-500);
}

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

/* ---------- Services ---------- */
.services {
    padding: 100px 0;
    background: var(--cream-50);
}

.services .section-header {
    text-align: center;
    margin-bottom: 64px;
}

.services .section-subtitle {
    margin: 0 auto;
}

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

.service-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 40px 32px;
    border: 1px solid var(--stone-200);
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.service-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gold-500);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--transition);
}

.service-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--gold-200);
}

.service-card:hover::before {
    transform: scaleX(1);
}

.service-icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(27, 58, 92, 0.06);
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    color: var(--navy-800);
    transition: all var(--transition);
}

.service-card:hover .service-icon {
    background: var(--navy-800);
    color: var(--gold-500);
}

.service-title {
    font-size: 1.25rem;
    margin-bottom: 12px;
    color: var(--navy-900);
}

.service-desc {
    font-size: 0.95rem;
    color: var(--stone-500);
    line-height: 1.75;
}

/* ---------- About ---------- */
.about {
    padding: 100px 0;
    background: var(--white);
}

.about-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 64px;
    align-items: center;
}

.about-image {
    position: relative;
}

.about-image img {
    border-radius: var(--radius-xl);
    width: 100%;
    height: 500px;
    object-fit: cover;
    box-shadow: var(--shadow-lg);
}

.about-image-accent {
    position: absolute;
    bottom: -20px;
    right: -20px;
    width: 200px;
    height: 200px;
    background: var(--gold-100);
    border-radius: var(--radius-xl);
    z-index: -1;
}

.about-content {
    padding: 16px 0;
}

.about-text {
    font-size: 1.05rem;
    color: var(--stone-600);
    line-height: 1.85;
    margin-bottom: 20px;
}

.about-stats {
    display: flex;
    gap: 40px;
    margin-top: 40px;
    padding-top: 40px;
    border-top: 1px solid var(--stone-200);
}

.stat {
    text-align: center;
}

.stat-number {
    display: block;
    font-family: var(--font-serif);
    font-size: 2.5rem;
    font-weight: 600;
    color: var(--navy-800);
    line-height: 1;
    margin-bottom: 8px;
}

.stat-label {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--stone-500);
}

/* ---------- Why Us ---------- */
.why-us {
    padding: 100px 0;
    background: var(--navy-900);
    position: relative;
    overflow: hidden;
}

.why-us::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(200, 169, 97, 0.06) 0%, transparent 70%);
    pointer-events: none;
}

.why-us .section-header {
    text-align: center;
    margin-bottom: 64px;
    position: relative;
    z-index: 1;
}

.why-us .section-title {
    color: var(--white);
}

.why-us .section-label {
    color: var(--gold-400);
}

.why-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
    position: relative;
    z-index: 1;
}

.why-item {
    padding: 32px;
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all var(--transition);
}

.why-item:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(200, 169, 97, 0.3);
    transform: translateY(-4px);
}

.why-number {
    font-family: var(--font-serif);
    font-size: 2.5rem;
    font-weight: 600;
    color: var(--gold-500);
    opacity: 0.4;
    line-height: 1;
    margin-bottom: 16px;
}

.why-title {
    font-size: 1.15rem;
    color: var(--white);
    margin-bottom: 12px;
}

.why-desc {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.75;
}

/* ---------- CTA Banner ---------- */
.cta-banner {
    position: relative;
    padding: 100px 0;
    overflow: hidden;
}

.cta-bg {
    position: absolute;
    inset: 0;
    background: url('https://images.pexels.com/photos/32236830/pexels-photo-32236830.jpeg?auto=compress&cs=tinysrgb&fit=crop&w=1920&h=600') center center / cover no-repeat;
}

.cta-banner::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(10, 22, 40, 0.92) 0%, rgba(27, 58, 92, 0.88) 100%);
}

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

.cta-title {
    font-size: clamp(2rem, 4vw, 2.8rem);
    color: var(--white);
    margin-bottom: 20px;
}

.cta-text {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.75);
    line-height: 1.8;
    margin-bottom: 40px;
}

.cta-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

/* ---------- Contact ---------- */
.contact {
    padding: 100px 0;
    background: var(--cream-50);
}

.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 64px;
    align-items: start;
}

.contact-info {
    padding: 16px 0;
}

.contact-text {
    font-size: 1.05rem;
    color: var(--stone-500);
    line-height: 1.8;
    margin-bottom: 40px;
}

.contact-details {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.contact-detail {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.contact-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--navy-800);
    border-radius: var(--radius-md);
    color: var(--gold-500);
    flex-shrink: 0;
}

.contact-detail strong {
    display: block;
    font-family: var(--font-serif);
    font-size: 1rem;
    color: var(--navy-900);
    margin-bottom: 4px;
}

.contact-detail p {
    font-size: 0.9rem;
    color: var(--stone-500);
    line-height: 1.6;
}

.contact-detail a {
    color: var(--navy-700);
}

.contact-detail a:hover {
    color: var(--gold-500);
}

/* Contact Form */
.contact-form-wrap {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: 48px;
    border: 1px solid var(--stone-200);
    box-shadow: var(--shadow-md);
}

.form-title {
    font-size: 1.5rem;
    margin-bottom: 8px;
    color: var(--navy-900);
}

.form-subtitle {
    font-size: 0.9rem;
    color: var(--stone-500);
    margin-bottom: 32px;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--stone-700);
    margin-bottom: 8px;
    letter-spacing: 0.02em;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 14px 16px;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    color: var(--stone-800);
    background: var(--stone-50);
    border: 1px solid var(--stone-200);
    border-radius: var(--radius-md);
    transition: all var(--transition);
    outline: none;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--gold-500);
    background: var(--white);
    box-shadow: 0 0 0 3px rgba(200, 169, 97, 0.15);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--stone-400);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.form-success {
    display: none;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: rgba(200, 169, 97, 0.1);
    border: 1px solid rgba(200, 169, 97, 0.3);
    border-radius: var(--radius-md);
    margin-top: 20px;
}

.form-success svg {
    color: var(--gold-500);
    flex-shrink: 0;
}

.form-success p {
    font-size: 0.9rem;
    color: var(--stone-700);
}

/* ---------- Map ---------- */
.map-section {
    background: var(--stone-200);
}

.map-container {
    width: 100%;
    height: 400px;
    filter: saturate(0.7) contrast(1.05);
}

/* ---------- Footer ---------- */
.footer {
    background: var(--navy-950);
    padding: 64px 0 0;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1.5fr;
    gap: 48px;
    padding-bottom: 48px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-serif);
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--white);
    margin-bottom: 16px;
}

.footer-logo:hover {
    color: var(--gold-400);
}

.footer-logo-icon {
    color: var(--gold-500);
}

.footer-tagline {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1.7;
    max-width: 300px;
}

.footer-heading {
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--gold-500);
    margin-bottom: 20px;
}

.footer-nav ul,
.footer-contact ul {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.footer-nav a,
.footer-contact a {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.55);
}

.footer-nav a:hover,
.footer-contact a:hover {
    color: var(--gold-400);
}

.footer-contact p {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.55);
    line-height: 1.6;
}

.footer-bottom {
    padding: 24px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

.footer-bottom p {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.35);
}

.footer-disclaimer {
    font-size: 0.8rem !important;
    color: rgba(255, 255, 255, 0.3) !important;
    max-width: 500px;
    text-align: right;
}

/* ---------- Reveal Animations ---------- */
.reveal {
    opacity: 1;
    transform: none;
    transition: opacity 0.6s ease, transform 0.6s ease;
}

@media (prefers-reduced-motion: no-preference) {
    .reveal {
        opacity: 0;
        transform: translateY(24px);
    }
    
    .reveal.revealed {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .why-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .footer-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 768px) {
    .nav-links {
        position: fixed;
        top: 72px;
        left: 0;
        right: 0;
        background: rgba(10, 22, 40, 0.98);
        flex-direction: column;
        padding: 32px 24px;
        gap: 24px;
        transform: translateY(-100%);
        opacity: 0;
        pointer-events: none;
        transition: all var(--transition);
        border-bottom: 1px solid rgba(200, 169, 97, 0.15);
    }
    
    .nav-links.open {
        transform: translateY(0);
        opacity: 1;
        pointer-events: all;
    }
    
    .nav-toggle {
        display: flex;
    }
    
    .hero-content {
        padding: 100px 20px 60px;
    }
    
    .hero-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .hero-actions .btn {
        width: 100%;
    }
    
    .hero-trust {
        flex-direction: column;
        gap: 12px;
    }
    
    .services-grid {
        grid-template-columns: 1fr;
    }
    
    .about-grid {
        grid-template-columns: 1fr;
        gap: 40px;
    }
    
    .about-image img {
        height: 350px;
    }
    
    .about-image-accent {
        display: none;
    }
    
    .about-stats {
        gap: 24px;
    }
    
    .why-grid {
        grid-template-columns: 1fr;
    }
    
    .contact-grid {
        grid-template-columns: 1fr;
        gap: 40px;
    }
    
    .contact-form-wrap {
        padding: 32px 24px;
    }
    
    .cta-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .cta-actions .btn {
        width: 100%;
    }
    
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 32px;
    }
    
    .footer-bottom {
        flex-direction: column;
        text-align: center;
    }
    
    .footer-disclaimer {
        text-align: center !important;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 16px;
    }
    
    .services,
    .about,
    .why-us,
    .contact {
        padding: 72px 0;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .service-card {
        padding: 28px 24px;
    }
}
</style>
<sm-file path="script.js">
/* ============================================
   Olive Branch Pregnancy Center — Script
   ============================================ */

(function () {
    'use strict';

    // ---- Mobile Navigation Toggle ----
    const navToggle = document.getElementById('navToggle');
    const navLinks = document.getElementById('navLinks');

    if (navToggle && navLinks) {
        navToggle.addEventListener('click', function () {
            const expanded = navToggle.getAttribute('aria-expanded') === 'true';
            navToggle.setAttribute('aria-expanded', !expanded);
            navLinks.classList.toggle('open');
        });

        // Close mobile menu when a link is clicked
        navLinks.querySelectorAll('a').forEach(function (link) {
            link.addEventListener('click', function () {
                navToggle.setAttribute('aria-expanded', 'false');
                navLinks.classList.remove('open');
            });
        });
    }

    // ---- Navbar scroll effect ----
    const nav = document.getElementById('nav');
    let lastScroll = 0;

    function handleScroll() {
        const currentScroll = window.pageYOffset;
        if (currentScroll > 50) {
            nav.classList.add('scrolled');
        } else {
            nav.classList.remove('scrolled');
        }
        lastScroll = currentScroll;
    }

    window.addEventListener('scroll', handleScroll, { passive: true });

    // ---- Scroll Reveal (progressive enhancement) ----
    const prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;

    if (!prefersReducedMotion && 'IntersectionObserver' in window) {
        const revealElements = document.querySelectorAll('.reveal');

        const revealObserver = new IntersectionObserver(function (entries) {
            entries.forEach(function (entry) {
                if (entry.isIntersecting) {
                    entry.target.classList.add('revealed');
                    revealObserver.unobserve(entry.target);
                }
            });
        }, {
            threshold: 0.1,
            rootMargin: '0px 0px -40px 0px'
        });

        revealElements.forEach(function (el) {
            revealObserver.observe(el);
        });
    } else {
        // If JS is disabled or reduced motion is preferred, ensure all elements are visible
        document.querySelectorAll('.reveal').forEach(function (el) {
            el.classList.add('revealed');
        });
    }

    // ---- Contact Form ----
    const contactForm = document.getElementById('contactForm');
    const formSuccess = document.getElementById('formSuccess');

    if (contactForm && formSuccess) {
        contactForm.addEventListener('submit', function (e) {
            e.preventDefault();

            // Simulate form submission
            const submitBtn = contactForm.querySelector('button[type="submit"]');
            const originalText = submitBtn.textContent;
            submitBtn.textContent = 'Sending...';
            submitBtn.disabled = true;

            setTimeout(function () {
                contactForm.style.display = 'none';
                formSuccess.style.display = 'flex';
            }, 800);
        });
    }

    // ---- Smooth scroll for anchor links ----
    document.querySelectorAll('a[href^="#"]').forEach(function (anchor) {
        anchor.addEventListener('click', function (e) {
            const targetId = this.getAttribute('href');
            if (targetId === '#') return;

            const target = document.querySelector(targetId);
            if (target) {
                e.preventDefault();
                const navHeight = nav ? nav.offsetHeight : 0;
                const targetPosition = target.getBoundingClientRect().top + window.pageYOffset - navHeight - 20;

                window.scrollTo({
                    top: targetPosition,
                    behavior: 'smooth'
                });
            }
        });
    });
})();
