/**
 * Phantom Protocol Header
 * A distinctive, premium cybersecurity navigation system
 * Design: Refined obsidian with cyan precision accents
 */

/* ========================================
   FONTS & VARIABLES
   ======================================== */
@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;500;600;700&display=swap');

:root {
    /* Core palette */
    --phantom-black: #0a0a0f;
    --phantom-dark: #12121a;
    --phantom-slate: #1a1a24;
    --phantom-gray: #2a2a38;

    /* Accent colors */
    --phantom-cyan: #00d4ff;
    --phantom-cyan-dim: rgba(0, 212, 255, 0.15);
    --phantom-cyan-glow: rgba(0, 212, 255, 0.4);
    --phantom-teal: #00ffcc;
    --phantom-amber: #ffb800;

    /* Text */
    --phantom-text: #e8e8ed;
    --phantom-text-dim: rgba(232, 232, 237, 0.6);

    /* Transitions */
    --phantom-ease: cubic-bezier(0.4, 0, 0.2, 1);
    --phantom-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Spacing */
    --phantom-header-height: 80px;
    --phantom-header-height-scrolled: 64px;
}

/* No scroll when mobile menu open */
body.phantom-no-scroll {
    overflow: hidden;
}

/* ========================================
   HEADER BASE
   ======================================== */
.phantom-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    font-family: 'Sora', -apple-system, BlinkMacSystemFont, sans-serif;
}

.phantom-header__inner {
    background: linear-gradient(180deg,
        rgba(10, 10, 15, 0.98) 0%,
        rgba(18, 18, 26, 0.95) 100%
    );
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(0, 212, 255, 0.08);
    transition: all 0.4s var(--phantom-ease);
}

/* Subtle noise texture overlay */
.phantom-header__inner::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    opacity: 0.015;
    pointer-events: none;
}

/* Scrolled state */
.phantom-header.is-scrolled .phantom-header__inner {
    box-shadow:
        0 4px 30px rgba(0, 0, 0, 0.4),
        0 0 60px rgba(0, 212, 255, 0.03);
}

.phantom-header__container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    height: var(--phantom-header-height);
    transition: height 0.4s var(--phantom-ease);
}

.phantom-header.is-scrolled .phantom-header__container {
    height: var(--phantom-header-height-scrolled);
}

/* ========================================
   LOGO
   ======================================== */
.phantom-header__logo {
    position: relative;
    display: flex;
    align-items: center;
    z-index: 10;
    text-decoration: none;
}

.phantom-header__logo-img {
    height: 44px;
    width: auto;
    transition: all 0.3s var(--phantom-ease);
    opacity: 0.95;
}

.phantom-header__logo:hover .phantom-header__logo-img {
    opacity: 1;
}

.phantom-header.is-scrolled .phantom-header__logo-img {
    height: 36px;
}

/* ========================================
   DESKTOP NAVIGATION
   ======================================== */
.phantom-nav {
    display: none;
}

@media (min-width: 992px) {
    .phantom-nav {
        display: flex;
        align-items: center;
    }
}

.phantom-nav__list {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.phantom-nav__item {
    position: relative;
}

.phantom-nav__link {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.75rem 1.25rem;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--phantom-text);
    text-decoration: none;
    background: transparent;
    border: none;
    cursor: pointer;
    position: relative;
    transition: color 0.3s var(--phantom-ease);
}

.phantom-nav__link-text {
    position: relative;
    z-index: 2;
}

/* Loading bar underline effect */
.phantom-nav__link-bar {
    position: absolute;
    bottom: 4px;
    left: 1.25rem;
    right: 1.25rem;
    height: 2px;
    background: var(--phantom-gray);
    border-radius: 2px;
    overflow: hidden;
}

.phantom-nav__link-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--phantom-cyan), var(--phantom-teal));
    border-radius: 2px;
    transition: width 0.4s var(--phantom-ease);
    box-shadow: 0 0 8px var(--phantom-cyan-glow);
}

.phantom-nav__link:hover .phantom-nav__link-bar::after,
.phantom-nav__item.is-active .phantom-nav__link-bar::after {
    width: 100%;
}

.phantom-nav__item.is-active .phantom-nav__link {
    color: var(--phantom-cyan);
}

