/* ==========================================================================
   layout.css
   Site header (desktop menu, dropdowns, sticky state, mobile menu)
   and site footer.
   ========================================================================== */

/* ---------- Header ---------- */
.ks-header {
    position: relative;
    z-index: 100;
    background: var(--ks-white);
}
.ks-header__bar {
    display: flex;
    align-items: center;
    gap: 30px;
    min-height: var(--ks-header-h);
}
.ks-header__logo { flex-shrink: 0; }
.ks-header__logo img { width: auto; height: 66px; }
@media (max-width: 767px) { .ks-header__logo img { height: 54px; } }
.ks-header__actions { display: flex; align-items: center; gap: 20px; margin-left: auto; }

/* Sticky on desktop only.
   nav.js adds .is-stuck once the page scrolls, for the soft shadow. */
@media (min-width: 1025px) {
    .ks-header { position: sticky; top: 0; transition: box-shadow 0.3s; }
    .ks-header.is-stuck { box-shadow: 0 6px 24px rgba(0, 0, 0, 0.06); }
}

/* Round icon buttons (call, menu) */
.ks-header__icon-btn {
    display: grid;
    place-items: center;
    width: 44px; height: 44px;
    border-radius: 50%;
    font-size: 20px;
    transition: background-color 0.3s;
}
.ks-header__icon-btn:hover { background: var(--ks-wine-pale); }
.ks-header__call-btn, .ks-header__menu-btn { display: none; }

/* Burger: two lines, the lower one shorter */
.ks-burger { display: grid; gap: 6px; width: 22px; justify-items: end; }
.ks-burger span { display: block; height: 1.5px; width: 100%; background: currentColor; transition: transform 0.3s, width 0.3s; }
.ks-burger span:last-child { width: 70%; }
.ks-header.is-menu-open .ks-burger span:first-child { transform: translateY(3.75px) rotate(45deg); }
.ks-header.is-menu-open .ks-burger span:last-child { width: 100%; transform: translateY(-3.75px) rotate(-45deg); }

/* ---------- Main menu (desktop) ---------- */
.ks-nav { margin-left: 45px; }
.ks-nav__list { display: flex; align-items: center; gap: 32px; list-style: none; }
.ks-nav__item { position: relative; display: flex; align-items: center; }
.ks-nav__link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 30px 0;
    font-family: var(--ks-font-ui);
    font-size: 15px;
    font-weight: 500;
    transition: color 0.3s;
}
.ks-nav__link:hover, .ks-nav__link.is-active, .ks-nav__item:hover > .ks-nav__link { color: var(--ks-wine-text); }
.ks-nav__chevron { width: 14px; height: 14px; stroke-width: 2.5; }
.ks-nav__toggle { display: none; }

