/* ============================================================================
   0. DESIGN SYSTEM VARIABLES & TOKENS
   ============================================================================

   Color palette, spacing scale, typography system, and CSS custom properties
   that define the visual design. Includes both light and dark mode variants.
*/

:root { 
    /* Colors - Background */
    --bg-body: #FAFAF9;         /* The Desk: Warm off-white */
    --bg-paper: #ffffff;        /* The Page: Pure white */
    --bg-accent: #f0f9ff;       /* Light blue background */
    --bg-accent-hover: #e0f2fe; /* Hover state for accent bg */
    
    /* Colors - Text Hierarchy */
    --text-primary: #1e293b;    /* Main headings and important text */
    --text-secondary: #334155;  /* Secondary text */
    --text-tertiary: #475569;   /* Tertiary text */
    --text-light: #64748b;      /* Standard light text */
    --text-muted: #94a3b8;      /* More muted/lighter text */
    --text-lighter: #cbd5e1;    /* Very light text */
    
    /* Colors - Accent */
    --accent: #2774AE;          /* UCLA Blue */
    --accent-hover: #1e5f8e;    /* Darker blue for hover */
    --accent-orange: #D97706;   /* Amber accent (job market tag) */

    /* Colors - Border */
    --border: #e2e8f0;          /* Default border */
    --border-dashed: #e2e8f0;   /* Dashed borders */
    --border-medium: #cbd5e1;   /* Medium border */
    --border-dark: #94a3b8;     /* Dark border */
    
    /* Colors - Status/Info */
    --info-text: #0284c7;       /* Info badges text */
    --info-bg: #e0f2fe;         /* Info badges background */
    --info-bg-hover: #bae6fd;   /* Info badges hover */
    
    /* Spacing System - Based on 4px grid */
    --space-1: 0.25rem;   /* 4px */
    --space-2: 0.5rem;    /* 8px */
    --space-3: 0.75rem;   /* 12px */
    --space-4: 1rem;      /* 16px */
    --space-5: 1.25rem;   /* 20px */
    --space-6: 1.5rem;    /* 24px */
    --space-8: 2rem;      /* 32px */
    --space-10: 2.5rem;   /* 40px */
    --space-12: 3rem;     /* 48px */
    --space-16: 4rem;     /* 64px */
    --space-24: 6rem;     /* 96px */
    
    /* Typography Scale */
    --text-xs: 0.65rem;   /* 10.4px */
    --text-sm: 0.75rem;   /* 12px */
    --text-base: 0.85rem; /* 13.6px */
    --text-md: 0.9rem;    /* 14.4px */
    --text-normal: 0.95rem; /* 15.2px */
    --text-lg: 1rem;      /* 16px */
    --text-xl: 1.05rem;   /* 16.8px */
    --text-2xl: 1.125rem; /* 18px */
    --text-3xl: 1.25rem;  /* 20px */
    --text-4xl: 1.4rem;   /* 22.4px */
    --text-5xl: 1.5rem;   /* 24px */
    --text-6xl: 2.5rem;   /* 40px */
    
    /* Line Heights */
    --leading-tight: 1.1;
    --leading-snug: 1.3;
    --leading-normal: 1.6;
    --leading-relaxed: 1.7;
}

/* Dark Mode Variables */
[data-theme="dark"] {
    /* Colors - Background */
    --bg-body: #0f172a;         /* Dark slate background */
    --bg-paper: #1e293b;        /* Dark paper */
    --bg-accent: #1e3a5f;       /* Dark blue background */
    --bg-accent-hover: #2d4a6f; /* Hover state for accent bg */
    
    /* Colors - Text Hierarchy */
    --text-primary: #f1f5f9;    /* Light text for dark bg */
    --text-secondary: #e2e8f0;  /* Secondary light text */
    --text-tertiary: #cbd5e1;   /* Tertiary light text */
    --text-light: #94a3b8;      /* Lighter gray text */
    --text-muted: #64748b;      /* Muted text */
    --text-lighter: #475569;    /* Even lighter/darker gray */
    
    /* Colors - Accent (slightly brighter for dark mode) */
    --accent: #3b82f6;          /* Brighter blue for dark mode */
    --accent-hover: #60a5fa;    /* Lighter blue for hover */
    --accent-orange: #f59e0b;   /* Brighter amber */
    
    /* Colors - Border */
    --border: #334155;          /* Dark border */
    --border-dashed: #334155;   /* Dashed borders */
    --border-medium: #475569;   /* Medium border */
    --border-dark: #64748b;     /* Lighter border in dark mode */
    
    /* Colors - Status/Info */
    --info-text: #38bdf8;       /* Brighter info text */
    --info-bg: #1e3a5f;         /* Dark info background */
    --info-bg-hover: #2d4a6f;   /* Info hover */
    
    /* Dark mode specific adjustments */
    --container-border: #334155;
    --dots-color: #1e293b;
    --profile-border: #334155;
    --shadow-color: rgba(0, 0, 0, 0.3);
}

