/* CSS Reset and Variables */
:root {
    --bg-color: #ffffff;
    --bg-alt: #f8f9fa;
    /* Light grey for alternating sections */
    --text-color: #333333;
    --text-light: #666666;
    --accent-color: #2c3e50;
    /* Dark blue-grey */
    --accent-hover: #34495e;
    --border-color: #e0e0e0;
    --card-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    --hover-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);

    --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --max-width: 900px;
    --transition-speed: 0.3s;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-main);
    color: var(--text-color);
    line-height: 1.6;
    background-color: var(--bg-color);
}

img {
    max-width: 100%;
    height: auto;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color var(--transition-speed);
}

a:hover {
    color: var(--text-light);
}

ul {
    list-style: none;
}

/* Layout Utilities */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
}

.section {
    padding: 60px 0;
    border-bottom: 1px solid transparent;
}

.alt-bg {
    background-color: var(--bg-alt);
}

h2 {
    font-size: 2rem;
    margin-bottom: 30px;
    font-weight: 600;
    color: var(--accent-color);
    text-align: center;
    /* or left, depending on preference */
}

/* Header */
.site-header {
    background-color: var(--bg-color);
    padding: 20px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    /* Box shadow removed in favor of wave */
}

.header-wave {
    position: absolute;
    bottom: -20px;
    left: 0;
    width: 100%;
    height: 30px;
    fill: var(--bg-color);
    pointer-events: none;
    filter: drop-shadow(0 4px 4px rgba(0, 0, 0, 0.03));
}

.site-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.site-header nav ul {
    display: flex;
    gap: 20px;
}

.site-header nav a.active-nav {
    color: var(--accent-color);
    font-weight: 700;
}

/* Section Intros */
.section-title {
    margin-bottom: 10px;
}

.section-intro,
.blog-intro {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 40px;
    font-size: 1.1rem;
}

/* About Section */
.about-grid {
    display: flex;
    align-items: center;
    gap: 40px;
    max-width: 900px;
    margin: 0 auto;
}

.about-text {
    flex: 1;
    text-align: left;
}

.content-block {
    font-size: 1.1rem;
}

.content-block p {
    margin-bottom: 15px;
}

.about-images {
    flex: 0 0 300px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.profile-frame {
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    background: var(--bg-alt);
}

.profile-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.secondary-image-frame {
    width: 100%;
    height: 120px;
    background: var(--bg-alt);
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    font-size: 0.9rem;
    overflow: hidden;
}

.secondary-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Interactive CV Section */
.resume-section {
    max-width: 800px;
    margin: 0 auto;
}

.subsection-title {
    font-size: 1.4rem;
    margin-bottom: 20px;
    color: var(--accent-color);
    border-bottom: 2px solid var(--bg-alt);
    padding-bottom: 5px;
}

.resume-list,
.education-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.resume-item,
.education-item {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    transition: all var(--transition-speed) ease;
    overflow: hidden;
    position: relative;
}

.resume-item:hover,
.resume-item:focus,
.resume-item.active {
    box-shadow: var(--hover-shadow);
    border-color: #ccc;
    transform: translateY(-2px);
}

.resume-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
        "title meta"
        "org meta";
    align-items: start;
    column-gap: 14px;
    row-gap: 4px;
}

.resume-header .role,
.resume-header .degree {
    grid-area: title;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent-color);
    min-width: 0;
}

.resume-header .company,
.resume-header .school {
    grid-area: org;
    font-weight: 500;
    color: var(--text-light);
    min-width: 0;
}

.resume-header .date {
    grid-area: meta;
    font-size: 0.9rem;
    color: #888;
    justify-self: end;
    text-align: right;
    line-height: 1.35;
    max-width: 36ch;
}

/* The 'Magic' Expansion Part */
.resume-details {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    transition: max-height 0.4s ease, opacity 0.4s ease, margin-top 0.4s ease;
    overflow: hidden;
}

