/* ══════════════════════════════════════════════════════════════════════════
   xcPEP PAGE - MOBILE CSS (≤ 900px)
   Loaded via media="screen and (max-width: 900px)" - does NOT touch desktop.
   
   Architecture: This file is the FINAL authority for mobile layout.
   Uses !important to override any cascade conflicts from xcpep.css inline
   @media blocks. All mobile rules consolidated here.

   DOES NOT touch global footer or header - those are managed globally.
   ══════════════════════════════════════════════════════════════════════════ */

/* ===================== GLOBAL MOBILE RESETS ===================== */

/* Override page-padding variable - fluid side padding across devices */
.xcpep-page {
    --page-padding: clamp(1rem, 3.5vw, 1.5rem) !important;
    --container-padding: clamp(1rem, 3.5vw, 1.5rem) !important;
}

/* Tighter section spacing - fluid vertical rhythm */
.section {
    padding: clamp(2rem, 6vw, 3.5rem) 0 !important;
}

.section-header {
    margin-bottom: clamp(1.25rem, 4vw, 2rem) !important;
}

.section-header h2 {
    font-size: clamp(1.5rem, 6vw, 2rem) !important;
    line-height: 1.2 !important;
}

.section-header p {
    font-size: clamp(0.85rem, 2.5vw, 0.95rem) !important;
    line-height: 1.6 !important;
}

/* Left-align centered multi-line text on mobile - easier to read */
.section-header.centered {
    text-align: center !important;
}

.section-header.centered p {
    text-align: left !important;
}

/* Remove paragraph width constraints globally */
.xcpep-page p {
    max-width: none !important;
}

/* ===================== PERFORMANCE - REDUCE GPU LOAD ===================== */

/* Disable heavy backdrop-filter on mobile - saves GPU */
.xcpep-page .glass-card,
.xcpep-page .pillar-card,
.xcpep-page .uc-card,
.xcpep-page .db-card,
.xcpep-page .bento-card,
.xcpep-page .hero-prop {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

/* Disable hero gradient sweep animation */
#hero-section.hero::after {
    animation: none !important;
}

/* Faster reveals on mobile */
.xcpep-page .reveal {
    transform: translateY(12px) !important;
    transition: opacity 0.3s ease, transform 0.3s ease !important;
}

/* Disable hover transforms on mobile (touch devices) */
.glass-card:hover,
.pillar-card:hover,
.uc-card:hover,
.bento-card:hover {
    transform: none !important;
}

/* ===================== SUB-NAVIGATION - HIDE ON MOBILE ===================== */
.sticky-sub-nav {
    display: none !important;
}


/* ══════════════════════════════════════════════════════════════════════════
   SECTION 1: HERO
   - Text + 2 CTAs (Cost Models + Cost Data) first
   - Video below text
   - Value props HIDDEN
   - Secondary "Security" CTA HIDDEN
   ══════════════════════════════════════════════════════════════════════════ */

#hero-section.hero {
    min-height: auto !important;
    padding: max(90px, 10vh) clamp(1rem, 3.5vw, 1.5rem) 2rem !important;
}

/* Kill violet mesh blobs on mobile */
#hero-section.hero::after,
#hero-section.hero::before,
#hero-section.mesh-bg::before,
#hero-section.mesh-bg::after {
    display: none !important;
    content: none !important;
}

/* Stack hero grid to single column */
#hero-section .hero-grid {
    grid-template-columns: 1fr !important;
    gap: 2rem !important;
}

/* Hero headline */
.hero-headline {
    font-size: clamp(1.8rem, 7vw, 2.8rem) !important;
    line-height: 1.15 !important;
}

/* Hero subtext - fluid */
.hero-sub {
    font-size: clamp(0.88rem, 2.8vw, 1rem) !important;
    line-height: 1.65 !important;
}

/* Hero CTAs - always in 1 row, never full width */
#hero-section .hero-ctas {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 0.75rem !important;
    justify-content: center !important;
}

#hero-section .hero-ctas .btn {
    padding: clamp(0.55rem, 1.8vw, 0.75rem) clamp(1rem, 3.5vw, 1.5rem) !important;
    font-size: clamp(0.78rem, 2.2vw, 0.9rem) !important;
    min-width: auto !important;
    width: auto !important;
    flex: 0 0 auto !important;
}

