/* ============================================================
   NORCEMIC UNIVERSAL ENHANCEMENTS
   Mobile responsiveness, UX polish, Bootstrap conflict fixes
   Applied to ALL pages via <link> tag
   ============================================================ */

/* ============================
   1. BOOTSTRAP CONFLICT RESET
   More robust than inline <style>
   ============================ */

/* ============================
   Bootstrap Nav Conflict Fix
   Surgical overrides — no "all:unset"
   ============================ */

/* Reset Bootstrap's .nav flexbox/padding that conflicts with our custom nav */
.site-header .nav,
header .nav,
.nav#nav {
    /* Override Bootstrap .nav defaults */
    flex-wrap: nowrap !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-bottom: 0 !important;
    list-style: none !important;
    /* Restore custom nav styling */
    display: block !important;
    padding: 0 2rem !important;
    height: 76px !important;
    background: rgba(255,255,255,0.92) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border-bottom: 1px solid var(--border-color, #e2e8f0) !important;
    width: 100% !important;
    box-sizing: border-box !important;
}
[data-theme="dark"] .site-header .nav,
[data-theme="dark"] header .nav,
[data-theme="dark"] .nav#nav {
    background: rgba(15,23,42,0.92) !important;
    border-bottom-color: #334155 !important;
}

.nav-inner {
    max-width: var(--container-max, 1280px) !important;
    margin: 0 auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    height: 100% !important;
}

.nav-logo {
    display: flex !important;
    align-items: center !important;
    gap: 0.75rem !important;
    cursor: pointer !important;
    text-decoration: none !important;
}

/* Override Bootstrap .nav-link styles on our nav-links */
.nav-links {
    display: flex !important;
    list-style: none !important;
    gap: 0.25rem !important;
    margin: 0 !important;
    padding: 0 !important;
    flex-wrap: nowrap !important;
}

.nav-links li {
    display: block !important;
}

