@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400..700;1,9..40,400..700&family=Fraunces:ital,opsz,wght@0,9..144,100..900;1,9..144,100..900&display=swap');

:root {
    /* Identity Colors - Economist Brand Palette */
    --bg-color: #F5F4EF; /* Los Angeles 95 - Canvas */
    --bg-secondary: #FFFFFF;
    --text-primary: #111827;
    --text-secondary: #4B5563;
    --accent-red: #E3120B; /* Economist Red */
    --accent-red-hover: #991B1B; /* Darker red for hover */
    --accent-green: #166534;
    --border-light: #E5E7EB;
    
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --card-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    /* Typography */
    --font-heading: 'Fraunces', serif;
    --font-body: 'DM Sans', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    
    --max-width: 1080px;
    --nav-height: 70px;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: var(--nav-height);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Utilities */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
}

@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }
}

.section {
    padding-top: 36px;
    padding-bottom: 36px;
    border-bottom: 1px solid var(--border-light);
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

h2 {
    font-size: 36px;
    margin-bottom: 48px;
    text-align: center;
}

p {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

strong {
    color: var(--text-primary);
    font-weight: 600;
}

a {
    text-decoration: none;
    color: var(--accent-red);
    transition: color 0.2s ease, opacity 0.2s ease;
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
}

a:hover {
    text-decoration: underline;
}

/* Navigation */
.main-nav {
    position: sticky;
    top: 0;
    width: 100%;
    background-color: var(--nav-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-light);
    z-index: 1000;
    height: var(--nav-height);
    display: flex;
    align-items: center;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 18px;
    color: var(--text-primary);
    text-decoration: none;
}

.nav-logo:hover {
    text-decoration: none;
    color: var(--accent-red);
}

.nav-coin {
    width: 36px !important;
    height: 36px !important;
    margin: 0 !important;
}

.nav-coin .coin-inner {
    border-width: 2px !important;
}

.nav-links {
    display: flex;
    gap: 32px;
}

.nav-links a {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 14px;
    text-decoration: none;
}

.nav-links a:hover {
    color: var(--accent-red);
    text-decoration: none;
}

.nav-links a.active {
    color: var(--accent-red);
    font-weight: 700;
}

.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    background: none;
    border: none;
    padding: 4px;
}

.hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background-color: var(--text-primary);
    transition: 0.3s;
}

/* Mobile Nav Toggle */
#nav-toggle {
    display: none;
}

/* Buttons */
.btn {
    display: inline-block;
    background-color: var(--accent-red);
    color: white;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    text-decoration: none;
}

.btn:hover {
    background-color: var(--accent-red-hover); /* Darker red hover */
    text-decoration: none;
    transform: translateY(-1px);
    color: white;
}

.btn-secondary {
    background-color: transparent;
    color: var(--accent-red);
    border: 1px solid var(--accent-red);
}

.btn-secondary:hover {
    background-color: rgba(227, 18, 11, 0.05);
    color: var(--accent-red);
}

.link-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: var(--accent-red);
    background: var(--bg-secondary);
    padding: 12px 24px;
    border-radius: 8px;
    box-shadow: var(--card-shadow);
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid var(--border-light);
}

.link-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--card-hover);
    text-decoration: none;
}

/* Hero Section */
.hero {
    padding-top: 60px;
    padding-bottom: 24px;
    text-align: center;
    position: relative;
}

/* Hero Profile Coin Flip Animation */
.profile-coin {
    width: 140px;
    height: 140px;
    margin: 0 auto 32px;
    perspective: 1200px;
    cursor: pointer;
    position: relative;
    z-index: 10;
}

.coin-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transform-style: preserve-3d;
    box-shadow: var(--card-shadow);
    border-radius: 50%;
    border: 4px solid var(--accent-red);
    transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    will-change: transform;
}

.coin-inner.is-flipped {
    transform: rotateY(180deg) scale(1.05);
}

.coin-front, .coin-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: 50%;
    overflow: hidden;
    background-color: var(--bg-secondary);
    /* Prevent sub-pixel jitter */
    transform: rotateX(0);
    /* Subtle 3D highlight */
    background-image: linear-gradient(135deg, rgba(255,255,255,0.3) 0%, transparent 100%);
}

.coin-front img, .coin-back img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.coin-back {
    transform: rotateY(180deg);
}

.hero h1 {
    font-size: clamp(32px, 5vw, 48px);
    margin-bottom: 16px;
    color: var(--text-primary);
    line-height: 1.1;
    position: relative;
    z-index: 1;
}

.hero-subtitle {
    font-size: clamp(16px, 2vw, 20px);
    color: var(--text-secondary);
    margin-bottom: 32px;
    font-weight: 400;
    position: relative;
    z-index: 1;
}

.status-badge {
    display: inline-block;
    background-color: rgba(227, 18, 11, 0.1);
    color: var(--accent-red);
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 24px;
    position: relative;
    z-index: 1;
}

.bio-text {
    max-width: 760px;
    margin: 0 auto 40px;
    text-align: left;
    position: relative;
    z-index: 1;
}

.bio-text p {
    font-size: 17px;
    margin-bottom: 24px;
    line-height: 1.7;
}

.hero-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}

.resume-meta {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 8px;
}

/* Competencies Grid */
#competencies {
    padding-top: 40px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 32px;
}

.skill-card {
    background: var(--bg-secondary);
    padding: 32px;
    border-radius: 16px;
    transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1), 
                box-shadow 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    display: flex;
    flex-direction: column;
    border: 1px solid #E2E8F0;
    transform-style: preserve-3d;
    backface-visibility: hidden;
}

.skill-card:hover {
    transform: translate3d(0, -8px, 20px) scale(1.02);
    box-shadow: var(--card-hover);
}

.skill-card h3 {
    font-size: 20px;
    margin-bottom: 16px;
    color: var(--text-primary);
    font-family: var(--font-body);
}

.skill-list {
    list-style: none;
}

.skill-list li {
    margin-bottom: 12px;
    color: var(--text-secondary);
    font-size: 15px;
    position: relative;
    padding-left: 16px;
}

.skill-list li::before {
    content: "•";
    color: var(--accent-red);
    position: absolute;
    left: 0;
    font-weight: bold;
}

