/* ============================================
   World-Class Blog Layout - Optimized for Readability
   ============================================ */

:root {
    /* Modern Color Palette - High Contrast for Readability */
    --frame-color: #0f172a;
    --page-bg: #ffffff;
    --text-color: #334155;
    --heading-color: #1e293b;
    --text-secondary: #64748b;
    --text-tertiary: #94a3b8;
    --border-color: #e2e8f0;
    --accent-color: #2563eb;
    --accent-hover: #1d4ed8;
    --bg-secondary: #f8fafc;
    --bg-light: #ffffff;

    /* Navigation Colors */
    --nav-text: #f8fafc;
    --nav-text-secondary: #cbd5e1;

    /* Code colors - Dark theme by default */
    --code-bg: #1e293b;
    --code-text: #e2e8f0;
    --code-border: #334155;

    /* Typography - Optimized for Readability */
    --font-heading: 'Philosopher', 'Georgia', serif;
    --font-body: 'Work Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;

    /* Optimal Spacing Scale (reduced by 20%) */
    --spacing-xs: 0.2rem;
    --spacing-sm: 0.4rem;
    --spacing-md: 0.8rem;
    --spacing-lg: 1.2rem;
    --spacing-xl: 1.6rem;
    --spacing-2xl: 2.4rem;
    --spacing-3xl: 3.2rem;
    --spacing-4xl: 4.8rem;

    /* Shadows - Subtle and Modern */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-body);
    line-height: 1.75;
    color: var(--text-color);
    background-color: var(--frame-color);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    padding: 2rem;
    letter-spacing: -0.011em;
    position: relative;
    min-height: 100vh;
}

.canvas-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
    background: radial-gradient(circle at 50% 0%, #1e293b 0%, var(--frame-color) 70%);
    opacity: 0.5;
}

/* ============================================
   Typography - Optimized for Readability
   ============================================ */

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.2;
    color: var(--heading-color);
    margin: 0;
    letter-spacing: -0.02em;
}

h1 {
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    margin-bottom: var(--spacing-lg);
}

h2 {
    font-size: clamp(1.4rem, 3.2vw, 2rem);
    margin-bottom: var(--spacing-md);
}

h3 {
    font-size: clamp(1.2rem, 2.4vw, 1.6rem);
    margin-bottom: var(--spacing-md);
}

h4 {
    font-size: 1.2rem;
    margin-bottom: var(--spacing-sm);
}

h5 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
}

h6 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
}

/* ============================================
   Layout Components
   ============================================ */

.header {
    background: rgba(15, 23, 42, 0.9);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: var(--spacing-md) 0;
    position: sticky;
    top: 0;
    z-index: 100;
    margin-bottom: var(--spacing-xl); /* Adjusted from 2rem */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: all var(--transition-base);
}

.main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0;
    min-height: calc(100vh - 200px);
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--shadow-2xl);
    padding: var(--spacing-4xl) var(--spacing-3xl);
    position: relative;
    overflow: hidden;
}

.main::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--accent-color), #60a5fa);
}

/* ============================================
   Hero Section
   ============================================ */

.hero {
    text-align: center;
    padding: var(--spacing-4xl) 0 var(--spacing-3xl);
    margin-bottom: var(--spacing-4xl);
    position: relative;
    z-index: 1;
}

/* Updated Hero Styles for better visibility on light background */
.hero h1 {
    font-size: clamp(2rem, 5.6vw, 3.6rem);
    font-weight: 700;
    margin-bottom: var(--spacing-lg);
    color: var(--heading-color);
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, var(--heading-color) 0%, var(--accent-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    padding-bottom: 0.1em;
}

.subtitle {
    font-size: clamp(0.9rem, 2vw, 1.2rem);
    color: var(--text-secondary);
    font-weight: 400;
    max-width: 65ch;
    margin: 0 auto;
    font-family: var(--font-body);
    line-height: 1.6;
}

/* ============================================
   Post Cards - Modern Grid Layout
   ============================================ */

.posts-list {
    position: relative;
    z-index: 1;
}

.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
    gap: var(--spacing-2xl);
    margin-top: var(--spacing-3xl);
    position: relative;
    z-index: 1;
}