/* Expand on Hover OR when .active class is present (for mobile/click) */
.resume-item:hover .resume-details,
.resume-item:focus-within .resume-details,
.resume-item.active .resume-details {
    max-height: 500px;
    /* Arbitrary large height */
    opacity: 1;
    margin-top: 15px;
}

.resume-details ul {
    list-style: disc;
    margin-left: 20px;
    margin-top: 10px;
}

.hint-text {
    text-align: center;
    font-size: 0.8rem;
    color: #999;
    margin-top: 15px;
}

/* Projects / Currently */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.projects-grid.full-grid {
    grid-template-columns: 1fr;
    max-width: 700px;
    margin: 0 auto;
}

.view-all-container {
    text-align: center;
    margin-top: 40px;
}

.btn-outline {
    display: inline-block;
    padding: 10px 25px;
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    border-radius: 4px;
    font-weight: 500;
    transition: all var(--transition-speed);
}

.btn-outline:hover {
    background-color: var(--accent-color);
    color: white;
}

.project-card {
    background: var(--bg-alt);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 25px;
    transition: all var(--transition-speed);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.project-card:hover,
.project-card.active {
    box-shadow: var(--hover-shadow);
    transform: translateY(-2px);
    background: var(--bg-color);
}

.project-card h3 {
    margin-bottom: 5px;
}

.project-status {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #888;
    margin-bottom: 15px;
    font-weight: 600;
}

.project-details {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: all 0.4s ease;
}

.project-card.active .project-details,
.project-card:hover .project-details {
    max-height: 300px;
    opacity: 1;
    margin-top: 15px;
}

.project-link {
    display: inline-block;
    margin-top: 10px;
    font-size: 0.9rem;
    color: var(--accent-color);
    border-bottom: 1px solid var(--accent-color);
}

/* Blog styles */
.blog-entry {
    max-width: 700px;
    margin: 0 auto 40px;
    padding-bottom: 40px;
    border-bottom: 1px solid var(--border-color);
}

.blog-meta,
.post-meta {
    font-size: 0.9rem;
    color: #888;
    margin-bottom: 10px;
}

.blog-title {
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.blog-summary {
    margin-bottom: 15px;
}

.read-more {
    font-weight: 600;
    color: var(--accent-color);
}

/* Post Content */
.post-content {
    max-width: 700px;
    margin: 0 auto;
}

.back-link {
    display: block;
    margin-bottom: 20px;
    font-size: 0.9rem;
    color: var(--text-light);
}

.post-title {
    font-size: 2.5rem;
    line-height: 1.2;
    margin-bottom: 10px;
}

.post-body p {
    margin-bottom: 20px;
    font-size: 1.1rem;
}

.post-body h3 {
    margin: 30px 0 15px;
}

.post-body code {
    background: var(--bg-alt);
    padding: 2px 6px;
    border-radius: 4px;
}

/* Footer */
footer {
    padding: 40px 0;
    text-align: center;
    color: #888;
    font-size: 0.9rem;
    border-top: 1px solid var(--border-color);
    margin-top: 40px;
}

.social-links {
    margin-top: 15px;
    display: flex;
    justify-content: center;
    gap: 20px;
}

/* Academic homepage overrides (index only) */
.home-academic {
    background:
        radial-gradient(1200px 300px at 20% -10%, #f3f6fb 0%, transparent 65%),
        radial-gradient(900px 280px at 90% 0%, #f7f4ec 0%, transparent 60%),
        #fdfdfb;
    color: #1f2933;
    font-family: "Source Sans 3", "Segoe UI", sans-serif;
}

.home-academic .container {
    max-width: 980px;
}

.home-academic .site-header {
    position: relative;
    background: rgba(253, 253, 251, 0.96);
    backdrop-filter: blur(4px);
    border-bottom: 1px solid #d9dee8;
    padding: 18px 0;
}

.home-academic .header-wave {
    display: none;
}

.home-academic .site-header .container {
    align-items: flex-end;
    gap: 20px;
}

.home-academic .logo-wrap {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.home-academic .logo {
    font-family: "Crimson Text", Georgia, serif;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 0.2px;
    color: #111827;
}

.home-academic .logo-subtitle {
    font-size: 0.95rem;
    color: #4b5563;
}

.home-academic .site-header nav ul {
    gap: 18px;
}

.home-academic .site-header nav a {
    font-size: 0.95rem;
    color: #1f3a5f;
    border-bottom: 1px solid transparent;
    padding-bottom: 2px;
}

.home-academic .site-header nav a:hover {
    color: #0f2744;
    border-bottom-color: #0f2744;
}

.home-academic .site-header nav a.active-nav {
    color: #0f2744;
    border-bottom-color: #0f2744;
    font-weight: 700;
}

.home-academic .section {
    padding: 56px 0;
    border-bottom: 1px solid #e8ecf3;
}

.home-academic .alt-bg {
    background: #f7f9fc;
}

.home-academic h2 {
    text-align: left;
    font-family: "Crimson Text", Georgia, serif;
    font-size: 2rem;
    color: #14253d;
    margin-bottom: 18px;
}

.home-academic .about-grid {
    align-items: flex-start;
}

.home-academic #about .about-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(240px, 320px);
    gap: 28px;
}

.home-academic #about .about-text,
.home-academic #about .content-block {
    min-width: 0;
}

.home-academic #about .content-block {
    max-width: none;
}

.home-academic #about .content-block p {
    margin-bottom: 18px;
    overflow-wrap: anywhere;
}

.home-academic #about .about-images {
    align-self: start;
    margin-top: 3.2rem;
}