.skill-link {
    font-size: 13px;
    display: inline-block;
    margin-top: 4px;
    color: var(--accent-red);
    opacity: 0.8;
}

/* Projects Section */
#projects-grid {
    perspective: 1200px;
    position: relative;
    padding-bottom: 50vh; /* Increased to allow sticky space for the last card */
}

.project-card {
    background: var(--bg-secondary);
    border-radius: 16px;
    overflow: hidden; /* Changed from visible to contain the whiteout overlay */
    overflow-y: auto;
    max-height: 80vh;
    box-shadow: var(--card-shadow);
    margin-bottom: 45vh;
    display: flex;
    flex-direction: column;
    border: 2px solid var(--border-light);
    position: sticky;
    top: clamp(100px, 15vh, 200px); /* Responsive sticky top */
    will-change: transform, opacity, filter;
    transform-origin: top center;
    transition: box-shadow 0.4s cubic-bezier(0.165, 0.84, 0.44, 1), 
                border-color 0.4s cubic-bezier(0.165, 0.84, 0.44, 1),
                transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1),
                opacity 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
    transform-style: preserve-3d;
    backface-visibility: hidden;

    /* Transform and filter driven by JS via CSS vars — do NOT add these to transition for the scroll part */
    transform:
        translate3d(var(--tx, 0), var(--ty, 50px), var(--tz, 0))
        rotateX(var(--rx, 0deg))
        rotateY(var(--ry, 0deg))
        rotateZ(var(--r, -2deg))
        scale(var(--s, 0.93));
    opacity: var(--o, 0.001);
    filter: brightness(var(--b, 1));
    z-index: 1; /* Base z-index, overridden by JS */
}

/* Specific adjustment for shorter viewports */
@media (max-height: 1080px) {
    .project-card {
        top: 80px;
    }
}

/* Instant re-order helper */
.project-card.no-transition {
    transition: none !important;
}

/* White-out overlay for smooth background blending */
.project-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background-color: var(--bg-color);
    opacity: var(--whiteout, 0);
    pointer-events: none;
    z-index: 100;
    transition: opacity 0.1s linear;
}

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

.project-card.visible {
    opacity: var(--o, 1);
}

.project-card:hover {
    box-shadow: var(--card-hover);
    border-color: var(--accent-red);
    /* Slightly pop-out effect on hover */
    transform:
        translate3d(var(--tx, 0), var(--ty, 50px), calc(var(--tz, 0) + 20px))
        rotateX(var(--rx, 0deg))
        rotateY(var(--ry, 0deg))
        rotateZ(var(--r, -2deg))
        scale(calc(var(--s, 0.93) + 0.03));
        z-index: 1000 !important; /* Ensure hovered card is on top of siblings */
        }
/* Flagship Project Tiering */
.project-card.flagship {
    border-top: 4px solid var(--accent-red);
    align-items: stretch;
}

/* Landscape Layout Variant */
.project-card.layout-landscape {
    flex-direction: column;
    height: 80vh; /* Force exact height so flex dynamically fills space without overflowing */
    max-height: 80vh;
    overflow: hidden; /* Disable whole-card scrolling */
}

.project-card.layout-landscape .project-visual {
    width: 100%;
    flex: 1; /* Dynamically fill remaining space */
    min-height: 200px; /* Prevent it from disappearing entirely */
    height: auto;
    display: block; /* Remove flex to avoid auto-height inheritance bugs */
    position: relative;
    padding: 0; /* Remove padding to maximize space */
    border-left: none;
    border-bottom: none;
    background-color: transparent;
}

@media (max-height: 1080px) {
    .project-card.layout-landscape .project-visual {
        min-height: 350px;
    }
}

.project-card.layout-landscape .project-content {
    max-width: 100%;
    padding: 16px 24px;
    flex: 0 1 auto !important; /* Allow shrinking if needed */
    justify-content: flex-start !important;
    overflow-y: auto; /* Scroll only the text if absolutely necessary, protecting the buttons */
}

@media (max-height: 1080px) {
    .project-card.layout-landscape .project-content {
        padding: 16px 24px;
    }
}

.project-card.layout-landscape .project-content p {
    max-width: 800px; /* Maintain readability on wide layout */
}

.project-card.flagship .project-title {
    font-size: clamp(24px, 5vw, 32px);
    margin-bottom: 12px;
}

/* Contact Sidebar */
.contact-sidebar {
    position: fixed;
    right: 0;
    bottom: 0;
    width: 100px; /* Wider hit zone */
    height: 100vh;
    z-index: 100;
    display: none; 
    pointer-events: auto; /* Active trigger */
}

/* Side Timeline */
.side-timeline {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    width: 120px; /* Wider hit zone */
    z-index: 1000;
    display: none;
    pointer-events: auto; /* Active trigger */
}

@media (min-width: 960px) {
    .side-timeline, .contact-sidebar {
        display: block;
    }
    .page-content {
        padding: 0 120px; /* Match sidebar width for balance */
    }
}

.timeline-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: flex-start;
    position: absolute;
    top: 50%;
    left: 40px; /* Fixed distance from edge */
    transform: translateY(-50%);
}

.sidebar-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    position: absolute;
    right: 40px; /* Fixed distance from edge */
    bottom: 0;
}

.timeline-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    padding: 8px 0;
    cursor: pointer;
}

.timeline-marker {
    display: flex;
    align-items: center;
    position: relative;
}

.timeline-line {
    width: 30px;
    height: 2px;
    background-color: var(--text-secondary);
    opacity: 0.3;
    transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.3s ease, opacity 0.3s ease;
}

.timeline-label {
    position: absolute;
    left: 100%;
    margin-left: 15px;
    white-space: nowrap;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-secondary);
    opacity: 0; /* Hidden by default */
    transform: translateX(-10px);
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), color 0.3s ease;
    pointer-events: none;
}

/* Hover States - Reveal labels */
.side-timeline:hover .timeline-label {
    opacity: 0.6;
    transform: translateX(0);
}

.timeline-link:hover .timeline-line {
    width: 45px;
    background-color: var(--accent-red);
    opacity: 1;
}

.timeline-link:hover .timeline-label {
    opacity: 1 !important;
    color: var(--text-primary);
    transform: translateX(0);
}

