:root {
    --ocean-blue: #4A90E2;
    --teal: #5FB3B3;
    --light-teal: #7FD8D8;
    --white: #FFFFFF;
    --glass-bg: rgba(0, 0, 0, 0.3);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-primary: #FFFFFF;
    --text-secondary: #E0E0E0;
    --bg-dark: #0A0E27;
    --bg-darker: #050710;
    --hero-content-bg: rgba(0, 0, 0, 0.4);
    --hero-content-border: rgba(255, 255, 255, 0.1);
    --hero-content-shadow: rgba(0, 0, 0, 0.5);
    --glass-card-hover-bg: rgba(0, 0, 0, 0.4);
    --glass-card-hover-border: rgba(255, 255, 255, 0.2);
    --glass-card-hover-shadow: rgba(0, 0, 0, 0.7);
    --founder-card-bg-start: rgba(74, 144, 226, 0.15);
    --founder-card-bg-mid: rgba(95, 179, 179, 0.1);
    --founder-card-bg-end: rgba(127, 216, 216, 0.15);
    --founder-card-border: rgba(255, 255, 255, 0.18);
    --founder-card-shadow: rgba(0, 0, 0, 0.4);
    --founder-card-hover-bg-start: rgba(74, 144, 226, 0.25);
    --founder-card-hover-bg-mid: rgba(95, 179, 179, 0.15);
    --founder-card-hover-bg-end: rgba(127, 216, 216, 0.25);
    --founder-card-hover-border: rgba(255, 255, 255, 0.3);
    --founder-card-hover-shadow: rgba(74, 144, 226, 0.2);
    --founder-image-wrapper-bg-start: rgba(74, 144, 226, 0.3);
    --founder-image-wrapper-bg-end: rgba(95, 179, 179, 0.25);
    --founder-image-wrapper-shadow: rgba(0, 0, 0, 0.4);
    --founder-image-wrapper-hover-shadow: rgba(74, 144, 226, 0.4);
    --text-shadow: rgba(0, 0, 0, 0.3);
    --button-shadow: rgba(74, 144, 226, 0.5);
    --button-hover-shadow: rgba(74, 144, 226, 0.7);
}

