/**
 * MEP Details Custom Stylesheet
 */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
    --primary-blue: #0077c8;
    --primary-navy: #002e6e;
    --accent-orange: #f05423;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #1e293b;
    background-color: #f8fafc;
    -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.no-scrollbar::-webkit-scrollbar {
    display: none;
}
.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.glassmorphism {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 0 15px rgba(240, 84, 35, 0.4);
    }
    50% {
        box-shadow: 0 0 30px rgba(240, 84, 35, 0.8);
    }
}

.pulse-orange-glow {
    animation: pulseGlow 2.5s infinite ease-in-out;
}

/* ========================================================
   WORDPRESS PRIMARY NAVIGATION & DROPDOWN STYLING
   Resolves layout issues where sub-menus break onto hero
   ======================================================== */

.primary-nav-menu,
.primary-nav-container ul,
header nav ul.menu {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.primary-nav-menu > li,
.primary-nav-container ul > li,
header nav ul.menu > li {
    position: relative;
    list-style: none;
    margin: 0;
    padding: 0;
}

.primary-nav-menu > li > a,
.primary-nav-container ul > li > a,
header nav ul.menu > li > a {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 700;
    color: #334155;
    border-radius: 0.75rem;
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    white-space: nowrap;
}

.primary-nav-menu > li > a:hover,
.primary-nav-container ul > li > a:hover,
header nav ul.menu > li > a:hover {
    color: #0077c8;
    background-color: rgba(0, 119, 200, 0.08);
}

.primary-nav-menu > li.current-menu-item > a,
.primary-nav-menu > li.current-menu-ancestor > a {
    color: #0077c8;
    background-color: rgba(0, 119, 200, 0.08);
}

/* Fallback chevron arrow for menu-item-has-children without walker */
.primary-nav-menu > li.menu-item-has-children > a:not(:has(svg))::after {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-right: 2px solid #94a3b8;
    border-bottom: 2px solid #94a3b8;
    transform: rotate(45deg) translateY(-2px);
    margin-left: 4px;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.primary-nav-menu > li.menu-item-has-children:hover > a:not(:has(svg))::after {
    transform: rotate(-135deg) translateY(-2px);
    border-color: #0077c8;
}

/* ----------------------------------------------------
   SUB-MENU DROPDOWN CARD (Position Absolute, Floating)
   ---------------------------------------------------- */
.primary-nav-menu ul.sub-menu,
.primary-nav-menu ul.children,
.primary-nav-container ul.sub-menu,
header nav ul.sub-menu {
    position: absolute !important;
    top: calc(100% + 4px) !important;
    left: 0 !important;
    min-width: 240px !important;
    max-width: 320px !important;
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 1rem !important;
    box-shadow: 0 20px 30px -5px rgba(15, 23, 42, 0.15), 0 10px 15px -5px rgba(15, 23, 42, 0.08) !important;
    padding: 0.5rem !important;
    margin: 0 !important;
    list-style: none !important;
    display: block !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    z-index: 1000 !important;
    transform: translateY(8px) !important;
    transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.2s !important;
}

/* Safe Hover Bridge */
.primary-nav-menu ul.sub-menu::before,
header nav ul.sub-menu::before {
    content: '';
    position: absolute;
    top: -12px;
    left: 0;
    right: 0;
    height: 14px;
}

/* Show Submenu on Parent Hover / Focus */
.primary-nav-menu li:hover > ul.sub-menu,
.primary-nav-menu li:focus-within > ul.sub-menu,
.primary-nav-container li:hover > ul.sub-menu,
header nav li:hover > ul.sub-menu {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    transform: translateY(0) !important;
}

/* Submenu Items */
.primary-nav-menu ul.sub-menu li,
header nav ul.sub-menu li {
    display: block !important;
    width: 100% !important;
    margin: 0 0 2px 0 !important;
    padding: 0 !important;
    list-style: none !important;
    position: relative !important;
}

.primary-nav-menu ul.sub-menu li a,
header nav ul.sub-menu li a {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 0.5rem 0.75rem !important;
    font-size: 0.8125rem !important;
    font-weight: 600 !important;
    color: #334155 !important;
    border-radius: 0.625rem !important;
    text-decoration: none !important;
    transition: all 0.15s ease !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.primary-nav-menu ul.sub-menu li a:hover,
header nav ul.sub-menu li a:hover {
    background-color: #f0f7ff !important;
    color: #0077c8 !important;
    padding-left: 1rem !important;
}

/* Multi-tier Nested Submenu (3rd Level Flyout) */
.primary-nav-menu ul.sub-menu ul.sub-menu,
header nav ul.sub-menu ul.sub-menu {
    top: 0 !important;
    left: calc(100% + 4px) !important;
    margin-top: 0 !important;
}

/* Prevent Dropdown from overflowing viewport on right side items */
.primary-nav-menu > li:last-child > ul.sub-menu,
.primary-nav-menu > li:nth-last-child(2) > ul.sub-menu {
    right: 0 !important;
    left: auto !important;
}

/* ========================================================
   MOBILE DRAWER NAVIGATION & ACCORDION SUBMENUS
   ======================================================== */
.mobile-nav-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mobile-nav-item {
    list-style: none;
    margin: 0 0 0.25rem 0;
}

.mobile-sub-menu {
    list-style: none;
    margin: 0.25rem 0 0.5rem 0;
    transition: all 0.2s ease-in-out;
}

.mobile-sub-menu li a {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #475569;
    border-radius: 0.5rem;
    text-decoration: none;
    transition: all 0.15s ease;
}

.mobile-sub-menu li a:hover {
    background-color: #e0f2fe;
    color: #0077c8;
    padding-left: 1rem;
}

/* ========================================================
   FOOTER NAVIGATION & RESPONSIVE COLUMN STYLING
   ======================================================== */
footer ul.menu,
footer .menu {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

footer ul.menu li,
footer .menu li {
    list-style: none !important;
    margin: 0 0 0.5rem 0 !important;
    padding: 0 !important;
}

footer ul.menu li a,
footer .menu li a {
    display: inline-block;
    color: #475569;
    font-size: 0.75rem;
    text-decoration: none;
    transition: color 0.15s ease, transform 0.15s ease;
    padding: 2px 0;
}

footer ul.menu li a:hover,
footer .menu li a:hover {
    color: #0077c8;
    transform: translateX(3px);
}

.footer-legal-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    list-style: none;
    margin: 0;
    padding: 0;
}

.footer-legal-menu li {
    list-style: none;
    margin: 0;
}

.footer-legal-menu li a {
    color: #64748b;
    font-size: 0.75rem;
    text-decoration: none;
    transition: color 0.15s ease;
}

.footer-legal-menu li a:hover {
    color: #0077c8;
}

@media print {
    header, footer, #floatingChatWidget, #floatingChatBox, .calc-tab-btn, button {
        display: none !important;
    }
    body {
        background: white !important;
        color: black !important;
    }
    .sop-card, .calc-panel {
        box-shadow: none !important;
        border: 1px solid #ccc !important;
        page-break-inside: avoid;
    }
}

/* ========================================================
   NEXT-GEN HIGH-TECH ANIMATIONS & ENGINEERING BLUEPRINT GRID
   ======================================================== */

/* 1. Engineering Technical Grid Mesh */
.blueprint-mesh-grid {
    background-image: 
        linear-gradient(to right, rgba(0, 119, 200, 0.06) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(0, 119, 200, 0.06) 1px, transparent 1px);
    background-size: 32px 32px;
}

.blueprint-mesh-grid-dark {
    background-image: 
        linear-gradient(to right, rgba(0, 119, 200, 0.07) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(0, 119, 200, 0.07) 1px, transparent 1px);
    background-size: 28px 28px;
}

/* 2. Floating Ambient Glow Orbs */
@keyframes floatOrb1 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(30px, -25px) scale(1.08); }
}