/* Dark mode background pattern adjustment */
[data-theme="dark"] body {
    background-image: radial-gradient(var(--dots-color) 1px, transparent 1px);
}

/* Dark mode container adjustments */
[data-theme="dark"] .container {
    border-color: var(--container-border);
    box-shadow: 0 4px 20px var(--shadow-color);
}

/* Dark mode profile image border */
[data-theme="dark"] .profile-img {
    border-color: var(--profile-border);
}

/* Dark mode modal overlay */
[data-theme="dark"] .modal-overlay {
    background-color: rgba(15, 23, 42, 0.95);
}

/* Dark mode modal close button */
[data-theme="dark"] .modal-close {
    background: var(--bg-paper);
    border-color: var(--border);
    color: var(--text-light);
}

[data-theme="dark"] .modal-close:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* Dark mode paper cards */
[data-theme="dark"] .paper-card {
    background: var(--bg-paper);
    border-color: var(--border);
}

[data-theme="dark"] .paper-card:hover {
    border-color: var(--border-medium);
    box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.3);
}

/* Dark mode button adjustments */
[data-theme="dark"] .btn-outline {
    border-color: var(--border);
    color: var(--text-primary);
}

[data-theme="dark"] .btn-outline:hover {
    border-color: var(--accent);
    color: var(--accent);
    background-color: var(--bg-accent);
}

[data-theme="dark"] .btn-active {
    background-color: var(--bg-accent);
    border-color: var(--accent);
}

/* Dark mode callout box */
[data-theme="dark"] .callout-box {
    background-color: var(--bg-accent);
    border-left-color: var(--accent);
}