/* Chevron for dropdown */
.phantom-nav__chevron {
    width: 16px;
    height: 16px;
    stroke: var(--phantom-text-dim);
    transition: all 0.3s var(--phantom-ease);
}

.phantom-nav__item--dropdown:hover .phantom-nav__chevron,
.phantom-nav__item--dropdown.is-open .phantom-nav__chevron {
    stroke: var(--phantom-cyan);
    transform: rotate(180deg);
}

/* ========================================
   MEGA MENU
   ======================================== */
.phantom-mega {
    position: absolute;
    top: calc(100% + 16px);
    left: 50%;
    transform: translateX(-50%);
    width: 900px;
    max-width: calc(100vw - 4rem);
    padding-top: 0;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.4s var(--phantom-ease);
}

/* Arrow pointer */
.phantom-mega::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 16px;
    height: 16px;
    background: var(--phantom-slate);
    border-top: 1px solid rgba(0, 212, 255, 0.15);
    border-left: 1px solid rgba(0, 212, 255, 0.15);
    z-index: 2;
}

.phantom-nav__item--dropdown.is-open .phantom-mega,
.phantom-nav__item--dropdown:hover .phantom-mega {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
    transform: translateX(-50%) translateY(0);
}

.phantom-mega__backdrop {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg,
        var(--phantom-slate) 0%,
        var(--phantom-dark) 100%
    );
    border: 1px solid rgba(0, 212, 255, 0.12);
    border-radius: 16px;
    box-shadow:
        0 25px 80px rgba(0, 0, 0, 0.5),
        0 0 100px rgba(0, 212, 255, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.03);
    overflow: hidden;
}

/* Subtle grid pattern */
.phantom-mega__backdrop::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(0, 212, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 212, 255, 0.02) 1px, transparent 1px);
    background-size: 40px 40px;
    opacity: 0.5;
}

.phantom-mega__container {
    position: relative;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    padding: 2rem;
    z-index: 2;
}

/* Column dividers */
.phantom-mega__column {
    position: relative;
    padding: 0 1.5rem;
}

.phantom-mega__column:not(:last-child)::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 1px;
    background: linear-gradient(180deg,
        transparent 0%,
        rgba(0, 212, 255, 0.15) 20%,
        rgba(0, 212, 255, 0.15) 80%,
        transparent 100%
    );
}

.phantom-mega__column:first-child {
    padding-left: 0;
}

.phantom-mega__column:last-child {
    padding-right: 0;
}

/* Headers */
.phantom-mega__header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.phantom-mega__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--phantom-cyan-dim);
    border: 1px solid rgba(0, 212, 255, 0.2);
    transition: all 0.3s var(--phantom-ease);
}

.phantom-mega__icon svg {
    width: 18px;
    height: 18px;
    stroke: var(--phantom-cyan);
}

.phantom-mega__icon--core {
    background: rgba(0, 212, 255, 0.1);
    border-color: rgba(0, 212, 255, 0.2);
}

.phantom-mega__icon--security {
    background: rgba(0, 255, 204, 0.1);
    border-color: rgba(0, 255, 204, 0.2);
}

.phantom-mega__icon--security svg {
    stroke: var(--phantom-teal);
}

.phantom-mega__icon--specialized {
    background: rgba(255, 184, 0, 0.1);
    border-color: rgba(255, 184, 0, 0.2);
}

.phantom-mega__icon--specialized svg {
    stroke: var(--phantom-amber);
}

.phantom-mega__title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--phantom-text);
}

/* Links */
.phantom-mega__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.phantom-mega__link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--phantom-text-dim);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.25s var(--phantom-ease);
    position: relative;
}

.phantom-mega__link-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--phantom-gray);
    transition: all 0.25s var(--phantom-ease);
    flex-shrink: 0;
}

.phantom-mega__link:hover {
    color: var(--phantom-text);
    background: rgba(0, 212, 255, 0.06);
    padding-left: 1rem;
}

.phantom-mega__link:hover .phantom-mega__link-dot {
    background: var(--phantom-cyan);
    box-shadow: 0 0 8px var(--phantom-cyan-glow);
}

