html {
    scroll-behavior: smooth; /* Enable smooth scrolling for anchor links */
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background-color: #f8f9fa; /* Light grey background */
    color: #343a40; /* Dark grey text */
}

header {
    background-color: #ffffff;
    padding: 0.8rem 1.5rem; /* Consistent padding */
    display: flex;
    justify-content: space-between; /* Logo left, button right */
    align-items: center;
    border-bottom: 1px solid #dee2e6;
    position: fixed; /* Keep header fixed at the top */
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000; /* Original z-index */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease-in-out; /* Add transition for hiding */
}

header.header-hidden {
    transform: translateY(-100%); /* Hide header by moving it up */
}

header h1 {
    margin: 0;
    font-size: 2rem; /* Ensure font-size is set */
    line-height: 1; /* Ensure line-height doesn't cause issues */
    color: #dc3545; /* Set red color directly on H1 */
    z-index: 1; /* Ensure it appears above potential pseudo-elements */
}

/* Style the logo link */
header h1 a {
    color: inherit; /* Inherit color from h1 */
    text-decoration: none; /* Remove underline */
}

.mobile-menu-button {
    display: block; /* Always display the button */
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: #343a40;
    padding: 0.5rem;
    line-height: 1;
    z-index: 1101; /* Ensure button is above overlay background but below menu content if needed */
}

.nav-menu {
    visibility: hidden; /* Use visibility for animation */
    opacity: 0; /* Start fully transparent */
    position: fixed; /* Fixed position for overlay */
    top: 0;
    left: 0;
    width: 100vw; /* Use viewport width */
    height: 100vh; /* Use viewport height */
    background-color: rgba(255, 255, 255, 1.0); /* Increased opacity */
    z-index: 1100; /* High z-index to cover content */
    display: flex; /* Keep flex for layout */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    box-sizing: border-box;
    overflow-y: auto; /* Allow scrolling if content overflows */
    cursor: pointer; /* Indicate the background is clickable */
    transition: opacity 0.4s ease-in-out, visibility 0.4s ease-in-out; /* Animate opacity and visibility */
}

/* New container for logo and close button in overlay */
.menu-top-bar {
    width: 100%; /* Take full width */
    padding: 0.8rem 1.5rem; /* Match header padding */
    display: flex;
    justify-content: space-between; /* Logo left, button right */
    align-items: center; /* Vertically align items */
    box-sizing: border-box;
    position: absolute; /* Position at the top */
    top: 0;
    left: 0;
}

/* Logo positioning within the nav menu */
.nav-menu h1 {
    margin: 0;
    font-size: 2rem;
    line-height: 1;
    color: #dc3545;
}

.nav-menu h1 a {
    color: inherit;
    text-decoration: none;
}

.nav-menu.nav-active {
    visibility: visible; /* Make visible */
    opacity: 1; /* Fade in */
}

.nav-menu ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex; /* Use flex for the list itself */
    flex-direction: column; /* Stack links vertically */
    align-items: center; /* Center items horizontally */
    width: 100%;
    cursor: default; /* Reset cursor for the list area */
    padding-top: calc(0.8rem + 2rem + 0.8rem + 1rem); /* Top padding + logo height + bottom padding + extra space */
}

.nav-menu ul li {
    margin: 0.2rem 0; /* Further reduced vertical spacing */
    width: auto; /* Fit content width */
    text-align: center;
    border-bottom: none; /* Remove previous borders */
}

.nav-menu ul li a {
    text-decoration: none;
    color: #343a40; /* Darker text for overlay */
    font-weight: 500;
    font-size: 1.5rem; /* Larger font size */
    padding: 0.5rem 1rem;
    display: block;
    border-radius: 4px; /* Add border-radius for background hover */
    transition: color 0.2s ease, background-color 0.2s ease; /* Add background-color transition */
}

.nav-menu ul li a:hover {
    color: #dc3545; /* Red hover text */
    background-color: rgba(220, 53, 69, 0.05); /* Subtle red background on hover */
    opacity: 1; /* Reset opacity */
}

/* Style for the close button inside the overlay */
.menu-close-button {
    background: none;
    border: none;
    font-size: 2.5rem;
    color: #343a40;
    cursor: pointer;
    line-height: 1;
    padding: 0.5rem; /* Restore padding */
}

.menu-close-button:hover {
    color: #dc3545;
}

main {
    max-width: 900px;
    margin: 3rem auto;
    padding: 0 2rem;
    padding-top: 80px; /* Add padding-top to main to prevent content from hiding under fixed header */
}

section {
    margin-bottom: 2.5rem; /* Reduced bottom margin */
    padding: 2.5rem;
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.04); /* Slightly softer shadow */
    transition: box-shadow 0.3s ease-in-out; /* Add transition for potential hover effects */
}

/* Optional: subtle lift on hover for sections */
section:hover {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.06);
}

section h2 {
    font-size: 1.8rem;
    color: #495057; /* Slightly darker heading */
    margin-top: 0;
    border-bottom: 2px solid #e9ecef; /* Light underline */
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
}

#hero {
    background-color: transparent; /* Remove background for hero */
    border: none; /* Remove border */
    box-shadow: none; /* Remove shadow */
    padding-top: 2rem; /* Add padding */
    padding-bottom: 2rem;
    text-align: center; /* Center align all hero content */
}

#hero h2 {
    font-size: 2.8rem; /* Larger headline */
    font-weight: 600; /* Bolder headline */
    color: #343a40;
    text-align: center;
    border-bottom: none;
    margin-bottom: 1rem;
    line-height: 1.3; /* Adjust line height */
}

#hero p {
    font-size: 1.1rem;
    color: #6c757d;
    max-width: 700px; /* Constrain width of paragraphs */
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 1rem; /* Spacing below paragraphs */
}

