/* ================================================
   UX BITES DETAIL PAGE — CLEAN EDITORIAL REDESIGN
   Magazine-article layout with consistent card styling
   matching the portfolio's glassmorphic design language
   ================================================ */

/* Fix sticky positioning */
body.ux-bite-detail-page main {
    overflow: visible !important;
    overflow-x: visible !important;
}

body.ux-bite-detail-page {
    overflow-x: clip;
}

/* Ensure wrapper doesn't break sticky */
.ux-bite-detail-wrapper {
    overflow: visible;
    padding: 2rem 0 6rem;
    background: transparent;
    min-height: 100vh;
}

/* ------------------------------------------------
   Breadcrumb & Back Navigation
   ------------------------------------------------ */
.ux-bite-breadcrumb {
    padding: 1.25rem 0 0.5rem;
    background: transparent;
    border-bottom: none;
}

.breadcrumb-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-muted, var(--color-muted));
    font-family: var(--font-body, "DM Sans", system-ui, sans-serif);
}

.breadcrumb-list {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
    list-style: none;
}

.breadcrumb-item {
    display: flex;
    align-items: center;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: '/';
    margin: 0 0.5rem;
    color: var(--text-muted, var(--color-muted));
    opacity: 0.5;
}

.breadcrumb-item a {
    color: var(--text-secondary, var(--color-text));
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

@media (hover: hover) {
    .breadcrumb-item a:hover {
        color: var(--accent, #059669);
    }
}

[data-theme="dark"] .breadcrumb-item a {
    color: rgba(255, 255, 255, 0.7);
}

@media (hover: hover) {
    [data-theme="dark"] .breadcrumb-item a:hover {
        color: var(--accent, #34d399);
    }
}

.breadcrumb-item.active {
    color: var(--text-muted, var(--color-muted));
    font-weight: 400;
}

[data-theme="dark"] .breadcrumb-item.active {
    color: rgba(255, 255, 255, 0.4);
}

/* Back button */
.ux-bite-back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-body, "DM Sans", system-ui, sans-serif);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary, var(--color-text));
    text-decoration: none;
    padding: 0.5rem 1rem 0.5rem 0.75rem;
    border-radius: var(--radius-pill, 999px);
    background: var(--bg-card, rgba(255, 255, 255, 0.2));
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.4));
    backdrop-filter: blur(8px);
    transition: all 0.25s ease;
    margin-bottom: 0.5rem;
}

.ux-bite-back-link svg {
    transition: transform 0.25s ease;
}