/* Active State */
.timeline-link.active .timeline-line {
    width: 60px;
    background-color: var(--accent-red);
    opacity: 1;
}

.timeline-link.active .timeline-label {
    opacity: 0.8;
    transform: translateX(0);
    color: var(--accent-red);
}

/* Scroll Fade-out Logic (applied via JS class) */
body.is-scrolling .timeline-label,
body.is-scrolling .sidebar-label {
    opacity: 0 !important;
    transition: opacity 0.2s ease;
}

@keyframes fadeInSidebar {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.sidebar-label {
    writing-mode: vertical-rl;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.25em;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    margin-bottom: 4px;
    opacity: 0; /* Hidden by default */
    transition: opacity 0.3s ease;
}

.contact-sidebar:hover .sidebar-label {
    opacity: 0.6;
}

.sidebar-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-links a {
    color: var(--text-secondary);
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    transform-style: preserve-3d;
}

.sidebar-links a:hover {
    color: var(--accent-red);
    background-color: rgba(227, 18, 11, 0.08);
    transform: translate3d(0, -6px, 10px) scale(1.1);
}

.sidebar-links a svg {
    width: 22px;
    height: 22px;
    pointer-events: none; /* Let the anchor handle the click */
}

.sidebar-line {
    width: 1px;
    height: 100px;
    background-color: var(--border-light);
}

.page-content {
    transition: padding 0.3s ease;
}

/* Optimized Scroll Reveal */
.reveal {
    opacity: 0;
    transform: translate3d(0, 40px, 0); /* Use translate3d for GPU acceleration */
    transition: transform 0.8s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal.visible {
    opacity: 1;
    transform: translate3d(0, 0, 0);
}

@media (min-width: 768px) {
    .project-card {
        flex-direction: row;
        align-items: stretch;
    }
    .project-content {
        flex: 1;
        padding: 16px 24px;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
}

.project-visual {
    flex: 1 1 45%;
    background-color: transparent; /* Distinct from both card and website bg */
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 350px; /* Reduced to fit better on standard heights */
    max-height: 70vh; /* Ensures it never takes more than 70% of viewport */
    padding: 20px;
    border-left: none;
    position: relative;
    overflow: hidden;
    border-radius: 12px;
}

@media (max-height: 1080px) {
    .project-visual {
        min-height: 400px;
    }
}

/* Slider Container */
.project-slider-container {
    width: 100%;
    height: 100%;
    position: absolute; /* Force it to strictly fill the parent height */
    top: 0;
    left: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.slider-track {
    width: 100%;
    height: 100%;
    flex: 1;
    min-height: 0;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none; /* Firefox */
}
.slider-track::-webkit-scrollbar {
    display: none; /* Safari/Chrome */
}

@media (max-height: 1080px) {
    .slider-track {
        min-height: 250px;
    }
}

.slider-card {
    position: relative;
    flex: 0 0 100%;
    height: 100%; /* Use full height */
    background-color: transparent;
    border: none;
    border-radius: 12px;
    display: block; /* Use block to bypass Safari flex bugs */
    padding: 0; /* Remove padding */
    scroll-snap-align: center;
    opacity: 1;
    user-select: none;
}

.slider-card.dragging {
    cursor: grabbing;
}

.slider-card img {
    display: block;
    width: 100%;
    height: 100%;
    max-height: 100%;
    object-fit: contain !important;
}

/* Navigation Controls */
.slider-nav {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    padding: 12px 0; /* Reduced padding */
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-light);
}

@media (max-height: 1080px) {
    .slider-nav {
        padding: 8px 0;
        gap: 16px;
    }
}

.slider-btn {
    background: rgba(0, 0, 0, 0.4);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

@media (max-height: 1080px) {
    .slider-btn {
        width: 36px;
        height: 36px;
    }
}

.slider-btn:hover {
    background: rgba(0, 0, 0, 0.6);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.slider-dots {
    display: flex;
    gap: 8px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--border-light);
    cursor: pointer;
    transition: all 0.3s ease;
}

.dot.active {
    background-color: var(--accent-red);
    width: 20px;
    border-radius: 4px;
}

/* Image Lightbox Modal */
.lightbox {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    cursor: zoom-out;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lightbox.visible {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

.lightbox-content {
    margin: auto;
    display: block;
    max-width: 85%;
    max-height: 80vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.lightbox.visible .lightbox-content {
    transform: scale(1);
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    font-size: 60px;
    font-weight: 300;
    padding: 20px;
    cursor: pointer;
    user-select: none;
    transition: color 0.2s, transform 0.2s;
    z-index: 10001;
    opacity: 0.5;
}

.lightbox-nav:hover {
    color: var(--accent-red);
    opacity: 1;
    transform: translateY(-50%) scale(1.1);
}

.lightbox-nav.prev { left: 20px; }
.lightbox-nav.next { right: 20px; }

#lightbox-caption {
    margin: 10px auto;
    display: block;
    width: 80%;
    max-width: 700px;
    text-align: center;
    color: #FFFFFF;
    font-family: var(--font-body);
    font-size: 14px;
    letter-spacing: 0.02em;
    opacity: 0.8;
}

/* Zoomable Image Indicators */
.figure-card img, 
.node-figure img, 
.visual-container img, 
.slider-card.active img, 
.project-img {
    cursor: zoom-in;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
    z-index: 10002;
}

.lightbox-close:hover,
.lightbox-close:focus {
    color: #bbb;
    text-decoration: none;
    cursor: pointer;
}

@media (max-width: 700px) {
    .lightbox-content {
        max-width: 95%;
        max-height: 75vh;
    }
    
    .lightbox-close {
        top: 10px;
        right: 20px;
        font-size: 35px;
    }
}

.visual-embed > div {
    width: 100%;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-light);
    box-shadow: var(--card-shadow);
}
    /* Secondary cards are smaller */
    .project-card:not(.flagship) .project-content {
        padding: 24px;
    }

    @media (max-height: 1080px) {
        .project-card:not(.flagship) .project-content {
            padding: 16px;
        }
    }
    .project-card:not(.flagship) .project-title {
        font-size: 24px;
    }
}

.project-content {
    padding: 32px;
}

.project-meta {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent-red);
    margin-bottom: 12px;
    display: block;
    font-family: var(--font-mono);
}

.project-title {
    font-size: clamp(20px, 4vw, 26px);
    margin-bottom: 12px;
    line-height: 1.2;
}

.tech-stack-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 16px 0;
}

.tag {
    background: var(--bg-color);
    border: 1px solid var(--border-light);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

.project-img {
    max-width: 100%;
    max-height: 400px;
    width: auto;
    height: auto;
    border-radius: 8px;
    box-shadow: var(--card-shadow);
    display: block;
}

/* NDA Badge */
.nda-badge {
    display: inline-block;
    background: rgba(227, 18, 11, 0.1);
    color: var(--accent-red);
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-left: 12px;
    vertical-align: middle;
    border: 1px solid rgba(227, 18, 11, 0.2);
}

/* KPI Grid for Project Cards */
.project-kpis {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin: 24px 0;
    padding: 16px;
    background: var(--bg-color);
    border-radius: 8px;
    border: 1px solid var(--border-light);
}

.kpi-item {
    display: flex;
    flex-direction: column;
}

.kpi-value {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 18px;
    color: var(--accent-red);
}

.kpi-label {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
}

.placeholder-img {
    width: 100%;
    height: 300px;
    background-color: var(--border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    border-radius: 8px;
    font-weight: 500;
    text-align: center;
    padding: 20px;
}

.project-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: auto;
}

/* Experience List */
.exp-subsection {
    margin-top: 48px;
    margin-bottom: 12px;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 8px;
}

.experience-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 24px 0;
    border-bottom: 1px solid var(--border-light);
}

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

.role {
    font-weight: 600;
    font-size: 18px;
    color: var(--text-primary);
}

.company {
    color: var(--accent-red);
    font-weight: 500;
    font-size: 15px;
    margin-bottom: 8px;
}

.exp-desc {
    color: var(--text-secondary);
    font-size: 15px;
    max-width: 500px;
}

.exp-left {
    flex: 1;
    padding-right: 24px;
}

.exp-right {
    flex: 1;
}

/* Contact Section (Bottom) */
#contact {
    text-align: center;
    background-color: var(--bg-secondary);
    padding: 36px 0; /* Shrink the section further */
}

.contact-links {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin: 24px 0; /* Tighten margins */
}

.contact-link {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.contact-link:hover {
    color: var(--accent-red);
    text-decoration: none;
}

/* Footer */
footer {
    padding: 40px 0;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
    background-color: var(--bg-color);
    border-top: 1px solid var(--border-light);
}

/* Pages - Methodology & Results Common Overrides */
.page-nav-top {
    margin-top: 40px;
    margin-bottom: 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.back-link {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s;
}
.back-link:hover { color: var(--accent-red); }

.page-switcher {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 600;
}

.page-switcher a { color: var(--text-secondary); }
.page-switcher a:hover { color: var(--text-primary); }
.page-switcher .active { color: var(--accent-red); cursor: default; }
.page-switcher .separator { color: var(--border-light); font-weight: 400; }

.page-header { text-align: center; margin-bottom: 60px; }
.page-title { font-size: 36px; margin-bottom: 16px; }
.page-subtitle { color: var(--text-secondary); font-size: 18px; max-width: 700px; margin: 0 auto; }

/* Responsive adjustments */
@media (max-width: 768px) {
    :root {
        --nav-height: 60px;
    }
    
    h1 { font-size: 32px; }
    h2 { font-size: 26px; margin-bottom: 32px; }
    
    .section { padding-top: 60px; padding-bottom: 60px; }
    
    .hamburger { display: flex; }
    .nav-links {
        display: none;
        position: absolute;
        top: var(--nav-height);
        left: 0;
        width: 100%;
        background-color: var(--bg-secondary);
        flex-direction: column;
        padding: 32px 24px;
        border-bottom: 1px solid var(--border-light);
        gap: 20px;
        box-shadow: var(--card-hover);
        text-align: center;
    }
    .nav-links a {
        font-size: 16px;
        padding: 8px 0;
    }
    #nav-toggle:checked ~ .nav-links { display: flex; }
    
    .hero { padding-top: 40px; padding-bottom: 40px; }
    .hero h1 { font-size: 36px; }
    .hero-img { width: 110px; height: 110px; }
    
    .project-card { flex-direction: column; position: relative; top: auto; margin-bottom: 24px; }
    .project-visual { height: 364px; min-height: 364px; border-left: none; border-top: none; background-color: transparent; align-items: stretch; }
    .project-card.layout-landscape .project-visual { height: 364px; min-height: 364px; }
    .project-img { max-height: 300px; }
    
    .experience-item { flex-direction: column; gap: 12px; }
    .exp-left { padding-right: 0; }
    .exp-desc { max-width: 100%; }
    .exp-right { text-align: left !important; opacity: 0.6; }
    
    .page-nav-top { flex-direction: column; gap: 20px; align-items: flex-start; margin-top: 24px; }
    .page-switcher { width: 100%; justify-content: space-between; border-top: 1px solid var(--border-light); padding-top: 16px; }
    
    .kpi-grid { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; gap: 16px; max-width: 100%; box-sizing: border-box; }
    .kpi-grid::-webkit-scrollbar { display: none; }
    .kpi-card { padding: 16px; scroll-snap-align: center; flex: 0 0 85%; max-width: 85%; }
    .kpi-card .kpi-value { font-size: 24px; }
}

@media (max-width: 480px) {
    h1 { font-size: 28px; }
    h2 { font-size: 22px; }
    p { font-size: 15px; line-height: 1.7; }
    
    .hero h1 { font-size: 30px; }
    .hero-subtitle { font-size: 15px; }
    .bio-text p { font-size: 16px; }
    
    .project-title { font-size: 22px !important; }
    .project-content { padding: 16px !important; }
    .project-kpis { grid-template-columns: 1fr; }
    
    .btn { width: 100%; text-align: center; justify-content: center; }
    .hero-actions { flex-direction: column; gap: 12px; }
    .hero-actions div { width: 100%; }
    
    /* Resume viewer mobile overrides */
    .resume-viewer { margin: 0 0 32px; border-radius: 0; }
    .rv-embed-wrapper { height: 0; overflow: hidden; }
    .rv-canvas-container { display: none; }
    .rv-fallback { display: block; }
    .rv-fallback-links .btn { width: auto; }
    
    .contact-links { flex-direction: column; gap: 16px; align-items: flex-start; }
    
    .grid-3 { grid-template-columns: 1fr; }
    
    /* Pages specific */
    .page-title { font-size: 28px; }
    .page-subtitle { font-size: 16px; }
    .node { padding: 20px; }
    .node-title { font-size: 18px; }
    .section-title { font-size: 22px; }
    .figure-card { padding: 16px; }
    
    .industrial-ahp-block, .wsm-viz-block { padding: 16px; }
    .jab-row, .wsm-data-row { padding: 12px 8px; }
    .wsm-full-table { min-width: 100%; }
}

/* ============================================
   INLINE DATA VISUALIZATIONS (replaces screenshots)
   ============================================ */

/* Shared container */
.inline-matrix-preview,
.inline-ahp-preview,
.inline-wsm-preview {
    padding: 24px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 16px;
    justify-content: center;
}

.imp-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

.imp-note {
    font-size: 11px;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    line-height: 1.5;
    border-top: 1px solid var(--border-light);
    padding-top: 12px;
    margin-top: 4px;
}

/* ---- Correlation Matrix ---- */
.imp-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-mono);
    font-size: 13px;
}

.imp-table th {
    padding: 8px 12px;
    text-align: center;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-light);
}

