/* ==========================================
   PROFESSIONAL PORTFOLIO STYLESHEET
   Improved version with enhanced accessibility,
   performance, and modern CSS patterns
   ========================================== */

/* ==========================================
   CUSTOM PROPERTIES
   ========================================== */
:root {
    /* Primary palette */
    --navy: #1a2744;
    --slate: #3d4f5f;
    --accent: #c23a3a;
    --accent-dark: #a32e2e;
    --accent-light: #d84545;
    
    /* Neutrals */
    --white: #ffffff;
    --off-white: #f7f8fa;
    --grey-100: #f0f2f5;
    --grey-200: #e2e6eb;
    --grey-300: #c9cfd6;
    --grey-400: #9fa6b0;
    --grey-600: #5a6675;
    --grey-800: #2d3640;
    
    /* Semantic colors */
    --text-primary: #1a1a2e;
    --text-secondary: #2d3748;
    --text-muted: #6b7280;
    --border: #dde1e7;
    
    /* Feedback colors */
    --success: #2e7d4a;
    --success-bg: rgba(46, 125, 74, 0.08);
    --error: #b33a3a;
    --error-bg: rgba(179, 58, 58, 0.08);
    --info: #2563eb;
    --info-bg: rgba(37, 99, 235, 0.08);
    --warning: #d4a017;
    --warning-bg: #fffbeb;
    
    /* Spacing system (8px base) */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;
    
    /* Border radius */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    
    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 12px 32px rgba(0, 0, 0, 0.12);
    
    /* Typography */
    --font-primary: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-display: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'IBM Plex Mono', 'Consolas', 'Monaco', 'Courier New', monospace;
    --font-size-base: 19px;
    --line-height-base: 1.7;
    --line-height-tight: 1.4;
    --line-height-relaxed: 1.8;
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-base: 0.2s ease;
    --transition-slow: 0.3s ease;
    
    /* Layout */
    --max-width-content: 1100px;
    --max-width-wide: 1300px;
    --nav-height: 56px;
}

/* ==========================================
   RESET & BASE STYLES
   ========================================== */
*, 
*::before, 
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: var(--font-size-base);
}

/* Respect user's motion preferences */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

body {
    font-family: var(--font-primary);
    background: var(--white);
    color: var(--text-primary);
    line-height: var(--line-height-base);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
    overflow-y: scroll;
}

/* Improved focus styles for accessibility */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Remove outline for mouse users */
:focus:not(:focus-visible) {
    outline: none;
}

/* Improve text rendering and prevent clipping */
h1, h2, h3, h4, h5, h6 {
    text-rendering: geometricPrecision;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

p, li, td, th {
    overflow-wrap: break-word;
    word-wrap: break-word;
}

p {
    margin-bottom: 1em;
    line-height: var(--line-height-base);
}

p:last-child {
    margin-bottom: 0;
}

/* ==========================================
   NAVIGATION
   ========================================== */
.nav-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    transition: transform 0.3s ease;
}

.nav-container.nav-hidden {
    transform: translateY(-100%);
}

nav {
    width: 100%;
    margin: 0 auto;
    padding: 0 clamp(1.5rem, 4vw, 4rem);
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: var(--nav-height);
}

.nav-home {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--navy);
    text-decoration: none;
    padding: 0.5rem 0.65rem;
    border-radius: var(--radius-md);
    transition: color var(--transition-base), background-color var(--transition-base);
}

.nav-home:hover,
.nav-home:focus-visible {
    color: var(--accent);
    background: var(--grey-100);
}