.nav-links a,
.nav-links li a {
    padding: 0.5rem 1rem !important;
    color: var(--text-secondary, #475569) !important;
    font-weight: 500 !important;
    font-size: 0.9rem !important;
    border-radius: 8px !important;
    text-decoration: none !important;
    display: block !important;
    transition: all 0.2s ease !important;
    background: transparent !important;
    border: none !important;
}
.nav-links a:hover,
.nav-links a.active {
    color: var(--text-primary, #0f172a) !important;
    background: var(--bg-tertiary, #f1f5f9) !important;
}
[data-theme="dark"] .nav-links a:hover,
[data-theme="dark"] .nav-links a.active {
    color: #f8fafc !important;
    background: rgba(255,255,255,0.08) !important;
}

.nav-actions {
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
}

/* Container — prevent Bootstrap override */
.container {
    max-width: var(--container-max, 1280px) !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 2rem !important;
    padding-right: 2rem !important;
    width: 100% !important;
}

/* Section — prevent Bootstrap margins */
section {
    margin-bottom: 0 !important;
}

/* Footer — preserve grid */
.footer { padding: 4rem 0 2rem !important; }
.footer-grid { display: grid !important; }
.footer-links { list-style: none !important; padding: 0 !important; margin: 0 !important; }
.footer-links li { margin-bottom: 0.5rem !important; }

/* Row — no negative margins */
.row { margin: 0 !important; }

/* ============================
   2. UNIVERSAL TOUCH TARGETS
   Min 44x44px for all interactive
   ============================ */
.btn,
button,
a.btn,
.theme-toggle,
.accessibility-toggle,
.nav-hamburger {
    min-height: 44px;
    min-width: 44px;
}

/* ============================
   3. SMOOTH SCROLLING + FOCUS
   ============================ */
html { scroll-behavior: smooth; }
*:focus-visible {
    outline: 2px solid var(--norcemic-green, #2E8B57);
    outline-offset: 2px;
    border-radius: 4px;
}
::selection {
    background: rgba(46, 139, 87, 0.2);
    color: var(--text-primary);
}

/* ============================
   4. TYPOGRAPHY POLISH
   ============================ */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, h5, h6 {
    text-wrap: balance;
}
p {
    text-wrap: pretty;
}

/* ============================
   5. MOBILE HAMBURGER — ensure visible
   ============================ */
.nav-hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    padding: 0.5rem;
    background: none;
    border: none;
    z-index: 100;
}
.nav-hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text-primary, #0f172a);
    border-radius: 2px;
    transition: all 0.3s ease;
}
[data-theme="dark"] .nav-hamburger span {
    background: #f8fafc;
}

/* Animated hamburger → X */
.nav-hamburger.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.nav-hamburger.active span:nth-child(2) { opacity: 0; }
.nav-hamburger.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* ============================
   6. MOBILE NAV PANEL
   ============================ */
.mobile-nav {
    display: none;
    position: fixed;
    top: 76px;
    left: 0; right: 0;
    background: var(--bg-card, #ffffff);
    border-bottom: 1px solid var(--border-color, #e2e8f0);
    padding: 1rem;
    z-index: 9998;
    box-shadow: 0 12px 40px rgba(0,0,0,0.15);
    max-height: calc(100vh - 76px);
    overflow-y: auto;
    animation: slideDown 0.25s ease;
}
[data-theme="dark"] .mobile-nav {
    background: var(--navy-medium, #1e293b);
    border-color: #334155;
}
.mobile-nav.active { display: block; }
.mobile-nav a {
    display: block;
    padding: 0.85rem 1.25rem;
    color: var(--text-secondary, #475569);
    font-weight: 500;
    font-size: 1rem;
    border-radius: 10px;
    text-decoration: none;
    transition: all 0.2s;
}
.mobile-nav a:hover,
.mobile-nav a:active {
    background: var(--bg-tertiary, #f1f5f9);
    color: var(--text-primary, #0f172a);
}
[data-theme="dark"] .mobile-nav a {
    color: #94a3b8;
}
[data-theme="dark"] .mobile-nav a:hover {
    background: rgba(255,255,255,0.05);
    color: #f8fafc;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================
   7. CARD UNIVERSAL POLISH
   ============================ */
.product-card,
.feature-card,
.about-card,
.stage-card,
.device-card,
.guarantee-card,
.pricing-card,
.testimonial-card,
.faq-item,
.biomarker-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

/* ============================
   8. SCROLL PROGRESS BAR (top)
   ============================ */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--norcemic-green, #2E8B57), var(--norcemic-orange, #F5A623));
    z-index: 99999;
    width: 0%;
    transition: width 0.1s;
}

/* ============================
   9. BACK TO TOP BUTTON
   ============================ */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--norcemic-green, #2E8B57);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 4px 14px rgba(46,139,87,0.4);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    z-index: 9000;
}
.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.back-to-top:hover {
    background: var(--norcemic-green-dark, #228B22);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(46,139,87,0.5);
}

/* ============================
   10. LOADING / SKELETON STATES
   ============================ */
.skeleton {
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-secondary) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: skeleton-pulse 1.5s infinite;
    border-radius: 8px;
}
@keyframes skeleton-pulse {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============================
   11. IMAGE LAZY LOAD FADE-IN
   ============================ */
img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.4s ease;
}
img[loading="lazy"].loaded,
img[loading="lazy"][src] {
    opacity: 1;
}

/* ============================================================
   RESPONSIVE BREAKPOINTS — MOBILE POLISH
   ============================================================ */

/* Desktop: ensure hamburger hidden */
@media (min-width: 769px) {
    .nav-hamburger { display: none !important; }
    .mobile-nav { display: none !important; }
}

/* === TABLETS (1200px) === */
@media (max-width: 1200px) {
    .container { padding-left: 1.5rem !important; padding-right: 1.5rem !important; }
}

/* === TABLETS (1024px) === */
@media (max-width: 1024px) {
}

/* === MOBILE (768px) === */
@media (max-width: 768px) {
    .container { padding-left: 1.25rem !important; padding-right: 1.25rem !important; }

    /* Nav */
    .nav-links { display: none !important; }
    .nav-hamburger { display: flex !important; }
    .nav-actions .btn { display: none !important; }
    .nav-actions .theme-toggle { display: flex !important; }
    .nav-actions .accessibility-toggle { display: flex !important; }

    /* Section spacing */
    section { padding: 3rem 0; }
    .section-header { margin-bottom: 2rem; }
    .section-header h2 { font-size: clamp(1.4rem, 5vw, 2rem); }
    .section-header p { font-size: 0.95rem; }
    .section-label { font-size: 0.75rem; padding: 0.4rem 1rem; }

    /* Hero */
    .hero { padding: 2.5rem 0; }
    .hero h1 { font-size: clamp(1.75rem, 6vw, 2.5rem); }
    .hero-description { font-size: 1rem; }

    /* Buttons — full width stack */
    .cta-buttons,
    .hero-actions {
        flex-direction: column;
        align-items: center;
        gap: 0.75rem;
    }
    .cta-buttons .btn,
    .hero-actions .btn {
        width: 100%;
        max-width: 320px;
    }

    /* Footer */
    .footer-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 2rem !important;
    }
    .footer-brand { grid-column: 1 / -1; text-align: center; }
    .footer-social { justify-content: center; }
    .footer-bottom {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    .footer-bottom-links { justify-content: center; }

    /* Cards — bigger touch targets, more padding */
    .product-card,
    .device-card,
    .guarantee-card,
    .feature-card {
        padding: 1.25rem;
    }

    /* Back to top — smaller on mobile */
    .back-to-top { width: 42px; height: 42px; bottom: 1.25rem; right: 1.25rem; font-size: 1rem; }
}

/* === SMALL MOBILE (480px) === */
@media (max-width: 480px) {
    .container { padding-left: 1rem !important; padding-right: 1rem !important; }

    /* Nav compact */
    .site-header .nav,
    header .nav,
    .nav#nav {
        padding: 0 1rem !important;
    }
    .nav-logo-text { font-size: 1rem; }
    .nav-logo img { height: 32px; }

    /* Smaller headings */
    .hero h1 { font-size: 1.5rem; line-height: 1.25; }
    .section-header h2 { font-size: 1.35rem; }

    /* Footer single col */
    .footer-grid {
        grid-template-columns: 1fr !important;
        text-align: center !important;
    }
    .footer-column { text-align: center; }
    .footer-links { text-align: center; }
    .footer-social { justify-content: center; }
    .footer-bottom-links { flex-wrap: wrap; justify-content: center; gap: 1rem; }

    /* Cards full width */
    .product-card,
    .device-card { padding: 1rem; }

    /* Trust items stack */
    .hero-trust,
    .hero-trust-items {
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
    }
}

/* === REDUCED MOTION === */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    html { scroll-behavior: auto; }
    .scroll-progress { display: none; }
}


/* ============================================================
   /* MOBILE ALIGNMENT FIX — Comprehensive centering for all pages
   ============================================================ */

/* === TABLET (768px) — Center stacked grids + footer === */
@media (max-width: 768px) {

    /* --- Footer centering (all pages) --- */
    .footer-brand {
        grid-column: 1 / -1 !important;
        text-align: center !important;
        padding-right: 0 !important;
    }
    .footer-social {
        justify-content: center !important;
    }
    .footer-bottom {
        flex-direction: column !important;
        text-align: center !important;
        gap: 1rem !important;
    }
    .footer-bottom-links {
        justify-content: center !important;
        flex-wrap: wrap !important;
    }
    .footer-column {
        text-align: center !important;
    }
    .footer-column h4::after {
        left: 50% !important;
        transform: translateX(-50%) !important;
    }
    .footer-links {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
    }

    /* --- Single-column grids: center content --- */
    .stats-grid,
    .pipeline,
    .testimonials-grid,
    .partners-grid,
    .advisors-grid {
        max-width: 500px !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    /* --- Cards in stacked grids: center text --- */
    .about-card,
    .value-card,
    .feature-card,
    .stage-card,
    .step-card,
    .partner-card,
    .advisor-card {
        text-align: center !important;
    }
    .about-card .about-icon,
    .value-card .value-icon,
    .feature-card .feature-icon,
    .step-card .step-icon,
    .stage-card .stage-number {
        margin-left: auto !important;
        margin-right: auto !important;
    }

    /* --- Stats section centering --- */
    .stat-card,
    .hero-stat,
    .hero-stat-item {
        text-align: center !important;
    }

    /* --- Trust items centering --- */
    .trust-items,
    .trust-badges,
    .hero-trust {
        justify-content: center !important;
        text-align: center !important;
    }
    .trust-item {
        text-align: center !important;
        justify-content: center !important;
    }

    /* --- Preorder benefits centering --- */
    .preorder-benefits {
        max-width: 500px !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }
    .preorder-benefit {
        text-align: center !important;
    }
    .preorder-benefit .benefit-icon {
        margin-left: auto !important;
        margin-right: auto !important;
    }

    /* --- Section label badges: center --- */
    .section-label {
        margin-left: auto !important;
        margin-right: auto !important;
    }

    /* --- Page headers: ensure centered --- */
    .page-header {
        text-align: center !important;
    }
    .page-header .cta-buttons,
    .page-header .hero-actions {
        justify-content: center !important;
    }

    /* --- Guarantee cards centering --- */
    .guarantee-card {
        text-align: center !important;
    }
    .guarantee-icon {
        margin-left: auto !important;
        margin-right: auto !important;
    }

    /* --- Device cards on 2-col: keep left-aligned (fine) --- */
    /* Only center when they stack to 1-col at 480px */

    /* --- How it works steps centering --- */
    .how-step,
    .how-step-content {
        text-align: center !important;
    }
    .how-step-number {
        margin-left: auto !important;
        margin-right: auto !important;
    }

    /* --- Biomarker cards centering --- */
    .biomarker-card {
        text-align: center !important;
    }
    .biomarker-icon {
        margin-left: auto !important;
        margin-right: auto !important;
    }

    /* --- Explorer/features centering --- */
    .explorer-feature {
        text-align: center !important;
    }
    .explorer-feature-icon {
        margin-left: auto !important;
        margin-right: auto !important;
    }

    /* --- FAQ centering when single col --- */
    .faq-item {
        text-align: left !important; /* FAQ answers stay left-aligned for readability */
    }
    .faq-question {
        text-align: left !important;
    }

    /* --- Newsletter form centering --- */
    .newsletter-form {
        max-width: 400px !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    /* --- Comparison table wrapper hint --- */
    .comparison-table-wrapper::after {
        text-align: center !important;
    }

    /* --- Partner content centering --- */
    .partner-content {
        text-align: center !important;
    }
    .partner-image {
        margin-left: auto !important;
        margin-right: auto !important;
    }
    .partner-features {
        max-width: 400px !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }
    .partner-feature {
        text-align: center !important;
    }
}

/* === SMALL MOBILE (480px) — Full stack centering === */
@media (max-width: 480px) {

    /* --- Footer full center --- */
    .footer-grid {
        grid-template-columns: 1fr !important;
        text-align: center !important;
        gap: 2rem !important;
    }
    .footer-brand {
        grid-column: span 1 !important;
        text-align: center !important;
    }
    .footer-column {
        text-align: center !important;
    }
    .footer-links {
        align-items: center !important;
    }
    .footer-social {
        justify-content: center !important;
    }
    .footer-bottom-links {
        justify-content: center !important;
        gap: 1rem !important;
    }

    /* --- Device cards: center when single col --- */
    .device-card {
        text-align: center !important;
        max-width: 400px !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }
    .device-select {
        margin-left: auto !important;
        margin-right: auto !important;
    }
    .device-icon-wrap {
        margin-left: auto !important;
        margin-right: auto !important;
    }
    .device-features {
        display: inline-flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        margin-left: auto !important;
        margin-right: auto !important;
        width: fit-content !important;
    }

    /* --- Guarantee cards centering --- */
    .guarantee-card {
        max-width: 400px !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    /* --- Product cards: center when single col --- */
    .product-card {
        text-align: center !important;
        max-width: 400px !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }
    .product-card .product-icon,
    .product-card img {
        margin-left: auto !important;
        margin-right: auto !important;
    }
    .product-features {
        display: inline-flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        margin-left: auto !important;
        margin-right: auto !important;
        width: fit-content !important;
    }

    /* --- All single-col grids: constrain width --- */
    .stats-grid,
    .pipeline,
    .how-it-works-grid,
    .testimonials-grid,
    .about-grid,
    .values-grid,
    .leadership-grid,
    .core-team-grid,
    .advisors-grid,
    .partners-grid,
    .pricing-grid,
    .features-grid,
    .steps-grid {
        max-width: 400px !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    /* --- Hero trust items: vertical stack centered --- */
    .hero-trust,
    .hero-trust-items,
    .trust-items {
        flex-direction: column !important;
        align-items: center !important;
        gap: 0.5rem !important;
    }
    .hero-trust-item,
    .trust-item {
        justify-content: center !important;
        text-align: center !important;
    }

    /* --- Team/leadership cards: center --- */
    .team-card,
    .leader-card,
    .advisor-card {
        text-align: center !important;
        max-width: 400px !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }
    .team-card img,
    .leader-card img,
    .advisor-card img {
        margin-left: auto !important;
        margin-right: auto !important;
    }

    /* --- Testimonial cards: center --- */
    .testimonial-card {
        text-align: center !important;
        max-width: 400px !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }
    .testimonial-avatar {
        margin-left: auto !important;
        margin-right: auto !important;
    }
    .testimonial-header {
        justify-content: center !important;
    }

    /* --- Contact/form cards: center --- */
    .contact-card,
    .contact-method {
        text-align: center !important;
    }
    .contact-icon {
        margin-left: auto !important;
        margin-right: auto !important;
    }

    /* --- Pricing cards: center --- */
    .pricing-card {
        text-align: center !important;
        max-width: 400px !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }
    .pricing-features {
        display: inline-flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        margin-left: auto !important;
        margin-right: auto !important;
        width: fit-content !important;
    }

    /* --- Stage/pipeline cards: center --- */
    .stage-card {
        text-align: center !important;
        max-width: 400px !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }
    .stage-number {
        margin-left: auto !important;
        margin-right: auto !important;
    }

    /* --- Buttons: full width centered --- */
    .btn:not(.btn-sm):not(.nav-actions .btn):not(.qty-btn) {
        display: flex !important;
        justify-content: center !important;
    }
}


/* === PRINT === */
@media print {
    .nav, .site-header, .footer, .back-to-top, .scroll-progress,
    .chatbot-button, .chatbot-widget, .mobile-nav { display: none !important; }
    body { padding-top: 0; background: white; color: black; }
    a { color: black; text-decoration: underline; }
    .container { max-width: 100%; padding: 0; }
}