/* Dark mode paper buttons */
[data-theme="dark"] .btn-abstract:hover {
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

[data-theme="dark"] .card-link {
    background: var(--bg-paper);
    border-color: var(--border);
}

[data-theme="dark"] .card-link:hover {
    background: var(--bg-accent);
    border-color: var(--accent);
}

/* ============================================================================
   1. GLOBAL STYLES & RESET
   ============================================================================ */

*, *::before, *::after {
    box-sizing: border-box;
}

body { 
    font-family: 'Atkinson Hyperlegible', sans-serif;
    font-size: var(--text-2xl); 
    color: var(--text-primary); 
    line-height: var(--leading-relaxed);
    margin: 0; 
    padding: 0; 
    background-color: var(--bg-body); 
    background-image: radial-gradient(#d6d3d1 1px, transparent 1px);
    background-size: 32px 32px; 
    min-height: 100vh; 
    display: flex; 
    flex-direction: column; 
}

h1, h2, h3, .name { 
    font-family: 'Merriweather', serif; 
}

/* Global Focus Styles - Softer, more subtle */
*:focus {
    outline: 2px solid rgba(39, 116, 174, 0.4);
    outline-offset: 2px;
}

*:focus:not(:focus-visible) {
    outline: none;
}

*:focus-visible {
    outline: 2px solid rgba(39, 116, 174, 0.5);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(39, 116, 174, 0.1);
}

/* Prevent Safari showing a focus outline box after anchor jumps */
#main-content:focus {
  outline: none;
}

/* ============================================================================
   2. LAYOUT - CONTAINER & GRID
   ============================================================================ */

.container { 
    max-width: 1080px; 
    margin: var(--space-8) auto; 
    background-color: var(--bg-paper); 
    border: 1px solid #d1d5db;
    box-shadow: 0 4px 20px rgba(0,0,0,0.04);
    border-radius: 4px;
    padding: var(--space-10);
    display: grid; 
    grid-template-columns: 260px 1fr; 
    gap: 4.5rem; 
    flex: 1; 
    align-items: start; 
}

.content { 
    background: transparent; 
    border: none; 
    box-shadow: none; 
    padding: 0; 
}

.content section { 
    margin-bottom: var(--space-16); 
}

.section-spacing {
    margin-top: var(--space-16);
}


/* ============================================================================
   3. SIDEBAR - NAVIGATION & PROFILE
   ============================================================================ */

.sidebar { 
    text-align: center; 
    position: sticky; 
    top: var(--space-8);
    height: auto;
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0; 
    font-size: var(--text-lg); 
}

/* Profile Image */
.profile-img {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: var(--space-6);
    border: 4px solid #f8fafc;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    user-select: none;
    -webkit-user-drag: none;
    cursor: pointer;  /* Clickable - triggers spin animation */
}

/* Profile Text */
.name { 
    font-size: var(--text-5xl); 
    font-weight: 700; 
    margin: 0 0 var(--space-2) 0; 
    color: var(--text-primary); 
    letter-spacing: -0.5px; 
}

.affiliation { 
    font-size: var(--text-md); 
    color: var(--text-light); 
    margin-bottom: var(--space-8); 
    font-family: 'Atkinson Hyperlegible', sans-serif; 
}

/* Navigation Buttons */
.sidebar-btn { 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    width: 100%; 
    padding: var(--space-3) 0; 
    margin-bottom: var(--space-3); 
    border-radius: 6px; 
    text-decoration: none; 
    font-size: var(--text-md); 
    font-weight: 500; 
    transition: all 0.2s; 
    font-family: inherit; 
}

.sidebar-btn:focus-visible {
    outline: 2px solid rgba(39, 116, 174, 0.5);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(39, 116, 174, 0.1);
}

.btn-primary { 
    background-color: var(--accent); 
    color: white; 
    border: 1px solid var(--accent); 
    box-shadow: 0 2px 4px rgba(39, 116, 174, 0.2); 
}

.btn-primary:hover { 
    background-color: var(--accent-hover); 
    transform: translateY(-1px); 
}

.btn-outline { 
    background-color: transparent; 
    border: 1px solid var(--border); 
    color: var(--text-primary); 
}

.btn-outline:hover { 
    border-color: var(--accent); 
    color: var(--accent); 
    background-color: #f8fafc; 
}

.btn-active { 
    background-color: var(--bg-accent); 
    color: var(--accent); 
    border: 1px solid var(--info-bg-hover);
    font-weight: 600; 
}

.btn-active:hover { 
    background-color: var(--bg-accent-hover); 
}

/* Social Links */
.social-links { 
    margin-top: var(--space-4); 
    display: flex; 
    justify-content: center; 
    gap: var(--space-4); 
}

.social-icon { 
    fill: var(--text-light); 
    transition: fill 0.2s; 
}

.social-link:hover .social-icon { 
    fill: var(--accent); 
    transform: scale(1.1);
}

/* NEW - Special class for outline icons only */
.social-icon-outline {
    fill: none;
    stroke: var(--text-light);
    transition: stroke 0.2s, transform 0.2s;
}

.social-link:hover .social-icon-outline {
    stroke: var(--accent);
    transform: scale(1.1);
}

/* Theme Toggle Button */
.theme-toggle {
    margin-top: var(--space-5);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: var(--bg-paper);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
    margin-left: auto;
    margin-right: auto;
}

.theme-toggle:hover {
    border-color: var(--accent);
    background: var(--bg-accent);
    transform: rotate(20deg);
}

.theme-toggle:active {
    transform: scale(0.95) rotate(20deg);
}

/* Theme Icons */
.theme-icon {
    color: var(--text-light);
    transition: all 0.3s ease;
    position: absolute;
}

.theme-icon-sun {
    opacity: 1;
    transform: rotate(0deg);
}

.theme-icon-moon {
    opacity: 0;
    transform: rotate(180deg);
}

/* Dark mode icon states */
[data-theme="dark"] .theme-icon-sun {
    opacity: 0;
    transform: rotate(180deg);
}

[data-theme="dark"] .theme-icon-moon {
    opacity: 1;
    transform: rotate(0deg);
}

/* Hover effects */
.theme-toggle:hover .theme-icon {
    color: var(--accent);
}

/* Focus styles */
.theme-toggle:focus-visible {
    outline: 2px solid rgba(39, 116, 174, 0.5);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(39, 116, 174, 0.1);
}


/* ============================================================================
   4. TYPOGRAPHY - HEADINGS & TEXT
   ============================================================================ */

h1 {
    font-size: 1.75rem;
    margin-bottom: var(--space-4);
    margin-top: 0;
    color: var(--text-primary);
    font-weight: 700;
}

h2 {
    font-size: var(--text-5xl);
    border-bottom: 1px solid var(--border);
    padding-bottom: var(--space-3);
    margin-bottom: var(--space-8);
    margin-top: 0;
    color: var(--text-primary);
    font-weight: 700;
}

.lead {
    font-size: var(--text-3xl);
    color: var(--text-secondary);
    font-weight: 300; 
    line-height: var(--leading-normal);
    margin-bottom: var(--space-8);
    font-family: 'Merriweather', serif;
}

.pull-quote {
    border-left: 4px solid var(--accent);
    padding-left: var(--space-6);
    font-size: var(--text-4xl);
    font-weight: 600;
    color: var(--text-primary);
    margin: var(--space-12) 0;
    font-family: 'Merriweather', serif;
}


/* ============================================================================
   5. RESEARCH PAGE - PAPERS & CARDS
   ============================================================================ */

.research-grid { 
    display: grid; 
    grid-template-columns: 1fr; 
    gap: var(--space-6); 
    margin-top: var(--space-4); 
}

.paper-card {
    background: white; 
    border: 1px solid var(--border); 
    border-radius: 8px; 
    padding: var(--space-10); 
    transition: all 0.2s ease-out; 
    display: flex; 
    flex-direction: column; 
    position: relative;
}

.paper-card:hover { 
    transform: translateY(-2px); 
    box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.05); 
    border-color: var(--border-medium); 
}