.nav-home-label {
    font-family: var(--font-primary);
    font-size: 0.82rem;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.nav-links {
    display: flex;
    gap: 0.25rem;
    list-style: none;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.88rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    transition: color var(--transition-base), background-color var(--transition-base);
    display: inline-block;
    letter-spacing: 0.01em;
}

.nav-links a:hover,
.nav-links a:focus-visible {
    color: var(--navy);
    background: var(--grey-100);
}

/* Active page indicator */
.nav-links a[aria-current="page"] {
    color: var(--navy);
    font-weight: 600;
    background: var(--grey-100);
}

/* ==========================================
   HERO SECTION - HOMEPAGE
   ========================================== */
.hero {
    min-height: 60vh;
    display: flex;
    align-items: center;
    padding: calc(var(--nav-height) + var(--space-3xl)) clamp(1.5rem, 5vw, 6rem) var(--space-3xl);
    background: var(--white);
}

.hero-content {
    max-width: 780px;
    margin: 0 auto;
    text-align: center;
}

.hero-text h1 {
    font-family: var(--font-display);
    font-size: clamp(2.25rem, 4vw, 3rem);
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 1rem;
    line-height: 1.25;
    letter-spacing: -0.01em;
    padding: 0.1em 0;
    text-rendering: geometricPrecision;
}

.subtitle {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: var(--space-sm);
}

.tagline {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: var(--space-lg);
}

.hero-description {
    font-size: 1.05rem;
    line-height: var(--line-height-relaxed);
    color: var(--text-secondary);
    margin-bottom: var(--space-xl);
}

.hero-cta {
    display: flex;
    gap: 0.875rem;
    flex-wrap: wrap;
    justify-content: center;
}

/* Hero stat highlights */
.hero-highlights {
    display: flex;
    justify-content: center;
    gap: 2.5rem;
    margin-top: 3.5rem;
    padding-top: 2.5rem;
    border-top: 1px solid var(--grey-200);
}

.highlight-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
}

.highlight-number {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--navy);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.highlight-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: 0.01em;
}

/* ==========================================
   BUTTONS
   ========================================== */
.cta-btn {
    display: inline-block;
    padding: 0.75rem var(--space-lg);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    transition: all var(--transition-base);
    border: none;
    cursor: pointer;
    text-align: center;
}

.btn-primary {
    background: var(--accent);
    color: var(--white);
    border: 1.5px solid var(--accent);
}

.btn-primary:hover,
.btn-primary:focus-visible {
    background: var(--accent-dark);
    border-color: var(--accent-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--white);
    color: var(--navy);
    border: 1.5px solid var(--grey-300);
}

.btn-secondary:hover,
.btn-secondary:focus-visible {
    background: var(--grey-100);
    border-color: var(--grey-400);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:active {
    transform: translateY(0);
}

/* ==========================================
   PROJECT HERO (detail pages)
   ========================================== */
.project-hero {
    padding: calc(var(--nav-height) + 5rem) clamp(1.5rem, 5vw, 6rem) 3.5rem;
    background: var(--white);
    text-align: center;
    border-bottom: 1px solid var(--border);
}

.project-hero h1 {
    font-family: var(--font-display);
    font-size: clamp(2.25rem, 4.5vw, 3.1rem);
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 1.5rem;
    line-height: 1.25;
    letter-spacing: -0.02em;
    max-width: 850px;
    margin-left: auto;
    margin-right: auto;
    padding: 0.1em 0;
    text-rendering: geometricPrecision;
}

.project-hero .subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: 400;
    line-height: 1.75;
    max-width: 760px;
    margin: 0 auto 2rem;
}

.project-meta-bar {
    display: flex;
    justify-content: center;
    gap: 3rem;
    flex-wrap: wrap;
    margin-top: 2rem;
    padding-top: 1.75rem;
    border-top: 1px solid var(--grey-200);
}

.meta-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
}

.meta-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
}

.meta-value {
    font-size: 1.15rem;
    color: var(--navy);
    font-weight: 700;
    font-family: var(--font-display);
}

/* ==========================================
   SECTIONS
   ========================================== */
section {
    padding: var(--space-3xl) clamp(1.5rem, 5vw, 6rem);
    max-width: var(--max-width-content);
    margin: 0 auto;
}

section h2 {
    font-family: var(--font-display);
    font-size: clamp(1.9rem, 3.5vw, 2.5rem);
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 1.5rem;
    line-height: var(--line-height-tight);
    letter-spacing: -0.02em;
    padding-top: 0.1em;
}

section h3 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--navy);
    margin-top: 2.75rem;
    margin-bottom: 1.25rem;
    line-height: var(--line-height-tight);
    padding-top: 0.1em;
}

section h4 {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--navy);
    margin-top: var(--space-lg);
    margin-bottom: var(--space-sm);
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

section p {
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--text-secondary);
}

