/* ==========================================================================
   PTI — v2 mega-menu (Phase 3)
   Markup comes from pti_mega_nav() in functions.php. Panels open on hover and
   keyboard focus with CSS alone; pti-v2-menu.js adds click/tap toggles,
   Escape, outside-click closing and the current-section highlight.
   ========================================================================== */

/* ---------- Desktop bar ---------- */
.pti-nav .pti-mega {
    display: flex; align-items: stretch; gap: 4px;
    list-style: none; margin: 0; padding: 0;
}
.pti-nav .pti-mega > .pti-mega__item {
    position: relative; display: flex; align-items: center; margin: 0;
}
.pti-nav .pti-mega > .pti-mega__item.is-wide { position: static; }

body.pti .pti-mega__top {
    display: inline-flex; align-items: center; min-height: var(--pti-header-h, 68px);
    padding: 0 6px 0 12px; font: 600 15px/1 var(--pti-font-body);
    color: #0D1E30; text-decoration: none; white-space: nowrap;
}
body.pti .pti-mega__item:not(.has-panel) > .pti-mega__top { padding-right: 12px; }
body.pti .pti-mega__top:hover,
body.pti .pti-mega__item.is-open > .pti-mega__top { color: #17707F; }
body.pti .pti-mega__item.is-current > .pti-mega__top { box-shadow: inset 0 -3px 0 #C9A84C; }

body.pti .pti-mega__toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 32px; margin-right: 4px; padding: 0;
    border: 0; border-radius: 8px; background: transparent; color: #4A5868; cursor: pointer;
    font: inherit; letter-spacing: normal; text-transform: none;
}
body.pti .pti-mega__toggle:hover { background: #EEF3F7; color: #0D1E30; }
body.pti .pti-mega__toggle svg { transition: transform .2s ease; }
body.pti .pti-mega__item.is-open > .pti-mega__toggle svg { transform: rotate(180deg); }
body.pti .pti-mega__toggle:focus-visible,
body.pti .pti-mega__top:focus-visible { outline: 3px solid #17707F; outline-offset: 2px; border-radius: 6px; }

/* Panels */
.pti-mega__panel {
    display: none; position: absolute; z-index: 210;
    top: 100%; left: 0;
    min-width: 280px;
    background: #fff; border: 1px solid #DDE3EA; border-radius: 0 0 16px 16px;
    box-shadow: 0 24px 48px rgba(13, 30, 48, .16);
    font-family: var(--pti-font-body);
}
.pti-mega__item.is-wide > .pti-mega__panel {
    left: 0; right: 0; min-width: 0;
    border-radius: 0; border-left: 0; border-right: 0;
    max-height: calc(100vh - var(--pti-header-h, 68px) - 24px); overflow-y: auto;
}
.pti-mega__item.is-open > .pti-mega__panel { display: block; }
@media (hover: hover) and (min-width: 1024px) {
    .pti-mega__item:hover > .pti-mega__panel,
    .pti-mega__item:focus-within > .pti-mega__panel { display: block; }
    .pti-mega.is-dismissed .pti-mega__item:not(.is-open) > .pti-mega__panel { display: none; }
}

.pti-mega__inner { padding: 18px 20px 14px; }
.pti-mega__item.is-wide .pti-mega__inner { padding-top: 26px; padding-bottom: 18px; }
.pti-mega__grid {
    display: grid; gap: 8px 32px;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.pti-mega__item:not(.is-wide) .pti-mega__grid { display: block; }

.pti-mega__head {
    margin: 0 0 8px; padding: 6px 10px; border-radius: 8px;
    font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
}
.pti-mega__group--foundation .pti-mega__head { background: #E3F1F3; color: #0F5560; }
.pti-mega__group--physio .pti-mega__head     { background: #F6EFDC; color: #6E5414; }
.pti-mega__group--clinical .pti-mega__head   { background: #E4ECF7; color: #22497A; }
.pti-mega__group--practice .pti-mega__head   { background: #EFE8F3; color: #5A3D73; }

.pti-mega__links { list-style: none; margin: 0; padding: 0; }
.pti-mega__links li { margin: 0; padding: 0; }
.pti-mega__links li::before { content: none; }
body.pti .pti-mega__links a {
    display: block; padding: 6px 10px; border-radius: 8px;
    font: 500 14.5px/1.35 var(--pti-font-body); color: #1F2B38; text-decoration: none;
}
body.pti .pti-mega__links a:hover,
body.pti .pti-mega__links a:focus-visible { background: #EEF3F7; color: #0F5560; outline: none; }
body.pti .pti-mega__links a[aria-current="page"] { color: #0F5560; font-weight: 700; }

.pti-mega__foot {
    display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 24px;
    margin-top: 14px; padding-top: 12px; border-top: 1px solid #E4EAF1;
    font-size: 14px; color: #4A5868;
}
body.pti .pti-mega__foot a { font: 700 14.5px/1.3 var(--pti-font-body); color: #17707F; text-decoration: none; }
body.pti .pti-mega__foot a:hover { color: #0F5560; text-decoration: underline; }

/* The bar has 5 items now; tighten between 1024px and 1200px. */
@media (min-width: 1024px) and (max-width: 1199px) {
    body.pti .pti-mega__top { padding-left: 8px; font-size: 14.5px; }
}

/* ---------- Mobile drawer: accordions (the drawer is navy) ---------- */
.pti-drawer .pti-mega--drawer { list-style: none; margin: 0; padding: 0; display: block; }
.pti-drawer .pti-mega--drawer > li { margin: 0; border-bottom: 1px solid rgba(255, 255, 255, .14); }
.pti-drawer .pti-mega--drawer > li + li { border-top: 0; }
.pti-drawer .pti-mega--drawer > li::before { content: none; }
body.pti .pti-drawer .pti-mega--drawer > .pti-mega__item > .pti-mega__top {
    display: flex; min-height: 52px; padding: 0 4px; font-size: 17px; color: #fff;
}
.pti-acc summary {
    display: flex; align-items: center; justify-content: space-between;
    min-height: 52px; padding: 0 4px; cursor: pointer; list-style: none;
    font: 600 17px/1.2 var(--pti-font-body); color: #fff;
}
.pti-acc summary::-webkit-details-marker { display: none; }
.pti-acc summary::after {
    content: ""; width: 9px; height: 9px; margin-right: 6px;
    border-right: 2px solid #E0BE63; border-bottom: 2px solid #E0BE63;
    transform: rotate(45deg); transition: transform .2s ease;
}
.pti-acc details[open] > summary::after { transform: rotate(-135deg); }
.pti-acc summary:focus-visible { outline: 3px solid #E0BE63; outline-offset: 2px; border-radius: 6px; }
.pti-acc__body { padding: 0 0 14px; }
.pti-acc .pti-mega__group { margin-bottom: 10px; }
.pti-acc .pti-mega__head { background: transparent; padding: 6px 10px 2px; }
.pti-acc .pti-mega__group--foundation .pti-mega__head { color: #7FC4CF; }
.pti-acc .pti-mega__group--physio .pti-mega__head     { color: #E0BE63; }
.pti-acc .pti-mega__group--clinical .pti-mega__head   { color: #A9C4E8; }
.pti-acc .pti-mega__group--practice .pti-mega__head   { color: #CDB6E0; }
body.pti .pti-drawer .pti-acc .pti-mega__links a {
    padding: 9px 10px; font-size: 15.5px; font-weight: 400; color: #C3CFDB;
}
body.pti .pti-drawer .pti-acc .pti-mega__links a:hover,
body.pti .pti-drawer .pti-acc .pti-mega__links a:focus-visible { background: #1A3A5C; color: #fff; }
body.pti .pti-drawer .pti-acc .pti-mega__links a[aria-current="page"] { color: #fff; font-weight: 700; }
body.pti .pti-drawer .pti-acc__all {
    display: inline-block; margin: 4px 10px 0; padding: 6px 0;
    font: 700 15px/1.3 var(--pti-font-body); color: #E0BE63; text-decoration: none;
}
.pti-acc.is-current > details > summary,
body.pti .pti-drawer .pti-mega__item.is-current > .pti-mega__top { color: #E0BE63; }

@media (prefers-reduced-motion: reduce) {
    body.pti .pti-mega__toggle svg, .pti-acc summary::after { transition: none; }
}
@media print { .pti-mega__panel { display: none !important; } }

/* The old menu drew an animated underline with ::after; the mega bar uses its own. */
body.pti .pti-mega > li > .pti-mega__top::after { content: none; display: none; }
.pti-mega .screen-reader-text {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
/* Keep the right-most dropdown inside the window. */
.pti-nav .pti-mega > .pti-mega__item:last-child > .pti-mega__panel { left: auto; right: 0; }