@media (hover: hover) {
    .ux-bite-back-link:hover {
        color: var(--accent, #059669);
        border-color: var(--accent, #059669);
        background: rgba(5, 150, 105, 0.06);
    }

    .ux-bite-back-link:hover svg {
        transform: translateX(-3px);
    }
}

[data-theme="dark"] .ux-bite-back-link {
    color: rgba(255, 255, 255, 0.7);
    background: rgba(140, 182, 255, 0.06);
    border-color: rgba(140, 182, 255, 0.12);
}

@media (hover: hover) {
    [data-theme="dark"] .ux-bite-back-link:hover {
        color: var(--accent, #34d399);
        border-color: var(--accent, #34d399);
        background: rgba(52, 211, 153, 0.08);
    }
}

/* ------------------------------------------------
   Detail Grid
   ------------------------------------------------ */
.ux-bite-detail-grid {
    display: grid;
    grid-template-columns: 1fr 260px;
    gap: 3rem;
    align-items: start;
    position: relative;
    max-width: 1100px;
    margin: 0 auto;
}

.ux-bite-detail-content {
    min-width: 0;
}

@media (max-width: 1024px) {
    .ux-bite-detail-grid {
        grid-template-columns: 1fr;
    }

    .ux-bite-sidebar {
        display: none;
    }
}

/* ------------------------------------------------
   Hero — Clean Image + Text (No Overlay)
   ------------------------------------------------ */
.ux-bite-detail-hero {
    margin-bottom: 3rem;
}

.hero-image-wrapper {
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: 2rem;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.08),
        0 2px 8px rgba(0, 0, 0, 0.04);
}

.hero-image-wrapper img {
    width: 100%;
    height: auto;
    display: block;
    aspect-ratio: 16/9;
    object-fit: cover;
}

[data-theme="dark"] .hero-image-wrapper {
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.4),
        0 4px 16px rgba(0, 0, 0, 0.2);
}

/* Badges */
.ux-bite-hero-badge {
    display: flex;
    gap: 0.625rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.hero-pattern,
.hero-spotlight {
    display: inline-block;
    padding: 0.375rem 0.875rem;
    border-radius: var(--radius-pill, 999px);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.hero-pattern {
    background: rgba(59, 130, 246, 0.1);
    color: #2563eb;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.hero-spotlight {
    background: rgba(245, 158, 11, 0.1);
    color: #d97706;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

[data-theme="dark"] .hero-pattern {
    background: rgba(96, 165, 250, 0.12);
    color: #93bbfd;
    border-color: rgba(96, 165, 250, 0.25);
}

[data-theme="dark"] .hero-spotlight {
    background: rgba(251, 191, 36, 0.12);
    color: #fcd34d;
    border-color: rgba(251, 191, 36, 0.25);
}

/* Title */
.ux-bite-hero-title {
    font-family: var(--font-display, "Playfair Display", Georgia, serif);
    font-size: clamp(2rem, 5vw, 2.75rem);
    font-weight: 500;
    margin: 0 0 1rem;
    color: var(--text-display, var(--color-text));
    letter-spacing: -0.02em;
    line-height: 1.15;
}

[data-theme="dark"] .ux-bite-hero-title {
    color: rgba(255, 255, 255, 0.98);
}

/* Hook */
.ux-bite-hero-hook {
    font-size: 1.125rem;
    color: var(--text-secondary, var(--color-muted));
    margin: 0 0 2rem;
    line-height: 1.7;
}

[data-theme="dark"] .ux-bite-hero-hook {
    color: rgba(255, 255, 255, 0.7);
}

/* Meta Grid Card */
.ux-bite-hero-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.25rem;
    padding: 1.75rem;
    border: 1px solid var(--border-subtle, rgba(0, 0, 0, 0.06));
    background: var(--bg-card, rgba(255, 255, 255, 0.5));
    backdrop-filter: blur(12px);
    border-radius: 16px;
    position: relative;
}

.ux-bite-hero-meta::before {
    content: '';
    position: absolute;
    top: 0;
    left: 1.5rem;
    right: 1.5rem;
    height: 2px;
    background: linear-gradient(90deg, var(--accent, #059669), transparent);
    border-radius: 1px;
}

[data-theme="dark"] .ux-bite-hero-meta {
    background: rgba(140, 182, 255, 0.04);
    border-color: rgba(140, 182, 255, 0.1);
    backdrop-filter: blur(16px);
}

[data-theme="dark"] .ux-bite-hero-meta::before {
    background: linear-gradient(90deg, var(--accent, #34d399), transparent);
}

.hero-meta-item {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.meta-label {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted, var(--color-muted));
}

[data-theme="dark"] .meta-label {
    color: rgba(196, 215, 255, 0.6);
}

.meta-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-display, var(--color-text));
    line-height: 1.3;
}

[data-theme="dark"] .meta-value {
    color: rgba(255, 255, 255, 0.92);
}

/* ------------------------------------------------
   Section Titles
   ------------------------------------------------ */
.section-title {
    font-family: var(--font-display, "Playfair Display", Georgia, serif);
    font-size: clamp(1.75rem, 4vw, 2.25rem);
    font-weight: 500;
    margin: 0 0 2rem;
    color: var(--text-display, var(--color-text));
    letter-spacing: -0.02em;
    line-height: 1.2;
    position: relative;
    padding-bottom: 1rem;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    width: 0;
    background: linear-gradient(90deg, var(--accent, #059669), transparent);
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.ux-bite-section.in-view .section-title::after {
    width: 60px;
}

[data-theme="dark"] .section-title {
    color: rgba(255, 255, 255, 0.98);
}

[data-theme="dark"] .section-title::after {
    background: linear-gradient(90deg, var(--accent, #34d399), transparent);
}

.subsection-title {
    font-family: var(--font-heading, "Space Grotesk", sans-serif);
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.75rem;
    color: var(--text-display, var(--color-text));
}

[data-theme="dark"] .subsection-title {
    color: rgba(196, 215, 255, 0.9);
}

.ux-bite-section {
    margin-bottom: 3.5rem;
}

.section-intro {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--accent, #059669);
    margin: 0 0 0.75rem;
}

[data-theme="dark"] .section-intro {
    color: var(--accent, #34d399);
}

/* ------------------------------------------------
   Core Idea — Pull Quote
   ------------------------------------------------ */
.core-idea-text {
    font-family: var(--font-display, "Playfair Display", Georgia, serif);
    font-size: clamp(1.375rem, 3vw, 1.75rem);
    font-weight: 400;
    font-style: italic;
    line-height: 1.6;
    color: var(--text-display, var(--color-text));
    padding: 2rem 0 2rem 1.75rem;
    margin: 0;
    border-left: 3px solid var(--accent, #059669);
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    backdrop-filter: none;
    border-top: none;
    border-right: none;
    border-bottom: none;
    overflow: visible;
}

/* Remove old pseudo-element styles */
.core-idea-text::before {
    display: none;
}

[data-theme="dark"] .core-idea-text {
    color: rgba(255, 255, 255, 0.9);
    border-left-color: var(--accent, #34d399);
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
}

/* ------------------------------------------------
   Key Lessons — Simple Cards (No Timeline)
   ------------------------------------------------ */
.key-lessons-grid {
    display: grid;
    gap: 1.25rem;
    padding-left: 0;
}

/* Remove timeline line */
.key-lessons-grid::before {
    display: none;
}

.key-lesson-card {
    position: relative;
    display: flex;
    gap: 1.25rem;
    padding: 1.75rem;
    background: var(--bg-card, rgba(255, 255, 255, 0.5));
    border: 1px solid var(--border-subtle, rgba(0, 0, 0, 0.06));
    border-radius: 16px;
    transition: all 0.3s ease;
    overflow: visible;
}

.key-lesson-card + .key-lesson-card {
    border-top: 1px solid var(--border-subtle, rgba(0, 0, 0, 0.06));
}

/* Remove horizontal connector */
.key-lesson-card::before {
    display: none;
}

[data-theme="dark"] .key-lesson-card {
    background: rgba(140, 182, 255, 0.04);
    border-color: rgba(140, 182, 255, 0.08);
}

@media (hover: hover) {
    .key-lesson-card:hover {
        border-color: var(--accent, #059669);
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
        transform: translateY(-2px);
    }

    [data-theme="dark"] .key-lesson-card:hover {
        border-color: rgba(140, 182, 255, 0.2);
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    }
}

/* Number badge — inline, not positioned on timeline */
.lesson-number {
    width: 36px;
    height: 36px;
    min-width: 36px;
    background: linear-gradient(135deg, var(--accent, #059669), var(--accent-2, #34d399));
    color: #fff;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading, "Space Grotesk", sans-serif);
    font-size: 0.875rem;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 2px;
}

[data-theme="dark"] .lesson-number {
    background: linear-gradient(135deg, var(--accent-primary, #c4d7ff), var(--accent-secondary, #8cb6ff));
    color: #060912;
}

.lesson-content {
    flex: 1;
    min-width: 0;
}

.lesson-concept {
    font-family: var(--font-heading, "Space Grotesk", sans-serif);
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0 0 0.625rem;
    color: var(--text-display, var(--color-text));
    line-height: 1.3;
}

[data-theme="dark"] .lesson-concept {
    color: rgba(255, 255, 255, 0.95);
}

.lesson-summary {
    font-size: 0.9375rem;
    color: var(--text-secondary, var(--color-muted));
    margin: 0 0 1rem;
    line-height: 1.7;
}

[data-theme="dark"] .lesson-summary {
    color: rgba(255, 255, 255, 0.7);
}

/* Takeaway — always visible */
.lesson-takeaway {
    font-size: 0.875rem;
    color: var(--text-body, var(--color-text));
    margin: 0;
    line-height: 1.6;
    padding: 0.875rem 1rem;
    background: rgba(5, 150, 105, 0.04);
    border-left: 3px solid var(--accent, #059669);
    border-radius: 0 8px 8px 0;
    max-height: none;
    overflow: visible;
    opacity: 1;
    transition: none;
}

/* Override old hover/in-view reveals — always visible now */
.key-lesson-card:hover .lesson-takeaway,
.key-lesson-card.in-view .lesson-takeaway {
    max-height: none;
    opacity: 1;
    margin: 0;
    padding: 0.875rem 1rem;
    background: rgba(5, 150, 105, 0.04);
    border-radius: 0 8px 8px 0;
}

[data-theme="dark"] .lesson-takeaway,
[data-theme="dark"] .key-lesson-card:hover .lesson-takeaway,
[data-theme="dark"] .key-lesson-card.in-view .lesson-takeaway {
    background: rgba(52, 211, 153, 0.06);
    border-left-color: var(--accent, #34d399);
    color: rgba(255, 255, 255, 0.85);
}

.lesson-takeaway strong {
    font-weight: 700;
    color: var(--accent, #059669);
    text-transform: uppercase;
    font-size: 0.6875rem;
    letter-spacing: 0.08em;
    margin-right: 0.375rem;
}

[data-theme="dark"] .lesson-takeaway strong {
    color: var(--accent, #34d399);
}

/* Lessons with images */
.key-lesson-card.has-image {
    flex-direction: column;
}

.key-lesson-card.has-image .lesson-header {
    display: flex;
    gap: 1.25rem;
}

.lesson-image {
    position: relative;
    margin-top: 1.25rem;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .lesson-image {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

.lesson-image img {
    width: 100%;
    max-width: 600px;
    height: auto;
    display: block;
    border-radius: 12px;
    margin: 0 auto;
}

.lesson-badge {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: var(--accent, #059669);
    color: white;
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-pill, 999px);
    font-size: 0.75rem;
    font-weight: 600;
    z-index: 2;
}

/* ------------------------------------------------
   Context & Insight Cards
   ------------------------------------------------ */
.context-insight-card {
    border: 1px solid var(--border-subtle, rgba(0, 0, 0, 0.06));
    background: var(--bg-card, rgba(255, 255, 255, 0.5));
    backdrop-filter: blur(12px);
    border-radius: 16px;
    padding: 1.75rem;
    margin-bottom: 1.25rem;
    transition: all 0.3s ease;
}

[data-theme="dark"] .context-insight-card {
    background: rgba(140, 182, 255, 0.04);
    border-color: rgba(140, 182, 255, 0.08);
    backdrop-filter: blur(16px);
}

@media (hover: hover) {
    .context-insight-card:hover {
        border-color: var(--accent, #059669);
        transform: translateY(-2px);
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
    }

    [data-theme="dark"] .context-insight-card:hover {
        border-color: rgba(140, 182, 255, 0.2);
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    }
}

.context-insight-card:last-child {
    margin-bottom: 0;
}

.context-insight-card p {
    margin: 0;
    font-size: 0.9375rem;
    line-height: 1.7;
    color: var(--text-body, var(--color-text));
}

[data-theme="dark"] .context-insight-card p {
    color: rgba(255, 255, 255, 0.85);
}

/* ------------------------------------------------
   Observations — Clean Numbered List
   ------------------------------------------------ */
.observations-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    counter-reset: obs;
}

.observations-list li {
    counter-increment: obs;
    position: relative;
    padding: 1.125rem 0 1.125rem 2.75rem;
    border-bottom: 1px solid var(--border-subtle, rgba(0, 0, 0, 0.06));
    font-size: 0.9375rem;
    line-height: 1.7;
    color: var(--text-body, var(--color-text));
}

.observations-list li::before {
    content: counter(obs, decimal-leading-zero);
    position: absolute;
    left: 0;
    top: 1.125rem;
    font-family: var(--font-mono, ui-monospace, "SF Mono", monospace);
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--text-muted, #a89073);
}

[data-theme="dark"] .observations-list li {
    border-bottom-color: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.85);
}

[data-theme="dark"] .observations-list li::before {
    color: rgba(196, 215, 255, 0.4);
}

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

/* Observations with images */
.observation-with-image {
    padding: 0 !important;
    border-bottom: none !important;
}

.observation-with-image::before {
    display: none !important;
}

.observation-content {
    display: grid;
    gap: 1.25rem;
    background: var(--bg-card, rgba(255, 255, 255, 0.5));
    border: 1px solid var(--border-subtle, rgba(0, 0, 0, 0.06));
    border-radius: 16px;
    padding: 1.75rem;
    transition: all 0.3s ease;
}

[data-theme="dark"] .observation-content {
    background: rgba(140, 182, 255, 0.04);
    border-color: rgba(140, 182, 255, 0.08);
}

@media (hover: hover) {
    .observation-with-image:hover .observation-content {
        border-color: var(--accent, #059669);
        transform: translateY(-2px);
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
    }

    [data-theme="dark"] .observation-with-image:hover .observation-content {
        border-color: rgba(140, 182, 255, 0.2);
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    }
}

.observation-text {
    font-size: 0.9375rem;
    line-height: 1.7;
    color: var(--text-body, var(--color-text));
    margin: 0;
}

[data-theme="dark"] .observation-text {
    color: rgba(255, 255, 255, 0.85);
}

.observation-image {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .observation-image {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

.observation-image img {
    width: 100%;
    max-width: 600px;
    height: auto;
    display: block;
    border-radius: 12px;
    margin: 0 auto;
}

.observation-badge {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: var(--accent, #059669);
    color: white;
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-pill, 999px);
    font-size: 0.75rem;
    font-weight: 600;
    z-index: 2;
}

.observation-with-image.highlighted .observation-content {
    border-color: rgba(5, 150, 105, 0.2);
}

[data-theme="dark"] .observation-with-image.highlighted .observation-content {
    border-color: rgba(52, 211, 153, 0.2);
    background: rgba(52, 211, 153, 0.04);
}

/* ------------------------------------------------
   Changes List
   ------------------------------------------------ */
.changes-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0;
    counter-reset: changes;
}

.changes-list li {
    position: relative;
    padding: 1rem 0 1rem 2.5rem;
    border-bottom: 1px solid var(--border-subtle, rgba(0, 0, 0, 0.06));
    font-size: 0.9375rem;
    line-height: 1.7;
    color: var(--text-body, var(--color-text));
}

.changes-list li::before {
    content: '\2713';
    position: absolute;
    left: 0.375rem;
    top: 1rem;
    color: var(--accent, #059669);
    font-weight: 700;
    font-size: 1rem;
}

[data-theme="dark"] .changes-list li {
    border-bottom-color: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.85);
}

[data-theme="dark"] .changes-list li::before {
    color: var(--accent, #34d399);
}

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

#changes-section {
    margin-top: 1rem;
}

#image-stack-gallery {
    margin-bottom: 3.5rem;
}

/* ------------------------------------------------
   Connected Threads
   ------------------------------------------------ */
.connections-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
}

.connection-card {
    border: 1px solid var(--border-subtle, rgba(0, 0, 0, 0.06));
    background: var(--bg-card, rgba(255, 255, 255, 0.5));
    backdrop-filter: blur(12px);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    text-decoration: none !important;
    color: inherit;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.connection-card,
.connection-card:hover,
.connection-card:visited,
.connection-card:active,
.connection-card * {
    text-decoration: none !important;
}

[data-theme="dark"] .connection-card {
    background: rgba(140, 182, 255, 0.04);
    border-color: rgba(140, 182, 255, 0.08);
    backdrop-filter: blur(16px);
}

@media (hover: hover) {
    .connection-card:hover {
        transform: translateY(-4px);
        border-color: var(--accent, #059669);
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    }

    [data-theme="dark"] .connection-card:hover {
        border-color: rgba(140, 182, 255, 0.2);
        box-shadow: 0 8px 28px rgba(0, 0, 0, 0.25);
    }
}

.connection-image {
    width: 100%;
    height: 130px;
    overflow: hidden;
    position: relative;
    background: var(--color-cream, #FAF3E8);
}

[data-theme="dark"] .connection-image {
    background: rgba(255, 255, 255, 0.04);
}

.connection-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

@media (hover: hover) {
    .connection-card:hover .connection-image img {
        transform: scale(1.06);
    }
}

.connection-content {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.connection-card:not(.has-image) .connection-content {
    padding-top: 1.5rem;
}

.connection-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.connection-type {
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-white, #fff);
    background: var(--text-display, #1a1a1a);
    padding: 0.25rem 0.625rem;
    border-radius: var(--radius-pill, 999px);
}

[data-theme="dark"] .connection-type {
    background: rgba(140, 182, 255, 0.12);
    color: rgba(196, 215, 255, 0.9);
    border: 1px solid rgba(140, 182, 255, 0.2);
}

.connection-icon {
    color: var(--text-muted, var(--color-muted));
    transition: all 0.3s ease;
    flex-shrink: 0;
}

[data-theme="dark"] .connection-icon {
    color: rgba(255, 255, 255, 0.4);
}

@media (hover: hover) {
    .connection-card:hover .connection-icon {
        transform: translateX(3px);
        color: var(--accent, #059669);
    }

    [data-theme="dark"] .connection-card:hover .connection-icon {
        color: var(--accent, #34d399);
    }
}

.connection-label {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-display, var(--color-text));
    line-height: 1.4;
    text-decoration: none !important;
}

[data-theme="dark"] .connection-label {
    color: rgba(255, 255, 255, 0.92);
}

/* Mobile: horizontal scroll */
@media (max-width: 768px) {
    .connections-grid {
        display: flex;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        gap: 1rem;
        margin: 0 -16px;
        padding: 0 16px 1rem;
        scrollbar-width: none;
    }

    .connections-grid::-webkit-scrollbar {
        display: none;
    }

    .connection-card {
        flex: 0 0 260px;
        scroll-snap-align: start;
    }
}

/* ------------------------------------------------
   Table of Contents (Sidebar)
   ------------------------------------------------ */
.ux-bite-sidebar {
    position: -webkit-sticky;
    position: sticky;
    top: 100px;
    align-self: start;
    height: auto;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    scrollbar-width: none;
    z-index: 10;
}

.ux-bite-sidebar::-webkit-scrollbar {
    display: none;
}

/* Progress bar */
.toc-progress {
    height: 2px;
    background: var(--border-subtle, rgba(0, 0, 0, 0.06));
    margin-bottom: 1rem;
    border-radius: 1px;
    overflow: hidden;
}

.toc-progress-bar {
    height: 100%;
    background: var(--accent, #059669);
    width: 0%;
    transition: width 0.15s linear;
    border-radius: 1px;
}

[data-theme="dark"] .toc-progress {
    background: rgba(140, 182, 255, 0.08);
}

[data-theme="dark"] .toc-progress-bar {
    background: var(--accent, #34d399);
}

.ux-bite-toc {
    padding: 1.25rem;
    background: var(--bg-card, rgba(255, 255, 255, 0.5));
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-subtle, rgba(0, 0, 0, 0.06));
    border-radius: 16px;
}

[data-theme="dark"] .ux-bite-toc {
    background: rgba(15, 22, 41, 0.5);
    backdrop-filter: blur(16px);
    border-color: rgba(140, 182, 255, 0.08);
}

.ux-bite-toc .toc-meta-card {
    display: none;
}

.toc-title {
    display: block;
    font-family: var(--font-heading, "Space Grotesk", sans-serif);
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted, var(--color-muted));
    margin: 0 0 0.875rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-subtle, rgba(0, 0, 0, 0.06));
}

[data-theme="dark"] .toc-title {
    color: rgba(196, 215, 255, 0.5);
    border-bottom-color: rgba(140, 182, 255, 0.08);
}

.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.toc-list li {
    border-bottom: none;
}

.toc-link {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-muted, var(--color-muted));
    text-decoration: none;
    transition: all 0.2s ease;
    padding: 0.5rem 0.75rem;
    line-height: 1.3;
    font-family: var(--font-body, "DM Sans", system-ui, sans-serif);
    border-radius: 8px;
}

[data-theme="dark"] .toc-link {
    color: rgba(255, 255, 255, 0.45);
}

.toc-link::after {
    display: none;
}

@media (hover: hover) {
    .toc-link:hover {
        color: var(--text-display, var(--color-text));
        background: rgba(0, 0, 0, 0.03);
    }

    [data-theme="dark"] .toc-link:hover {
        color: rgba(255, 255, 255, 0.85);
        background: rgba(255, 255, 255, 0.04);
    }
}

.toc-link.active {
    color: #fff;
    font-weight: 600;
    background: var(--text-display, #1a1a1a);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .toc-link.active {
    color: #fff;
    background: rgba(140, 182, 255, 0.12);
    box-shadow: 0 2px 8px rgba(140, 182, 255, 0.08);
}

/* ------------------------------------------------
   Diagram Section
   ------------------------------------------------ */
.diagram-container {
    background: var(--bg-card, rgba(255, 255, 255, 0.5));
    border: 1px solid var(--border-subtle, rgba(0, 0, 0, 0.06));
    border-radius: 16px;
    padding: 1.75rem;
}

[data-theme="dark"] .diagram-container {
    background: rgba(140, 182, 255, 0.04);
    backdrop-filter: blur(12px);
    border-color: rgba(140, 182, 255, 0.08);
}

.diagram-title {
    font-family: var(--font-heading, "Space Grotesk", sans-serif);
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0 0 1.25rem;
    color: var(--text-display, var(--color-text));
    text-align: center;
}

[data-theme="dark"] .diagram-title {
    color: rgba(255, 255, 255, 0.95);
}

.diagram-formula {
    font-size: 1.25rem;
    font-weight: 600;
    text-align: center;
    padding: 1.5rem;
    margin: 1.5rem 0;
    background: rgba(245, 158, 11, 0.06);
    border: 1px solid rgba(245, 158, 11, 0.15);
    border-radius: 12px;
    color: var(--text-display, var(--color-text));
    font-family: var(--font-heading, "Space Grotesk", sans-serif);
}

[data-theme="dark"] .diagram-formula {
    background: rgba(251, 191, 36, 0.08);
    border-color: rgba(251, 191, 36, 0.2);
    color: rgba(255, 255, 255, 0.95);
}

.ux-bite-diagram {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
    margin: 1.5rem 0;
}

.ux-bite-diagram .diagram-step {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
    padding: 1.5rem;
    background: var(--bg-card, rgba(255, 255, 255, 0.5));
    border: 1px solid var(--border-subtle, rgba(0, 0, 0, 0.06));
    border-radius: 12px;
    transition: all 0.3s ease;
    opacity: 1;
}

[data-theme="dark"] .ux-bite-diagram .diagram-step {
    background: rgba(140, 182, 255, 0.04);
    border-color: rgba(140, 182, 255, 0.08);
}

/* Remove scroll activation — always visible */
.ux-bite-diagram .diagram-step.active {
    opacity: 1;
    border-color: var(--accent, #059669);
}

@media (hover: hover) {
    .ux-bite-diagram .diagram-step:hover {
        transform: translateY(-2px);
        border-color: var(--accent, #059669);
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
    }

    [data-theme="dark"] .ux-bite-diagram .diagram-step:hover {
        border-color: rgba(140, 182, 255, 0.2);
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    }
}

.ux-bite-diagram .diagram-step-number {
    width: 40px;
    height: 40px;
    background: rgba(245, 158, 11, 0.08);
    color: #d97706;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    font-weight: 700;
    font-family: var(--font-heading, "Space Grotesk", sans-serif);
}

[data-theme="dark"] .ux-bite-diagram .diagram-step-number {
    background: rgba(251, 191, 36, 0.12);
    color: #fbbf24;
}

.ux-bite-diagram .diagram-step.active .diagram-step-number {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}

[data-theme="dark"] .ux-bite-diagram .diagram-step.active .diagram-step-number {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #1a1a1a;
}

.ux-bite-diagram .diagram-step-content h4 {
    font-family: var(--font-heading, "Space Grotesk", sans-serif);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-display, var(--color-text));
    margin: 0 0 0.375rem;
}

[data-theme="dark"] .ux-bite-diagram .diagram-step-content h4 {
    color: rgba(255, 255, 255, 0.95);
}

.ux-bite-diagram .diagram-step-content p {
    font-size: 0.875rem;
    color: var(--text-secondary, var(--color-muted));
    line-height: 1.6;
    margin: 0 0 0.625rem;
}

[data-theme="dark"] .ux-bite-diagram .diagram-step-content p {
    color: rgba(255, 255, 255, 0.65);
}

.diagram-metric {
    display: block;
    width: 100%;
    text-align: center;
    padding: 0.375rem 0.75rem;
    background: rgba(5, 150, 105, 0.06);
    border: 1px solid rgba(5, 150, 105, 0.15);
    border-radius: var(--radius-pill, 999px);
    font-size: 0.75rem;
    font-weight: 600;
    color: #059669;
}

[data-theme="dark"] .diagram-metric {
    background: rgba(52, 211, 153, 0.08);
    border-color: rgba(52, 211, 153, 0.2);
    color: #34d399;
}

.diagram-arrow { display: none; }

.diagram-achievement {
    grid-column: 1 / -1;
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: rgba(245, 158, 11, 0.04);
    border: 1px solid rgba(245, 158, 11, 0.12);
    border-radius: 12px;
    font-size: 0.9375rem;
    line-height: 1.7;
    color: var(--text-body, var(--color-text));
}

[data-theme="dark"] .diagram-achievement {
    background: rgba(251, 191, 36, 0.06);
    border-color: rgba(251, 191, 36, 0.15);
    color: rgba(255, 255, 255, 0.85);
}

.diagram-achievement strong {
    color: #d97706;
    font-weight: 700;
}

[data-theme="dark"] .diagram-achievement strong {
    color: #fbbf24;
}

.diagram-note {
    margin-top: 1.25rem;
    padding: 1rem;
    background: rgba(5, 150, 105, 0.04);
    border-radius: 12px;
    border-left: 3px solid var(--accent, #059669);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-body, var(--color-text));
}

[data-theme="dark"] .diagram-note {
    background: rgba(52, 211, 153, 0.04);
    border-left-color: var(--accent, #34d399);
    color: rgba(255, 255, 255, 0.8);
}

@media (max-width: 1024px) {
    .ux-bite-diagram {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .diagram-formula {
        font-size: 1.0625rem;
        padding: 1.25rem;
    }
}

/* ------------------------------------------------
   Image Gallery
   ------------------------------------------------ */
.image-stack-section {
    margin-bottom: 3rem;
}

.image-stack-container {
    padding: 0;
}

.stack-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.stack-title {
    font-family: var(--font-heading, "Space Grotesk", sans-serif);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-display, var(--color-text));
    margin: 0;
}

.stack-title::before { display: none; }

[data-theme="dark"] .stack-title {
    color: rgba(255, 255, 255, 0.92);
}

.stack-hint {
    font-size: 0.6875rem;
    color: var(--text-muted, var(--color-muted));
    padding: 0.25rem 0.75rem;
    background: var(--bg-card, rgba(255, 255, 255, 0.3));
    border: 1px solid var(--border-subtle, rgba(0, 0, 0, 0.06));
    border-radius: var(--radius-pill, 999px);
    font-weight: 500;
}

[data-theme="dark"] .stack-hint {
    color: rgba(255, 255, 255, 0.4);
    background: rgba(140, 182, 255, 0.06);
    border-color: rgba(140, 182, 255, 0.1);
}

.stack-hint-icon { display: none; }

.image-stack-wrapper {
    position: relative;
    min-height: auto;
    padding: 0;
    margin-bottom: 0;
}

.image-stack-wrapper.is-expanded {
    min-height: auto;
}

.image-stack {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.25rem;
    width: 100%;
}

.stack-image {
    position: relative;
    cursor: pointer;
    overflow: hidden;
    border-radius: 12px;
    transition: transform 0.3s ease;
}

.stack-image-inner {
    position: relative;
    background: transparent;
    border-radius: 12px;
    overflow: hidden;
    padding: 0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .stack-image-inner {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

.stack-image-inner img {
    transition: transform 0.4s ease;
}

@media (hover: hover) {
    .stack-image:hover {
        transform: translateY(-3px);
    }

    .stack-image:hover .stack-image-inner img {
        transform: scale(1.04);
    }

    .stack-image:hover .stack-image-inner {
        box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
    }

    [data-theme="dark"] .stack-image:hover .stack-image-inner {
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
    }
}

.stack-image img {
    width: 100%;
    height: auto;
    display: block;
    position: relative;
    top: 0;
    z-index: 1;
    border-radius: 12px;
    margin-bottom: 0;
}

.folder-tab { display: none; }

/* Caption overlay on hover */
.stack-image-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 2rem 1rem 0.875rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.65) 0%, transparent 100%);
    color: #fff;
    font-size: 0.8125rem;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    margin: 0;
    text-align: left;
    border-radius: 0 0 12px 12px;
    z-index: 2;
    font-weight: 400;
    line-height: 1.5;
}

@media (hover: hover) {
    .stack-image:hover .stack-image-caption {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Touch devices: show captions below */
@media (hover: none) {
    .stack-image-caption {
        position: relative;
        opacity: 1;
        transform: none;
        background: transparent;
        color: var(--text-muted, #a89073);
        padding: 0.5rem 0 0;
        border-radius: 0;
    }
}

[data-theme="dark"] .stack-image-caption {
    color: #fff;
}

/* Override JS states */
.image-stack:not(.expanded) .stack-image,
.image-stack.expanded .stack-image {
    position: relative !important;
    transform: none !important;
    opacity: 1 !important;
}

.image-stack:not(.expanded) .stack-image-caption {
    pointer-events: auto;
    visibility: visible;
}

.image-stack:not(.expanded)::after {
    display: none;
}

@media (max-width: 768px) {
    .image-stack {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .stack-image-caption {
        position: relative;
        opacity: 1;
        transform: none;
        background: transparent;
        color: var(--text-muted, #a89073);
        padding: 0.5rem 0 0;
        border-radius: 0;
    }

    [data-theme="dark"] .stack-image-caption {
        color: rgba(255, 255, 255, 0.45);
    }
}

/* ------------------------------------------------
   Lightbox
   ------------------------------------------------ */
.image-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    animation: lbFadeIn 0.25s ease;
}

.image-lightbox.active {
    display: flex;
}

@keyframes lbFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    animation: lbScaleIn 0.25s ease;
}

@keyframes lbScaleIn {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

.lightbox-image {
    max-width: 100%;
    max-height: 90vh;
    height: auto;
    width: auto;
    display: block;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
}

.lightbox-caption {
    position: absolute;
    bottom: -2.5rem;
    left: 0;
    right: 0;
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.875rem;
    line-height: 1.5;
    padding: 0 1rem;
}

.lightbox-close {
    position: absolute;
    top: -2.5rem;
    right: 0;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-pill, 999px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    transition: all 0.2s ease;
    backdrop-filter: blur(8px);
}

@media (hover: hover) {
    .lightbox-close:hover {
        background: rgba(255, 255, 255, 0.2);
    }
}

@media (max-width: 768px) {
    .lightbox-content {
        max-width: 95vw;
    }

    .lightbox-close {
        top: 1rem;
        right: 1rem;
    }

    .lightbox-caption {
        bottom: 1rem;
        font-size: 0.8125rem;
    }
}

/* Legacy hero classes — hide if still present */
.hero-immersive { display: none; }
.hero-immersive-image { display: none; }
.hero-immersive-overlay { display: none; }
.hero-immersive-content { display: none; }
.ux-bite-hero-images-grid { display: none; }
.ux-bite-hero-image { display: none; }

/* ------------------------------------------------
   Responsive — Tablet
   ------------------------------------------------ */
@media (max-width: 1024px) {
    .ux-bite-hero-hook {
        font-size: 1.0625rem;
    }

    .ux-bite-hero-meta {
        grid-template-columns: repeat(2, 1fr);
        padding: 1.5rem;
    }
}

/* ------------------------------------------------
   Responsive — Mobile
   ------------------------------------------------ */
@media (max-width: 768px) {
    .ux-bite-detail-wrapper {
        padding: 1.5rem 0 3rem;
    }

    .ux-bite-section {
        margin-bottom: 2.5rem;
    }

    .hero-image-wrapper {
        border-radius: 16px;
        margin-bottom: 1.5rem;
    }

    .ux-bite-hero-title {
        font-size: clamp(1.75rem, 6vw, 2.25rem);
    }

    .ux-bite-hero-hook {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }

    .ux-bite-hero-badge {
        gap: 0.5rem;
        margin-bottom: 1rem;
    }

    .hero-pattern,
    .hero-spotlight {
        font-size: 0.6875rem;
        padding: 0.3rem 0.75rem;
    }

    .ux-bite-hero-meta {
        grid-template-columns: 1fr 1fr;
        padding: 1.25rem;
        gap: 1rem;
    }

    .meta-label { font-size: 0.625rem; }
    .meta-value { font-size: 0.9375rem; }

    .core-idea-text {
        font-size: 1.125rem;
        line-height: 1.6;
        padding: 1.5rem 0 1.5rem 1.25rem;
    }

    .key-lesson-card {
        padding: 1.25rem;
        gap: 1rem;
    }

    .lesson-number {
        width: 30px;
        height: 30px;
        min-width: 30px;
        font-size: 0.75rem;
        border-radius: 8px;
    }

    .lesson-concept { font-size: 1rem; }
    .lesson-summary { font-size: 0.875rem; }

    .lesson-takeaway,
    .key-lesson-card:hover .lesson-takeaway,
    .key-lesson-card.in-view .lesson-takeaway {
        font-size: 0.8125rem;
        padding: 0.75rem;
    }

    .context-insight-card {
        padding: 1.25rem;
    }

    .context-insight-card p {
        font-size: 0.875rem;
    }

    .subsection-title { font-size: 0.9375rem; }

    .observations-list li {
        padding: 1rem 0 1rem 2.25rem;
        font-size: 0.875rem;
    }

    .changes-list li {
        padding: 0.875rem 0 0.875rem 2.25rem;
        font-size: 0.875rem;
    }

    .connection-label {
        font-size: 0.875rem;
    }

    .diagram-formula {
        font-size: 1rem;
        padding: 1rem;
    }

    .ux-bite-diagram .diagram-step {
        padding: 1.25rem;
    }

    .ux-bite-diagram .diagram-step-number {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    .ux-bite-diagram .diagram-step-content h4 {
        font-size: 0.9375rem;
    }

    .ux-bite-diagram .diagram-step-content p {
        font-size: 0.8125rem;
    }
}

/* Extra small mobile */
@media (max-width: 400px) {
    .ux-bite-hero-meta {
        grid-template-columns: 1fr;
    }

    .key-lesson-card {
        flex-direction: column;
        gap: 0.75rem;
    }

    .lesson-number {
        width: 28px;
        height: 28px;
        min-width: 28px;
    }
}

/* ------------------------------------------------
   Reduced Motion
   ------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
    .core-idea-text,
    .key-lesson-card,
    .context-insight-card,
    .connection-card,
    .ux-bite-diagram .diagram-step,
    .stack-image {
        transition: none;
    }

    .section-title::after {
        transition: none;
        width: 60px;
    }
}