section li {
    font-size: 1.02rem;
    line-height: 1.75;
    color: var(--text-secondary);
}

.section-title {
    font-family: var(--font-display);
    font-size: clamp(1.9rem, 3.5vw, 2.5rem);
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 1.5rem;
    line-height: var(--line-height-tight);
    letter-spacing: -0.02em;
}

.section-subtitle {
    font-size: 1.05rem;
    line-height: var(--line-height-relaxed);
    color: var(--text-secondary);
    margin-bottom: var(--space-xl);
}

.summary-section {
    background: var(--off-white);
    padding: var(--space-2xl) clamp(1.5rem, 5vw, 6rem);
}

/* ==========================================
   THEORY BOXES & CONTENT CONTAINERS
   ========================================== */
.theory-box {
    background: var(--white);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius-md);
    padding: var(--space-xl);
    margin: var(--space-xl) 0;
    box-shadow: var(--shadow-sm);
}

.theory-box h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--navy);
    margin-top: 0;
    margin-bottom: var(--space-md);
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.theory-box h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--navy);
    margin-top: var(--space-lg);
    margin-bottom: var(--space-sm);
    border-bottom: none;
    padding-bottom: 0;
}

.theory-box p {
    color: var(--text-secondary);
    line-height: var(--line-height-relaxed);
    margin-bottom: var(--space-md);
}

.theory-box p:last-child {
    margin-bottom: 0;
}

.theory-box ul,
.theory-box ol {
    margin: var(--space-md) 0;
    padding-left: 1.75rem;
}

.theory-box li {
    margin-bottom: 0.5rem;
    line-height: var(--line-height-relaxed);
    color: var(--text-secondary);
}

/* Info/Warning Boxes */
.info-box {
    background: var(--info-bg);
    border: 1px solid rgba(37, 99, 235, 0.2);
    border-left: 4px solid var(--info);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    margin: var(--space-lg) 0;
}

.warning-box,
.suggestion-box {
    background: var(--warning-bg);
    border: 1px solid #f5d778;
    border-left: 4px solid var(--warning);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    margin: var(--space-lg) 0;
}

.warning-box h4,
.suggestion-box h4,
.info-box h4 {
    color: inherit;
    margin-bottom: 0.75rem;
    font-size: 1rem;
    border-bottom: none;
    padding-bottom: 0;
}

.suggestion-box h4 {
    color: #92710c;
}

.suggestion-box p {
    color: #6b5608;
    font-size: 0.9rem;
    line-height: 1.7;
    margin-bottom: 0.5rem;
}

/* ==========================================
   LISTS
   ========================================== */
ul, ol {
    margin: var(--space-md) 0;
    padding-left: 1.75rem;
}

li {
    margin-bottom: 0.75rem;
    line-height: var(--line-height-relaxed);
    color: var(--text-secondary);
}

li:last-child {
    margin-bottom: 0;
}

ul ul, ol ul, ul ol, ol ol {
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

/* Better bullet styling */
ul {
    list-style-type: disc;
}

ul ul {
    list-style-type: circle;
}

/* ==========================================
   CODE & PREFORMATTED TEXT
   ========================================== */
code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    background: var(--grey-100);
    color: var(--navy);
    padding: 0.15em 0.4em;
    border-radius: 3px;
    border: 1px solid var(--grey-200);
}

pre {
    background: var(--grey-100);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    overflow-x: auto;
    margin: var(--space-lg) 0;
    line-height: 1.5;
}

pre code {
    background: transparent;
    border: none;
    padding: 0;
    font-size: 0.875rem;
    color: var(--text-primary);
}

/* Equation/formula styling */
.equation,
.formula {
    text-align: center;
    font-family: var(--font-mono);
    font-size: 1.05rem;
    padding: var(--space-lg);
    background: var(--grey-100);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    margin: var(--space-lg) 0;
    color: var(--navy);
    line-height: 1.6;
    overflow-x: auto;
}

/* ==========================================
   EMPHASIS & INLINE ELEMENTS
   ========================================== */
strong {
    font-weight: 600;
    color: var(--text-primary);
}

em {
    font-style: italic;
    color: var(--text-secondary);
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition-base);
}

a:hover {
    color: var(--accent-dark);
    text-decoration: underline;
}