@media (prefers-color-scheme: light) {
    :root {
        --ocean-blue: #2E7BD6;
        --teal: #4A9B9B;
        --light-teal: #5FC4C4;
        --white: #FFFFFF;
        --glass-bg: rgba(255, 255, 255, 0.4);
        --glass-border: rgba(0, 0, 0, 0.1);
        --text-primary: #1A1A1A;
        --text-secondary: #4A4A4A;
        --bg-dark: #F5F7FA;
        --bg-darker: #E8ECF1;
        --hero-content-bg: rgba(255, 255, 255, 0.5);
        --hero-content-border: rgba(0, 0, 0, 0.1);
        --hero-content-shadow: rgba(0, 0, 0, 0.15);
        --glass-card-hover-bg: rgba(255, 255, 255, 0.5);
        --glass-card-hover-border: rgba(0, 0, 0, 0.15);
        --glass-card-hover-shadow: rgba(0, 0, 0, 0.2);
        --founder-card-bg-start: rgba(74, 144, 226, 0.08);
        --founder-card-bg-mid: rgba(95, 179, 179, 0.06);
        --founder-card-bg-end: rgba(127, 216, 216, 0.08);
        --founder-card-border: rgba(0, 0, 0, 0.12);
        --founder-card-shadow: rgba(0, 0, 0, 0.1);
        --founder-card-hover-bg-start: rgba(74, 144, 226, 0.15);
        --founder-card-hover-bg-mid: rgba(95, 179, 179, 0.1);
        --founder-card-hover-bg-end: rgba(127, 216, 216, 0.15);
        --founder-card-hover-border: rgba(0, 0, 0, 0.2);
        --founder-card-hover-shadow: rgba(74, 144, 226, 0.15);
        --founder-image-wrapper-bg-start: rgba(74, 144, 226, 0.2);
        --founder-image-wrapper-bg-end: rgba(95, 179, 179, 0.15);
        --founder-image-wrapper-shadow: rgba(0, 0, 0, 0.15);
        --founder-image-wrapper-hover-shadow: rgba(74, 144, 226, 0.25);
        --text-shadow: rgba(255, 255, 255, 0.5);
        --button-shadow: rgba(74, 144, 226, 0.4);
        --button-hover-shadow: rgba(74, 144, 226, 0.6);
    }

    .service .icon {
        filter: brightness(1.2) invert(1) !important;
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
    width: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 16px; /* Base font size for better mobile readability */
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
    width: 100%;
    max-width: 100%;
    background: linear-gradient(180deg, var(--bg-dark) 0%, var(--bg-darker) 100%);
    background-attachment: fixed;
}

h1 {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    font-weight: 400; /* Increased from 300 for better legibility */
    letter-spacing: 0.05em;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.2; /* Tighter line height for headers */
}

main {
    position: relative;
    z-index: 5;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem 4rem 2rem; /* Reduced top padding to allow overlap */
    width: 100%;
    box-sizing: border-box;
}

section {
    margin: 6rem 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

#services {
    position: relative;
    z-index: 2;
    margin-top: -40vh; /* Increased negative margin to show more cards on first screen */
    margin-bottom: 4rem; /* Maintain spacing below */
}

#hero {
    position: relative;
    width: 100vw;
    height: 100vh;
    text-align: center;
    padding: clamp(8rem, 12vh, 10rem) 2rem 6rem 2rem; /*Responsive top padding accounting for header, reduced to show more content */
    display: flex;
    align-items: flex-start; /* Changed from center to flex-start to position content higher */
    justify-content: center;
    overflow: hidden;
    border-radius: 0;
    margin: 0;
    z-index: 1;
    left: 0;
    right: 0;
    box-sizing: border-box;
}

#wave-canvas {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
    display: block;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.hero-content {
    position: relative;
    z-index: 10; /* Above service cards to maintain visual hierarchy */
    max-width: 800px;
    margin: clamp(2rem, 4vh, 3rem) auto 0 auto; /* Top margin for spacing from header */
    padding: 3rem 2.5rem;
    background: var(--hero-content-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--hero-content-border);
    border-radius: 20px;
    box-shadow: 0 8px 32px var(--hero-content-shadow);
}

#hero h2 {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    font-weight: 500; /* Increased from 400 for better legibility on dark background */
    line-height: 1.3; /* Improved from 1.4 for better readability */
    color: var(--text-primary);
    margin: 0 auto;
    text-shadow: 0 2px 10px var(--text-shadow), 0 4px 20px var(--text-shadow);
    letter-spacing: 0.02em;
}

.divider {
    width: 100%;
    height: 1px;
    background: var(--text-secondary);
    margin: 1rem 0;
}

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 3rem;
    box-shadow: 0 8px 32px var(--hero-content-shadow);
    transition: all 0.3s ease;
}

.glass-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px var(--glass-card-hover-shadow);
    border-color: var(--glass-card-hover-border);
    background: var(--glass-card-hover-bg);
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-top: 1rem; /* Reduced top margin since we're overlapping more */
}

.service {
    text-align: center;
}

.service .icon {
    width: 4rem;
    height: 4rem;
    margin-bottom: 1.5rem;
    opacity: 0.9;
    filter: brightness(1.2);
}

.service h3 {
    font-size: clamp(1.25rem, 2.5vw, 1.5rem);
    font-weight: 500; /* Increased from 400 for better hierarchy */
    margin-bottom: 1rem;
    color: var(--text-primary);
    line-height: 1.3;
}

.service p {
    font-size: clamp(1rem, 2vw, 1.1rem); /* Minimum 16px for mobile readability */
    line-height: 1.7; /* Increased from 1.6 for better readability */
    color: var(--text-secondary);
}

