/* =========================================
   How It Works Page Styles (Function Theme)
   ========================================= */

.how-it-works-page {
    background-color: #FFFFFF;
    /* White background */
    color: #4A3B32;
    /* Brown Text */
}

/* Override Navbar for this page */
/* Override Navbar for this page - REMOVED to allow global glass gradient */
/* .how-it-works-page .navbar {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
} */

.how-it-works-page .nav-links a {
    color: #4A3B32;
}

.how-it-works-page .nav-links a.active {
    font-weight: 700;
}

.how-it-works-page .icon-btn {
    color: #4A3B32;
}

.how-it-works-page .logo-img {
    filter: brightness(0);
    /* Make logo black/dark for cream bg if it's white */
    opacity: 0.8;
}

/* Hero Title */
.hiw-title-section {
    padding: 60px 0 60px;
    text-align: center;
}

.hiw-main-title {
    font-family: 'Playfair Display', serif;
    font-size: 5rem;
    color: #000000;
    /* Black */
    margin: 0;
    font-weight: 400;
}

.hiw-main-title em {
    color: #1F6BFF;
    /* Brand Blue */
    font-style: italic;
}

/* Steps Section */
.hiw-steps-section {
    padding-bottom: 40px;
}

.hiw-card {
    background: linear-gradient(135deg, #0A2468 0%, #133B9E 100%);
    /* Darwin Blue Gradient */
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 40px;
    padding: 40px;
    margin-bottom: 32px;
    display: flex;
    flex-direction: column;
    gap: 32px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    color: #FFFFFF;
    /* White text on dark bg */

    /* Sticky Scrolling Effect */
    position: sticky;
    top: 40px;
    z-index: 1;
}

@media (min-width: 768px) {
    .hiw-card {
        padding: 60px;
    }
}

.hiw-card-header {
    margin-bottom: 24px;
}

.step-label {
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    color: #37C384;
    /* Brand Green for accent */
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.step-label .dot {
    margin: 0 8px;
    font-size: 1.2em;
    vertical-align: middle;
    /* Reset global .dot properties */
    background-color: transparent;
    width: auto;
    height: auto;
    border-radius: 0;
}

/* Card Body Layout */
.hiw-card-body {
    display: flex;
    flex-direction: column;
    gap: 48px;
}

@media (min-width: 992px) {
    .hiw-card-body {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

.hiw-content-col {
    flex: 1;
    max-width: 500px;
}

.hiw-visual-col {
    flex: 1;
    width: 100%;
}

/* Typography */
.hiw-heading {
    font-family: 'Playfair Display', serif;
    font-size: 3rem;
    line-height: 1.1;
    color: #FFFFFF;
    /* White */
    margin-bottom: 24px;
    font-weight: 400;
}

.hiw-subheading {
    font-size: 1.1rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 32px;
}

/* List */
.hiw-features-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 40px;
}

.hiw-features-list li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.9);
}

.check-icon-brown {
    color: #37C384;
    /* Switch icon to Brand Green */
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

/* Darwin Button (Replaces Brown Button) */
.btn-brown {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 32px;
    background: linear-gradient(135deg, #FFB04E 0%, #F97316 100%);
    /* Brand Orange Gradient */
    color: white;
    border-radius: 999px;
    font-weight: 600;
    transition: all 0.3s ease;
    text-decoration: none;
    font-size: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border: none;
}

.btn-brown:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

/* Visual Cards - Darwin Theme (Glassmorphism) */
.hiw-visual-card {
    /* Rich Darwin Theme Background: Deep Blue with accent glow */
    background: radial-gradient(circle at top right, #1F6BFF 0%, #1E3A8A 60%, #0F172A 100%);
    border-radius: 24px;
    width: 100%;
    aspect-ratio: 4/3;
    position: relative;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.copper-bg {
    /* Renamed conceptually, but keeping selector if HTML not changed. 
       This replaces the copper gradients with Darwin Blue/Green abstract feels. */
    background:
        radial-gradient(circle at 10% 50%, rgba(55, 195, 132, 0.2) 0%, transparent 50%),
        linear-gradient(135deg, #1E3A8A 0%, #0F172A 100%);
}

.step1-bg {
    /* Specific texture for Step 1 - Abstract Blue Waves */
    background:
        repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.03) 0px, rgba(255, 255, 255, 0.03) 1px, transparent 1px, transparent 20px),
        radial-gradient(circle at 80% 20%, #1F6BFF 0%, transparent 60%),
        linear-gradient(to bottom right, #0F172A, #1E3A8A);
}

/* Glass Overlay Cards - Enhanced */
.glass-overlay-card {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.4);
    border-left: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 24px;
    box-shadow:
        0 8px 32px 0 rgba(0, 0, 0, 0.25),
        inset 0 0 0 1px rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    z-index: 2;
}

/* Step 1 Specifics - Update for Theme */
/* .center-box {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
} */

.hiw-visual-card::before {
    /* Optional: Global sheen/noise if needed, skipping for cleaner look */
    content: none;
}

.center-box .big-number {
    font-size: 5rem;
    font-weight: 400;
    margin-bottom: -5px;
    display: block;
    font-family: 'Playfair Display', serif;
    letter-spacing: -2px;
}

.center-box .label-text {
    font-size: 1.1rem;
    font-weight: 300;
    text-transform: none;
    font-family: 'Inter', sans-serif;
    color: rgba(255, 255, 255, 0.9);
}

.step1-curve {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    pointer-events: none;
}

/* Timeline Elements */
.step1-timeline {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 10;
}

.arrow-down {
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid white;
    margin-bottom: 8px;
    opacity: 0.8;
}

.month-pill {
    padding: 6px 18px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 99px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.85rem;
    background: rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(4px);
    margin-bottom: 12px;
}

.timeline-ticks-container {
    width: 100%;
    height: 40px;
    /* Height of ticks area */
    display: flex;
    justify-content: center;
    align-items: flex-end;
    position: relative;
    /* Mask/Fade edges */
    -webkit-mask-image: linear-gradient(to right, transparent, black 40%, black 60%, transparent);
    mask-image: linear-gradient(to right, transparent, black 40%, black 60%, transparent);
}

.main-tick {
    width: 2px;
    height: 100%;
    background-color: white;
    opacity: 0.9;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: 0;
}

.sub-ticks {
    display: flex;
    gap: 16px;
    /* Spacing between ticks */
    align-items: flex-end;
    height: 60%;
    /* Ticks start lower */
}

.sub-ticks span {
    width: 1px;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.3);
}

/* Glass Overlay Base */
.glass-overlay-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    z-index: 2;
}

.glass-overlay-card.wide {
    width: 80%;
    align-items: flex-start;
    padding: 30px;
}

.big-number {
    font-family: 'Playfair Display', serif;
    font-size: 4rem;
    line-height: 1;
}

.label-text {
    font-size: 1rem;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    opacity: 0.9;
}

.decorative-curve {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    opacity: 0.6;
}

/* List Visual (Step 2) */
/* List Visual (Step 2) */
.glass-list-card {
    width: 60%;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.4);
    border-left: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 20px;
    padding: 20px;
    color: white;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.list-item:last-child {
    border-bottom: none;
}

.bar-mini {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    margin-left: auto;
    max-width: 60px;
}

.bar-mini .fill {
    height: 100%;
    border-radius: 2px;
}

.bar-mini .fill.green {
    background: #37C384;
}

.bar-mini .fill.red {
    background: #F97316;
}

/* Highlight Circle for Step 2 */
.floating-highlight {
    position: absolute;
    right: -80px;
    top: -40px;
    width: 140px;
    height: 160px;
    background: rgba(20, 20, 20, 0.6);
    backdrop-filter: blur(16px);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.circular-chart {
    display: block;
    margin: 0 auto;
    max-width: 80%;
    max-height: 250px;
}

.circle-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: 2.5;
}

.circle {
    fill: none;
    stroke-width: 2.5;
    stroke: #37C384;
    stroke-linecap: round;
}

.cc-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: white;
}

.cc-val {
    display: block;
    font-size: 2rem;
    font-family: 'Playfair Display';
}

.cc-label {
    font-size: 0.7rem;
    opacity: 0.8;
}

/* Step 4 Stat Card */
.stat-row {
    display: flex;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 12px;
}

.stat-name {
    font-size: 1.2rem;
    font-family: 'Playfair Display';
}

.stat-val-text {
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.stat-desc {
    font-size: 0.8rem;
    opacity: 0.8;
    line-height: 1.4;
}

.sg-bar {
    width: 4px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    position: relative;
    margin-left: 10px;
}

.sg-val-marker {
    position: absolute;
    top: 30%;
    left: -4px;
    width: 12px;
    height: 12px;
    background: #37C384;
    border-radius: 50%;
    border: 2px solid white;
}

/* Animations */
.hiw-card {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.hiw-card.visible {
    opacity: 1;
    transform: translateY(0);
}

/* =========================================
   Mobile Optimizations for Steps Cards
   ========================================= */
@media (max-width: 768px) {

    /* Title Section - Smaller for mobile */
    .hiw-title-section {
        padding: 40px 16px 30px;
    }

    .hiw-main-title {
        font-size: 2.5rem;
    }

    /* Steps Section */
    .hiw-steps-section {
        padding: 0 16px 40px;
    }

    .hiw-steps-section .container {
        padding: 0;
    }

    /* Card Layout - Remove sticky, optimize padding */
    .hiw-card {
        position: relative;
        top: 0;
        padding: 24px 20px;
        margin-bottom: 24px;
        border-radius: 24px;
        gap: 24px;
        overflow: visible;
        /* Ensure floating elements are visible if needed, or hidden if causing scroll */
    }

    /* Fix for Step 2 Floating Highlight on Mobile */
    .floating-highlight {
        right: -10px;
        /* Pull it back in */
        top: -30px;
        width: 100px;
        /* Smaller size */
        height: 120px;
        transform: scale(0.8);
    }

    .floating-highlight .circular-chart {
        max-width: 100%;
    }

    .floating-highlight .cc-val {
        font-size: 1.5rem;
    }

    /* Card Header */
    .hiw-card-header {
        margin-bottom: 16px;
    }

    .step-label {
        font-size: 0.75rem;
        letter-spacing: 0.08em;
    }

    .step-label .dot {
        margin: 0 6px;
    }

    /* Card Body Layout - Reorder: Visual first, then Content */
    .hiw-card-body {
        flex-direction: column;
        gap: 4px;
    }

    /* Content Column - Comes after visual on mobile */
    .hiw-content-col {
        max-width: 100%;
        order: 2;
    }

    /* Visual Column - Comes first (between step label and heading) */
    .hiw-visual-col {
        order: 1;
        justify-content: center;
        width: 100%;
    }

    /* Typography */
    .hiw-heading {
        font-size: 1.75rem;
        margin-bottom: 16px;
        margin-top: 0;
        line-height: 1.2;
    }

    .hiw-subheading {
        font-size: 0.95rem;
        margin-bottom: 24px;
    }

    /* Features List */
    .hiw-features-list {
        gap: 12px;
        margin-bottom: 28px;
    }

    .hiw-features-list li {
        font-size: 0.9rem;
        gap: 10px;
    }

    .check-icon-brown {
        width: 18px;
        height: 18px;
    }

    /* CTA Button */
    .btn-brown {
        padding: 12px 24px;
        font-size: 0.9rem;
        width: 100%;
        justify-content: center;
    }

    /* Hide interconnecting connectors on mobile */
    .connector-vertical-1,
    .connector-split {
        display: none !important;
    }

    /* Step 1 & 3 - Center Box Glassmorphism Card */
    .center-box {
        padding: 24px 32px;
        min-width: 180px;
        border-radius: 20px;
    }

    .center-box .big-number {
        font-size: 3rem;
    }

    .center-box .label-text {
        font-size: 1rem;
    }

    /* Step 1 & 3 - Visual Card Background */
    .hiw-visual-card,
    .step1-bg,
    .step3-mockup-container {
        aspect-ratio: 4/3;
        border-radius: 16px;
        max-height: 280px;
    }

    /* Timeline Elements */
    .step1-timeline {
        height: 90px;
    }

    .month-pill {
        padding: 6px 14px;
        font-size: 0.8rem;
    }

    .timeline-ticks-container {
        height: 30px;
    }

    .main-tick {
        height: 30px;
    }

    .sub-ticks {
        gap: 6px;
    }

    /* Step 2 - List + Chart Mockup */
    .step2-mockup-container {
        min-height: 280px;
        aspect-ratio: 1/1;
        margin-top: 0;
    }

    .mockup-list-card {
        width: 55%;
        left: 0;
        top: 10px;
        padding: 12px 12px 24px;
    }

    .mockup-list li {
        padding: 10px 0;
        gap: 10px;
    }

    .m-icon {
        width: 24px;
        height: 24px;
    }

    .m-title {
        font-size: 0.8rem;
    }

    .glass-stats-card {
        width: 60%;
        right: 0;
        bottom: 10px;
        padding: 16px;
    }

    .chart-container {
        width: 90px;
        height: 90px;
        margin-bottom: 12px;
    }

    .chart-number {
        font-size: 1.6rem;
    }

    .chart-label {
        font-size: 0.6rem;
    }

    .stats-legend {
        gap: 8px;
    }

    .legend-item {
        font-size: 0.75rem;
    }

    .l-bar {
        width: 40px;
        height: 5px;
    }

    /* Step 3 - Curve + Biomarkers */
    .step3-mockup-container {
        min-height: 280px;
    }

    /* =========================================
       Step 4 - Complete Mobile Redesign
       ApoB Analysis + Recommendations
       ========================================= */

    /* Main Container */
    .step4-visual-col {
        transform: none;
        max-width: 100%;
        gap: 16px;
        padding: 0;
    }

    /* ApoB Main Card - Compact Stacked Layout */
    .step4-visual-col .apob-card {
        flex-direction: column !important;
        padding: 20px;
        border-radius: 20px;
        gap: 20px;
        background: rgba(255, 255, 255, 0.1);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
    }

    /* Left Content - Title & Description */
    .apob-content-left {
        gap: 10px;
        width: 100%;
    }

    .apob-title-group {
        gap: 8px;
    }

    .apob-title {
        font-size: 1.3rem;
        font-family: 'Playfair Display', serif;
        margin-bottom: 6px;
    }

    .apob-status-row {
        gap: 10px;
        flex-wrap: wrap;
    }

    .status-label {
        padding: 4px 12px;
        font-size: 0.65rem;
        border-radius: 12px;
        background: rgba(55, 195, 132, 0.2);
        border: 1px solid rgba(55, 195, 132, 0.5);
    }

    .status-value {
        font-size: 1rem;
        font-weight: 700;
    }

    .apob-desc {
        font-size: 0.85rem;
        line-height: 1.5;
        color: rgba(255, 255, 255, 0.8);
        margin-top: 8px;
    }

    /* Chart Area - Horizontal Layout for Mobile */
    .apob-chart-area {
        width: 100%;
        flex-direction: row;
        align-items: stretch;
        gap: 12px;
        padding: 16px;
        background: rgba(255, 255, 255, 0.05);
        border-radius: 16px;
        border: 1px solid rgba(255, 255, 255, 0.1);
    }

    /* Range Labels - Vertical on left */
    .range-labels {
        flex-direction: column;
        justify-content: space-between;
        min-height: auto;
        height: auto;
        width: auto;
        gap: 8px;
    }

    .r-label {
        font-size: 0.5rem;
        font-weight: 700;
        white-space: nowrap;
        writing-mode: horizontal-tb;
    }

    .r-label.in-range {
        color: #37C384;
    }

    /* Range Indicators - Vertical bars */
    .range-indicators {
        flex-direction: column;
        justify-content: space-between;
        min-height: auto;
        height: auto;
        width: auto;
        gap: 6px;
    }

    .r-bar {
        width: 24px;
        height: 20px;
        border-radius: 4px;
    }

    .r-bar.active {
        background: rgba(55, 195, 132, 0.4);
        border: 1px solid #37C384;
        box-shadow: 0 0 8px rgba(55, 195, 132, 0.3);
    }

    /* Chart Graph - Flexible width */
    .chart-graph-container {
        flex: 1;
        height: 80px;
        min-width: 120px;
    }

    .graph-svg {
        width: 100%;
        height: 100%;
    }

    /* =========================================
       Flowchart Connectors - Mobile Styled
       ========================================= */

    /* Vertical Connector: ApoB Card → Omega-3 Card */
    .connector-vertical-1 {
        display: block !important;
        width: 2px;
        height: 24px;
        background: rgba(255, 255, 255, 0.3);
        margin: 0 auto;
    }

    /* T-Split Connector: Omega-3 → Bottom Cards */
    .connector-split {
        display: block !important;
        width: 100%;
        height: 32px;
        position: relative;
        margin: 0 auto;
    }

    .connector-split svg {
        width: 100%;
        height: 100%;
    }

    .connector-split path {
        stroke: rgba(255, 255, 255, 0.3);
        stroke-width: 2;
    }

    /* Omega-3 Action Card */
    .omega-card {
        max-width: 100%;
        margin: 0;
    }

    .step4-visual-col .action-card {
        padding: 14px 16px;
        border-radius: 16px;
        gap: 12px;
        background: rgba(255, 255, 255, 0.08);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
    }

    .action-icon-box {
        width: 40px;
        height: 40px;
        border-radius: 12px;
        background: rgba(249, 115, 22, 0.15);
        border: 1px solid rgba(249, 115, 22, 0.4);
    }

    .action-text {
        gap: 4px;
    }

    .a-title {
        font-size: 0.95rem;
        font-weight: 600;
    }

    .a-sub {
        font-size: 0.8rem;
        color: rgba(255, 255, 255, 0.7);
    }

    /* Bottom Row Cards - 2 Column Grid with T-Connector */
    .bottom-card-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 16px;
        margin-top: 0;
    }

    .small-card {
        padding: 14px 16px;
        border-radius: 14px;
        width: 100%;
    }

    .small-card .action-icon-box {
        width: 36px;
        height: 36px;
        border-radius: 10px;
    }

    .small-card .a-title {
        font-size: 0.9rem;
    }

    .small-card .a-sub {
        font-size: 0.75rem;
    }

    /* SVG Curves - Scale down */
    .step1-curve,
    .step3-curve {
        transform: scale(1);
    }

    /* Disable floating animations on mobile for performance */
    .center-box,
    .glass-stats-card {
        animation: none;
    }
}

/* =========================================
   Step 2 Overlap Fix (Mobile < 480px)
   ========================================= */
@media (max-width: 480px) {
    .step2-mockup-container {
        display: flex;
        flex-direction: column;
        gap: 16px;
        height: auto !important;
        min-height: auto !important;
        padding: 10px;
        aspect-ratio: auto !important;
        /* Allow growing */
    }

    .mockup-list-card,
    .glass-stats-card {
        position: relative !important;
        width: 100% !important;
        left: auto !important;
        right: auto !important;
        top: auto !important;
        bottom: auto !important;
        transform: none !important;
        margin: 0 !important;
    }

    .mockup-list-card {
        margin-bottom: 10px !important;
    }
}