/* Header Menu Styles */
.site-header {
    background-color: #fff;
    padding: 1em 0;
    border-bottom: 1px solid #eee;
    display: flex; /* Flexbox for alignment */
    justify-content: space-between; /* Space between logo and menu */
    align-items: center;
    flex-wrap: wrap; /* Allow wrapping for smaller screens if needed */
    position: relative; /* For absolute positioning of menu toggle in center mode */
}

.site-header.left .site-branding {
    margin-right: auto; /* Pushes menu to the right */
}

.site-header.center .site-branding {
    margin-left: auto;
    margin-right: auto;
    text-align: center; /* Center the logo/title */
    flex-grow: 1; /* Allow branding to take space to truly center */
}

.site-header.center .main-navigation {
    width: 100%; /* Full width for centered menu below logo */
    justify-content: center;
    margin-top: 0.5em;
    order: 3; /* Ensure navigation is below branding and toggle */
}

.site-branding {
    flex-shrink: 0; /* Prevent shrinking */
}

.site-logo img {
    max-height: 60px; /* Adjust as needed */
    width: auto;
}

.site-title a {
    text-decoration: none;
    font-size: 1.8em; /* Slightly reduced */
    color: #333;
    font-weight: bold;
}

/* Navigation Menu - PC */
.main-navigation {
    display: flex;
    align-items: center;
}

.main-navigation ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
}

.main-navigation ul li {
    margin: 0 0.8em; /* Slightly reduced margin */
}

.main-navigation ul li a {
    text-decoration: none;
    color: #444; /* Slightly darker */
    padding: 0.8em 0.5em; /* Adjusted padding */
    position: relative;
    font-weight: 500;
    transition: color 0.3s ease;
}

.main-navigation ul li a:hover {
    color: var(--main-color, #5ca870);
}

.main-navigation ul li a::after {
    content: "";
    position: absolute;
    bottom: 0; /* Underline at the very bottom of the link area */
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background-color: var(--main-color, #5ca870);
    transition: width 0.3s ease;
}

.main-navigation ul li a:hover::after,
.main-navigation ul li.current-menu-item a::after {
    width: 100%;
}

/* Mobile Menu - Hamburger Icon */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    padding: 0.5em;
    cursor: pointer;
    z-index: 1001; /* Ensure toggle is above other elements */
}

.hamburger-icon {
    width: 24px; /* Standard size */
    height: 18px; /* 3 lines * 2px height + 2 * 6px space */
    position: relative;
    display: inline-block;
}

.hamburger-icon .line {
    display: block;
    width: 100%;
    height: 2px;
    background-color: #333;
    position: absolute;
    left: 0;
    transition: all 0.3s ease-in-out;
}

.hamburger-icon .line:nth-child(1) {
    top: 0;
}

.hamburger-icon .line:nth-child(2) {
    top: 50%;
    transform: translateY(-50%);
}

.hamburger-icon .line:nth-child(3) {
    bottom: 0;
}

.toggled .hamburger-icon .line:nth-child(1) {
    top: 50%;
    transform: translateY(-50%) rotate(45deg);
}

.toggled .hamburger-icon .line:nth-child(2) {
    opacity: 0;
}

.toggled .hamburger-icon .line:nth-child(3) {
    bottom: 50%;
    transform: translateY(50%) rotate(-45deg);
}

/* Responsive adjustments */
@media screen and (max-width: 768px) {
    .site-header {
        padding: 0.8em 1em; /* Adjust padding for mobile */
        flex-direction: row; /* Ensure items are in a row for mobile */
        justify-content: space-between; /* Default for left aligned logo */
    }
    .site-header.center {
        justify-content: center; /* Center the branding */
    }

    .site-header.center .site-branding {
        order: 1; /* Branding first */
        margin-left: 0; /* Reset margin for flex centering */
        margin-right: 0;
    }
    .site-header.center .menu-toggle {
        order: 2; /* Toggle button after branding */
        position: static; /* Reset absolute positioning */
        transform: none;
        margin-left: auto; /* Push to the right if space allows, or it will be next to logo */
    }

    .main-navigation ul {
        display: none;
        flex-direction: column;
        width: 100%;
        background-color: #fff; /* Cleaner background */
        position: absolute;
        top: calc(100% + 1px); /* Position below the header, adjust if needed */
        left: 0;
        z-index: 1000;
        border-top: 1px solid #eee;
        box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    }

    .main-navigation.toggled ul {
        display: flex;
    }

    .main-navigation ul li {
        margin: 0;
        width: 100%;
        text-align: left; /* Align text to left for better readability */
    }

    .main-navigation ul li a {
        display: block;
        padding: 1em 1.5em; /* More padding for touch targets */
        border-bottom: 1px solid #f0f0f0; /* Softer border */
        color: #333;
    }
    .main-navigation ul li:last-child a {
        border-bottom: none;
    }

    .main-navigation ul li a:hover,
    .main-navigation ul li.current-menu-item a {
        background-color: #f5f5f5; /* Subtle hover */
        color: var(--main-color, #5ca870);
    }
    .main-navigation ul li a:hover::after,
    .main-navigation ul li.current-menu-item a::after {
        display: none; 
    }

    .menu-toggle {
        display: block;
    }

    .site-header.left .menu-toggle {
        margin-left: auto; /* Push to the far right for left-aligned logo */
    }
}