.imp-table td {
    padding: 10px 12px;
    text-align: center;
    border-radius: 4px;
    font-weight: 500;
}

.imp-table .row-h {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    text-align: right;
    padding-right: 16px;
}

.imp-table .cell-diag {
    background: var(--bg-color);
    color: var(--text-secondary);
    font-size: 12px;
}

.imp-table .cell-high {
    background: var(--accent-red);
    color: white;
    font-size: 15px;
    font-weight: 700;
}

.imp-table .cell-low {
    background: #FEE2E2;
    color: var(--accent-red);
    font-size: 14px;
}

@media (prefers-color-scheme: dark) {
    .imp-table .cell-low {
        background: rgba(227, 18, 11, 0.15);
        color: white;
    }
    .imp-table .cell-diag {
        background: rgba(255,255,255,0.04);
    }
}

/* ---- AHP Bar Chart ---- */
.ahp-bars,
.wsm-bars {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ahp-row,
.wsm-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ahp-name,
.wsm-name {
    font-size: 12px;
    color: var(--text-primary);
    min-width: 160px;
    flex-shrink: 0;
    font-weight: 500;
}

.ahp-track,
.wsm-track {
    flex: 1;
    height: 6px;
    background: var(--border-light);
    border-radius: 3px;
    overflow: hidden;
    min-width: 60px;
}

.ahp-fill,
.wsm-fill {
    height: 100%;
    border-radius: 3px;
    background: var(--accent-red);
    transition: width 0.6s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.wsm-fill.wsm-winner {
    background: var(--accent-red);
}

.ahp-score,
.wsm-score {
    font-size: 12px;
    font-weight: 700;
    color: var(--accent-red);
    font-family: var(--font-mono);
    min-width: 60px;
    text-align: right;
    flex-shrink: 0;
}

.wsm-score.wsm-top {
    color: var(--accent-red);
}

.ahp-rank {
    font-size: 10px;
    color: var(--text-secondary);
    font-weight: 400;
    margin-left: 4px;
}

/* ============================================
   METHODOLOGY NODE FIGURE — full-width plots
   ============================================ */

.node-figure {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--border-light);
}

.node-figure img {
    width: 100%;
    height: auto;
    max-height: 520px;
    object-fit: contain;
    border-radius: 8px;
    display: block;
    background: var(--bg-color);
}

.node-figure figcaption {
    margin-top: 12px;
    font-size: 13px;
    color: var(--text-secondary);
    text-align: center;
    font-style: italic;
    line-height: 1.5;
    font-family: var(--font-body);
}

/* Robustness validation presentation */
.validation-presentation {
    display: flex;
    flex-direction: column;
    gap: 48px;
    margin-top: 32px;
    padding-top: 32px;
    border-top: 1px solid var(--border-light);
}

.val-item {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 40px;
    align-items: center;
}

.val-visual img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    border: 1px solid var(--border-light);
    box-shadow: var(--card-shadow);
    background: var(--bg-color);
}