.paper-tag { 
    font-size: var(--text-sm); 
    text-transform: uppercase; 
    letter-spacing: 0.05em; 
    color: var(--accent); 
    font-weight: 700; 
    margin-bottom: var(--space-3); 
    display: inline-block; 
}

.paper-tag.job-market { 
    color: var(--accent-orange); 
}

.card-title { 
    font-family: 'Merriweather', serif; 
    font-size: var(--text-4xl); 
    font-weight: 700; 
    margin: 0 0 var(--space-3) 0; 
    color: var(--text-primary); 
    line-height: var(--leading-snug); 
}

.author-list {
    font-size: var(--text-base);
    color: var(--text-light);
    margin-bottom: var(--space-2);
}

.author-link {
    color: inherit;
    text-decoration: underline;
}

.author-link:hover {
    color: var(--accent);
}

.badge-container {
    margin-bottom: var(--space-3);
}

.tech-badge {
    display: inline-block; 
    font-size: var(--text-sm); 
    font-family: inherit; 
    font-weight: 600; 
    text-transform: uppercase; 
    letter-spacing: 0.5px;
    color: var(--info-text); 
    background-color: var(--info-bg); 
    padding: 4px 10px; 
    border-radius: 9999px; 
    margin-right: 6px; 
    margin-bottom: 4px; 
    transition: all 0.2s ease;
}

.tech-badge:hover { 
    background-color: var(--info-bg-hover); 
    color: #0369a1; 
}

.paper-meta {
    font-size: var(--text-base);
    color: var(--text-light);
    margin-bottom: var(--space-3);
}

.paper-highlights {
    font-size: var(--text-base);
    color: var(--accent-orange);
    font-weight: 600;
    margin-bottom: var(--space-3);
}

.paper-abstract-container {
    margin-bottom: var(--space-4);
    overflow: hidden;
}

.paper-abstract {
    font-size: var(--text-sm);
    color: var(--text-light);
    line-height: var(--leading-normal);
    max-width: 780px;
    transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1),
                padding 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.paper-abstract.collapsed {
    max-height: 0;
    opacity: 0;
    padding: 0;
}

.paper-abstract.expanded {
    max-height: 1500px;
    opacity: 1;
    padding-bottom: var(--space-4);
}

.paper-actions {
    display: flex;
    gap: var(--space-3);
    align-items: center;
    flex-wrap: wrap;
    margin-top: auto;
}

