/* Base styles */
:root {
    --primary-color: #333;
    --background-color: #fff;
    --background-color-rgb: 255, 255, 255;
    --text-color: #333;
    --link-color: #0066cc;
    --hover-color: #004499;
    --transition-speed: 0.3s;
    --focus-outline-color: #4A90E2;
    --social-link-bg: rgba(0, 0, 0, 0.08);
    --social-heading-color: rgba(0, 0, 0, 0.85);
    --social-link-text: rgba(0, 0, 0, 0.85);
    --app-bar-height: 60px;
}

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

/* Add universal transition for color properties */
*:not(script):not(style) {
    transition: background-color var(--transition-speed) ease,
                color var(--transition-speed) ease,
                border-color var(--transition-speed) ease,
                box-shadow var(--transition-speed) ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    position: relative;
    min-height: 100vh;
}

body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../images/forest-background-lowres.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    filter: blur(8px);
    z-index: -2;
    transform: scale(1.1);  /* Prevent blur from showing edges */
}

body::after {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../images/forest-background.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.5s ease-in;
}

body.bg-loaded::after {
    opacity: 1;
}

/* Add support for WebP background with fallback */
@supports (background-image: -webkit-image-set(url("") 1x)) {
    body::before {
        background-image: -webkit-image-set(
            url('../images/forest-background-lowres.webp') 1x,
            url('../images/forest-background-lowres.png') 1x
        );
    }
    
    body::after {
        background-image: -webkit-image-set(
            url('../images/forest-background.webp') 1x,
            url('../images/forest-background.png') 1x
        );
    }
}

@supports (background-image: image-set(url("") 1x)) {
    body::before {
        background-image: image-set(
            url('../images/forest-background-lowres.webp') 1x,
            url('../images/forest-background-lowres.png') 1x
        );
    }
    
    body::after {
        background-image: image-set(
            url('../images/forest-background.webp') 1x,
            url('../images/forest-background.png') 1x
        );
    }
}

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

/* Focus Styles */
:focus {
    outline: 3px solid var(--focus-outline-color);
    outline-offset: 2px;
}

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

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

/* Skip Link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--background-color);
    color: var(--text-color);
    padding: 8px;
    z-index: 100;
    transition: top 0.3s;
}

.skip-link:focus {
    top: 0;
}

/* App Bar */
.app-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    position: fixed;
    top: 0;
    width: 100%;
    background-color: var(--background-color);
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    height: var(--app-bar-height);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.app-bar-logo {
    height: 40px;
    width: auto;
    border-radius: 4px;
}

.site-title {
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--text-color);
    margin: 0;
    letter-spacing: 0.5px;
}

#theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    padding: 0.5rem;
    transition: transform var(--transition-speed);
}

#theme-toggle:hover {
    transform: scale(1.1);
}

/* Main Content */
main {
    min-height: 100vh;
    padding-top: var(--app-bar-height);
    display: flex;
    flex-direction: column;
}

/* Hero Section */
.hero {
    min-height: calc(100vh - var(--app-bar-height));
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.logo-showcase {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
}

.hero-logo {
    width: 100%;
    height: auto;
    max-width: 100%;
    border-radius: clamp(12px, 2.5vw, 24px);
    transition: transform var(--transition-speed) ease;
}

/* Mobile-first responsive adjustments */
@media (max-width: 480px) {
    :root {
        --app-bar-height: 50px; /* Slightly smaller app bar on mobile */
    }

    .app-bar {
        padding: 0.5rem 1rem;
    }

    .logo-showcase {
        width: 100%;
        max-width: 100%;
        margin: 0 auto;
        padding: 1rem;
    }
    
    .hero {
        padding: 0.5rem;
        min-height: calc(100vh - var(--app-bar-height));
    }

    .site-title {
        font-size: 1.2rem;
    }
}

/* Tablet and larger */
@media (min-width: 481px) and (max-width: 1024px) {
    .logo-showcase {
        width: 90vw;
        max-width: 800px;
    }
}

/* Desktop */
@media (min-width: 1025px) {
    .logo-showcase {
        width: 85vw;
        max-width: 1200px;
    }

    .hero {
        padding: 2rem;
    }
}

/* Hover effect only on devices that support hover */
@media (hover: hover) {
    .hero-logo:hover {
        transform: scale(1.02);
    }
}

/* Social Links */
.social-links {
    padding: 4rem 2rem;
    background-color: rgba(var(--background-color-rgb), 0.85);
    margin: 0 auto 40px auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 640px;
    border-radius: 24px;
    width: calc(100% - 40px); /* Account for 20px margin on each side */
}

.social-heading {
    font-size: 0.9rem;
    font-weight: normal;
    color: var(--social-heading-color);
    letter-spacing: 0.5px;
    margin-bottom: 20px;
    text-transform: uppercase;
}

.link-tree {
    width: 100%;
    min-width: calc(320px - 40px); /* Minimum mobile viewport (320px) minus margins */
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.social-link {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    text-align: center;
    text-decoration: none;
    color: var(--social-link-text);
    background-color: var(--social-link-bg);
    border-radius: 8px;
    transition: transform var(--transition-speed), background-color var(--transition-speed);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.social-icon {
    width: 24px;
    height: 24px;
    color: var(--text-color);
    transition: transform var(--transition-speed);
}

.social-link:hover .social-icon {
    transform: scale(1.1);
}

.social-link:hover {
    transform: translateY(-2px);
    background-color: rgba(0, 0, 0, 0.12);
}

/* Bottom Bar */
.bottom-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem 2rem;
    background-color: var(--background-color);
    box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.1);
}

.copyright {
    font-size: 0.9rem;
    color: var(--text-color);
    opacity: 0.8;
    letter-spacing: 0.5px;
}

/* Footer */
footer {
    margin-top: auto;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    padding: 1rem;
    background-color: var(--background-color);
}

.footer-links a {
    color: var(--text-color);
    text-decoration: none;
    opacity: 0.8;
    transition: opacity var(--transition-speed);
    font-size: 0.9rem;
}

.footer-links a:hover {
    opacity: 1;
}

/* Responsive Design */
.logo-showcase {
    width: 80%;
}

.footer-content {
    flex-direction: column;
    text-align: center;
}