.val-content h4 {
    font-family: var(--font-heading);
    font-size: 18px;
    margin-bottom: 12px;
    color: var(--accent-red);
}

.val-content p {
    font-size: 14px;
    margin-bottom: 0;
    line-height: 1.6;
}

@media (max-width: 768px) {
    .val-item {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .val-item:nth-child(even) .val-visual {
        order: 2;
    }
}

/* Robustness validation grid — 2x2 responsive */
.validation-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.val-fig {
    margin: 0;
    padding: 0;
}

.val-fig img {
    width: 100%;
    height: auto;
    border-radius: 6px;
    display: block;
    background: var(--bg-color);
    border: 1px solid var(--border-light);
}

.val-fig figcaption {
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
    font-style: italic;
    line-height: 1.4;
    font-family: var(--font-body);
}

@media (max-width: 600px) {
    .validation-grid {
        grid-template-columns: 1fr;
    }
    .node-figure img {
        max-height: none;
    }
}

/* Methodology Flow Styles */
.flow-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.node {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 32px;
    margin-bottom: 24px;
    width: 100%;
    box-shadow: var(--card-shadow);
    position: relative;
    transition: transform 0.2s ease;
}

.node:hover {
    transform: translateY(-2px);
    box-shadow: var(--card-hover);
}

.node.terminal {
    background: var(--accent-red);
    color: white;
    font-weight: 700;
    text-align: center;
    padding: 20px;
    border: none;
    font-family: var(--font-heading);
    font-size: 18px;
    text-decoration: none;
}

.node.terminal.end-btn {
    display: block;
    margin-top: 40px;
    transition: background-color 0.2s;
}

.node.terminal.end-btn:hover {
    background-color: var(--accent-hover);
}

.node-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 12px;
}

.node-title {
    font-family: var(--font-heading);
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
}

.tech-stack {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--accent-red);
    font-weight: 600;
}

.content-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 32px;
}

@media (max-width: 768px) {
    .content-grid {
        grid-template-columns: 1fr;
    }
}