@keyframes floatOrb2 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(-25px, 30px) scale(0.95); }
}

.animate-float-orb-1 {
    animation: floatOrb1 12s ease-in-out infinite;
}

.animate-float-orb-2 {
    animation: floatOrb2 15s ease-in-out infinite;
}

/* 3. Infinite Marquee Ticker for Standards */
@keyframes marqueeScroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

.marquee-container {
    display: flex;
    overflow: hidden;
    user-select: none;
    mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
}

.marquee-content {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-around;
    min-width: 100%;
    animation: marqueeScroll 35s linear infinite;
}

.marquee-container:hover .marquee-content {
    animation-play-state: paused;
}

/* 4. Button Shimmer & Glowing Aura */
@keyframes shimmerGlow {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.btn-shimmer {
    background-size: 200% auto;
    animation: shimmerGlow 4s linear infinite;
}

/* 5. 3D Tilt & Elevated Hover Cards */
.tech-card-hover {
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.3s ease;
}

.tech-card-hover:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 35px -10px rgba(0, 119, 200, 0.15), 0 10px 15px -5px rgba(0, 0, 0, 0.05);
}

/* 6. Pulse Beacon Glow */
@keyframes beaconPulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.beacon-live {
    animation: beaconPulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ========================================================
   KNOWLEDGE HUB & SINGLE ARTICLE ENHANCEMENTS
   ======================================================== */

/* Reading progress bar */
#readingProgressBar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, #0077c8, #0ea5e9, #f05423);
    z-index: 99999;
    width: 0%;
    transition: width 0.1s ease-out;
}