.home-academic #about .profile-frame {
    aspect-ratio: 3 / 4;
}

.home-academic .content-block {
    font-size: 1.06rem;
    max-width: 62ch;
}

.home-academic .violin-text {
    max-width: none;
    width: 100%;
}

.home-academic .academic-meta {
    list-style: none;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #d9dee8;
}

.home-academic .academic-meta li {
    margin-bottom: 8px;
    color: #374151;
}

.home-academic .profile-frame {
    border-radius: 4px;
    box-shadow: 0 10px 24px rgba(14, 33, 61, 0.12);
}

.home-academic .academic-note {
    padding: 14px;
    border: 1px solid #d9dee8;
    background: #ffffff;
    font-size: 0.95rem;
    line-height: 1.5;
    color: #374151;
}

.home-academic .note-label {
    font-family: "Crimson Text", Georgia, serif;
    font-weight: 700;
    font-size: 1.05rem;
    margin-bottom: 4px;
    color: #1f3a5f;
}

.home-academic .section-intro {
    text-align: left;
    margin-bottom: 18px;
    font-size: 1rem;
    color: #4b5563;
}

.home-academic .blog-intro {
    text-align: left;
    margin-bottom: 24px;
}

.home-academic .blog-entry {
    background: #ffffff;
    border: 1px solid #d9dee8;
    padding: 18px 20px;
    margin-bottom: 16px;
}

.home-academic .read-more {
    color: #1f3a5f;
}

.home-academic .gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    max-width: 760px;
    margin: 0 auto;
}

.home-academic .gallery-item {
    background: #ffffff;
    border: 1px solid #d9dee8;
    border-radius: 4px;
    padding: 10px;
}

.home-academic .gallery-img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 2px;
}

.home-academic .gallery-caption {
    margin-top: 8px;
    font-size: 0.88rem;
    color: #4b5563;
    text-align: center;
}

.home-academic .post-content {
    background: #ffffff;
    border: 1px solid #d9dee8;
    padding: 22px 24px;
}

.home-academic .post-title {
    font-family: "Crimson Text", Georgia, serif;
    color: #14253d;
    font-size: clamp(2rem, 5vw, 2.5rem);
}

.home-academic .back-link {
    color: #1f3a5f;
}

.home-academic .resume-section {
    margin-bottom: 0;
}