.post-card {
    background: var(--page-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    transition: all var(--transition-base);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    height: 100%;
    text-decoration: none;
    color: inherit;
    box-shadow: var(--shadow-sm);
}

.post-card:hover {
    border-color: var(--accent-color);
    box-shadow: var(--shadow-xl);
    transform: translateY(-8px);
}

.post-card-image {
    width: 100%;
    height: 240px;
    overflow: hidden;
    background: var(--bg-secondary);
    position: relative;
}

.post-card-image::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.2) 100%);
    opacity: 0.6;
    transition: opacity var(--transition-base);
}

.post-card:hover .post-card-image::after {
    opacity: 0.3;
}

.post-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.post-card:hover .post-card-image img {
    transform: scale(1.1);
}

.post-card-content {
    padding: var(--spacing-xl);
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.post-card-content h3 {
    font-size: clamp(1rem, 1.6vw, 1.2rem);
    margin-bottom: var(--spacing-md);
    font-weight: 700;
    line-height: 1.3;
    color: var(--heading-color);
}

.post-card-content h3 a {
    color: var(--heading-color);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.post-card-content h3 a:hover {
    color: var(--accent-color);
}

.post-meta {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
    display: flex;
    gap: var(--spacing-md);
    align-items: center;
    flex-wrap: wrap;
    font-weight: 500;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
    margin: var(--spacing-md) 0;
}

.tag {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.6rem;
    font-weight: 600;
    border: 1px solid var(--border-color);
    transition: all var(--transition-fast);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.post-card:hover .tag {
    border-color: var(--accent-color);
    color: var(--accent-color);
    background: rgba(37, 99, 235, 0.05);
}

.excerpt {
    color: var(--text-secondary);
    margin-bottom: var(--spacing-lg);
    line-height: 1.6;
    flex-grow: 1;
    font-size: 0.8rem;
}

.read-more {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.75rem;
    transition: all var(--transition-fast);
    margin-top: auto;
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.read-more:hover {
    color: var(--accent-hover);
    gap: var(--spacing-sm);
}

/* ============================================
   Post Content - Optimized for Reading
   ============================================ */

.post {
    max-width: 100%;
    margin: 0 auto;
    background: transparent;
}

.post-header-image {
    width: 100%;
    max-height: 600px;
    overflow: hidden;
    margin-bottom: var(--spacing-3xl);
    border-radius: 16px;
    background: var(--bg-secondary);
    box-shadow: var(--shadow-lg);
}

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

.post-header {
    margin-bottom: var(--spacing-4xl);
    padding-bottom: var(--spacing-xl);
    border-bottom: 1px solid var(--border-color);
    text-align: center;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.post-header h1 {
    font-size: clamp(2rem, 4.8vw, 2.8rem);
    font-weight: 800;
    margin-bottom: var(--spacing-lg);
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: var(--heading-color);
    font-family: var(--font-heading);
}

.post-content {
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text-color);
    font-family: var(--font-body);
    max-width: 68ch;
    margin: 0 auto;
    position: relative;
    margin-bottom: var(--spacing-3xl);
}

/* Videos and charts respect content margins but can be wider than text */
.post-content .video-wrapper,
.post-content .chart-wrapper {
    width: 100vw;
    max-width: 100%;
    margin: var(--spacing-3xl) calc(50% - 50vw);
    transform: translateX(calc(50vw - 50%));
    padding: 0 var(--spacing-xl);
}
/* Constrain if inside container */
.main .post-content .video-wrapper,
.main .post-content .chart-wrapper {
    width: 100%;
    margin: var(--spacing-3xl) 0;
    transform: none;
    padding: 0;
}


/* Drop cap for first paragraph */
.post-content>p:first-of-type::first-letter {
    float: left;
    font-size: 3.2rem;
    line-height: 0.8;
    padding-top: 0.15em;
    padding-right: 0.1em;
    padding-bottom: 0;
    color: var(--accent-color);
    font-family: var(--font-heading);
    font-weight: 700;
    margin-right: 0.1em;
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6 {
    margin-top: var(--spacing-3xl);
    margin-bottom: var(--spacing-lg);
    color: var(--heading-color);
    font-weight: 700;
    font-family: var(--font-heading);
    line-height: 1.3;
}

.post-content h2 {
    font-size: clamp(1.4rem, 3.2vw, 1.8rem);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: var(--spacing-sm);
}

.post-content h3 {
    font-size: clamp(1.2rem, 2.4vw, 1.4rem);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: var(--spacing-sm);
}

.post-content h4 {
    font-size: 1.1rem;
}

.post-content h5 {
    font-size: 1rem;
    font-weight: 600;
}

.post-content h6 {
    font-size: 0.9rem;
    font-weight: 600;
}

.post-content p {
    margin-bottom: var(--spacing-lg);
    text-align: left;
    hyphens: auto;
}

.post-content a {
    color: var(--accent-color);
    text-decoration: none;
    border-bottom: 1px solid rgba(37, 99, 235, 0.3);
    transition: all var(--transition-fast);
    font-weight: 500;
}

.post-content a:hover {
    border-bottom-color: var(--accent-color);
    background: rgba(37, 99, 235, 0.05);
}

.post-content ul,
.post-content ol {
    margin-left: var(--spacing-xl);
    margin-bottom: var(--spacing-lg);
    padding-left: var(--spacing-md);
}

.post-content li {
    margin-bottom: var(--spacing-sm);
    padding-left: var(--spacing-sm);
}

.post-content li::marker {
    color: var(--accent-color);
    font-weight: bold;
}

.post-content blockquote {
    border-left: 4px solid var(--accent-color);
    margin: var(--spacing-2xl) 0;
    color: var(--text-color);
    font-style: italic;
    background: var(--bg-secondary);
    padding: var(--spacing-xl);
    border-radius: 0 12px 12px 0;
    font-size: 1rem;
    font-family: var(--font-heading);
    position: relative;
}
.post-content blockquote::before {
    content: '"';
    position: absolute;
    top: 0;
    left: 10px;
    font-size: 3.2rem; /* Adjusted from 4rem */
    color: rgba(37, 99, 235, 0.1);
    font-family: serif;
    line-height: 1;
}


.post-content code {
    background: var(--code-bg);
    padding: 0.2em 0.4em;
    border-radius: 6px;
    font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', monospace;
    font-size: 0.85rem; /* Adjusted from 0.85em, now relative to 1rem base */
    color: #60a5fa;
    font-weight: 500;
}

.post-content pre {
    background: var(--code-bg);
    color: var(--code-text);
    padding: var(--spacing-xl);
    border-radius: 16px;
    overflow-x: auto;
    margin: var(--spacing-2xl) 0;
    line-height: 1.6;
    border: 1px solid var(--code-border);
    font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', monospace;
    box-shadow: var(--shadow-lg);
}

.post-content pre code {
    background: transparent;
    padding: 0;
    color: inherit;
    font-size: 0.72rem;
    border: none;
    font-weight: 400;
}

.table-wrapper {
    width: 100%;
    overflow-x: auto;
    margin: var(--spacing-2xl) 0;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
    background: var(--page-bg);
}

.post-content table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    white-space: normal;
    margin: 0;
    border: none;
    box-shadow: none;
    border-radius: 0;
}

.post-content table th,
.post-content table td {
    border-bottom: 1px solid var(--border-color);
    padding: var(--spacing-md) var(--spacing-lg);
    text-align: left;
}

.post-content table th {
    background: var(--bg-secondary);
    font-weight: 700;
    color: var(--heading-color);
    font-family: var(--font-heading);
}

.post-content table tr:last-child td {
    border-bottom: none;
}

.post-content table tr:hover {
    background: var(--bg-secondary);
}

/* ============================================
   MathJax Styling
   ============================================ */

.post-content .MathJax {
    font-size: 0.88rem; /* Adjusted from 1.1em, now relative to 1rem base */
    color: var(--heading-color);
}

.post-content mjx-container {
    margin: var(--spacing-xl) 0;
    overflow-x: auto;
    padding: var(--spacing-md) 0;
}

/* ============================================
   Footer
   ============================================ */

.footer {
    text-align: center;
    padding: var(--spacing-3xl) var(--spacing-xl);
    color: var(--nav-text-secondary);
    border-top: none;
    margin-top: var(--spacing-3xl);
    font-size: 0.7rem;
    background: var(--frame-color);
    margin-left: calc(-1 * var(--spacing-3xl));
    margin-right: calc(-1 * var(--spacing-3xl));
    margin-bottom: calc(-1 * var(--spacing-4xl));
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-lg);
    max-width: 1200px;
    margin: 0 auto;
}

.social-links {
    display: flex;
    gap: var(--spacing-lg);
    align-items: center;
    justify-content: center;
}

.social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    color: var(--nav-text-secondary);
    transition: all var(--transition-base);
    text-decoration: none;
    padding: var(--spacing-sm);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.social-link:hover {
    background: var(--accent-color);
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
    border-color: var(--accent-color);
}

/* ============================================
   Posts List Page
   ============================================ */

.posts-list-detailed {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-2xl);
}

.post-item {
    padding: 0;
    background: var(--page-bg);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    transition: all var(--transition-base);
    overflow: hidden;
    display: flex;
    flex-direction: row;
    gap: var(--spacing-xl);
    box-shadow: var(--shadow-sm);
}

.post-item:hover {
    border-color: var(--accent-color);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.post-item-image {
    width: 240px;
    min-width: 240px;
    min-height: 200px;
    overflow: hidden;
    background: var(--bg-secondary);
    flex-shrink: 0;
    align-self: stretch;
    position: relative;
}

.post-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
    position: absolute; /* Absolute positioning ensures it covers the stretched container */
    top: 0;
    left: 0;
}

.post-item:hover .post-item-image img {
    transform: scale(1.05);
}

.post-item-content {
    padding: var(--spacing-xl);
    flex-grow: 1;
}

.post-item h2 {
    font-size: clamp(1.2rem, 3.2vw, 1.6rem);
    font-weight: 700;
    margin-bottom: var(--spacing-md);
    line-height: 1.3;
}

.post-item h2 a {
    color: var(--heading-color);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.post-item h2 a:hover {
    color: var(--accent-color);
}

.post-footer {
    margin-top: var(--spacing-3xl);
    padding-top: var(--spacing-xl);
    border-top: 2px solid var(--border-color);
}

.post-nav a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 600;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.post-nav a:hover {
    color: var(--accent-hover);
    gap: var(--spacing-sm);
}

/* ============================================
   About Page
   ============================================ */

.about-page {
    max-width: 800px;
    margin: 0 auto;
}

.about-header {
    margin-bottom: var(--spacing-4xl);
    padding-bottom: var(--spacing-lg);
    border-bottom: 2px solid var(--border-color);
    text-align: center;
}

.profile-image-container {
    display: flex;
    justify-content: center;
    margin-bottom: var(--spacing-xl);
}

.profile-image {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.profile-image:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-xl);
}

@media (max-width: 768px) {
    .profile-image {
        width: 150px;
        height: 150px;
    }
}

.about-header h1 {
    font-size: clamp(1.6rem, 4vw, 2.4rem);
    margin-bottom: var(--spacing-md);
}

.about-content {
    font-size: 0.9rem;
    line-height: 1.85;
}

.about-intro {
    margin-bottom: var(--spacing-4xl);
}

.about-intro .lead {
    font-size: 1.1rem;
    color: var(--text-color);
    font-weight: 400;
    line-height: 1.8;
}

.about-roles,
.about-experience,
.about-author,
.about-contact {
    margin-bottom: var(--spacing-2xl); /* Reduced from 4xl */
}

.about-roles h2,
.about-experience h2,
.about-author h2,
.about-contact h2 {
    font-size: clamp(1.2rem, 2.5vw, 1.5rem); /* Slightly smaller */
    margin-bottom: var(--spacing-lg);
    color: var(--heading-color);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: var(--spacing-xs);
}

.role-card {
    background: var(--page-bg);
    border: 1px solid var(--border-color); /* Reduced border width */
    border-radius: 12px; /* Slightly tighter radius */
    padding: 0;
    margin-bottom: var(--spacing-md); /* Reduced from xl */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow:
        0 1px 3px rgba(0, 0, 0, 0.05),
        0 1px 2px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    position: relative;
}

.role-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px; /* Thinner accent line */
    background: linear-gradient(90deg, var(--accent-color), var(--accent-hover));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.role-card:hover {
    border-color: var(--accent-color);
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.1),
        0 2px 6px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.role-card:hover::before {
    transform: scaleX(1);
}

.role-link {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: var(--spacing-lg); /* Reduced gap */
    text-decoration: none;
    color: inherit;
    padding: var(--spacing-md); /* Reduced padding */
    position: relative;
}

.role-image {
    width: 80px; /* Reduced from 140px */
    height: 80px; /* Reduced from 140px */
    flex-shrink: 0;
    border-radius: 10px;
    overflow: hidden;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, #f0f0f0 100%);
    box-shadow:
        0 2px 6px rgba(0, 0, 0, 0.1),
        0 1px 2px rgba(0, 0, 0, 0.06);
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.role-card:hover .role-image {
    box-shadow:
        0 4px 10px rgba(0, 0, 0, 0.15),
        0 2px 4px rgba(0, 0, 0, 0.1);
    transform: scale(1.05);
}

.role-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.role-card:hover .role-image img {
    transform: scale(1.1);
}

.role-image-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.1) 0%, rgba(37, 99, 235, 0.05) 100%);
}