/* Force-show "Cost Data" CTA (overrides xcpep.css aggressive hide at L5467) */
#hero-section .hero-ctas a.hero-cta-desktop[href="#xcproc"] {
    display: inline-flex !important;
    visibility: visible !important;
    width: auto !important;
    height: auto !important;
    overflow: visible !important;
    padding: 0.7rem 1.4rem !important;
    margin: 0 !important;
    border: 1px solid var(--accent-primary) !important;
    opacity: 1 !important;
}

/* Hide "Security" CTA on mobile */
#hero-section .hero-ctas a[href="#security"] {
    display: none !important;
}

/* Hero video tagline - hide */
.hero-video-tagline {
    display: none !important;
}

/* Hero video container - full width */
.xc-hud-container {
    width: 100% !important;
}

/* Hide scanner line on mobile */
.xc-hud-scanner {
    display: none !important;
}

/* ── HERO VALUE PROPS: HIDDEN ON MOBILE ── */
.hero-props-row {
    display: none !important;
}

/* Hero pillars - 2 columns */
.hero-pillars-row {
    grid-template-columns: 1fr 1fr !important;
    gap: 0.8rem !important;
}

.hero-pillar.glass-card {
    padding: 1.2rem 1rem !important;
}

.hero-pillar h4 {
    font-size: 0.88rem !important;
}

.hero-pillar .card-text {
    font-size: 0.78rem !important;
    line-height: 1.45 !important;
}


/* ══════════════════════════════════════════════════════════════════════════
   SECTION 2: FEATURES - ACCORDION
   - Hide desktop split grids
   - Show mobile features accordion (.feat-mobile-accordion)
   - Independent open/close (NOT one-at-a-time)
   - Screenshots HIDDEN inside accordion
   ══════════════════════════════════════════════════════════════════════════ */

/* Hide desktop features */
.features-showcase {
    display: none !important;
}

/* Show mobile features accordion */
.feat-mobile-accordion {
    display: block !important;
    margin-top: 2rem;
}

.feat-acc-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

/* Reuse same accordion styling as workflow */
.feat-acc-tab {
    display: flex !important;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 1rem 1.2rem;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.02);
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    font-family: inherit;
    color: var(--text-heading);
}

[data-theme="light"] .feat-acc-tab {
    border-color: rgba(0, 0, 0, 0.06);
    background: rgba(255, 255, 255, 0.5);
}

.feat-acc-tab.active {
    border-left: 4px solid var(--accent-primary) !important;
    background: rgba(var(--accent-primary-rgb), 0.04) !important;
}

.feat-acc-icon {
    font-size: 1rem;
    color: var(--accent-primary);
    min-width: 24px;
    text-align: center;
}

.feat-acc-title {
    font-size: 1rem;
    font-weight: 600;
    flex: 1;
}

.feat-acc-chevron {
    font-size: 0.75rem;
    color: var(--text-muted);
    transition: transform 0.3s ease;
    margin-left: auto;
}

.feat-acc-tab.active .feat-acc-chevron {
    transform: rotate(180deg);
    color: var(--accent-primary);
}

.feat-acc-body {
    display: none;
    overflow: hidden;
}

.feat-acc-tab.active + .feat-acc-body {
    display: block !important;
    animation: featAccSlideIn 0.35s ease forwards;
}

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

.feat-acc-body p {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.55;
    padding: 0.8rem 1rem 0.6rem;
    margin: 0;
}

.feat-acc-body .feature-bullets {
    padding: 0 1rem 1rem;
    margin: 0;
    list-style: none;
}

.feat-acc-body .feature-bullets li {
    font-size: 0.85rem;
    color: var(--text-muted);
    padding: 0.25rem 0;
}

.feat-acc-img {
    padding: 0 0.5rem 1rem;
}

.feat-acc-img img {
    width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    object-fit: contain;
    cursor: zoom-in;
}

/* ══════════════════════════════════════════════════════════════════════════
   SECTION 3: WORKFLOW - ACCORDION ON MOBILE
   - Desktop scroll-driven layout HIDDEN
   - Mobile accordion with text + image
   - Screenshots HIDDEN for steps 01 and 05
   - Smooth open/close animation
   ══════════════════════════════════════════════════════════════════════════ */

/* Hide desktop scroll-driven workflow entirely */
.wf-scroll-spacer {
    display: none !important;
}

/* Show mobile accordion */
.wf-mobile-accordion {
    display: block !important;
    padding: 3rem 0 !important;
}

