/* =====================================================================
   Pro AF — Global floating nav
   Top-center capsule, magnetic morphing pill indicator.
   - Pill defaults to the active page
   - On hover any item, pill smoothly slides to that item (preview)
   - On mouseleave the nav, pill snaps back to active
   - Mobile: hamburger → slide-down drawer
   ===================================================================== */

.proaf-nav {
    position: fixed;
    top: 16px;
    left: 0;
    right: 0;
    z-index: 9000;
    display: flex;
    justify-content: center;
    pointer-events: none;
    /* prevent layout shift on load */
    contain: layout;
}
.proaf-nav-inner {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 6px 6px 6px 16px;
    border-radius: 50px;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35), 0 2px 6px rgba(0, 0, 0, 0.25);
    max-width: calc(100vw - 32px);
}
html[data-theme="refresh"] .proaf-nav-inner {
    background: rgba(255, 255, 255, 0.82);
    border-color: rgba(15, 23, 42, 0.08);
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12), 0 2px 6px rgba(15, 23, 42, 0.06);
}

/* Logo */
.proaf-nav-logo {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: inherit;
    padding: 4px 0;
    flex-shrink: 0;
}
.proaf-nav-logo .logo-mark {
    width: 26px; height: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00ffff, #ff00ff);
    color: #050505;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: 'Bricolage Grotesque', 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: -0.02em;
}
html[data-theme="refresh"] .proaf-nav-logo .logo-mark {
    background: linear-gradient(135deg, #3B82F6, #EC4899);
    color: #ffffff;
}
.proaf-nav-logo .logo-text {
    font-family: 'Bricolage Grotesque', 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: -0.01em;
    color: #ffffff;
}
html[data-theme="refresh"] .proaf-nav-logo .logo-text { color: #0F172A; }

/* Items wrapper — anchor for the morphing pill */
.proaf-nav-items {
    position: relative;
    display: flex;
    gap: 2px;
    padding: 2px;
    border-radius: 50px;
    background: rgba(255, 255, 255, 0.03);
}
html[data-theme="refresh"] .proaf-nav-items { background: rgba(15, 23, 42, 0.04); }

/* The morphing pill — absolutely positioned, JS sets left+width */
.proaf-nav-pill {
    position: absolute;
    top: 2px;
    left: 0;
    width: 0;
    height: calc(100% - 4px);
    border-radius: 50px;
    background: linear-gradient(135deg, rgba(0, 255, 255, 0.28), rgba(255, 0, 255, 0.22));
    border: 1px solid rgba(0, 255, 255, 0.35);
    box-shadow: 0 4px 16px rgba(0, 255, 255, 0.2);
    transition: left 0.4s cubic-bezier(0.34, 1.36, 0.64, 1),
                width 0.4s cubic-bezier(0.34, 1.36, 0.64, 1),
                opacity 0.25s ease;
    pointer-events: none;
    z-index: 0;
    opacity: 1;
}
html[data-theme="refresh"] .proaf-nav-pill {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.18), rgba(236, 72, 153, 0.14));
    border-color: rgba(59, 130, 246, 0.35);
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.18);
}

/* Hide pill until JS has positioned it (avoids FOUC) */
.proaf-nav-items:not(.pill-ready) .proaf-nav-pill { opacity: 0; }

/* Items themselves */
.proaf-nav-item {
    position: relative;
    z-index: 1;
    padding: 8px 16px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.72);
    text-decoration: none;
    transition: color 0.2s ease;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}