.role-image-icon svg {
    width: 70%; /* Adjusted relative size */
    height: 70%;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.role-card:hover .role-image-icon svg {
    transform: scale(1.1) rotate(5deg);
}

/* Quantum and other symbols CSS remains largely the same, just scaled by container */

.role-content {
    flex: 1;
    min-width: 0;
    /* Allows text to wrap properly */
}

.role-content h3 {
    margin-bottom: var(--spacing-xs); /* Tighter spacing */
    color: var(--heading-color);
    font-weight: 700;
    font-size: 1rem; /* Reduced font size */
    line-height: 1.3;
    font-family: var(--font-heading);
    letter-spacing: -0.01em;
    transition: color 0.2s ease;
}

.role-card:hover .role-content h3 {
    color: var(--accent-color);
}

.role-content p {
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5; /* Tighter line height */
    font-size: 0.85rem; /* Reduced font size */
    font-weight: 400;
}

.role-link::after {
    content: '→';
    position: absolute;
    right: var(--spacing-md);
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
    color: var(--accent-color);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
}

.role-card:hover .role-link::after {
    opacity: 1;
    transform: translateY(-50%) translateX(4px);
}

@media (max-width: 768px) {
    .role-link {
        flex-direction: row; /* Keep row layout on mobile for compactness */
        text-align: left;
        padding: var(--spacing-md);
    }

    .role-image {
        width: 60px; /* Even smaller on mobile */
        height: 60px;
        margin: 0;
    }

    .role-content h3 {
        font-size: 0.95rem;
        text-align: left;
    }

    .role-content p {
        text-align: left;
        font-size: 0.8rem;
    }

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


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

.contact-links {
    display: flex;
    gap: var(--spacing-lg);
    justify-content: center;
    flex-wrap: wrap;
}

.contact-link {
    display: inline-block;
    padding: var(--spacing-md) var(--spacing-2xl);
    background: var(--accent-color);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-sm);
}

.contact-link:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 1024px) {
    .main {
        padding: var(--spacing-3xl) var(--spacing-2xl);
    }

    .post-content {
        font-size: 0.85rem;
    }
}