.formula-box {
    background: var(--bg-color);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 16px;
    font-family: var(--font-mono);
    font-size: 13px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.formula-label {
    font-size: 10px;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 700;
}

.arrow-down {
    width: 2px;
    height: 40px;
    background: var(--border-light);
    margin: 10px auto;
    position: relative;
}

.arrow-down::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 8px solid var(--border-light);
}

/* Results Page Styles */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 24px;
    margin-bottom: 60px;
}

.kpi-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    box-shadow: var(--card-shadow);
}

.kpi-card .kpi-value {
    display: block;
    font-size: 32px;
    margin-bottom: 4px;
}

.finding-section {
    margin-bottom: 100px;
}

.section-header {
    text-align: center;
    max-width: 800px;
    margin: 0 auto 48px;
}

.section-title {
    font-size: 28px;
    margin-bottom: 16px;
}

.section-desc {
    font-size: 17px;
    color: var(--text-secondary);
    line-height: 1.7;
}

.figure-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--card-shadow);
    margin-bottom: 24px;
}

.figure-img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    display: block;
}

.figure-caption {
    margin-top: 16px;
    font-size: 13px;
    color: var(--text-secondary);
    text-align: center;
    font-style: italic;
    line-height: 1.5;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 40px;
}

@media (max-width: 768px) {
    .grid-2 {
        grid-template-columns: 1fr;
    }
}

.highlight-box {
    background: rgba(227, 18, 11, 0.03);
    border-left: 4px solid var(--accent-red);
    padding: 32px;
    border-radius: 0 12px 12px 0;
}

.audience-callouts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin: 32px 0;
}

.audience-callout {
    background: rgba(227, 18, 11, 0.03);
    border-top: 3px solid var(--accent-red);
    border-radius: 0 0 8px 8px;
    padding: 20px;
}

.audience-callout .callout-label {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--accent-red);
    margin-bottom: 8px;
    letter-spacing: 0.05em;
}

.audience-callout p {
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-secondary);
    margin: 0;
}

/* ============================================
   PROJECT & CASE STUDY SPECIFIC STYLES
   (Consolidated from inline blocks)
   ============================================ */

/* Generic Case Study Layout */
.case-study-container, .analysis-container {
    max-width: 800px;
    margin: 40px auto 80px;
}

.visual-container {
    margin: 40px 0;
    text-align: center;
}

.visual-container img {
    max-width: 100%;
    border-radius: 12px;
    box-shadow: var(--card-hover);
}

.methodology-box {
    background: var(--bg-secondary);
    padding: 32px;
    border-radius: 12px;
    border: 1px solid var(--border-light);
    margin: 40px 0;
}

.methodology-box h3 { margin-bottom: 24px; }

/* NDA Components */
.nda-notice-top {
    margin-bottom: 40px;
    padding: 24px;
    background: rgba(227, 18, 11, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(227, 18, 11, 0.1);
    text-align: left;
}

.nda-notice-top p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 0;
    line-height: 1.6;
}

.nda-header {
    font-weight: 700;
    color: var(--accent-red);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 12px;
    margin-bottom: 8px;
    display: block;
}

/* Metrics & Criteria Lists */
.criteria-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
}

.criteria-item:last-child { border-bottom: none; }
.criteria-name { font-weight: 600; color: var(--text-secondary); }
.criteria-weight { font-family: var(--font-mono); color: var(--accent-red); font-weight: 700; }

.criteria-list { list-style: none; padding: 0; }

.metric-block {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    margin: 32px 0;
    padding: 24px;
    background: var(--bg-color);
    border-radius: 8px;
    border: 1px solid var(--border-light);
}

.metric-main {
    font-family: var(--font-heading);
    font-size: 42px;
    color: var(--accent-red);
    font-weight: 700;
}

.metric-sub {
    font-size: 14px;
    color: var(--text-secondary);
    max-width: 200px;
    line-height: 1.3;
}


/* Industrial AHP Visualization */
.industrial-ahp-block {
    margin: 40px 0;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-light);
    padding: 24px;
}

.jab-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    margin-bottom: 16px;
}

.jab-criteria-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
    padding: 12px;
    background: var(--bg-color);
    border-radius: 8px;
    border: 1px solid var(--border-light);
}

.jab-crit { font-size: 11px; color: var(--text-secondary); font-family: var(--font-mono); }
.jab-crit strong { color: var(--accent-red); }

.jab-solutions { display: flex; flex-direction: column; gap: 12px; }

.jab-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 16px;
    align-items: center;
    padding: 14px;
    border-radius: 8px;
    border: 1px solid var(--border-light);
    background: var(--bg-color);
}

.jab-top { background: rgba(227, 18, 11, 0.04); border-color: rgba(227, 18, 11, 0.15); }

.jab-solution-info { display: flex; align-items: flex-start; gap: 12px; }

.jab-rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent-red);
    color: white;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 2px;
    font-family: var(--font-mono);
}

.jab-rank-2 { background: var(--text-secondary); }
.jab-rank-3 { background: var(--border-light); color: var(--text-secondary); }
.jab-rank-4 { background: var(--border-light); color: var(--text-secondary); }

.jab-sol-name { font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }

.jab-scores-inline { display: flex; gap: 12px; flex-wrap: wrap; }
.jab-scores-inline span { font-size: 11px; color: var(--text-secondary); font-family: var(--font-mono); }
.jab-scores-inline strong { color: var(--text-primary); }

.jab-final-wrap { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; min-width: 120px; }