#cta {
    text-align: center;
    padding: 4rem 3rem;
    max-width: 700px;
    margin: 0 auto;
}

#cta h2 {
    font-size: clamp(1.5rem, 3.5vw, 2.2rem);
    font-weight: 400; /* Increased from 300 for better legibility */
    margin-bottom: 2rem;
    color: var(--text-primary);
    line-height: 1.3;
}

#cta > p {
    font-size: clamp(1rem, 2.2vw, 1.2rem); /* Minimum 16px for mobile */
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.7;
}

.cta-button {
    display: inline-block;
    padding: clamp(0.875rem, 2vw, 1rem) clamp(2rem, 5vw, 2.5rem);
    background: linear-gradient(135deg, var(--ocean-blue), var(--teal));
    color: var(--white);
    text-decoration: none;
    border-radius: 50px;
    font-size: clamp(1rem, 2vw, 1.1rem); /* Minimum 16px for mobile */
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px var(--button-shadow);
    margin-bottom: 1rem;
    letter-spacing: 0.01em; /* Slight letter spacing for button text */
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px var(--button-hover-shadow);
    filter: brightness(1.1);
}

.cta-button:focus-visible {
    outline: 2px solid var(--ocean-blue);
    outline-offset: 4px;
}

.email {
    font-size: clamp(0.95rem, 2vw, 1.1rem); /* Minimum ~15px for mobile */
    color: var(--text-secondary);
    margin-top: 0;
    line-height: 1.6;
}

#founders {
    position: relative;
    z-index: 2;
}

.section-title {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 500;
    text-align: center;
    margin-bottom: 3rem;
    color: var(--text-primary);
    line-height: 1.3;
}

.founders-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    justify-content: center;
}

.founder-card {
    position: relative;
    overflow: visible;
    background: linear-gradient(135deg, var(--founder-card-bg-start) 0%, var(--founder-card-bg-mid) 50%, var(--founder-card-bg-end) 100%);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid var(--founder-card-border);
    border-radius: 32px;
    padding: 2rem 2rem 2.5rem 2rem;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 8px 32px var(--founder-card-shadow),
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        inset 0 -1px 0 rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 0 1 320px;
    min-width: 320px;
    max-width: 100%;
}

.founder-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, var(--founder-card-bg-start) 0%, rgba(74, 144, 226, 0.05) 40%, transparent 80%);
    opacity: 0;
    transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    filter: blur(20px);
}

.founder-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
    border-radius: 32px;
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.founder-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 
        0 20px 60px var(--founder-card-hover-shadow),
        0 8px 24px var(--founder-card-hover-shadow),
        inset 0 1px 0 rgba(255, 255, 255, 0.3),
        inset 0 -1px 0 rgba(0, 0, 0, 0.1);
    border-color: var(--founder-card-hover-border);
    background: linear-gradient(135deg, var(--founder-card-hover-bg-start) 0%, var(--founder-card-hover-bg-mid) 50%, var(--founder-card-hover-bg-end) 100%);
}

.founder-card:hover::before {
    opacity: 0.6;
}

.founder-card:hover::after {
    opacity: 1;
}

.founder-card:focus-visible {
    outline: 2px solid var(--ocean-blue);
    outline-offset: 4px;
}

.founder-image-wrapper {
    position: relative;
    width: 180px;
    height: 180px;
    margin-bottom: 1.5rem;
    border-radius: 50%;
    overflow: hidden;
    background: linear-gradient(135deg, var(--founder-image-wrapper-bg-start) 0%, var(--founder-image-wrapper-bg-end) 100%);
    padding: 4px;
    box-shadow: 
        0 8px 24px var(--founder-image-wrapper-shadow),
        inset 0 0 0 2px rgba(255, 255, 255, 0.1),
        0 0 0 1px rgba(255, 255, 255, 0.05);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.founder-card:hover .founder-image-wrapper {
    transform: scale(1.08);
    box-shadow: 
        0 12px 32px var(--founder-image-wrapper-hover-shadow),
        inset 0 0 0 2px rgba(255, 255, 255, 0.2),
        0 0 0 1px rgba(255, 255, 255, 0.1);
}

.founder-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 25%;
    border-radius: 50%;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    filter: brightness(1.05) contrast(1.1);
}