/* Accordion list container */
.wf-acc-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-top: 2rem;
}

/* Accordion tab button */
.wf-acc-tab {
    display: flex !important;
    align-items: center;
    gap: 1rem;
    width: 100%;
    padding: 1rem 1.2rem;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.02);
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    font-family: inherit;
    color: var(--text-heading);
}

[data-theme="light"] .wf-acc-tab {
    border-color: rgba(0, 0, 0, 0.06);
    background: rgba(255, 255, 255, 0.5);
}

.wf-acc-tab.active {
    border-left: 4px solid var(--accent-primary) !important;
    background: rgba(var(--accent-primary-rgb), 0.04) !important;
}

/* Step number */
.wf-acc-num {
    font-family: var(--font-mono, 'Roboto Mono', monospace);
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent-primary);
    min-width: 28px;
}

/* Step title */
.wf-acc-title {
    font-size: 1rem;
    font-weight: 600;
    flex: 1;
}

/* Chevron */
.wf-acc-chevron {
    font-size: 0.75rem;
    color: var(--text-muted);
    transition: transform 0.3s ease;
    margin-left: auto;
}

.wf-acc-tab.active .wf-acc-chevron {
    transform: rotate(180deg);
    color: var(--accent-primary);
}

/* Accordion body - hidden by default, shown when tab is active */
.wf-acc-body {
    display: none;
    overflow: hidden;
}

.wf-acc-tab.active + .wf-acc-body {
    display: block !important;
    animation: wfAccSlideIn 0.35s ease forwards;
}

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

.wf-acc-body p {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.55;
    padding: 0.8rem 1rem 0.6rem;
    margin: 0;
}

.wf-acc-img {
    padding: 0 0.5rem 1rem;
}

.wf-acc-img img {
    width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    object-fit: contain;
}

/* ── Hide screenshots for Step 01 (Analyze) and Step 05 (Act & Integrate) ── */
.wf-acc-tab[data-wf-step="1"] + .wf-acc-body .wf-acc-img,
.wf-acc-tab[data-wf-step="5"] + .wf-acc-body .wf-acc-img {
    display: none !important;
}


/* ══════════════════════════════════════════════════════════════════════════
   SECTION 4: xcPROC DATABASES (already accordion on mobile ✅)
   ══════════════════════════════════════════════════════════════════════════ */

/* Description text - left-aligned for readability */
#xcproc .section-header.centered p {
    text-align: left !important;
}

/* Database card images - constrain */
.db-panel img {
    width: 100% !important;
    height: auto !important;
}


/* ══════════════════════════════════════════════════════════════════════════
   SECTION 5: COST MODEL LIBRARY
   - Show first 3 process rows, hide rest
   - "Show More" button reveals all
   - Scale down section
   ══════════════════════════════════════════════════════════════════════════ */

.proc-tag {
    font-size: 0.75rem !important;
    padding: 0.3rem 0.7rem !important;
}

/* Hide 4th+ process rows until expanded */
.proc-table-body .proc-row:nth-child(n+4) {
    display: none !important;
}

.proc-table-body.expanded .proc-row:nth-child(n+4) {
    display: flex !important;
}

/* Tighter section */
#models .section-header {
    max-width: none !important;
}

#models .section-header p {
    font-size: 0.88rem !important;
}


/* ══════════════════════════════════════════════════════════════════════════
   SECTION 6: AI PCB HARDWARE
   - Hide bullet list text (reduce scrolling)
   - Keep video
   ══════════════════════════════════════════════════════════════════════════ */

.ai-pcb-layout {
    grid-template-columns: 1fr !important;
}

/* Hide the bullet list on mobile */
.ai-pcb-list {
    display: none !important;
}


/* ══════════════════════════════════════════════════════════════════════════
   SECTION 7: USE CASES
   - Show first 3 cards, hide rest
   - "Show More" button reveals all
   ══════════════════════════════════════════════════════════════════════════ */

.use-cases-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
}

.use-cases-grid .uc-card {
    grid-column: auto !important;
}

.uc-card {
    padding: 1.5rem 1.2rem !important;
}

.uc-card h3 {
    font-size: 1rem !important;
}

.uc-card p {
    font-size: 0.85rem !important;
}

/* Hide 4th+ cards until expanded */
.use-cases-grid .uc-card:nth-child(n+4) {
    display: none !important;
}