.btn-abstract {
    font-size: var(--text-md);
    font-weight: 600;
    color: var(--accent);
    background: var(--bg-accent);
    border: 2px solid var(--accent);
    border-radius: 6px;
    padding: var(--space-2) var(--space-4);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.btn-abstract:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(39, 116, 174, 0.2);
}

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

.btn-abstract:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.card-link {
    font-size: var(--text-md);
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-paper);
    border: 2px solid var(--border);
    border-radius: 6px;
    padding: var(--space-2) var(--space-4);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    width: fit-content;
    transition: all 0.2s ease;
}

.card-link:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--bg-accent);
    transform: translateY(-1px);
}

.card-link:active {
    transform: translateY(0);
}

.card-link::after {
    content: "→";
    margin-left: 4px;
    transition: margin 0.2s;
}

.card-link:hover::after {
    margin-left: 8px;
}


/* ============================================================================
   6. NEWS SECTION
   ============================================================================ */

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

.news-item { 
    display: grid; 
    grid-template-columns: 90px 1fr; 
    gap: var(--space-6); 
    margin-bottom: var(--space-5); 
    align-items: baseline; 
}

.news-date { 
    font-family: inherit; 
    font-weight: 500; 
    color: var(--text-muted); 
    font-size: var(--text-base); 
    text-align: right; 
}

.news-text { 
    font-size: var(--text-lg); 
    color: var(--text-primary); 
}

.news-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.news-link:hover {
    text-decoration: underline;
}


/* ============================================================================
   7. NOW SECTION
   ============================================================================ */

.now-section {
    margin-top: var(--space-24);
    padding-top: var(--space-8);
    border-top: 1px dashed var(--border-dashed);
}

.now-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: var(--space-8);
}

.now-title {
    margin: 0;
    border: none;
}

.now-updated {
    font-size: var(--text-base);
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.now-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-12);
}

.now-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--text-light);
    margin-bottom: var(--space-4);
    letter-spacing: 0.5px;
}

.now-label-link {
    color: inherit;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 4px;
}

.now-label-link:hover {
    color: var(--accent);
}

.now-value {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-lg);
}

.now-book {
    margin-bottom: var(--space-2);
}

.now-book-link {
    color: var(--text-primary);
    text-decoration: none;
    border-bottom: 1px dotted var(--text-muted);
    transition: all 0.2s;
}

.now-book-link:hover {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.now-activity {
    margin-bottom: var(--space-2);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}


/* ============================================================================
   8. TEACHING PAGE
   ============================================================================ */

.callout-box {
    background-color: var(--bg-accent);
    padding: var(--space-6);
    border-radius: 8px;
    border-left: 4px solid var(--accent);
    margin-top: var(--space-8);
}

.course-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.course-role {
    color: var(--text-light);
    font-size: var(--text-normal);
}

.course-details {
    color: var(--text-light);
    font-size: var(--text-md);
    margin-top: var(--space-1);
}


/* ============================================================================
   9. CV PAGE
   ============================================================================ */

/* --- Header & Layout --- */

.cv-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-12);
    border-bottom: 1px solid var(--border);
    padding-bottom: var(--space-6);
    flex-wrap: wrap;
    gap: var(--space-4);
}

.cv-page-title {
    margin: 0;
    border: none;
    padding: 0;
}

.cv-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

/* Optional: if you use a dedicated class for the CV button */
.cv-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.55rem 0.9rem;
    border-radius: 8px;
    font-size: var(--text-md);
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.15s ease;
}

/* --- Section Headers --- */

.cv-section-header {
    color: var(--text-light);
    font-size: var(--text-base);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: var(--space-6);
}

.cv-subsection-header {
    font-family: 'Merriweather', serif;
    color: var(--text-secondary);
    font-size: var(--text-lg);
    font-weight: 700;
    margin-top: var(--space-8);
    margin-bottom: var(--space-4);
}

/* --- Standard Entries (Education, Industry, Teaching) --- */

.cv-entry {
    margin-bottom: var(--space-8);
    padding-left: var(--space-4);
    border-left: 2px solid transparent;
    transition: border 0.2s;
}

.cv-entry:hover {
    border-left-color: var(--accent);
}

.cv-entry-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.cv-company-header {
    margin-bottom: var(--space-3);
}