/* ==========================================
   PROJECTS GRID (homepage)
   ========================================== */
.projects-section {
    background: var(--off-white);
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr));
    gap: var(--space-xl);
    margin-top: var(--space-xl);
}

.project-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: transform var(--transition-base),
                box-shadow var(--transition-base);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
}

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

/* Card inner layout - scoped to .project-card for specificity */
.project-card .project-header {
    padding: 1.75rem 1.75rem 0;
}

.project-card .project-tag {
    display: inline-block;
    padding: 5px 14px;
    background: var(--accent);
    color: var(--white);
    border-radius: 20px;
    font-family: var(--font-primary);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 1rem;
}

.project-card .project-title {
    font-family: var(--font-primary);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--navy);
    margin: 0 0 0.6rem;
    padding: 0;
    line-height: 1.35;
    border: none;
}

.project-card .project-desc {
    font-family: var(--font-primary);
    font-size: 0.92rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin: 0;
}

.project-card .project-body {
    padding: 1.25rem 1.75rem 1.75rem;
    margin-top: auto;
}

.project-card .project-skills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.project-card .skill-tag {
    display: inline-block;
    padding: 5px 12px;
    background: var(--grey-100);
    border: 1px solid var(--grey-200);
    border-radius: 5px;
    font-family: var(--font-primary);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0.02em;
    line-height: 1;
    transition: all 0.15s ease;
}

.project-card .skill-tag:hover {
    background: var(--accent);
    color: var(--white);
    border-color: var(--accent);
}

/* Card footer row */
.project-card .project-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid var(--border-light, var(--grey-200));
}

.project-card .project-footer .project-link {
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
}

.project-card .project-footer .project-wip {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ==========================================
   STATISTICS DISPLAY
   ========================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
    margin: 1.25rem 0;
}

.stat-card,
.stat-highlight {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    text-align: center;
    transition: transform var(--transition-base),
                box-shadow var(--transition-base);
}

.stat-card {
    border-top: 3px solid var(--accent);
}

.stat-card:hover,
.stat-highlight:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-number,
.stat-highlight .value {
    font-family: var(--font-display);
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 0.5rem;
    line-height: 1.1;
    padding-top: 0.1em;
    text-rendering: geometricPrecision;
}

.stat-label,
.stat-highlight .label {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* ==========================================
   CONTENT CARDS & GRIDS
   ========================================== */
.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
    gap: 1.25rem;
    margin: var(--space-xl) 0;
}

.content-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: box-shadow var(--transition-base);
}

.content-card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    padding: var(--space-md) 1.25rem;
    background: var(--navy);
    color: var(--white);
}

.card-header h3 {
    font-size: 1rem;
    margin: 0;
    color: var(--white);
}

.card-body {
    padding: 1.25rem;
    color: var(--text-secondary);
    font-size: 0.975rem;
}

.card-body p {
    margin-bottom: var(--space-sm);
    line-height: var(--line-height-relaxed);
}

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

/* ==========================================
   COMPARISON BARS (for uber project style)
   ========================================== */
.compare-bars {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin: 2.5rem 0;
}

.compare-bar-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.compare-bar-group .bar-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 500;
}

.compare-bar-group .bar-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.compare-bar-group .bar-year {
    font-size: 0.85rem;
    color: var(--text-secondary);
    width: 2.5rem;
    flex-shrink: 0;
    font-weight: 500;
}