@media (max-width: 768px) {
    body {
        padding: 1rem;
    }

    .main {
        padding: var(--spacing-2xl) var(--spacing-lg);
        border-radius: 12px;
        box-shadow: var(--shadow-lg);
    }

    .header {
        padding: var(--spacing-sm) 0;
    }

    .hero {
        padding: var(--spacing-3xl) 0 var(--spacing-2xl);
    }

    .posts-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-xl);
    }

    .post-header-image {
        max-height: 300px;
        margin-bottom: var(--spacing-2xl);
    }

    .post-item {
        flex-direction: column;
    }

    .post-item-image {
        width: 100%;
        min-width: 100%;
        height: 200px;
    }

    .footer {
        margin-left: calc(-1 * var(--spacing-lg));
        margin-right: calc(-1 * var(--spacing-lg));
        margin-bottom: calc(-1 * var(--spacing-2xl));
        border-radius: 0 0 12px 12px;
    }
}

@media (max-width: 480px) {
    body {
        font-size: 16px;
        padding: 0.5rem;
    }

    .main {
        padding: var(--spacing-xl) var(--spacing-md);
        border-radius: 6px;
    }

    .hero {
        padding: var(--spacing-2xl) 0 var(--spacing-xl);
    }

    .post-card-content {
        padding: var(--spacing-lg);
    }
}