.proaf-nav-item:hover { color: #ffffff; }
.proaf-nav-item.is-active { color: #ffffff; font-weight: 600; }
html[data-theme="refresh"] .proaf-nav-item { color: rgba(15, 23, 42, 0.72); }
html[data-theme="refresh"] .proaf-nav-item:hover,
html[data-theme="refresh"] .proaf-nav-item.is-active { color: #0F172A; }

/* Mobile theme toggle button (sits inside the nav capsule on mobile only) */
.proaf-nav-theme {
    display: none;
    width: 36px; height: 36px;
    border: none;
    background: transparent;
    color: inherit;
    cursor: pointer;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    padding: 0;
}
.proaf-nav-theme:hover { background: rgba(255, 255, 255, 0.08); }
html[data-theme="refresh"] .proaf-nav-theme:hover { background: rgba(15, 23, 42, 0.06); }
.proaf-nav-theme svg {
    width: 18px; height: 18px;
    fill: #ffffff;
    pointer-events: none;
}
html[data-theme="refresh"] .proaf-nav-theme svg { fill: #0F172A; }
.proaf-nav-theme .icon-sun,
.proaf-nav-theme .icon-moon { display: none; }
html[data-theme="refresh"] .proaf-nav-theme .icon-moon { display: block; }
html:not([data-theme="refresh"]) .proaf-nav-theme .icon-sun { display: block; }

/* Mobile hamburger button — hidden on desktop */
.proaf-nav-mobile-btn {
    display: none;
    width: 36px; height: 36px;
    border: none;
    background: transparent;
    color: inherit;
    cursor: pointer;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    margin-right: 2px;
}
.proaf-nav-mobile-btn:hover { background: rgba(255, 255, 255, 0.08); }
html[data-theme="refresh"] .proaf-nav-mobile-btn:hover { background: rgba(15, 23, 42, 0.06); }
.proaf-nav-mobile-btn svg {
    width: 18px; height: 18px;
    fill: #ffffff;
    transition: transform 0.25s ease;
}
html[data-theme="refresh"] .proaf-nav-mobile-btn svg { fill: #0F172A; }
.proaf-nav-mobile-btn[aria-expanded="true"] svg { transform: rotate(90deg); }

/* Mobile drawer (slide-down full list) */
.proaf-nav-drawer {
    position: fixed;
    top: 0; left: 0; right: 0;
    background: rgba(15, 23, 42, 0.96);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(16px);
    padding: 76px 24px 24px;
    z-index: 8999;
    transform: translateY(-100%);
    transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
    display: flex;
    flex-direction: column;
    gap: 4px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.4);
}
html[data-theme="refresh"] .proaf-nav-drawer {
    background: rgba(255, 255, 255, 0.98);
    border-bottom-color: rgba(15, 23, 42, 0.08);
}
.proaf-nav-drawer.open { transform: translateY(0); }
.proaf-nav-drawer .proaf-nav-item {
    padding: 14px 18px;
    border-radius: 12px;
    font-size: 1rem;
    background: transparent;
}
.proaf-nav-drawer .proaf-nav-item:hover,
.proaf-nav-drawer .proaf-nav-item.is-active {
    background: rgba(255, 255, 255, 0.06);
}
html[data-theme="refresh"] .proaf-nav-drawer .proaf-nav-item:hover,
html[data-theme="refresh"] .proaf-nav-drawer .proaf-nav-item.is-active {
    background: rgba(59, 130, 246, 0.08);
}

/* Backdrop behind drawer */
.proaf-nav-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: 8998;
}
.proaf-nav-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

/* Mobile breakpoint — hide desktop items, show hamburger + theme toggle */
@media (max-width: 720px) {
    .proaf-nav-items { display: none; }
    .proaf-nav-mobile-btn { display: inline-flex; }
    .proaf-nav-theme { display: inline-flex; }
    .proaf-nav-inner { padding: 6px 4px 6px 14px; gap: 6px; }
    .proaf-nav-logo .logo-text { font-size: 0.88rem; }
    /* The floating bottom-right toggle moves into the nav on mobile */
    .theme-toggle { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
    .proaf-nav-pill { transition: opacity 0.2s ease !important; }
    .proaf-nav-drawer { transition: none; }
}

/* When body has data attr to hide nav (used on portal demo) */
body[data-hide-nav="true"] .proaf-nav,
body[data-hide-nav="true"] .proaf-nav-drawer,
body[data-hide-nav="true"] .proaf-nav-backdrop { display: none !important; }

/* =====================================================================
   Pro AF — Hero logo stage
   The logos.webp file is chrome text baked onto solid black. We:
   - Classic theme: mix-blend-mode: screen knocks the black bg out so
     only the chrome shows against the dark page.
   - Refresh theme: filter: invert flips it so the rectangle disappears
     into the white page and the chrome reads as dark engraved text.
   Wrapper pseudo-elements provide the orbit ring + radial halo so the
   logo feels alive without needing a transparent source image.
   ===================================================================== */

.proaf-logo-hero {
    position: relative;
    display: inline-flex;
    padding: 26px 32px;
    border-radius: 20px;
    isolation: isolate;
    cursor: default;
}

/* Conic-gradient halo behind logo. Static (no rotation) — Chrome will sometimes
   re-rasterize a blurred + rotated layer instead of caching, which spikes paint
   cost on busy pages. Reducing blur from 28px → 18px also drops raster cost. */
.proaf-logo-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    z-index: -2;
    background: conic-gradient(
        from 0deg,
        rgba(0, 255, 255, 0)    0%,
        rgba(0, 255, 255, 0.55) 20%,
        rgba(255, 0, 255, 0.55) 38%,
        rgba(0, 0, 0, 0)        50%,
        rgba(255, 0, 255, 0.55) 70%,
        rgba(0, 255, 255, 0.55) 88%,
        rgba(0, 255, 255, 0)    100%
    );
    filter: blur(18px);
    opacity: 0.6;
    pointer-events: none;
}

/* Soft inner radial halo — pulses slowly */
.proaf-logo-hero::after {
    content: '';
    position: absolute;
    inset: 8px;
    border-radius: 14px;
    z-index: -1;
    background: radial-gradient(
        ellipse at center,
        rgba(0, 255, 255, 0.28) 0%,
        rgba(255, 0, 255, 0.16) 45%,
        transparent 75%
    );
    animation: logo-pulse 4.2s ease-in-out infinite;
    pointer-events: none;
}

.proaf-logo-hero img {
    position: relative;
    z-index: 1;
    display: block;
    filter: none;
    animation: logo-float 5.4s ease-in-out infinite;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Classic: screen blend removes the baked-black background */
html:not([data-theme="refresh"]) .proaf-logo-hero img {
    mix-blend-mode: screen;
}

/* Refresh: invert turns chrome-on-black into dark-on-white so the
   rectangle vanishes into the bright page */
html[data-theme="refresh"] .proaf-logo-hero img {
    filter: invert(1) hue-rotate(180deg) saturate(0.85);
}
html[data-theme="refresh"] .proaf-logo-hero::before {
    background: conic-gradient(
        from 0deg,
        rgba(59, 130, 246, 0)    0%,
        rgba(59, 130, 246, 0.6)  20%,
        rgba(236, 72, 153, 0.55) 38%,
        rgba(255, 255, 255, 0)   50%,
        rgba(163, 230, 53, 0.5)  70%,
        rgba(59, 130, 246, 0.6)  88%,
        rgba(59, 130, 246, 0)    100%
    );
    filter: blur(22px);
    opacity: 0.5;
}
html[data-theme="refresh"] .proaf-logo-hero::after {
    background: radial-gradient(
        ellipse at center,
        rgba(59, 130, 246, 0.22) 0%,
        rgba(236, 72, 153, 0.12) 45%,
        transparent 75%
    );
}

.proaf-logo-hero:hover img {
    transform: translateY(-6px) scale(1.025);
}

@keyframes logo-orbit {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}
@keyframes logo-float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-6px); }
}
@keyframes logo-pulse {
    0%, 100% { opacity: 0.55; transform: scale(1); }
    50%      { opacity: 0.95; transform: scale(1.05); }
}

@media (prefers-reduced-motion: reduce) {
    .proaf-logo-hero img,
    .proaf-logo-hero::before,
    .proaf-logo-hero::after {
        animation: none !important;
    }
    .proaf-logo-hero:hover img { transform: none; }
}

@media (max-width: 720px) {
    .proaf-logo-hero { padding: 20px 24px; }
    .proaf-logo-hero::before { filter: blur(22px); }
}
