/* ===== Turing navbar enhancement: pill dropdowns + mobile menu =====
   Self-contained. Uses the site's design tokens (cream #F4F3EA, ink #191817,
   #403E39, border #DED6CB, hover #C9C1B2) and fonts (Inter, Tiempos Headline). */

/* The root pill carries backdrop-filter; because the dropdown panel is a DOM
   descendant of .nav-pill, that ancestor filter forms a backdrop root and the
   panel's own backdrop-filter has nothing left to blur (page shows through
   sharp). Move the pill glass to a ::before layer (a sibling, not an ancestor,
   of the panel) so .nav-pill is no longer a backdrop-filter ancestor and the
   panel blurs the page exactly like the pill. */
.nav-pill {
    position: relative;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
}
.nav-pill::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    -webkit-backdrop-filter: blur(18px) saturate(1.6);
    backdrop-filter: blur(18px) saturate(1.6);
    pointer-events: none;
    z-index: 0;
}
.nav-pill > .pill-menu { position: relative; z-index: 1; }

/* ---------- Desktop pill dropdown ---------- */
.pill-menu { position: relative; display: inline-flex; align-items: center; }

.pill-menu__trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: 0.875rem;
    line-height: 1.25rem;
    background: none;
    border: 0;
    padding: 0;
    margin: 0;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.25s ease, opacity 0.25s ease;
}

.pill-menu__trigger { position: relative; }

/* underline-grow on hover, mirroring the original nav-pill links */
.pill-menu__trigger::after {
    content: '';
    position: absolute;
    left: 0;
    right: 18px;
    bottom: -4px;
    height: 1px;
    background: currentColor;
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}
.pill-menu__trigger:hover::after,
.pill-menu.is-open .pill-menu__trigger::after { transform: scaleX(1); }
#header .pill-menu__trigger:hover { color: #C9C1B2; opacity: 1; }

/* "+" icon (Font Awesome) — rotates 180° when the dropdown opens */
.pill-menu__plus {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.pill-menu.is-open .pill-menu__plus { transform: rotate(180deg); }

.pill-menu__panel {
    position: absolute;
    top: calc(100% + 16px);
    left: 50%;
    min-width: 340px;
    /* mirror the root navbar pill — over dark sections: transparent glass,
       faint light border, blur. The on-light variants below flip it for
       light sections, exactly like .nav-pill / #header.on-light .nav-pill */
    background: transparent;
    -webkit-backdrop-filter: blur(18px) saturate(1.6);
    backdrop-filter: blur(18px) saturate(1.6);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 12px;
    box-shadow: 0 24px 60px -22px rgba(0, 0, 0, 0.45);
    padding: 8px;
    opacity: 0;
    transform: translateX(-50%) translateY(-8px);
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                visibility 0s linear 0.35s;
    z-index: 1000;
}

.pill-menu.is-open .pill-menu__panel {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    visibility: visible;
    pointer-events: auto;
    transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                visibility 0s linear 0s;
}

/* over light sections the header gets .on-light — flip the panel to the
   same light glass the root pill uses (#header.on-light .nav-pill) */
#header.on-light .pill-menu__panel {
    background: rgba(255, 255, 255, 0.35);
    border-color: rgba(25, 24, 23, 0.22);
    box-shadow: 0 24px 60px -24px rgba(25, 24, 23, 0.2);
}

/* invisible bridge so the cursor can travel from trigger to panel */
.pill-menu__panel::before {
    content: '';
    position: absolute;
    top: -16px;
    left: 0;
    right: 0;
    height: 16px;
}

.pill-menu__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 16px;
    border-radius: 8px;
    text-decoration: none;
    transition: background-color 0.2s ease;
}

.pill-menu__item + .pill-menu__item { margin-top: 8px; }

.pill-menu__item:hover { background-color: rgba(255, 255, 255, 0.08); }
.pill-menu__item.is-active { background-color: rgba(255, 255, 255, 0.06); }