/* Staggered animation */
.phantom-nav__item--dropdown.is-open .phantom-mega__column,
.phantom-nav__item--dropdown:hover .phantom-mega__column {
    animation: megaFadeIn 0.4s var(--phantom-ease) forwards;
}

.phantom-nav__item--dropdown.is-open .phantom-mega__column:nth-child(2),
.phantom-nav__item--dropdown:hover .phantom-mega__column:nth-child(2) {
    animation-delay: 0.05s;
}

.phantom-nav__item--dropdown.is-open .phantom-mega__column:nth-child(3),
.phantom-nav__item--dropdown:hover .phantom-mega__column:nth-child(3) {
    animation-delay: 0.1s;
}

@keyframes megaFadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   CONTACT CTA BUTTON
   ======================================== */
.phantom-cta {
    display: none;
    position: relative;
    padding: 0.75rem 1.75rem;
    font-family: 'Sora', sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--phantom-black);
    text-decoration: none;
    overflow: hidden;
    border-radius: 8px;
    transition: all 0.4s var(--phantom-ease);
}

@media (min-width: 992px) {
    .phantom-cta {
        display: inline-flex;
        align-items: center;
        gap: 0.5rem;
    }
}

.phantom-cta__bg {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--phantom-cyan) 0%, var(--phantom-teal) 100%);
    z-index: 1;
    transition: transform 0.4s var(--phantom-ease);
}

.phantom-cta__border {
    position: absolute;
    inset: 0;
    border: 2px solid transparent;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--phantom-cyan), var(--phantom-teal)) border-box;
    -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.4s var(--phantom-ease);
    z-index: 1;
}

.phantom-cta__text,
.phantom-cta__arrow {
    position: relative;
    z-index: 2;
}

.phantom-cta__arrow {
    width: 18px;
    height: 18px;
    transition: transform 0.3s var(--phantom-ease);
}

.phantom-cta:hover {
    color: var(--phantom-cyan);
}

.phantom-cta:hover .phantom-cta__bg {
    transform: translateY(100%);
}

.phantom-cta:hover .phantom-cta__border {
    opacity: 1;
}

.phantom-cta:hover .phantom-cta__arrow {
    transform: translateX(4px);
}

/* Pulse animation on button */
.phantom-cta::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--phantom-cyan), var(--phantom-teal));
    opacity: 0;
    z-index: 0;
    animation: ctaPulse 2s ease-out infinite;
}

@keyframes ctaPulse {
    0%, 100% {
        opacity: 0;
        transform: scale(1);
    }
    50% {
        opacity: 0.2;
        transform: scale(1.02);
    }
}

/* ========================================
   MOBILE TOGGLE
   ======================================== */
.phantom-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 0;
    background: rgba(0, 212, 255, 0.05);
    border: 1px solid rgba(0, 212, 255, 0.15);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s var(--phantom-ease);
    z-index: 10;
}

@media (min-width: 992px) {
    .phantom-toggle {
        display: none;
    }
}

.phantom-toggle:hover {
    background: rgba(0, 212, 255, 0.1);
    border-color: rgba(0, 212, 255, 0.3);
}

.phantom-toggle__line {
    width: 22px;
    height: 2px;
    background: var(--phantom-text);
    border-radius: 2px;
    transition: all 0.4s var(--phantom-ease);
    transform-origin: center;
}

/* Open state */
.phantom-header.mobile-open .phantom-toggle {
    background: rgba(0, 212, 255, 0.15);
    border-color: var(--phantom-cyan);
}

.phantom-header.mobile-open .phantom-toggle__line {
    background: var(--phantom-cyan);
}

.phantom-header.mobile-open .phantom-toggle__line--top {
    transform: rotate(45deg) translate(5px, 5px);
}

.phantom-header.mobile-open .phantom-toggle__line--mid {
    opacity: 0;
    transform: scaleX(0);
}

.phantom-header.mobile-open .phantom-toggle__line--bot {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* ========================================
   MOBILE NAVIGATION
   ======================================== */
.phantom-mobile {
    position: fixed;
    top: var(--phantom-header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, var(--phantom-dark) 0%, var(--phantom-black) 100%);
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-20px);
    transition: all 0.4s var(--phantom-ease);
    z-index: 9998;
}

