/* Existující styly */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: auto;
    min-height: 50px;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

/* Obsah pod fixním panelem — na všech stránkách s .master */
.master {
    padding-top: var(--site-header-offset, 64px);
    box-sizing: border-box;
}

#header {
    background-image: linear-gradient(to top, var(--primary-color), var(--tertiary-color));
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 56px;
    height: auto;
    padding: 0 12px 0 0;
    box-sizing: border-box;
    position: relative;
    z-index: 1100;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.22);
}
.logo{
    padding: 0;
    height: 100%;
    width: auto;
    flex: 0 0 auto;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    animation: fadeIn 1.3s ease-in-out forwards;
}
.logo img{
    padding: 0;
    margin: 6px 0 0 16px;
    height: 52px;
}
.logo a{
    text-decoration: none;
    color: var(--text2-color);
}
.logo h6{
    width: 180px;
    margin: 0 12px 0 8px;
    font-size: 18px;
    color: var(--text2-color);
}

/* Globální hledání uprostřed headeru */
.header-search {
    flex: 1 1 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    min-width: 0;
    max-width: 520px;
    margin: 0 auto;
}
.header-search-form {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 6px;
    background: var(--background-color);
    border: 1px solid var(--link-color);
    border-radius: 999px;
    padding: 3px 3px 3px 14px;
    box-sizing: border-box;
}
.header-search-form input[type="search"] {
    flex: 1 1 auto;
    min-width: 0;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text2-color);
    font-size: 16px;
    height: 34px;
    padding: 0;
}
.header-search-form input[type="search"]::-webkit-search-decoration,
.header-search-form input[type="search"]::-webkit-search-cancel-button {
    -webkit-appearance: none;
}
.header-search-submit {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 34px;
    min-width: 34px;
    padding: 0 14px;
    border: none;
    border-radius: 999px;
    background: var(--background-yellow2);
    color: var(--text2-color);
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
}
.header-search-submit:hover {
    background: var(--primary-color);
}
.header-search-toggle {
    display: none;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin-left: auto;
    border: 1px solid var(--link-color);
    border-radius: 50%;
    background: var(--background-color);
    color: var(--text2-color);
    cursor: pointer;
}
.header-search-toggle:hover {
    background: var(--primary-color);
}
.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;
}