.pill-menu__item-content { display: flex; flex-direction: column; gap: 4px; min-width: 0; }

.pill-menu__item-title {
    font-family: 'Tiempos Headline', 'Times New Roman', serif;
    font-weight: 300;
    font-size: 18px;
    color: #F4F3EA;
    line-height: 1.2;
}

.pill-menu__item-desc {
    font-family: 'Inter', sans-serif;
    font-weight: 300;
    font-size: 11px;
    color: rgba(244, 243, 234, 0.62);
    line-height: 1.4;
}

.pill-menu__item-arrow {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 0;
    transform: translateY(6px) scaleY(0);
    transform-origin: bottom;
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.pill-menu__item-arrow path { fill: rgba(244, 243, 234, 0.8); }

.pill-menu__item:hover .pill-menu__item-arrow { opacity: 1; transform: translateY(0) scaleY(1); }

/* light-section text/hover, matching the root navbar's on-light treatment */
#header.on-light .pill-menu__item:hover { background-color: rgba(25, 24, 23, 0.06); }
#header.on-light .pill-menu__item.is-active { background-color: rgba(25, 24, 23, 0.05); }
#header.on-light .pill-menu__item-title { color: #191817; }
#header.on-light .pill-menu__item-desc { color: #403E39; }
#header.on-light .pill-menu__item-arrow path { fill: #403E39; }

/* ---------- Mobile hamburger + slide-in menu ---------- */
.nav-burger {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 34px;
    height: 34px;
    padding: 7px;
    margin-left: 10px;
    background: none;
    border: 0;
    cursor: pointer;
}

.nav-burger span {
    display: block;
    height: 1.5px;
    width: 100%;
    background: currentColor;
    border-radius: 2px;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
}

.nav-burger.is-open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.nav-burger.is-open span:nth-child(2) { opacity: 0; }
.nav-burger.is-open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

@media (min-width: 768px) { .nav-burger { display: none; } }

.mnav {
    position: fixed;
    inset: 0;
    z-index: 1090;
    background: rgba(25, 24, 23, 0.78);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}

.mnav.is-open { opacity: 1; visibility: visible; transition: opacity 0.3s ease; }

.mnav__sheet {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: min(86vw, 360px);
    background: #F4F3EA;
    box-shadow: -20px 0 60px -20px rgba(0, 0, 0, 0.5);
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    padding: calc(env(safe-area-inset-top) + 20px) 22px 28px;
    overflow-y: auto;
}

.mnav.is-open .mnav__sheet { transform: translateX(0); }

.mnav__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.mnav__close { background: none; border: 0; cursor: pointer; width: 40px; height: 40px; color: #191817; font-size: 26px; line-height: 1; }

.mnav__group { border-top: 1px solid #DED6CB; padding: 14px 0; }

.mnav__label {
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #706D66;
    margin-bottom: 8px;
}

.mnav__item {
    display: block;
    text-decoration: none;
    padding: 9px 0;
    font-family: 'Tiempos Headline', 'Times New Roman', serif;
    font-weight: 300;
    font-size: 20px;
    color: #191817;
}

.mnav__item.is-active { position: relative; padding-left: 14px; }
.mnav__item.is-active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 16px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #191817;
}

.mnav__item-desc {
    display: block;
    font-family: 'Inter', sans-serif;
    font-weight: 300;
    font-size: 11px;
    color: #706D66;
    margin-top: 2px;
}

.mnav__cta { display: flex; flex-direction: column; gap: 10px; margin-top: auto; padding-top: 20px; }

.mnav__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 13px 18px;
    border-radius: 6px;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: 0.9rem;
    text-decoration: none;
    border: 1px solid #191817;
    color: #191817;
    background: transparent;
    transition: all 0.25s ease;
}

.mnav__btn--primary { background: #191817; color: #F4F3EA; }
.mnav__btn--ghost { border-color: transparent; color: #706D66; }

body.mnav-open { overflow: hidden; }