/* ============================================
   Citations and References
   ============================================ */

.reference-link,
.citation-link {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    background: rgba(37, 99, 235, 0.1);
    padding: 0.125rem 0.25rem;
    border-radius: 3px;
    font-size: 0.7em;
}

.reference-link:hover,
.citation-link:hover {
    color: var(--accent-hover);
    background: rgba(37, 99, 235, 0.15);
    text-decoration: none;
}

.reference-panel {
    margin-top: var(--spacing-4xl);
    padding: var(--spacing-2xl);
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 2px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.reference-panel h3 {
    margin-bottom: var(--spacing-xl);
    color: var(--heading-color);
    font-size: clamp(1rem, 2.4vw, 1.2rem);
    font-weight: 700;
    font-family: var(--font-heading);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: var(--spacing-sm);
    line-height: 1.3;
}

.reference-item {
    margin-bottom: var(--spacing-lg);
    padding: var(--spacing-md);
    background: var(--page-bg);
    border-left: 3px solid var(--accent-color);
    border-radius: 4px;
    line-height: 1.7;
}

.reference-item strong {
    color: var(--accent-color);
    margin-right: var(--spacing-sm);
}

.reference-panel.highlighted {
    animation: highlight 2s ease-in-out;
}

@keyframes highlight {

    0%,
    100% {
        background-color: var(--bg-secondary);
    }

    50% {
        background-color: rgba(37, 99, 235, 0.1);
    }
}

/* ============================================
   Chart Styling
   ============================================ */

.chart-wrapper {
    position: relative;
    width: 100%;
    height: 400px;
    margin: var(--spacing-2xl) 0;
    padding: var(--spacing-lg);
    background: var(--page-bg);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

@media (max-width: 768px) {
    .chart-wrapper {
        height: 300px;
        padding: var(--spacing-md);
    }
}

/* ============================================
   Image Styling
   ============================================ */

.post-content .post-image {
    max-width: 100%;
    width: 100%;
    height: auto;
    border-radius: 12px;
    margin: var(--spacing-xl) 0;
    display: block;
    box-shadow: var(--shadow-md);
    transition: transform var(--transition-base);
}

.post-content .post-image:hover {
    transform: scale(1.01);
}

.post-content p:has(.post-image) {
    margin: var(--spacing-xl) 0;
}

/* ============================================
   YouTube Video Styling
   ============================================ */

.video-wrapper {
    margin: var(--spacing-3xl) 0;
    width: 100%;
    max-width: 100%;
    column-span: all;
    /* Ensure videos span full width in multi-column layouts */
    break-inside: avoid;
    position: relative;
    display: block;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.video-container {
    position: relative;
    width: 100%;
    overflow: hidden;
    background: linear-gradient(135deg, var(--frame-color) 0%, #2a4a6f 100%);
    border-radius: 16px;
    box-shadow:
        0 15px 40px rgba(0, 0, 0, 0.25),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset,
        0 0 30px rgba(30, 58, 95, 0.3);
    transition: transform var(--transition-base), box-shadow var(--transition-base);
    display: block;
}

/* Use padding-bottom technique for maximum compatibility */
.video-container {
    padding-bottom: 56.25%;
    /* 16:9 aspect ratio */
    height: 0;
}

/* Modern browsers with aspect-ratio support - use it as enhancement */
@supports (aspect-ratio: 16 / 9) {
    .video-container {
        aspect-ratio: 16 / 9;
        padding-bottom: 0;
        height: auto;
    }
}

.video-container:hover {
    transform: translateY(-2px);
    box-shadow:
        0 25px 70px rgba(0, 0, 0, 0.35),
        0 0 0 1px rgba(255, 255, 255, 0.15) inset,
        0 0 50px rgba(30, 58, 95, 0.5);
}

.video-container::before {
    content: '';
    position: absolute;
    top: 6px;
    left: 6px;
    right: 6px;
    bottom: 6px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.15) 0%, transparent 50%);
    border-radius: 12px;
    pointer-events: none;
    z-index: 1;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    border: none !important;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
    z-index: 2;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    background: #000;
    /* Show black background while loading */
}

.video-caption {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.75rem;
    margin-top: var(--spacing-lg);
    font-style: italic;
    font-weight: 500;
    letter-spacing: 0.02em;
}

@media (max-width: 768px) {
    .video-wrapper {
        margin: var(--spacing-3xl) 0;
    }

    .video-container {
        border-radius: 12px;
        padding: 6px;
    }

    .video-container iframe {
        top: 6px;
        left: 6px;
        width: calc(100% - 12px);
        height: calc(100% - 12px);
        border-radius: 10px;
    }
}

@import './progress-bar.css';