.cv-subentry {
    margin-bottom: var(--space-5);
}

/* Logo & Institution Grouping */

.cv-header-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cv-header-group a {
    display: flex;
    align-items: center;
    line-height: 0;
}

.cv-logo {
    width: 28px;
    height: 28px;
    object-fit: contain;
    opacity: 0.9;
    transition: transform 0.2s;
}

a .cv-logo:hover {
    transform: scale(1.1);
    opacity: 1;
}

.cv-institution-link {
    color: inherit;
    text-decoration: none;
    font-weight: 600;
}

.cv-institution-link:hover {
    color: var(--accent);
    text-decoration: underline;
}

/* Typography Helpers */

.cv-title {
    font-weight: 600;
    font-size: var(--text-xl);
    display: block;
    margin-bottom: var(--space-1);
    color: var(--text-primary);
}

.cv-inline {
    display: inline !important;
    margin-bottom: 0 !important;
}

.cv-location {
    font-size: var(--text-xl);
    font-weight: 400;
    color: var(--text-secondary);
    display: inline;
}

.cv-date {
    color: var(--text-light);
    font-style: italic;
    font-size: var(--text-md);
    flex-shrink: 0;
    margin-left: var(--space-4);
}

.cv-role {
    color: var(--accent);
    font-weight: 500;
    margin: var(--space-2) 0 var(--space-2) 40px;
}

.cv-desc {
    margin-left: 40px;
}

.cv-desc-no-indent {
    margin-left: 0;
}

.cv-desc ul {
    margin-top: var(--space-2);
    color: var(--text-primary);
    padding-left: 1.2rem;
}

/* --- SPECIFIC SECTIONS --- */

/* 1. Presentations: Paper Title (Bold) */
.cv-paper-block {
    margin-bottom: 1.5rem;
}

.cv-paper-title {
    margin-bottom: 0.4rem;
    color: var(--text-main);
    font-weight: 600;        
    font-size: var(--text-lg); 
}

.cv-talks-list {
    margin: 0;
    padding-left: 1.2rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* 2. Skills: Grid Layout */
.cv-skills-container {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.cv-skill-row {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: var(--space-4);
    align-items: baseline;
}

.cv-skill-category {
    color: var(--text-primary);
    font-weight: 700;
}

.cv-skill-list {
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ============================================================================
   10. LIBRARY PAGE
   ============================================================================ */

.library-intro {
    margin-bottom: var(--space-16);
    border-bottom: 1px solid var(--border);
    padding-bottom: var(--space-8);
}

.bookshelf-title {
    font-family: 'Merriweather', serif;
    font-size: var(--text-5xl);
    color: var(--text-primary);
    margin-top: var(--space-12);
    margin-bottom: var(--space-6);
    display: flex;
    align-items: center;
    gap: 10px;
}

.bookshelf-title::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border);
}

.book-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-10);
}

.book-item {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: var(--space-6);
    align-items: baseline;
}

.book-meta {
    text-align: right;
    font-size: var(--text-sm);
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.book-content { 
    max-width: 650px; 
}

.book-title {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-primary);
    display: block;
    margin-bottom: var(--space-1);
}

.book-author {
    font-size: var(--text-md);
    color: var(--text-light);
    font-style: italic;
    margin-bottom: var(--space-3);
    display: block;
}

.book-comment {
    font-size: var(--text-lg);
    color: var(--text-tertiary);
    line-height: var(--leading-normal);
}

/* ============================================================================
   11. MANIFESTO PAGE
   ============================================================================ */

.manifesto-header {
    border-bottom: 2px solid var(--accent);
    margin-bottom: var(--space-8);
    padding-bottom: var(--space-4);
}

.manifesto-title {
    font-size: var(--text-6xl); 
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
    line-height: var(--leading-tight);
}

.manifesto-subtitle {
    font-family: 'Merriweather', serif;
    font-size: var(--text-3xl);
    color: var(--text-light);
    font-style: italic;
}

.manifesto-body {
    font-size: 1.2rem; 
    max-width: 700px;
    margin-top: var(--space-12);
}

.manifesto-body p { 
    margin-bottom: var(--space-6); 
}


/* ============================================================================
   12. FOOTER
   ============================================================================ */