.founder-card:hover .founder-image {
    transform: scale(1.1);
}

.founder-card-content {
    text-align: center;
    position: relative;
    z-index: 1;
    width: 100%;
}

.founder-card h3 {
    font-size: clamp(1.2rem, 2.5vw, 1.4rem);
    font-weight: 500;
    color: var(--text-primary);
    margin: 0 0 1rem 0;
    line-height: 1.3;
    text-shadow: 0 2px 8px var(--text-shadow);
    letter-spacing: 0.02em;
}

.founder-card p {
    font-size: clamp(0.95rem, 2vw, 1rem);
    line-height: 1.6;
    color: var(--text-secondary);
    margin: 0;
    text-align: left;
}

@media (max-width: 768px) {
    /* Typography is now handled with clamp() for fluid scaling */
    /* Additional mobile-specific adjustments */
    
    /* Scroll snap for smooth card-to-card scrolling */
    html {
        scroll-snap-type: y mandatory;
        height: 100%;
    }
    
    body {
        scroll-snap-type: y mandatory;
        -webkit-overflow-scrolling: touch;
    }
    
    .glass-card,
    .founder-card {
        scroll-snap-align: center;
        scroll-snap-stop: always;
    }
    
    /* Centered state for mobile - replicates hover effects */
    .glass-card.centered {
        transform: translateY(-5px);
        box-shadow: 0 12px 40px var(--glass-card-hover-shadow);
        border-color: var(--glass-card-hover-border);
        background: var(--glass-card-hover-bg);
    }
    
    .founder-card.centered {
        transform: translateY(-4px) scale(1.01);
        box-shadow: 
            0 12px 32px rgba(0, 0, 0, 0.15),
            0 4px 12px rgba(0, 0, 0, 0.1),
            inset 0 1px 0 rgba(255, 255, 255, 0.15),
            inset 0 -1px 0 rgba(0, 0, 0, 0.05);
        border-color: rgba(255, 255, 255, 0.22);
        background: linear-gradient(135deg, 
            rgba(74, 144, 226, 0.18) 0%, 
            rgba(95, 179, 179, 0.12) 50%, 
            rgba(127, 216, 216, 0.18) 100%);
    }
    
    .founder-card.centered::before {
        opacity: 0.25;
    }
    
    .founder-card.centered::after {
        opacity: 0.4;
    }
    
    .founder-card.centered .founder-image-wrapper {
        transform: scale(1.04);
        box-shadow: 
            0 8px 20px rgba(0, 0, 0, 0.2),
            inset 0 0 0 2px rgba(255, 255, 255, 0.15),
            0 0 0 1px rgba(255, 255, 255, 0.08);
    }
    
    .founder-card.centered .founder-image {
        transform: scale(1.05);
    }
    
    .services-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem; /* Reduced gap on mobile */
    }

    main {
        padding: 0 clamp(1rem, 3vw, 2rem) clamp(1.5rem, 4vw, 2rem) clamp(1rem, 3vw, 2rem);
    }

    section {
        margin: clamp(3rem, 8vw, 4rem) 0;
    }

    #services {
        margin-top: -30vh; /* Increased overlap on tablet to show more content */
    }

    .hero-content {
        padding: clamp(2rem, 5vw, 3rem) clamp(1.5rem, 4vw, 2.5rem);
    }

    .glass-card {
        padding: clamp(1.5rem, 4vw, 3rem);
    }

    #cta {
        padding: clamp(2.5rem, 6vw, 4rem) clamp(1.5rem, 4vw, 3rem);
    }

    .service .icon {
        width: clamp(3rem, 8vw, 4rem);
        height: clamp(3rem, 8vw, 4rem);
        margin-bottom: clamp(1rem, 3vw, 1.5rem);
    }

    .founders-grid {
        gap: 1.5rem;
    }

    .founder-card {
        padding: 1.5rem 1.5rem 2rem 1.5rem;
        flex: 1 1 100%;
        min-width: 0;
    }

    .founder-image-wrapper {
        width: 150px;
        height: 150px;
        margin-bottom: 1.25rem;
    }

    .section-title {
        margin-bottom: 2rem;
    }
}