#hero h2 span {
    color: #dc3545; /* Red highlight */
    font-weight: 500;
}

#hero h2 em {
    font-style: italic;
}

.slogan {
    text-align: center;
    font-size: 1.2rem;
    color: #6c757d;
    margin-top: 1.5rem; /* Increased spacing above slogans */
    font-style: italic;
}

.slogan strong {
    color: #dc3545; /* Red 'no' */
    font-weight: 600;
}

#process ol {
    padding-left: 1.5rem;
}

#process li {
    margin-bottom: 0.5rem;
}

#team .team-members {
    display: flex;
    justify-content: space-around;
    text-align: center;
}

#team .member {
    flex-basis: 30%;
    padding: 1rem;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out; /* Add transitions */
}

/* Optional: slight hover effect for team members */
#team .member:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
}

#team .member img {
    width: 120px; /* Adjust size as needed */
    height: 120px;
    border-radius: 50%; /* Make images circular */
    margin-bottom: 1rem;
    object-fit: cover; /* Ensure image covers the area well */
    border: 3px solid #e9ecef; /* Subtle border */
}

#team h3 {
    font-size: 1.3rem;
    margin-bottom: 0.3rem;
    color: #495057;
}

#team p {
    font-size: 1rem;
    color: #6c757d;
    margin-top: 0;
}

#faq dt {
    font-weight: bold;
    margin-top: 1rem;
    color: #495057;
}

#faq dd {
    margin-left: 0;
    margin-bottom: 1rem;
    color: #6c757d;
}

#contact h2 {
    color: #dc3545; /* Red heading for Contact */
}

#contact a {
    color: #dc3545;
    text-decoration: none;
}

#contact a:hover {
    text-decoration: underline;
}

footer {
    text-align: center;
    margin-top: 3rem;
    padding: 1rem;
    font-size: 0.9rem;
    color: #6c757d;
    border-top: 1px solid #dee2e6;
    background-color: #e9ecef;
}

#stats {
    background-color: #e9ecef; /* Light background for stats */
}

#stats h2 {
    text-align: center;
    border-bottom: none;
}

.stats-container {
    display: flex;
    justify-content: space-around;
    text-align: center;
    margin-top: 1rem;
}

.stat-item h3 {
    font-size: 2.5rem;
    color: #dc3545; /* Red for stats */
    margin-bottom: 0.2rem;
}

.stat-item p {
    color: #6c757d;
    font-size: 0.9rem;
    margin-top: 0;
}

#philosophy h2 strong,
#process h2 strong,
#process p strong {
    color: #dc3545;
}

#vuokaavio .diagram-placeholder {
    border: 2px dashed #dee2e6;
    padding: 2rem;
    text-align: center;
    color: #adb5bd;
    margin-top: 1.5rem;
}

#contact small {
    display: block;
    margin-top: 1rem;
    font-style: italic;
    color: #6c757d;
}

#rejection-flowchart .flowchart-container {
    border: 1px solid #e0e0e0;
    background-color: #fdfdfd;
    padding: 1.5rem;
    border-radius: 5px;
    margin-top: 1.5rem;
    max-height: 80vh; /* Limit height to 80% of viewport height */
    overflow: auto;   /* Enable both vertical and horizontal scrolling if needed */
    text-align: center; /* Center the SVG initially if narrower than container */
}

.flowchart-svg {
    /* max-width: 100%; */ /* Allow SVG to exceed container width */
    height: auto;    /* Maintain aspect ratio */
    display: block;  /* Remove extra space below image */
    margin: 0 auto;  /* Center SVG within container */
}

/* Scroll Animation Classes */
.fade-in-on-scroll {
    opacity: 0;
    transform: translateY(50px); /* Increased vertical distance */
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.slide-in-left {
    opacity: 0;
    transform: translateX(-60px); /* Slide in from left */
    transition: opacity 0.7s ease-out, transform 0.7s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.slide-in-right {
    opacity: 0;
    transform: translateX(60px); /* Slide in from right */
    transition: opacity 0.7s ease-out, transform 0.7s cubic-bezier(0.25, 0.1, 0.25, 1);
}

/* Common visible state triggered by IntersectionObserver */
.is-visible {
    opacity: 1;
    transform: translate(0, 0); /* Reset transform for all types */
}

/* Responsive adjustments */
/* Remove nav specific rules from here, keep general layout ones */
@media (max-width: 600px) {
    /* Remove header rules previously added for mobile */
    /* Remove .mobile-menu-button display rule */
    /* Remove .nav-menu display/position/styling rules for mobile */
    /* Keep other mobile adjustments */

    header {
         /* Revert mobile specific header changes, rely on fixed header base style */
         padding: 0.8rem 1rem; /* Can keep smaller padding */
    }

    header h1 {
        font-size: 1.8rem;
    }

    main {
        margin: 1.5rem auto;
        padding: 0 1rem;
        padding-top: 70px; /* Adjust padding-top for mobile header height */
    }

    section {
        padding: 1.5rem;
        margin-bottom: 2rem;
    }

    #hero h2 {
        font-size: 2.2rem;
    }

    #team .team-members {
        flex-direction: column;
        align-items: center;
    }

    #team .member {
        margin-bottom: 2rem;
        flex-basis: 90%;
        max-width: 300px;
    }

    .stats-container {
        flex-direction: column;
    }

    .stat-item {
        margin-bottom: 1.5rem;
    }

    #rejection-flowchart .flowchart-container {
        padding: 1rem;
    }

     /* Ensure overlay link font size is still large enough */
    .nav-menu ul li a {
        font-size: 1.4rem;
    }

}

/* Class added to body when menu is open */
body.menu-open {
    overflow: hidden;
} 