.menu {
    display: flex;
    flex-direction: row;
    justify-content: flex-end;
    align-items: center;
    font-size: 30px;
    flex: 0 0 auto;
    z-index: 90;
}
.menu nav ul {
    text-decoration: none;
    height: auto;
    min-height: 38px;
    display: flex;
    flex-direction: row;
    justify-content: flex-end;
    align-items: center;
    gap: 6px;
    padding: 0;
    margin: 0;
    list-style: none;
}
.menu nav ul li{
    height: auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 0;
    margin: 0;
}
.menu nav ul li a{
    position: relative;
    height: auto;
    min-height: 38px;
    display: inline-flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    text-align: center;
    text-decoration: none;
    list-style: none;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: var(--text2-color);
    padding: 0 16px;
    border-radius: 999px;
    border: 1px solid rgba(102, 87, 1, 0.35);
    background: rgba(255, 255, 255, 0.78);
    box-shadow:
        0 2px 8px rgba(102, 87, 1, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    text-shadow: none;
    overflow: hidden;
    isolation: isolate;
    transition:
        transform 0.22s cubic-bezier(0.22, 1, 0.36, 1),
        background 0.22s ease,
        border-color 0.22s ease,
        box-shadow 0.22s ease,
        color 0.22s ease;
}
.menu nav ul li a::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.75), transparent 58%);
    opacity: 0.85;
    pointer-events: none;
    z-index: -1;
}
.menu nav ul li a::after {
    content: "";
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 6px;
    height: 2px;
    border-radius: 999px;
    background: var(--link-color);
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
    pointer-events: none;
}
.menu nav ul li a:hover,
.menu nav ul li a:focus-visible {
    color: var(--text2-color);
    transform: translateY(-2px);
    background: var(--primary-color);
    border-color: var(--link-color);
    box-shadow:
        0 8px 18px rgba(102, 87, 1, 0.22),
        0 0 0 1px rgba(102, 87, 1, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.65);
    outline: none;
    animation: none;
}
.menu nav ul li a:hover::after,
.menu nav ul li a:focus-visible::after {
    transform: scaleX(1);
}
.menu nav ul li a:active {
    transform: translateY(0);
    box-shadow:
        0 3px 8px rgba(102, 87, 1, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

@media (prefers-reduced-motion: reduce) {
    .menu nav ul li a,
    .menu nav ul li a::after {
        transition: none;
    }
    .menu nav ul li a:hover,
    .menu nav ul li a:focus-visible {
        transform: none;
    }
}

.hamburger {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 25px;
    height: 20px;
    cursor: pointer;
    z-index: 101;
    margin-right: 10px;
    flex: 0 0 auto;
}
.hamburger .bar {
    height: 3px;
    width: 100%;
    background-color: var(--text2-color);
    border-radius: 10px;
    transition: all 0.3s ease;
}

.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

/* Střední šířky: kratší text u tlačítka hledání */
@media screen and (max-width: 1200px) {
    .logo h6 {
        display: none;
    }
    .menu nav ul li a {
        font-size: 15px;
        padding: 0 12px;
        min-height: 34px;
    }
    .header-search-submit-text {
        display: none;
    }
    .header-search-submit {
        padding: 0;
        width: 34px;
    }
}

/* Pod 1020px: hamburger menu + lupa místo full search */
@media screen and (max-width: 1020px) {
    #header {
        flex-wrap: wrap;
        min-height: 56px;
        padding-right: 8px;
    }

    .header-search {
        order: 4;
        flex: 1 1 100%;
        max-width: none;
        display: none;
        margin: 0 8px 10px 16px;
    }
    .header-search.is-open {
        display: flex;
    }
    .header-search-form {
        border-radius: 12px;
        padding: 4px 4px 4px 12px;
    }
    .header-search-toggle {
        display: inline-flex;
        order: 2;
        margin-left: auto;
        margin-right: 8px;
    }
    .menu {
        order: 5;
        position: fixed;
        top: calc(var(--site-header-offset, 64px) + 8px);
        right: 16px;
        -webkit-backdrop-filter: blur(15px);
        backdrop-filter: blur(15px);
        background-color: var(--secondaryGlass-color);
        border-radius: 30px 10px 60px 10px;
        width: min(280px, calc(100vw - 32px));
        height: auto;
        min-height: 280px;
        flex-direction: column;
        align-items: stretch;
        padding: 20px;
        transform: translateX(130%);
        transition: transform 0.3s ease-in-out;
        box-shadow: -2px 0 5px rgba(0, 0, 0, 0.5);
        z-index: 2100;
        box-sizing: border-box;
    }
    .menu nav {
        width: 100%;
    }
    .menu nav ul {
        flex-direction: column;
        justify-content: flex-start;
        align-items: stretch;
        width: 100%;
        height: auto;
        gap: 10px;
    }
    .menu nav ul li {
        width: 100%;
        margin: 0;
    }
    .menu nav ul li a {
        width: 100%;
        min-width: 100%;
        box-sizing: border-box;
        font-size: 20px;
        min-height: 46px;
        padding: 0 16px;
        justify-content: center;
        text-align: center;
        background: rgba(255, 255, 255, 0.55);
        border-color: rgba(102, 87, 1, 0.18);
        text-shadow: none;
    }
    .menu nav ul li a::after {
        left: 16px;
        right: 16px;
        width: auto;
        bottom: 10px;
        transform-origin: center;
    }
    .menu nav ul li a:hover,
    .menu nav ul li a:focus-visible {
        transform: translateY(-2px);
    }
    .hamburger {
        display: flex;
        order: 3;
    }
    .menu.active {
        transform: translateX(0);
    }
    .logo {
        order: 1;
    }
}

.hamburger.active .bar:nth-child(2) {
    opacity: 0;
}
.hamburger.active .bar:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}
.hamburger.active .bar:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

.menu {
    transition: transform 0.3s ease-in-out;
}