/* Dropdown: opens on hover and keyboard focus (desktop) */
.ks-nav__sub {
    position: absolute;
    left: -20px;
    top: 100%;
    min-width: 240px;
    padding: 0;
    list-style: none;
    border-radius: var(--ks-radius-sm);
    background: var(--ks-white);
    box-shadow: var(--ks-shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.25s, transform 0.25s, visibility 0.25s;
}
.ks-nav__item:hover > .ks-nav__sub,
.ks-nav__item:focus-within > .ks-nav__sub { opacity: 1; visibility: visible; transform: none; }
.ks-nav__sublink {
    display: block;
    padding: 13px 20px;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.6;
    transition: background-color 0.2s, color 0.2s;
}
.ks-nav__sub li:first-child .ks-nav__sublink { border-radius: var(--ks-radius-sm) var(--ks-radius-sm) 0 0; }
.ks-nav__sub li:last-child .ks-nav__sublink { border-radius: 0 0 var(--ks-radius-sm) var(--ks-radius-sm); }
.ks-nav__sublink:hover, .ks-nav__sublink:focus-visible { background: var(--ks-wine-pale); color: var(--ks-wine-text); }

@media (max-width: 1280px) and (min-width: 1025px) {
    .ks-nav { margin-left: 10px; }
    .ks-nav__list { gap: 20px; }
    .ks-header__bar, .ks-header__actions { gap: 12px; }
}

/* ---------- Mobile / tablet header ---------- */
@media (max-width: 1024px) {
    .ks-header__phone, .ks-header__quote { display: none; }
    .ks-header__actions { gap: 10px; }
    .ks-header__icon-btn { background: var(--ks-cream); }
    .ks-header__call-btn { display: grid; background: var(--ks-gold); }
    .ks-header__menu-btn { display: grid; border-radius: 12px; }

    /* The menu becomes a panel under the header, opened by the burger */
    .ks-nav {
        position: absolute;
        left: var(--ks-edge);
        right: var(--ks-edge);
        top: calc(100% - 6px);
        margin: 0;
        max-height: calc(100vh - var(--ks-header-h) - 20px);
        overflow-y: auto;
        border: 1px solid var(--ks-wine);
        border-radius: var(--ks-radius-sm);
        background: var(--ks-white);
        display: none;
    }
    .ks-header.is-menu-open .ks-nav { display: block; }
    .ks-nav__list { flex-direction: column; align-items: stretch; gap: 0; }
    .ks-nav__item { flex-wrap: wrap; border-bottom: 1px solid var(--ks-line); }
    .ks-nav__item:last-child { border-bottom: 0; }
    .ks-nav__link { flex: 1; padding: 13px 20px; font-size: 14px; }
    .ks-nav__chevron { display: none; }
    .ks-nav__toggle {
        display: grid;
        place-items: center;
        width: 48px; height: 48px;
        font-size: 16px;
        transition: transform 0.3s;
    }
    .ks-nav__toggle[aria-expanded="true"] { transform: rotate(180deg); }
    .ks-nav__sub {
        position: static;
        flex-basis: 100%;
        display: none;
        min-width: 0;
        box-shadow: none;
        border-radius: 0;
        opacity: 1; visibility: visible; transform: none;
        background: var(--ks-cream);
    }
    .ks-nav__item.is-open > .ks-nav__sub { display: block; }
    .ks-nav__sublink { padding-left: 34px; }
    .ks-nav__sub li .ks-nav__sublink { border-radius: 0 !important; }
}

/* ---------- Footer ---------- */
.ks-footer { padding-top: var(--ks-section); }
.ks-footer__panel {
    --ks-card-bg: linear-gradient(180deg, var(--ks-wine-pale) 60%, rgba(248, 237, 238, 0) 100%);
    --ks-tilt: 0.6deg;
    margin-inline: var(--ks-edge);
    padding-top: 100px;
    border-radius: var(--ks-radius-xl) var(--ks-radius-xl) 0 0;
}
.ks-footer__top {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 40px;
    padding-bottom: 50px;
}
.ks-footer__cta { position: relative; }
.ks-footer__title { max-width: 480px; margin-bottom: 35px; font-size: var(--ks-h2); }
.ks-footer__brand img { width: auto; height: 90px; margin-bottom: 18px; }
.ks-footer__about { max-width: 300px; font-size: 15px; color: var(--ks-muted); line-height: 1.55; }

.ks-newsletter { width: 410px; max-width: 100%; }
.ks-newsletter__label { margin-bottom: 12px; }
.ks-newsletter__label::after { display: none; }
.ks-newsletter__row { display: flex; gap: 10px; }
.ks-newsletter__input { flex: 1; border-radius: 50px; border: 0; padding-inline: 16px; }
.ks-newsletter__btn { font-size: 15px; padding-inline: 30px; }
.ks-newsletter__msg { margin-top: 8px; font-size: 14px; font-weight: 400; min-height: 1em; }

.ks-footer__cols {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 40px 20px;
}
.ks-footer__col--wide { grid-column: span 2; }
/* Proximity rule: heading-to-list gap (24px) is larger than the gap between items (~9px) */
.ks-footer__head { margin-bottom: 24px; font-family: var(--ks-font-ui); font-size: 12px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: var(--ks-wine-text); }
.ks-footer__services { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.ks-footer__list { list-style: none; display: grid; gap: 9px; }
.ks-footer__list a, .ks-footer__address, .ks-hours {
    font-size: 16px;
    color: var(--ks-muted);
    line-height: 1.45;
    font-style: normal;
}
.ks-footer__list a:hover { color: var(--ks-wine-text); }
.ks-footer__phone { margin: 24px 0 18px; font-size: 15px; }
.ks-footer__email { display: block; text-decoration: underline; font-weight: 400; }
.ks-footer__email:hover { color: var(--ks-wine-text); }
.ks-hours { display: grid; grid-template-columns: auto 1fr; gap: 0 30px; margin: 0; line-height: 1.45; }
.ks-hours dd { margin: 0; }

.ks-footer__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-top: 55px;
    padding: 18px 20px;
    border-radius: var(--ks-radius-xl) var(--ks-radius-xl) 0 0;
    background: var(--ks-white);
}
.ks-footer__copy { margin: 0; font-size: 12px; font-weight: 400; color: var(--ks-muted); }
.ks-footer__copy a { margin-left: 10px; text-decoration: underline; }
.ks-socials { display: flex; gap: 10px; list-style: none; }
.ks-socials a {
    display: grid;
    place-items: center;
    width: 44px; height: 44px;
    border-radius: 50%;
    color: var(--ks-wine);
    font-size: 20px;
    transition: background-color 0.3s;
}
.ks-socials .ks-icon { fill: currentColor; }
.ks-socials a:hover { background: var(--ks-wine-pale); }

@media (max-width: 1024px) {
    .ks-footer__top { flex-direction: column; align-items: flex-start; }
    .ks-footer__cols { grid-template-columns: 1fr 1fr; }
    .ks-footer__col--wide { grid-column: 1 / -1; }
}
@media (max-width: 767px) {
    .ks-footer__panel { padding-top: 50px; }
    .ks-footer__title { max-width: 100%; }
    .ks-newsletter__row { flex-direction: column; }
    .ks-footer__cols { grid-template-columns: 1fr; }
    .ks-footer__services { grid-template-columns: 1fr; gap: 9px; }
    .ks-footer__bar { flex-direction: column-reverse; }
    .ks-footer__copy { text-align: center; }
}