.site-footer {
    padding: var(--space-2) 0 var(--space-8) 0;
    margin-top: 0;
    border-top: none;
    background: transparent;
    text-align: center;
}

/* --- Layout Wrappers --- */

.footer-main-row {
    display: flex;
    justify-content: space-between; 
    align-items: flex-end;          
    max-width: 1080px;
    margin: 0 auto var(--space-6) auto; 
    padding: 0 var(--space-4);
}

.footer-col-left {
    display: flex;
    flex-direction: column;
    align-items: flex-start; 
    gap: var(--space-2);
    text-align: left;
    flex: 1; 
}

.footer-col-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;   
    justify-content: flex-end;
    text-align: right;
    flex: 1;
    padding-bottom: 2px;     
}

/* --- Content Styling --- */

.credits { 
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--text-base);
    color: var(--text-light);
    margin: 0; 
}

.copyright-text {
    font-size: var(--text-md);
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: var(--space-2); 
    margin: 0;
}

/* Carbon Badge */
.carbon-badge {
    margin: 0;
    font-family: inherit;
    font-size: var(--text-md);
    line-height: var(--leading-snug);
    color: var(--text-light);
    display: flex;
    justify-content: flex-end;
    text-align: right;
    width: 100%;
}

.wcb-loading {
    font-size: var(--text-sm);
    opacity: 0.6;
}

/* Crucial: Forces the inserted span to respect right alignment */
.carbon-badge span, 
.wcb-text {
    text-align: right;
    display: inline-block; /* Allows text-align to work on the block */
}

/* Link Styling (Shared) */
.copyright-text a,
.credits a {
    color: inherit;
    text-decoration: none;
}

.copyright-text a:hover {
    opacity: 0.7;
}

/* --- Icons (Gemini/Claude) --- */

.gemini-link, .claude-link {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.gemini-icon, .claude-icon {
    filter: grayscale(100%) brightness(0.9);
    opacity: 0.7;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.gemini-link:hover .gemini-icon,
.claude-link:hover .claude-icon {
    filter: grayscale(0%) brightness(1);
    opacity: 1;
    transform: scale(1.15) rotate(5deg);
}

/* --- Badge Link (The "tested" link) --- */
.wcb-link {
    color: var(--accent) !important;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

.wcb-link:hover {
    text-decoration: underline;
    color: var(--accent-hover) !important;
}

/* --- Bottom Center Elements --- */

.amdg {
    display: inline-block;
    font-size: var(--text-sm); 
    color: var(--text-lighter); 
    letter-spacing: 2px; 
    font-weight: 600; 
    user-select: none; 
    margin-top: var(--space-4);
}

.amdg:hover { 
    color: var(--accent); 
    transition: color 0.5s ease; 
    cursor: none; 
}

#saint-trigger {
    cursor: crosshair;  
    opacity: 0.3;   
    font-size: var(--text-lg);    
    transition: all 0.2s ease;
    color: var(--text-light);
}

#saint-trigger:hover {
    opacity: 1;
    color: var(--accent); 
    transform: scale(1.2);
}

#copyright-content {
    display: inline-block;
    text-align: left; 
}

/* ============================================================================
   13. INTERACTIVE ELEMENTS & EASTER EGGS
   ============================================================================ */

/* Spinning Profile Picture */
.spin-effect {
    transition: transform 3.2s ease-in-out;
    transform: perspective(1000px) rotateY(720deg);
}

/* Family Modal */
.family-link {
    cursor: zoom-in;
    position: relative;
    border-bottom: none;
    transition: all 0.2s ease;
    border-radius: 2px;
}

.family-link:hover { 
    color: var(--accent); 
    border-bottom-color: var(--accent); 
}

.family-link:focus-visible {
    outline: 2px solid rgba(39, 116, 174, 0.4);
    outline-offset: 1px;
    background-color: rgba(39, 116, 174, 0.05);
}

.modal-overlay {
    display: none; 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%;
    background-color: rgba(255, 255, 255, 0.95); 
    z-index: 9999;
    justify-content: center; 
    align-items: center;
    backdrop-filter: blur(5px); 
    animation: fadeIn 0.3s ease-out;
}

.modal-content { 
    text-align: center; 
    max-width: 90%; 
    padding: 20px;
    position: relative;
}