.compare-bar-group .bar-track {
    flex: 1;
    height: 24px;
    background: var(--grey-100);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.compare-bar-group .bar-fill {
    height: 100%;
    border-radius: 4px;
}

.compare-bar-group .bar-fill.fill-2018 {
    background: #ff6b6b;
}

.compare-bar-group .bar-fill.fill-2025 {
    background: #4ecdc4;
}

.compare-bar-group .bar-value {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    width: 4rem;
    text-align: right;
    flex-shrink: 0;
}

/* Scorecard styling */
.scorecard-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

.scorecard-row:last-child {
    border-bottom: none;
}

.scorecard-check {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.85rem;
    font-weight: 700;
}

.scorecard-check.pass {
    background: var(--success-bg);
    color: var(--success);
    border: 1.5px solid var(--success);
}

.scorecard-prediction {
    flex: 1;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.scorecard-detail {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: right;
    flex-shrink: 0;
}

/* ==========================================
   VISUALIZATIONS
   ========================================== */
.viz-container {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0;
    margin: var(--space-xl) 0;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.viz-container iframe {
    border: none;
    display: block;
    width: 100%;
}

/* Size variants */
.viz-container.wide {
    max-width: none;
    margin-left: calc(var(--space-lg) * -1);
    margin-right: calc(var(--space-lg) * -1);
    border-radius: 0;
    border-left: none;
    border-right: none;
}

.viz-container.compact {
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

/* ==========================================
   TABLES
   ========================================== */
table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--space-lg) 0;
    background: var(--white);
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border);
    font-size: 0.975rem;
}

th {
    background: var(--navy);
    color: var(--white);
    padding: 0.875rem var(--space-md);
    text-align: left;
    font-weight: 600;
}

td {
    padding: 0.75rem var(--space-md);
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
}

tr:last-child td {
    border-bottom: none;
}

tbody tr {
    transition: background-color var(--transition-fast);
}

tbody tr:hover {
    background: var(--grey-100);
}

/* Responsive table on mobile */
@media (max-width: 640px) {
    table {
        font-size: 0.875rem;
    }
    
    th, td {
        padding: 0.625rem var(--space-sm);
    }
}

/* ==========================================
   DIVIDERS
   ========================================== */
hr,
.part-divider {
    border: none;
    border-top: 1px solid var(--grey-200);
    margin: var(--space-2xl) 0;
}

/* ==========================================
   VISUAL SHOWCASE - HOMEPAGE
   ========================================== */
.showcase-section {
    padding: var(--space-3xl) clamp(1.5rem, 5vw, 6rem);
    max-width: 1200px;
    margin: 0 auto;
}

.showcase-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-top: var(--space-xl);
}

/* First item spans wider */
.showcase-item.showcase-wide {
    grid-column: 1 / 2;
}

.showcase-item {
    display: block;
    text-decoration: none;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--white);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.showcase-frame {
    position: relative;
    width: 100%;
    height: 280px;
    overflow: hidden;
    background: var(--grey-100);
}

.showcase-frame iframe {
    width: 200%;
    height: 200%;
    border: none;
    transform: scale(0.5);
    transform-origin: top left;
    pointer-events: none;
}

.showcase-frame-img {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem;
}

.showcase-frame-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Transparent overlay to block iframe interaction, keeps link clickable */
.showcase-overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    cursor: pointer;
}

.showcase-caption {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
}

.showcase-project {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent);
    margin-bottom: 0.3rem;
}

.showcase-title {
    display: block;
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--text-secondary);
}

.showcase-cta {
    text-align: center;
    margin-top: 2.5rem;
}

/* ==========================================
   LIGHTBOX
   ========================================== */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(10, 15, 25, 0.92);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.lightbox.lightbox-open {
    opacity: 1;
    visibility: visible;
}

.lightbox-content {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-content iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.lightbox-close {
    position: absolute;
    top: 1.25rem;
    right: 1.5rem;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    font-size: 2.25rem;
    cursor: pointer;
    line-height: 1;
    padding: 0.5rem;
    transition: color 0.15s ease;
    z-index: 2001;
}

.lightbox-close:hover {
    color: #fff;
}

.lightbox-link {
    position: absolute;
    bottom: 1.25rem;
    right: 1.5rem;
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-md);
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
    z-index: 2001;
}

.lightbox-link:hover {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.08);
}

/* ==========================================
   FOOTER
   ========================================== */
footer {
    background: var(--navy);
    color: var(--white);
    text-align: center;
    padding: 2.5rem clamp(1.5rem, 5vw, 6rem);
}

footer p {
    margin: var(--space-xs) 0;
    font-size: 0.9rem;
    opacity: 0.85;
}

footer strong {
    color: inherit;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: var(--space-lg);
    margin-bottom: var(--space-md);
}

.social-link {
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color var(--transition-base);
}

.social-link:hover,
.social-link:focus-visible {
    color: var(--white);
}

