.tm-mega {
    --tm-ink: #303226;
    --tm-paper: #faf8f2;
    --tm-line: #ded8c9;
    --tm-accent: #695b3f;
    --tm-gutter: clamp(24px, 4vw, 72px);
    --tm-bar-height: 88px;
    --tm-ui: var(--tm-ink);
    --tm-stroke: var(--tm-line);
    color: var(--tm-ink);
    background-color: var(--tm-paper);
    border-bottom: 1px solid var(--tm-line);
    font-family: "tt-commons-pro", system-ui, sans-serif;
    font-weight: 300;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.tm-home-copy > .tm-mega {
    display: none;
}

.tm-mega__bar {
    display: grid;
    grid-template-columns: minmax(62px, 1fr) auto auto;
    column-gap: clamp(22px, 2.8vw, 46px);
    align-items: center;
    min-height: var(--tm-bar-height);
    padding-inline: var(--tm-gutter);
}

.tm-mega__logo {
    justify-self: start;
    display: grid;
}

.tm-mega__logo img {
    display: block;
    width: 62px;
    height: 62px;
    object-fit: contain;
    grid-area: 1 / 1;
    transition: opacity 240ms ease;
}

.tm-mega__logo-light {
    visibility: hidden;
    opacity: 0;
}

.tm-mega__items,
.tm-mega__panel {
    list-style: none;
    padding: 0;
    margin: 0;
}

.tm-mega__items {
    display: flex;
    align-items: stretch;
    column-gap: clamp(16px, 2.15vw, 38px);
}

.tm-mega__trigger {
    display: flex;
    align-items: center;
    gap: 7px;
    position: relative;
    min-height: var(--tm-bar-height);
    font-size: clamp(14px, 1.15vw, 16px);
    line-height: 1.2;
    letter-spacing: .085em;
    white-space: nowrap;
    cursor: pointer;
}

.tm-mega a:is(:link, :visited),
.tm-mega summary {
    color: inherit;
    text-decoration: none;
}

.tm-mega summary::marker {
    content: "";
}

.tm-mega summary::-webkit-details-marker {
    display: none;
}

.tm-mega summary::after {
    content: "";
    width: 6px;
    height: 6px;
    border-right: 1px solid currentColor;
    border-bottom: 1px solid currentColor;
    transform: translateY(-2px) rotate(45deg);
    transition: transform 230ms ease;
}

.tm-mega details[open] > summary::after {
    transform: translateY(2px) rotate(225deg);
}

.tm-mega__trigger::before {
    content: "";
    position: absolute;
    inset: auto 0 0;
    height: 2px;
    background-color: currentColor;
    opacity: 0;
    transition: opacity 190ms ease;
}

.tm-mega__trigger:hover::before,
.tm-mega details[open] > summary::before {
    opacity: 1;
}

.tm-mega :is(a, summary):focus-visible {
    outline: 2px solid var(--tm-ui);
    outline-offset: 4px;
}

.tm-mega__panel {
    position: absolute;
    inset: 100% 0 auto;
    --tm-ui: var(--tm-ink);
    color: var(--tm-ink);
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 302px));
    justify-content: start;
    gap: clamp(14px, 2.2vw, 34px);
    padding: 30px var(--tm-gutter) 32px;
    max-height: calc(100dvh - var(--tm-bar-height));
    overflow: auto;
    background-color: var(--tm-paper);
    border-block: 1px solid var(--tm-line);
    box-shadow: 0 18px 26px rgb(34 31 26 / 14%);
}

.tm-mega details:not([open]) > .tm-mega__panel {
    display: none;
}

.tm-mega__card {
    display: grid;
    gap: 12px;
    text-align: center;
    font: 300 clamp(18px, 1.6vw, 24px) / 1.25 "superior-title", Georgia, serif;
}

.tm-mega__card img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 5 / 3;
    object-fit: cover;
    background-color: #e9e3d6;
}

.tm-mega__card:hover span,
.tm-mega__language:hover {
    text-decoration: underline;
    text-underline-offset: .22em;
}