.use-cases-grid.expanded .uc-card:nth-child(n+4) {
    display: block !important;
}


/* ══════════════════════════════════════════════════════════════════════════
   SECTION 8: VS LEGACY TOOLS - HIDDEN ON MOBILE
   ══════════════════════════════════════════════════════════════════════════ */

#vs-legacy {
    display: none !important;
}


/* ══════════════════════════════════════════════════════════════════════════
   SECTION 9: AI DATA LAYER - HIDDEN ON MOBILE
   ══════════════════════════════════════════════════════════════════════════ */

#ai-layer {
    display: none !important;
}


/* ══════════════════════════════════════════════════════════════════════════
   SECTION 10: PHILOSOPHY - HIDDEN ON MOBILE
   ══════════════════════════════════════════════════════════════════════════ */

#philosophy {
    display: none !important;
}


/* ══════════════════════════════════════════════════════════════════════════
   SECTION 11: SECURITY
   - Show first 3 cards, hide rest
   - "Show More" button reveals all
   ══════════════════════════════════════════════════════════════════════════ */

.security-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
}

.sec-card {
    padding: 1.5rem 1.2rem !important;
}

.sec-card h3 {
    font-size: 1rem !important;
}

/* Hide 4th+ cards until expanded */
.security-grid .sec-card:nth-child(n+4) {
    display: none !important;
}

.security-grid.expanded .sec-card:nth-child(n+4) {
    display: block !important;
}


/* ══════════════════════════════════════════════════════════════════════════
   CTA BANNER
   - Hide description paragraph (trim content)
   ══════════════════════════════════════════════════════════════════════════ */

.cta-banner {
    padding: clamp(2rem, 6vw, 3rem) clamp(1rem, 3.5vw, 1.5rem) !important;
    border-radius: var(--radius-md) !important;
}

.cta-banner h2 {
    font-size: clamp(1.3rem, 5.5vw, 1.8rem) !important;
}

/* Hide description paragraph in CTA - heading + button is enough */
.cta-banner p {
    display: none !important;
}


/* ══════════════════════════════════════════════════════════════════════════
   SHOW MORE BUTTON - SHARED STYLE
   Used by: Use Cases, Security, Cost Model Library
   ══════════════════════════════════════════════════════════════════════════ */

.mobile-show-more {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    margin-top: 1rem;
    padding: 0.75rem 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.03);
    color: var(--accent-primary);
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

[data-theme="light"] .mobile-show-more {
    border-color: rgba(0, 0, 0, 0.1);
    background: rgba(var(--accent-primary-rgb), 0.05);
}

.mobile-show-more:hover {
    background: rgba(var(--accent-primary-rgb), 0.08);
}

.mobile-show-more i {
    transition: transform 0.3s ease;
}

.mobile-show-more.expanded i {
    transform: rotate(180deg);
}

/* Hide show-more buttons on desktop (they're injected by JS only on mobile) */


/* ══════════════════════════════════════════════════════════════════════════
   PILLARS GRID
   ══════════════════════════════════════════════════════════════════════════ */

.pillars-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
}

.pillar-card {
    padding: 1.5rem !important;
}

.pillar-card h3 {
    font-size: 0.95rem !important;
}

.pillar-card p {
    font-size: 0.85rem !important;
}

/* ===================== WORKFLOW STEPS (OLD GRID) ===================== */

.workflow-steps {
    grid-template-columns: 1fr !important;
}

.workflow-line {
    display: none !important;
}

/* ===================== DB GRID ===================== */

.db-grid {
    grid-template-columns: 1fr !important;
}


/* ══════════════════════════════════════════════════════════════════════════
   IMAGE LIGHTBOX / VIEWER (touch zoom enabled)
   Used by: Features, Workflow, Database accordion images
   ══════════════════════════════════════════════════════════════════════════ */

.mobile-lightbox {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity 0.3s ease;
    touch-action: pinch-zoom;
    cursor: zoom-out;
}

.mobile-lightbox.active {
    opacity: 1;
}

.mobile-lightbox img {
    max-width: 95vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    touch-action: pinch-zoom;
    user-select: none;
    -webkit-user-select: none;
}

.mobile-lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100001;
}

/* Make accordion images tappable */
.wf-acc-img img,
.feat-acc-img img,
.db-acc-img img {
    cursor: zoom-in;
}