.phantom-header.mobile-open .phantom-mobile {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.phantom-mobile__nav {
    padding: 1.5rem;
}

.phantom-mobile__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.phantom-mobile__link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 1rem 1.25rem;
    font-family: 'Sora', sans-serif;
    font-size: 1rem;
    font-weight: 500;
    color: var(--phantom-text);
    text-decoration: none;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    transition: all 0.3s var(--phantom-ease);
}

.phantom-mobile__link:hover,
.phantom-mobile__link.is-active {
    background: rgba(0, 212, 255, 0.08);
    border-color: rgba(0, 212, 255, 0.2);
    color: var(--phantom-cyan);
}

.phantom-mobile__link--trigger {
    cursor: pointer;
}

.phantom-mobile__chevron {
    width: 20px;
    height: 20px;
    stroke: var(--phantom-text-dim);
    transition: all 0.3s var(--phantom-ease);
}

.phantom-mobile__item--accordion.is-open .phantom-mobile__chevron {
    transform: rotate(180deg);
    stroke: var(--phantom-cyan);
}

/* Submenu */
.phantom-mobile__submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s var(--phantom-ease);
}

.phantom-mobile__item--accordion.is-open .phantom-mobile__submenu {
    max-height: 1500px;
}

.phantom-mobile__group {
    padding: 1rem;
    margin-top: 0.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    border-left: 2px solid rgba(0, 212, 255, 0.2);
}

.phantom-mobile__group:not(:last-child) {
    margin-bottom: 0.5rem;
}

.phantom-mobile__group-title {
    display: block;
    padding: 0.5rem 0;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--phantom-cyan);
    margin-bottom: 0.5rem;
}

.phantom-mobile__sublink {
    display: block;
    padding: 0.75rem 0.75rem;
    font-size: 0.9375rem;
    color: var(--phantom-text-dim);
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.25s var(--phantom-ease);
}

.phantom-mobile__sublink:hover {
    color: var(--phantom-text);
    background: rgba(0, 212, 255, 0.06);
    padding-left: 1rem;
}

/* Mobile CTA */
.phantom-mobile__item--cta {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.phantom-mobile__cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    padding: 1rem;
    font-family: 'Sora', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    color: var(--phantom-black);
    text-decoration: none;
    background: linear-gradient(135deg, var(--phantom-cyan) 0%, var(--phantom-teal) 100%);
    border-radius: 12px;
    transition: all 0.3s var(--phantom-ease);
}

.phantom-mobile__cta svg {
    width: 20px;
    height: 20px;
    transition: transform 0.3s var(--phantom-ease);
}

.phantom-mobile__cta:hover svg {
    transform: translateX(4px);
}

/* ========================================
   RESPONSIVE ADJUSTMENTS
   ======================================== */
@media (max-width: 1199px) {
    .phantom-mega {
        width: 720px;
    }
}

@media (max-width: 991px) {
    :root {
        --phantom-header-height: 72px;
    }

    .phantom-header__container {
        padding: 0 1.25rem;
    }

    .phantom-header__logo-img {
        height: 40px;
    }
}

@media (max-width: 576px) {
    :root {
        --phantom-header-height: 64px;
    }

    .phantom-header__logo-img {
        height: 36px;
    }

    .phantom-mobile__nav {
        padding: 1rem;
    }

    .phantom-mobile__link {
        padding: 0.875rem 1rem;
        font-size: 0.9375rem;
    }
}

/* ========================================
   ACCESSIBILITY
   ======================================== */
.phantom-nav__link:focus-visible,
.phantom-mega__link:focus-visible,
.phantom-cta:focus-visible,
.phantom-toggle:focus-visible,
.phantom-mobile__link:focus-visible {
    outline: 2px solid var(--phantom-cyan);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ========================================
   PAGE SPACING FOR FIXED HEADER
   ======================================== */
body.phantom-header-active {
    padding-top: var(--phantom-header-height);
}

@media (max-width: 991px) {
    body.phantom-header-active {
        padding-top: 72px;
    }
}

@media (max-width: 576px) {
    body.phantom-header-active {
        padding-top: 64px;
    }
}