.jab-bar-track { width: 120px; height: 5px; background: var(--border-light); border-radius: 3px; overflow: hidden; }
.jab-bar-fill { height: 100%; border-radius: 3px; }
.jab-fill-1 { background: var(--accent-red); }
.jab-fill-2 { background: #EF4444; }
.jab-fill-3 { background: #F87171; }
.jab-fill-4 { background: #FCA5A5; }

.jab-final-score { font-size: 18px; font-weight: 700; font-family: var(--font-mono); color: var(--accent-red); }
.jab-score-2 { color: #EF4444; }
.jab-score-3 { color: #F87171; }
.jab-score-4 { color: var(--text-secondary); }

.jab-note {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 16px;
    margin-bottom: 0;
    line-height: 1.6;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
    font-family: var(--font-mono);
}

/* Salmon WSM Visualization */
.wsm-viz-block {
    margin: 40px 0;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-light);
    padding: 24px;
    overflow-x: auto;
}

.wsm-viz-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    margin-bottom: 20px;
}

.wsm-full-table {
    width: 100%;
    min-width: 560px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.wsm-header-row, .wsm-data-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr 1fr 1fr;
    gap: 4px;
    align-items: center;
}

.wsm-header-row { padding-bottom: 8px; border-bottom: 1px solid var(--border-light); }

.wsm-header-row > div {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    text-align: center;
    font-family: var(--font-mono);
}

.wsm-header-row .wsm-col-solution { text-align: left; }

.wsm-weight {
    display: block;
    font-size: 9px;
    color: var(--accent-red);
    margin-top: 2px;
    font-weight: 700;
}

.wsm-data-row { padding: 10px 0; border-bottom: 1px solid var(--border-light); }
.wsm-data-row:last-child { border-bottom: none; }

.wsm-winner-row {
    background: rgba(227, 18, 11, 0.04);
    border-radius: 8px;
    padding: 10px 8px;
    border: 1px solid rgba(227, 18, 11, 0.12) !important;
}

.wsm-col-solution {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.wsm-rank-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    font-family: var(--font-mono);
    background: var(--accent-red);
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    width: fit-content;
}

.wsm-rank-2 { background: var(--text-secondary); }
.wsm-rank-3 { background: var(--border-light); color: var(--text-secondary); }

.wsm-recommended {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent-red);
    font-family: var(--font-mono);
}

.wsm-col-crit { text-align: center; }

.wsm-score {
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font-mono);
    color: var(--text-primary);
}

.wsm-col-total { text-align: center; }

.wsm-total-score {
    font-size: 18px;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-secondary);
}

.wsm-total-score span { font-size: 12px; font-weight: 400; }
.wsm-total-win { color: var(--accent-red); }

.wsm-viz-note {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 16px;
    margin-bottom: 0;
    line-height: 1.6;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
}

@media (max-width: 480px) {
    .jab-row { grid-template-columns: 1fr; }
    .jab-final-wrap { align-items: flex-start; }
    .jab-bar-track { width: 100%; }

    .ahp-name, .wsm-name { min-width: 120px; font-size: 11px; }
    .imp-table th, .imp-table td { padding: 6px 8px; }
}


/* Collage Responsive Collapse */
@media (max-width: 900px) {
    .project-visual {
        min-height: 624px; /* More height for stacked cards */
        width: 100%;
        border-left: none;
        border-top: 1px solid var(--border-light);
    }

    .project-collage.collage-taxonomy {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: repeat(5, 1fr);
        grid-template-areas:
            "geo     geo"
            "scatter elbow"
            "heatmap anova"
            "model   model"
            "stress  stress";
    }
}

@media (max-width: 600px) {
    .project-collage.collage-taxonomy {
        grid-template-columns: 1fr;
        grid-template-rows: repeat(7, 200px);
        grid-template-areas:
            "geo"
            "scatter"
            "elbow"
            "heatmap"
            "anova"
            "model"
            "stress";
    }
}

/* Project Sort Controls */
.sort-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
    position: sticky;
    top: var(--nav-height);
    z-index: 500;
    width: 100%;
    /* Elegant gradient fade to soften the card transition boundary */
    padding: 24px 0 60px;
    background: linear-gradient(to bottom, 
        var(--bg-color) 0%, 
        var(--bg-color) 60%, 
        rgba(245, 244, 239, 0) 100%
    );
    border-bottom: none;
    transition: opacity 0.3s ease;
    will-change: opacity;
    pointer-events: none; /* Allow clicks to pass through padding to cards */
}

.sort-controls > * {
    pointer-events: auto; /* Re-enable for buttons and labels */
}

.sort-controls.is-sticky {
    /* Subtle interaction hint when stuck */
    border-bottom: 1px solid rgba(0,0,0,0.02);
}

.sort-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    margin-right: 4px;
}

.sort-btn {
    background: none;
    border: 1px solid var(--border-light);
    padding: 5px 16px;
    border-radius: 20px;
    font-family: var(--font-body);
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.sort-btn:hover {
    border-color: var(--accent-red);
    color: var(--accent-red);
}

.sort-btn.active {
    background: var(--accent-red);
    border-color: var(--accent-red);
    color: white;
}

/* ── Collapsible Resume/CV Viewer ── */
.resume-viewer {
    background: var(--bg-secondary);
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    margin: 0 auto 40px;
    max-width: var(--max-width);
    overflow: hidden;
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.resume-viewer.open {
    grid-template-rows: 1fr;
}

.rv-inner {
    overflow: hidden;
}


/* Panel header */
.rv-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-light);
}

.rv-doc-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.rv-doc-label {
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.rv-doc-date {
    font-size: 12px;
    color: var(--text-secondary);
}

.rv-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.rv-download-btn,
.rv-switch-btn {
    font-size: 13px;
    padding: 8px 16px;
    white-space: nowrap;
}

/* Embed wrapper */
.rv-embed-wrapper {
    position: relative;
    width: 100%;
    height: 780px;
    background: var(--bg-secondary);
}

.rv-canvas-container {
    width: 100%;
    height: 780px;
    overflow-y: auto;
    background: #525659;
    padding: 16px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.rv-page-canvas {
    display: block;
    max-width: 100%;
    background: white;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

.rv-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 24px;
    color: var(--text-secondary);
    font-size: 14px;
}

.rv-loading-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-light);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: rv-spin 0.7s linear infinite;
}

@keyframes rv-spin {
    to { transform: rotate(360deg); }
}