/* Table of Contents scrollspy active link */
.toc-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    color: #64748b;
    border-left: 2px solid transparent;
    transition: all 0.2s ease;
    text-decoration: none;
    border-radius: 0 0.5rem 0.5rem 0;
}

.toc-link:hover {
    color: #0077c8;
    background: #f1f5f9;
}

.toc-link.active {
    color: #0077c8;
    font-weight: 800;
    border-left-color: #0077c8;
    background: #e0f2fe;
}

/* Engineering Callout Boxes */
.mep-callout-code {
    border-left: 4px solid #0077c8;
    background: #f0f9ff;
    padding: 1rem 1.25rem;
    border-radius: 0 0.75rem 0.75rem 0;
    margin: 1.5rem 0;
}

.mep-callout-warning {
    border-left: 4px solid #f59e0b;
    background: #fffbeb;
    padding: 1rem 1.25rem;
    border-radius: 0 0.75rem 0.75rem 0;
    margin: 1.5rem 0;
}

.mep-callout-danger {
    border-left: 4px solid #ef4444;
    background: #fef2f2;
    padding: 1rem 1.25rem;
    border-radius: 0 0.75rem 0.75rem 0;
    margin: 1.5rem 0;
}

.mep-formula-box {
    background: #0f172a;
    color: #f8fafc;
    padding: 1.25rem;
    border-radius: 0.75rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    border: 1px solid #1e293b;
    overflow-x: auto;
    margin: 1.5rem 0;
}

/* Line clamp helpers */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Knowledge Card smooth hover */
.kb-card-fresh {
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.25s ease;
}

.kb-card-fresh:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 119, 200, 0.12), 0 8px 10px -6px rgba(0, 119, 200, 0.08);
}

/* ========================================================
   MOBILE & TABLET RESPONSIVE OVERRIDES
   ======================================================== */