/* Additional mobile optimization for very small screens */
@media (max-width: 480px) {
    body {
        font-size: 15px; /* Slightly smaller base on very small screens */
    }

    #services {
        margin-top: -25vh; /* Increased overlap on mobile to show more content */
    }
}

/* Ensure icon inversion works in light mode on mobile too */
@media (prefers-color-scheme: light) and (max-width: 768px) {
    .service .icon {
        filter: brightness(1.2) invert(1) !important;
    }
}

/* Accessibility - Visually hidden but accessible to screen readers */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Accessibility - Respect user's motion preferences */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    #wave-canvas {
        display: none;
    }
}

/* Print Stylesheet - Optimize layout for printing */
@media print {
    /* Hide decorative and non-essential elements */
    #wave-canvas {
        display: none !important;
    }
    
    .divider {
        display: none;
    }
    
    /* Reset backgrounds and colors for print */
    * {
        background: white !important;
        color: black !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }
    
    body {
        background: white !important;
        font-size: 12pt;
        line-height: 1.5;
    }
    
    /* Optimize page layout */
    @page {
        margin: 2cm;
    }
    
    /* Remove fixed positioning and viewport constraints */
    #hero {
        position: static !important;
        height: auto !important;
        width: 100% !important;
        padding: 2rem 0 !important;
        page-break-inside: avoid;
    }
    
    main {
        max-width: 100% !important;
        padding: 0 !important;
    }
    
    section {
        margin: 2rem 0 !important;
        page-break-inside: avoid;
    }
    
    /* Simplify cards for print */
    .hero-content,
    .glass-card,
    .founder-card {
        background: white !important;
        border: 1px solid #ccc !important;
        border-radius: 0 !important;
        padding: 1.5rem !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        page-break-inside: avoid;
    }
    
    /* Remove hover effects */
    .glass-card:hover,
    .founder-card:hover {
        transform: none !important;
    }
    
    /* Optimize typography for print */
    h1, h2, h3 {
        color: black !important;
        page-break-after: avoid;
    }
    
    /* Show URLs for links */
    .cta-button {
        background: white !important;
        color: black !important;
        border: 1px solid black !important;
        text-decoration: underline;
    }
    
    .cta-button::after {
        content: " (info@coastlinedigital.ca)";
        font-size: 0.9em;
    }
    
    /* Optimize images */
    img {
        max-width: 100% !important;
        height: auto !important;
        page-break-inside: avoid;
    }
    
    .founder-image-wrapper {
        border: 1px solid #ccc !important;
        box-shadow: none !important;
    }
    
    /* Optimize grids for print */
    .services-grid {
        display: block !important;
    }
    
    .service {
        margin-bottom: 1.5rem;
        page-break-inside: avoid;
    }
    
    .founders-grid {
        display: block !important;
    }
    
    .founder-card {
        margin-bottom: 1.5rem;
        page-break-inside: avoid;
    }
    
    /* Remove decorative pseudo-elements */
    .founder-card::before,
    .founder-card::after {
        display: none !important;
    }
    
    /* Ensure proper spacing */
    #cta {
        padding: 2rem 0 !important;
        page-break-inside: avoid;
    }
    
    /* Hide visually hidden elements in print */
    .visually-hidden {
        display: none !important;
    }
}