/* Error message (missing file) */
.rv-error {
    padding: 48px 24px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

.rv-error p {
    margin: 0;
}

/* Mobile fallback */
.rv-fallback {
    padding: 32px 24px;
    text-align: center;
    display: none;
}

@media (max-width: 768px) {
    .rv-fallback {
        display: block;
    }
    .rv-embed-wrapper,
    .rv-header-actions,
    .rv-switch-btn {
        display: none !important;
    }
}

.rv-fallback p {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0 0 20px;
}

.rv-fallback-links {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* Button transitions */
.rv-download-btn,
.rv-switch-btn {
    transition: all 0.2s ease;
}

#rv-toggle {
    transition: all 0.2s ease;
}
/* Progress dashboard callout on landing page first visit */
.progress-bubble {
    position: fixed;
    z-index: 2000;
    transform: translateX(-50%) translateY(16px) scale(0.92);
    opacity: 0;
    pointer-events: none;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1.5px solid var(--accent-red);
    border-radius: 12px;
    padding: 10px 12px 10px 16px;
    box-shadow: var(--card-hover);
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-body);
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.25s ease, transform 0.25s ease;
}
.progress-bubble::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 10px solid var(--accent-red);
}
.progress-bubble::after {
    content: '';
    position: absolute;
    top: -7px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid var(--bg-secondary);
}
.progress-bubble-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
    pointer-events: auto;
    animation: progress-bubble-bob 2.2s ease-in-out 0.8s infinite;
}
@keyframes progress-bubble-bob {
    0%, 100% { transform: translateX(-50%) translateY(0) scale(1); }
    50% { transform: translateX(-50%) translateY(-5px) scale(1); }
}
.progress-bubble-hide {
    opacity: 0;
    transform: translateX(-50%) translateY(10px) scale(0.95);
    pointer-events: none;
}
.progress-bubble-text {
    white-space: nowrap;
}
.progress-bubble-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.05rem;
    line-height: 1;
    cursor: pointer;
    padding: 2px 5px;
    border-radius: 6px;
}
.progress-bubble-close:hover {
    background: var(--border-light);
}
@media (max-width: 768px) {
    .progress-bubble::before,
    .progress-bubble::after {
        display: none;
    }
    .progress-bubble-text {
        white-space: normal;
        max-width: 240px;
    }
}

/* Data-driven project catalog */
.catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    margin-top: 28px;
}

.catalog-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.catalog-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--card-hover);
}

.catalog-cover {
    display: block;
    aspect-ratio: 16 / 9;
    background: var(--bg-color);
    overflow: hidden;
}

.catalog-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.catalog-cover-noimg {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 28px 24px;
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.catalog-cover-static {
    cursor: default;
}

.catalog-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 18px 20px 20px;
    flex: 1;
}

.catalog-summary {
    color: var(--text-secondary);
    font-size: 0.92rem;
    line-height: 1.55;
    flex: 1;
}

.catalog-empty {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

@media (max-width: 768px) {
    .catalog-grid {
        grid-template-columns: 1fr;
    }
}

/* Catalog cover crossfade and section collapse */
.catalog-cover {
    position: relative;
}

.catalog-cover img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    opacity: 0;
    transition: opacity 0.7s ease;
    pointer-events: none;
}

.catalog-cover img.is-active {
    opacity: 1;
    position: relative;
    pointer-events: auto;
}

.section-toggle {
    display: flex;
    align-items: baseline;
    gap: 10px;
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    font: inherit;
    color: inherit;
    padding: 4px 0;
}

.section-toggle h2 {
    margin: 0;
}

.section-toggle:hover h2 {
    color: var(--accent-red-hover);
}

.section-chevron {
    margin-left: auto;
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: transform 0.25s ease;
}

.section-toggle[aria-expanded="false"] .section-chevron {
    transform: rotate(-90deg);
}

.catalog-wrap {
    display: grid;
    grid-template-rows: 1fr;
    transition: grid-template-rows 0.3s ease;
}

.catalog-wrap.collapsed {
    grid-template-rows: 0fr;
}

.catalog-inner {
    overflow: hidden;
    min-height: 0;
}

/* Competency tag layout */
.skill-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.skill-subhead {
    display: block;
    width: 100%;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin: 10px 0 4px;
}

.skill-focus {
    font-size: 15px;
    color: var(--text-secondary);
    margin: 0 0 14px;
}



/* Site-wide dark theme */
[data-theme="dark"] {
    --bg-color: #000000;
    --bg-secondary: #111113;
    --text-primary: #F3F4F6;
    --text-secondary: #9CA3AF;
    --accent-red: #F6423C;
    --accent-red-hover: #F87171;
    --accent-green: #34D399;
    --border-light: #232329;
    --nav-bg: rgba(0, 0, 0, 0.92);
    --btn-primary-bg: #232329;
    --btn-primary-text: #F3F4F6;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.6), 0 2px 4px -1px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] body {
    background-color: var(--bg-color);
    color: var(--text-primary);
}

/* Theme toggle in the top nav */
.nav-theme-toggle {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid var(--border-light);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: border-color 0.15s ease, transform 0.15s ease;
}

.nav-theme-toggle:hover {
    border-color: var(--accent-red);
    transform: scale(1.08);
}

@media (max-width: 768px) {
    .nav-theme-toggle {
        align-self: center;
    }
}

/* Connect sidebar pulse indicator */
.sidebar-pulse {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-red);
    box-shadow: 0 0 0 0 rgba(230, 18, 11, 0.45);
    animation: sidebar-pulse 2.4s ease-out infinite;
    z-index: 1;
    pointer-events: none;
}

@keyframes sidebar-pulse {
    0% { box-shadow: 0 0 0 0 rgba(230, 18, 11, 0.45); }
    70% { box-shadow: 0 0 0 14px rgba(230, 18, 11, 0); }
    100% { box-shadow: 0 0 0 0 rgba(230, 18, 11, 0); }
}

@media (prefers-reduced-motion: reduce) {
    .sidebar-pulse {
        animation: none;
        box-shadow: none;
    }
}

/* First-visit connect bubble on the landing page */
.connect-bubble,
.connect-bubble.progress-bubble-visible,
.connect-bubble.progress-bubble-hide {
    transform: none;
}

.contact-sidebar.bubble-open .sidebar-label {
    opacity: 0.6;
}

.connect-bubble.progress-bubble-visible {
    animation: connect-bob 2.2s ease-in-out 0.8s infinite;
}

@keyframes connect-bob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.connect-bubble::before {
    top: 50%;
    left: auto;
    right: -11px;
    transform: translateY(-50%);
    border-left: 10px solid var(--accent-red);
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
    border-right: none;
}

.connect-bubble::after {
    top: 50%;
    left: auto;
    right: -8px;
    transform: translateY(-50%);
    border-left: 8px solid var(--bg-secondary);
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-right: none;
}