.modal-close {
    position: absolute;
    top: -10px;
    right: -10px;
    background: white;
    border: 2px solid var(--border);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: var(--text-light);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.modal-close:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    transform: rotate(90deg);
}

.modal-close:focus {
    outline: 2px solid rgba(39, 116, 174, 0.5);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(39, 116, 174, 0.15);
}

.modal-close:focus:not(:focus-visible) {
    outline: none;
    box-shadow: none;
}

.family-photo { 
    max-height: 80vh; 
    max-width: 100%; 
    border-radius: 8px; 
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04); 
}

.modal-caption { 
    margin-top: var(--space-4); 
    color: var(--text-light); 
    font-family: serif; 
    font-style: italic; 
    font-size: 1.1rem; 
}

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


/* ============================================================================
   14. PRINT STYLES (for CV)
   ============================================================================ */

@media print {
    body {
        background: white;
        background-image: none;
        font-size: 11pt;
        line-height: 1.4;
    }
    
    .container {
        max-width: 100%;
        margin: 0;
        padding: 0;
        border: none;
        box-shadow: none;
        display: block;
    }
    
    .sidebar {
        display: none;
    }
    
    .content {
        max-width: 100%;
    }
    
    .site-footer {
        display: none;
    }
    
    .cv-entry {
        page-break-inside: avoid;
    }
    
    .cv-page-header {
        border-bottom: 2px solid #000;
        margin-bottom: 20px;
    }
    
    .cv-actions {
        display: none;
    }
    
    .cv-entry:hover {
        border-left-color: transparent;
    }
    
    a {
        color: #000;
        text-decoration: none;
    }
    
    .cv-logo {
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }
    
    h2 {
        page-break-after: avoid;
    }
}

/* ============================================================================
   15. RESPONSIVE DESIGN (Final Polish)
   ============================================================================ */

@media (max-width: 768px) {

    /* --- Layout --- */
    .container { 
        grid-template-columns: 1fr; 
        padding: var(--space-8) var(--space-6); 
        gap: var(--space-12); 
        margin: 0; 
        border-radius: 0; 
        box-shadow: none; 
    }
    
    .sidebar { 
        position: static; 
        border-bottom: 1px solid var(--border); 
        padding-bottom: var(--space-8); 
        margin-bottom: var(--space-8); 
        height: auto; 
        overflow-y: visible;
    } 
    
    .research-grid, .now-grid { grid-template-columns: 1fr; gap: var(--space-8); }
    .cv-page-header { flex-direction: column; align-items: flex-start; }
    .cv-actions, .cv-actions .cv-action-btn { width: 100%; }
    #main-content { scroll-margin-top: 140px; }

    /* --- FOOTER ALIGNMENT --- */
    .footer-main-row {
        flex-direction: column;
        align-items: center;
        gap: var(--space-6);
        width: 100%; 
    }

    .footer-col-left, .footer-col-right {
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center; 
        text-align: center;
    }

    .credits { justify-content: center; margin-bottom: var(--space-2); }

    /* --- COPYRIGHT & SAINT CROSS --- */
    .copyright-text {
        position: relative; 
        display: flex;
        justify-content: center;
        /* Aligns text to the top to prevent shifting */
        align-items: flex-start; 
        width: 100%;
        line-height: 1.6; 
    }
    
    #copyright-content {
        display: inline-block;
        min-width: 260px; 
        text-align: center;
        white-space: normal; 
    }

    /* THE FIX: PIN CROSS TO THE TOP LINE */
    #saint-trigger {
        position: absolute;
        left: 0; 
        /* 1. Anchors cross to the top edge (ignores line-height changes) */
        top: 0; 
        transform: none; 
        
        /* 2. Forces cross to equal the height of ONE text line */
        height: 1.6em; 
        display: flex;
        align-items: center; 
        
        padding: 0 12px;
        cursor: pointer;
        opacity: 0.6;
        
        /* 3. Prevents blue tap box and shifting */
        outline: none; 
        border: none;
        -webkit-tap-highlight-color: transparent; 
        user-select: none;
    }
    
    #saint-trigger:focus, #saint-trigger:active {
        outline: none;
        border: none;
    }

    .carbon-badge { justify-content: center; text-align: center; width: 100%; }
    .carbon-badge span, .wcb-text { text-align: center; }
}