/* ==========================================
   UTILITY CLASSES
   ========================================== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.text-center {
    text-align: center;
}

.mt-auto {
    margin-top: auto;
}

/* ==========================================
   MOBILE NAVIGATION (CSS-only, no JS)
   ========================================== */
.nav-check {
    display: none;
}

.nav-toggle {
    display: none;
    cursor: pointer;
    padding: var(--space-sm);
    z-index: 1001;
}

.nav-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--navy);
    margin: 5px 0;
    border-radius: 2px;
    transition: transform var(--transition-base), opacity var(--transition-base);
}

/* Animate hamburger to X when checked */
.nav-check:checked ~ .nav-toggle span:nth-child(1) {
    transform: rotate(45deg) translate(4px, 6px);
}

.nav-check:checked ~ .nav-toggle span:nth-child(2) {
    opacity: 0;
}

.nav-check:checked ~ .nav-toggle span:nth-child(3) {
    transform: rotate(-45deg) translate(4px, -6px);
}

@media (max-width: 640px) {
    .nav-toggle {
        display: block;
    }

    .nav-home-label {
        display: none;
    }

    .nav-links {
        position: fixed;
        top: var(--nav-height);
        left: 0;
        right: 0;
        background: rgba(255, 255, 255, 0.96);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow-lg);
        flex-direction: column;
        padding: var(--space-sm) var(--space-lg);
        gap: 0;
        display: none;
    }

    .nav-check:checked ~ .nav-links {
        display: flex;
    }

    .nav-links li {
        border-bottom: 1px solid var(--grey-200);
    }

    .nav-links li:last-child {
        border-bottom: none;
    }

    .nav-links a {
        display: block;
        padding: 0.85rem 0.5rem;
        font-size: 0.95rem;
        border-radius: 0;
    }

    .nav-links a:hover {
        background: var(--grey-100);
    }
}

/* ==========================================
   RESPONSIVE DESIGN
   ========================================== */
@media (max-width: 768px) {
    :root {
        --font-size-base: 16px;
    }
    
    .hero { 
        min-height: 55vh;
    }
    
    .hero-highlights {
        gap: 1.5rem;
        flex-wrap: wrap;
    }

    .showcase-grid {
        grid-template-columns: 1fr;
    }

    .showcase-item.showcase-wide {
        grid-column: 1;
    }

    .showcase-frame {
        height: 220px;
    }
    
    .projects-grid { 
        grid-template-columns: 1fr; 
    }
    
    .content-grid { 
        grid-template-columns: 1fr; 
    }
    
    .stats-grid { 
        grid-template-columns: repeat(2, 1fr); 
    }
    
    .project-meta-bar { 
        gap: var(--space-lg); 
    }
    
    .nav-links a { 
        font-size: 0.85rem;
        padding: 0.5rem 0.75rem;
    }
    
    .viz-container {
        overflow-x: auto;
    }
    
    .viz-container iframe {
        min-width: 700px;
    }
    
    .compare-bars {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .theory-box {
        padding: var(--space-lg);
    }
}

@media (max-width: 480px) {
    .stats-grid { 
        grid-template-columns: 1fr; 
    }
    
    .hero-cta {
        flex-direction: column;
    }
    
    .cta-btn {
        width: 100%;
    }

    .hero-highlights {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1.25rem;
    }

    .highlight-number {
        font-size: 1.35rem;
    }
    
    .project-meta-bar {
        gap: var(--space-md);
    }
}

/* ==========================================
   PRINT STYLES
   ========================================== */
@media print {
    .nav-container,
    .hero-cta,
    footer {
        display: none;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.5;
    }
    
    .project-card,
    .theory-box,
    .content-card {
        page-break-inside: avoid;
    }
    
    a {
        text-decoration: underline;
    }
    
    a[href^="http"]:after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
    }
}

/* ==========================================
   PERFORMANCE OPTIMIZATION
   ========================================== */
/* Use contain property for better paint performance */
.project-card,
.content-card,
.stat-card {
    contain: layout style paint;
}

/* Optimize transforms for better animation performance */
.project-card,
.stat-card,
.btn-primary,
.btn-secondary {
    will-change: transform;
}

/* Remove will-change after interaction */
.project-card:hover,
.stat-card:hover,
.btn-primary:hover,
.btn-secondary:hover {
    will-change: auto;
}