/* ══════════════════════════════════════════════════════════════════════════
   SPACING UNIFORMITY - non-redundant rules only
   (Global resets at top of file handle section padding, header margins, 
    font sizes via clamp(). This section covers component-specific gaps.)
   ══════════════════════════════════════════════════════════════════════════ */

/* Eyebrow → heading gap */
.section-header .eyebrow {
    margin-bottom: 0.5rem !important;
}

/* Heading → description gap */
.section-header h2 {
    margin-bottom: 0.75rem !important;
}

/* Section description - no trailing margin */
.section-header p {
    margin-bottom: 0 !important;
}

/* CTA banner text alignment */
.cta-banner {
    text-align: center !important;
}

.cta-banner h2 {
    margin-bottom: 1.25rem !important;
}

.cta-banner .btn {
    margin-top: 0 !important;
}

/* Trust Center button - hidden until security grid is expanded */
#security .reveal[style*="text-align: center"] {
    display: none !important;
}

#security .security-grid.expanded ~ .reveal[style*="text-align: center"] {
    display: block !important;
}

/* Feature accordion - hide bullets for Configurable Cost Models */
.feat-acc-tab[data-feat="2"] + .feat-acc-body .feature-bullets {
    display: none !important;
}


/* ══════════════════════════════════════════════════════════════════════════
   SMALL PHONE OVERRIDES (≤ 480px)
   iPhone SE, iPhone 8, older Android, Galaxy A series
   Scale DOWN: tighter padding, smaller text, compact cards
   ══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {

    .section {
        padding: 2.5rem 0 !important;
    }

    .section-header h2 {
        font-size: 1.5rem !important;
    }

    .section-header p {
        font-size: 0.85rem !important;
    }

    /* Hero - scale down */
    .hero-headline {
        font-size: 1.9rem !important;
    }

    .hero-sub {
        font-size: 0.88rem !important;
    }

    /* CTAs stay in row even on small phones */
    #hero-section .hero-ctas {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
    }

    #hero-section .hero-ctas .btn {
        width: auto !important;
        padding: 0.55rem 0.9rem !important;
        font-size: 0.78rem !important;
    }

    /* Pillars - single column */
    .hero-pillars-row {
        grid-template-columns: 1fr !important;
    }

    /* Accordion tabs - tighter */
    .feat-acc-tab,
    .wf-acc-tab {
        padding: 0.85rem 1rem !important;
    }

    .feat-acc-title,
    .wf-acc-title {
        font-size: 0.9rem !important;
    }

    /* Cards - tighter */
    .uc-card,
    .sec-card {
        padding: 1.25rem 1rem !important;
    }

    .uc-card h3,
    .sec-card h3 {
        font-size: 0.95rem !important;
    }

    .uc-card p,
    .sec-card p {
        font-size: 0.82rem !important;
    }

    /* Process tags - smaller */
    .proc-tag {
        font-size: 0.7rem !important;
        padding: 0.25rem 0.6rem !important;
    }

    /* CTA banner */
    .cta-banner {
        padding: 2rem 1rem !important;
    }

    .cta-banner h2 {
        font-size: 1.3rem !important;
    }

    /* Show-more button */
    .mobile-show-more {
        font-size: 0.82rem !important;
    }
}

/* ══════════════════════════════════════════════════════════════════════════
   EXTRA-SMALL PHONE (≤ 375px)
   iPhone SE (1st gen), very compact screens
   Maximum compression - minimal padding, tight text
   ══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 375px) {

    .section {
        padding: 2rem 0 !important;
    }

    .hero-headline {
        font-size: 1.65rem !important;
    }

    .hero-sub {
        font-size: 0.84rem !important;
    }

    .section-header h2 {
        font-size: 1.35rem !important;
    }

    .section-header p {
        font-size: 0.82rem !important;
    }

    #hero-section .hero-ctas .btn {
        padding: 0.5rem 0.8rem !important;
        font-size: 0.75rem !important;
    }

    .feat-acc-tab,
    .wf-acc-tab {
        padding: 0.75rem 0.85rem !important;
    }

    .feat-acc-title,
    .wf-acc-title {
        font-size: 0.85rem !important;
    }

    .uc-card,
    .sec-card {
        padding: 1.1rem 0.9rem !important;
    }

    .pillar-card {
        padding: 1.1rem 0.9rem !important;
    }

    .cta-banner h2 {
        font-size: 1.2rem !important;
    }
}