.home-academic .interest-list {
    list-style: disc;
    padding-left: 20px;
    color: #1f2933;
    display: grid;
    gap: 10px;
    max-width: 75ch;
}

.home-academic .projects-grid {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.home-academic .projects-grid.full-grid {
    grid-template-columns: 1fr;
    max-width: 700px;
    margin: 0 auto;
}

.home-academic .project-card {
    background: #ffffff;
    border-radius: 4px;
    border: 1px solid #d9dee8;
    box-shadow: none;
}

.home-academic .project-card:hover,
.home-academic .project-card.active {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(14, 33, 61, 0.08);
}

.home-academic .project-status {
    color: #526173;
}

.home-academic .project-link {
    color: #1f3a5f;
    border-bottom-color: #1f3a5f;
}

.home-academic .news-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.home-academic .news-item {
    background: #ffffff;
    border: 1px solid #d9dee8;
    padding: 14px 16px;
    border-left: 3px solid #1f3a5f;
}

.home-academic .news-date {
    display: inline-block;
    margin-bottom: 6px;
    font-size: 0.85rem;
    letter-spacing: 0.7px;
    text-transform: uppercase;
    color: #526173;
    font-weight: 700;
}

.home-academic .btn-outline {
    border-color: #1f3a5f;
    color: #1f3a5f;
    border-radius: 2px;
}

.home-academic .btn-outline:hover {
    background: #1f3a5f;
    color: #ffffff;
}

.home-academic footer {
    margin-top: 0;
    border-top: none;
    background: #f2f5fa;
}

.home-academic .social-links a {
    color: #1f3a5f;
}

/* Responsive adjustments */
@media (max-width: 900px) {
    .home-academic .site-header .container {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .home-academic .site-header nav {
        width: 100%;
    }

    .home-academic .site-header nav ul {
        flex-wrap: wrap;
        gap: 10px 14px;
    }

    .home-academic #about .about-grid {
        grid-template-columns: 1fr;
    }

    .home-academic #about .about-images {
        max-width: 320px;
        margin-top: 0;
    }
}

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

    .section,
    .home-academic .section {
        padding: 48px 0;
    }

    .about-grid {
        flex-direction: column;
        text-align: center;
    }

    .about-text {
        text-align: center;
    }

    .about-images {
        flex: 1;
        width: 100%;
        max-width: 300px;
    }

    .home-academic .site-header .container {
        align-items: flex-start;
    }

    .home-academic .about-grid,
    .home-academic .about-text,
    .home-academic .content-block,
    .home-academic .academic-meta,
    .home-academic .hint-text {
        text-align: left;
    }

    .home-academic #about .about-images {
        margin-left: auto;
        margin-right: auto;
        align-self: center;
    }

    .home-academic h2,
    .home-academic .section-intro {
        text-align: left;
    }

    .home-academic .project-card,
    .home-academic .post-content,
    .home-academic .blog-entry {
        padding: 18px;
    }
}

@media (max-width: 600px) {
    .site-header {
        position: relative;
    }

    .site-header .container {
        flex-direction: column;
        gap: 15px;
    }

    .resume-header {
        grid-template-columns: 1fr;
        grid-template-areas:
            "title"
            "org"
            "meta";
        row-gap: 6px;
    }

    .resume-header .date {
        justify-self: start;
        text-align: left;
        max-width: none;
    }

    .home-academic .site-header .container {
        align-items: flex-start;
        gap: 10px;
    }

    .home-academic .site-header nav ul {
        flex-wrap: wrap;
        gap: 12px;
        justify-content: flex-start;
    }

    .home-academic .logo-subtitle {
        font-size: 0.85rem;
    }

    .home-academic .site-header nav a {
        font-size: 0.92rem;
    }

    .home-academic .post-title {
        font-size: 1.85rem;
    }

    .home-academic .post-body p {
        font-size: 1rem;
    }

    .home-academic .social-links {
        flex-wrap: wrap;
        gap: 12px;
    }
}