@media (max-width: 639px) {
    /* Auth Modal Scrollability & Submit Protection */
    #facilitypro-auth-modal {
        padding: 0.5rem !important;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }
    #facilitypro-auth-modal > div {
        max-height: 92dvh !important;
        max-height: 92vh !important;
    }
    #facilitypro-auth-modal form {
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }
    #modal-register-submit-btn {
        min-height: 46px !important;
    }

    /* Consultation modal responsive drawer */
    #facilitypro-consultation-modal {
        -webkit-overflow-scrolling: touch;
    }
    #facilitypro-consultation-modal > div {
        max-height: 94dvh !important;
        max-height: 94vh !important;
    }

    /* Floating AI Button Mobile Safe Margin */
    #mep-floating-ai-widget {
        bottom: max(1rem, env(safe-area-inset-bottom, 1rem)) !important;
        right: max(1rem, env(safe-area-inset-right, 1rem)) !important;
    }

    /* Mobile tabs & chips */
    .scrollbar-none::-webkit-scrollbar {
        display: none !important;
    }
    .scrollbar-none {
        -ms-overflow-style: none !important;
        scrollbar-width: none !important;
    }

    /* Fast Touch Input */
    input, select, textarea, button {
        touch-action: manipulation;
        font-size: 16px; /* Prevents auto-zoom on iOS */
    }
    input[type="text"], input[type="email"], input[type="tel"], input[type="password"] {
        font-size: 14px;
    }
}

/* Tablet Optimizations (640px - 1024px) */
@media (min-width: 640px) and (max-width: 1024px) {
    #facilitypro-auth-modal > div {
        max-height: 88vh !important;
    }
    #facilitypro-consultation-modal > div {
        max-height: 88vh !important;
    }
}

/* Mobile Sticky Bottom Action Bar Safe Margins */
.mep-sticky-mobile-bar {
    padding-bottom: max(0.75rem, env(safe-area-inset-bottom, 0.75rem)) !important;
}

/* Prevent Mobile Overlap: When mobile sticky action bar is present (<1024px), hide floating AI widget */
@media (max-width: 1023px) {
    body.single-mep_knowledge #mep-floating-ai-widget,
    body.single #mep-floating-ai-widget,
    body.mep-has-sticky-bar #mep-floating-ai-widget,
    body:has(.mep-sticky-mobile-bar) #mep-floating-ai-widget {
        display: none !important;
        pointer-events: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
    }
}

/* ========================================================
   DYNAMIC BLOG ARCHIVE & SINGLE POST TYPOGRAPHY
   ======================================================== */
.mep-share-bar a,
.mep-share-bar button {
    text-decoration: none !important;
}

.mep-pagination-container .page-numbers {
    text-decoration: none !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

#mepArticleBody h2 {
    font-size: 1.5rem !important;
    font-weight: 900 !important;
    color: #0f172a !important;
    margin-top: 2rem !important;
    margin-bottom: 0.75rem !important;
    padding-bottom: 0.5rem !important;
    border-bottom: 1px solid #e2e8f0 !important;
    scroll-margin-top: 100px;
}

#mepArticleBody h3 {
    font-size: 1.25rem !important;
    font-weight: 800 !important;
    color: #1e293b !important;
    margin-top: 1.5rem !important;
    margin-bottom: 0.5rem !important;
    scroll-margin-top: 100px;
}

#mepArticleBody p {
    margin-bottom: 1.25rem !important;
    line-height: 1.75 !important;
}

#mepArticleBody ul,
#mepArticleBody ol {
    margin-left: 1.5rem !important;
    margin-bottom: 1.25rem !important;
}

#mepArticleBody li {
    margin-bottom: 0.5rem !important;
}

#mepArticleBody blockquote {
    border-left: 4px solid #0077c8 !important;
    background: #f8fafc !important;
    padding: 1rem 1.25rem !important;
    border-radius: 0 0.75rem 0.75rem 0 !important;
    font-style: italic !important;
    color: #334155 !important;
    margin: 1.5rem 0 !important;
}

#mepArticleBody img {
    border-radius: 1rem !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05) !important;
    margin: 1.5rem auto !important;
    max-width: 100% !important;
    height: auto !important;
}

#mepArticleBody table {
    width: 100% !important;
    border-collapse: collapse !important;
    margin: 1.5rem 0 !important;
    font-size: 0.875rem !important;
}

#mepArticleBody table th,
#mepArticleBody table td {
    padding: 0.75rem 1rem !important;
    border: 1px solid #e2e8f0 !important;
}

#mepArticleBody table th {
    background: #f1f5f9 !important;
    font-weight: 700 !important;
    color: #0f172a !important;
}