.tm-mega__actions {
    display: flex;
    align-items: center;
    justify-self: end;
    gap: clamp(12px, 1.4vw, 22px);
}

.tm-mega a.tm-mega__book {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 8px clamp(12px, 1.15vw, 18px);
    border-radius: 2px;
    background-color: var(--tm-book-bg, #fff);
    color: var(--tm-book-color, #3a3a3a);
    font-size: clamp(14px, 1.2vw, 16px);
    line-height: 1.2;
    text-transform: uppercase;
    white-space: nowrap;
    transition: background-color 260ms ease, color 260ms ease;
}

.tm-mega__language {
    padding: 10px 12px 10px 0;
    border-right: 1px solid var(--tm-stroke);
    font-size: 13px;
    letter-spacing: .1em;
}

#pool-bar,
#colazioni,
#vigneti,
#uliveti {
    scroll-margin-top: var(--altezza-intestazione, 100px);
}

@media (min-width: 1025px) {
    .tm-home-copy > .elementor-location-header {
        display: none;
    }

    .tm-home-copy > .tm-mega {
        --tm-ui: #fff;
        --tm-stroke: transparent;
        --tm-bar-height: clamp(88px, 7vw, 104px);
        display: block;
        position: fixed;
        inset: 0 0 auto;
        color: var(--tm-ui);
        background-color: transparent;
        border-color: var(--tm-stroke);
        transition: background-color 260ms ease, color 260ms ease, border-color 260ms ease;
    }

    .tm-home-copy > .tm-mega:is([data-scrolled], :hover, :has(.tm-mega__group[open])) {
        --tm-ui: var(--tm-ink);
        --tm-stroke: var(--tm-line);
        --tm-book-bg: #3a3a3a;
        --tm-book-color: #fff;
        background-color: var(--tm-paper);
    }

    .tm-home-copy > .tm-mega:not([data-scrolled], :hover, :has(.tm-mega__group[open])) .tm-mega__logo-light {
        visibility: visible;
        opacity: 1;
    }

    .tm-home-copy > .tm-mega:not([data-scrolled], :hover, :has(.tm-mega__group[open])) .tm-mega__logo-dark {
        visibility: hidden;
        opacity: 0;
    }

    .tm-home-copy .elementor-2 .elementor-element.elementor-element-594018c {
        --margin-top: 0px;
    }
}

@media (prefers-reduced-motion: no-preference) {
    .tm-mega[data-tm-mega-interactive] details[open] > .tm-mega__panel {
        animation: tm-mega-reveal 260ms cubic-bezier(.22, 1, .36, 1);
    }

    .tm-mega[data-tm-mega-interactive] details[data-closing] > .tm-mega__panel {
        animation: tm-mega-collapse 190ms ease-in both;
        pointer-events: none;
    }
}

@keyframes tm-mega-reveal {
    from {
        clip-path: inset(0 0 100% 0);
        opacity: 0;
    }
    to {
        clip-path: inset(0);
        opacity: 1;
    }
}

@keyframes tm-mega-collapse {
    from {
        clip-path: inset(0);
        opacity: 1;
    }
    to {
        clip-path: inset(0 0 100% 0);
        opacity: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tm-home-copy > .tm-mega,
    .tm-mega__logo img,
    .tm-mega a.tm-mega__book,
    .tm-mega__trigger::before,
    .tm-mega summary::after {
        transition: none;
    }
}

.tm-mega-editor[open] {
    width: min(100%, 1200px);
    max-width: 100%;
    max-height: 100%;
    margin: 0 auto;
    padding: 0;
    border: 0;
}

.tm-mega-editor .tm-mega__bar,
.tm-mega-editor .tm-mega__items {
    display: block;
}

.tm-mega-editor .tm-mega__trigger {
    min-height: 52px;
}

.tm-mega-editor .tm-mega__panel {
    position: static;
    grid-auto-flow: row;
    grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr));
    max-height: none;
    padding: 16px 0;
    box-shadow: none;
}
