/* components/layout/Header, Navigation, MenuButton and mode-switcher/ModeSwitcher
   (.module.scss). The header lies over the top of the page (absolute in .mk-layout). */

/* The builder's section wrappers are containing blocks (container queries, z-index);
   the header escapes them, so it is placed in .mk-layout and the fixed menu covers the page. */
.el-section:has(.mk-header),
.el-section:has(.mk-header) > .el-section__body,
.el-section:has(.mk-header) .el-inner,
.el-section:has(.mk-header) .el-inner__grid,
.el-section:has(.mk-header) .el-inner__col,
.el-section:has(.mk-header) .el-container {
    position: static;
    container-type: normal;
    z-index: auto;
    overflow: visible;
}

.mk-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    padding: var(--mk-space-top, 1.5rem) 0 var(--mk-space-bottom, 1.5rem);
    background: var(--mk-header-bg, none);
}
@media (min-width: 720px) {
    .mk-header { padding: var(--mk-space-top, var(--grid-gutter)) 0 var(--mk-space-bottom, var(--grid-gutter)); }
}

.mk-header__container {
    padding-left: var(--container-gutter);
    padding-right: var(--container-gutter);
    margin: 0 auto;
    max-width: var(--page-width);
    box-sizing: content-box;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.mk-header__logo {
    position: relative;
    z-index: 11;
    color: var(--mk-header-logo-color, var(--color-font));
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}
.mk-header__logo:focus { outline: none; }
.mk-dark-header .mk-header__logo { color: var(--mk-header-logo-color, var(--color-font-dark)); }
.mk-header__logo > svg { display: block; width: 18rem; max-width: none; height: auto; }
.mk-header__logo .wordmark { display: none; }
@media (min-width: 720px) {
    .mk-header__logo > svg { width: auto; }
    .mk-header__logo .wordmark { display: block; }
}

.mk-header__group { display: flex; align-items: center; }
.mk-header__order { display: none; }
@media (min-width: 720px) {
    .mk-header__order { display: block; }
}

/* ---- Navigation ----
   Type from the design system: the list has "menu-mobile" (full-screen menu), the bar
   .mk-header__nav "menu" (desktop); the links (label blocks) inherit it. */
.mk-navigation {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem;
    background: var(--mk-header-menu-bg, var(--color-background-nav));
    opacity: 0;
    transform: translate(100%, 0);
    transition: transform 0.2s ease-in-out, opacity 0.2s ease-in-out;
}
.mk-navigation.is-open { opacity: 1; transform: translate(0, 0); }

.mk-navigation__list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.mk-navigation .mk-links__item { position: relative; display: inline-flex; }

.mk-navigation__dot {
    position: absolute;
    z-index: -1;
    width: 6.6rem;
    height: 6.6rem;
    left: calc(50% - 3.3rem);
    background: var(--mk-header-dot, var(--color-accent-primary));
    border-radius: 50%;
}

.mk-navigation .mk-links__link {
    position: relative;
    z-index: 1;
    display: block;
    padding: 1rem;
    text-decoration: none;
    color: var(--mk-header-link-color, var(--color-font));
    transition: color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}
.mk-navigation .mk-links__link:focus { outline: none; }
.mk-navigation .mk-links__link:is(:hover, :focus-visible) { color: var(--mk-header-link-hover, var(--color-font-alt)); }

.mk-navigation__order { margin: 4rem auto 0; align-self: auto; }
.mk-navigation__order[hidden] { display: none; }

.mk-navigation__switcher {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 2rem;
    display: flex;
    justify-content: center;
}

@media (min-width: 1080px) {
    .mk-navigation {
        position: relative;
        top: auto;
        left: auto;
        right: auto;
        bottom: auto;
        padding: 0;
        background: none;
        opacity: 1;
        transform: none;
        transition: none;
    }
    .mk-navigation__list { flex-direction: row; }
    .mk-navigation .mk-links__item { margin: 0 2rem; }
    .mk-navigation__dot { left: -0.1rem; top: 1.5rem; width: 2rem; height: 2rem; }
    .mk-navigation .mk-links__link { color: var(--mk-header-link-color, var(--color-font)); }
    /* The desktop bar: the list leaves "menu-mobile" and takes "menu" from .mk-header__nav. */
    .mk-navigation__list.ts-menu-mobile { font: inherit; letter-spacing: inherit; text-transform: inherit; }
    /* Header.module.scss: "ugly override for the dark mode on hero image" */
    .mk-dark-header .mk-navigation .mk-links__link { color: var(--mk-header-link-color, var(--color-font-dark)); }
    .mk-dark-header .mk-navigation .mk-links__link:hover { color: var(--mk-header-link-hover, #000); }
    .mk-navigation__order, .mk-navigation__switcher { display: none; }
}

/* ---- Menu button ---- */
.mk-menu-button {
    position: relative;
    z-index: 11;
    margin: 0 -1rem 0 0;
    padding: 0;
    width: 4rem;
    height: 4rem;
    border: 0;
    color: inherit;
    background: transparent;
    appearance: none;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.mk-menu-button:focus { outline: none; }
@media (min-width: 720px) {
    .mk-menu-button { margin-left: 3rem; margin-right: -0.7rem; }
}
@media (min-width: 1080px) {
    .mk-menu-button { display: none; }
}
.mk-menu-button::after {
    content: '';
    position: absolute;
    top: 1.7rem;
    right: 1.8rem;
    z-index: 1;
    opacity: 0;
    width: 1rem;
    height: 0.2rem;
    background: var(--color-background-nav);
    transition: transform 0.2s ease-in-out;
}
.mk-menu-button.is-open::after { opacity: 1; transform: rotate(45deg); }
.mk-menu-button__line {
    position: absolute;
    top: 1.6rem;
    right: 1rem;
    width: 2.6rem;
    height: 0.4rem;
    border: 1px solid var(--color-font);
    background: var(--color-background-nav);
    transition: transform 0.2s ease-in-out;
    transition-property: transform, width, top;
}
.mk-menu-button.is-open .mk-menu-button__line { transform: rotate(45deg); }
.mk-menu-button__line:last-child { top: 2.4rem; width: 1.6rem; }
.mk-menu-button.is-open .mk-menu-button__line:last-child { top: 1.6rem; width: 2.6rem; transform: rotate(-45deg); }

/* ---- Mode switcher (summer / winter) ---- */
.mk-mode-switcher {
    position: relative;
    margin-right: 1.8rem;
    width: 3rem;
    height: 3rem;
    overflow: hidden;
    border-radius: 50%;
    border: 0.1rem solid var(--color-font);
    background-color: var(--color-background-form);
    transition: background-color 0.2s ease;
}
.mk-mode-switcher:hover { background-color: var(--color-accent-primary); }
.mk-mode-switcher__button {
    display: block;
    width: 100%;
    height: 100%;
    z-index: 1;
    margin: 0;
    padding: 0;
    border: 0;
    color: inherit;
    background: transparent;
    appearance: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.mk-mode-switcher__button:focus { outline: none; }
.mk-mode-switcher__icon {
    position: absolute;
    top: 50%;
    left: 50%;
    opacity: 1;
    width: 1.7rem;
    height: 1.7rem;
    color: var(--color-summer);
    transform: translate(-50%, -50%);
    transition: opacity 0.2s ease-in-out;
}
.mk-mode-switcher__icon--summer { opacity: 0; color: var(--color-summer); }
.mk-mode-switcher__icon--winter { color: var(--color-font); }
:root.dark-mode .mk-mode-switcher__icon--summer { opacity: 1; }
:root.dark-mode .mk-mode-switcher__icon--winter { opacity: 0; }

/* ---- Editable look (unset = the original) ---- */
.mk-header--full .mk-header__container { max-width: none; }
.mk-header--logo-small .mk-header__logo > svg { width: 14rem; }
.mk-header--logo-large .mk-header__logo > svg { width: 22rem; }
@media (min-width: 720px) {
    .mk-header--logo-small .mk-header__logo > svg { width: 20rem; }
    .mk-header--logo-large .mk-header__logo > svg { width: 34rem; }
}
/* The order button is a minkButton in the slot (wrapper .mk-header__order); as in the original it is a block. */
.mk-header__order > .mk-button { display: block; }
.mk-header :is(.mk-header__order > .mk-button, .mk-navigation__order) {
    color: var(--mk-header-button-color, var(--color-font));
    border-color: var(--mk-header-button-color, var(--color-font));
    background-color: var(--mk-header-button-bg, var(--color-background-form));
}
.mk-header :is(.mk-header__order > .mk-button, .mk-navigation__order):hover { background-color: var(--color-accent-primary); }

@media (prefers-reduced-motion: reduce) {
    .mk-navigation, .mk-menu-button__line, .mk-menu-button::after { transition: none; }
}
