#header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 1.5em 2.5em;
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid #e0e0e0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: background-color 0.3s ease;
}

#header .header-left {
    justify-self: start;
}

#header .header-center {
    justify-self: center;
}

#header .header-right {
    justify-self: end;
}

#header .logo {
    font-size: 1.5em;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
}

#header nav.header-center a, #header .header-right a {
    font-weight: 500;
    padding-bottom: 0.5em;
    position: relative;
    color: #555;
    text-decoration: none;
}

#header nav.header-center a {
    margin: 0 1.5em;
}

#header nav.header-center a::after, #header .header-right a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 3px;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(90deg, var(--primary-color), var(--gradient-end-color));
    border-radius: 2px;
    transition: width 0.3s ease;
}

#header nav.header-center a:hover, #header .header-right a:hover {
    color: var(--primary-color);
}

#header nav.header-center a:hover::after, #header .header-right a:hover::after {
    width: 100%;
}

#menu {
    transform: translateX(25em);
    transition: transform 0.5s ease, visibility 0.5s;
    -webkit-overflow-scrolling: touch;
    background: #f8f9fa;
    box-shadow: -0.25em 0 0.75em 0 rgba(0, 0, 0, 0.1);
    color: #343a40;
    height: 100%;
    max-width: 80%;
    overflow-y: auto;
    position: fixed;
    right: 0;
    top: 0;
    visibility: hidden;
    width: 25em;
    z-index: 10002;
    padding: 2.5em;
}

#menu .close {
    text-decoration: none;
    position: absolute;
    top: 1em;
    right: 1em;
    width: 2.5em;
    height: 2.5em;
    line-height: 2.5em;
    text-align: center;
    border-radius: 50%;
    color: #868e96;
    font-size: 1.2em;
    transition: background-color 0.3s ease, color 0.3s ease;
}

#menu .close:before {
    content: "\f00d";
    font-family: FontAwesome;
    font-style: normal;
}

#menu .close:hover {
    background-color: #e9ecef;
    color: #343a40;
}

body.is-menu-visible #menu {
    transform: translateX(0);
    visibility: visible;
}

#menu .links {
    list-style: none;
    padding: 0;
    margin: 0;
}

#menu .links li {
    padding: 0;
    margin: 0.5em 0;
    border-bottom: 1px solid #e9ecef;
}

#menu .links li:last-child {
    border-bottom: none;
}

#menu .links li a {
    display: block;
    padding: 0.8em 1em;
    color: #495057;
    text-decoration: none;
    font-weight: 500;
    border-radius: 4px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

#menu .links li a:hover {
    background-color: var(--primary-color);
    color: #fff;
}

#menu .links li strong {
    display: flex;
    align-items: center;
    font-size: 1.2em;
    padding: 1em 1em 0.5em 1em;
    color: #212529;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 1px;
}

#menu .links li strong img {
    margin-right: 6px;
    width: 12px;
    height: 12px;
    filter: brightness(0) invert(0);
    transition: filter 0.3s ease;
}

@media (max-width: 980px) {
    #header {
        grid-template-columns: auto 1fr auto;
        padding: 1em;
    }
    #header nav.header-center a {
        margin: 0 0.5em;
        font-size: 0.9em;
    }
}

@media (max-width: 768px) {
    #header {
        display: flex;
        flex-direction: column;
        padding: 1.5em;
    }

    #header .header-center {
        margin: 1em 0;
        order: 2;
    }
    #header .header-left {
        order: 1;
    }
    #header .header-right {
        order: 3;
    }

    #header .logo {
        width: auto;
        margin-bottom: 0;
    }

    #header nav.header-center {
        width: 100%;
        display: flex;
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.5em 1.5em;
    }

    #header nav.header-center a {
        margin: 0;
    }
}
