/* 
---
Theme: Contemporary Music PhD / Geek Minimalist
Principles: Clarity, Restraint, Longevity.
---
*/

:root {
    /* Colors - Strict Monochrome + one tint */
    --bg-color: #fbfbfb;
    /* Very slightly warm white for paper feel */
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --text-meta: #888888;
    --grid-line: #e5e5e5;
    --accent: #000000;
    /* Black is the only accent */

    /* Typography */
    --font-heading: 'EB Garamond', serif;
    --font-body: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Spacing System */
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 32px;
    --space-xl: 64px;
    --section-gap: 120px;

    /* Layout */
    --max-width: 800px;
    /* Balanced size: large enough for video, close enough to text width */
}

/* Base Reset & Typography */
html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-body);
    line-height: 1.6;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

img[data-fade] {
    opacity: 0;
    transition: opacity 0.6s ease;
}

img[data-fade].is-loaded {
    opacity: 1;
}

/* Ambient Light Effect */
.ambient-glow {
    position: fixed;
    top: 0;
    left: 0;
    width: 55vw;
    /* Large size: ~55% of viewport width */
    height: 55vw;
    /* Keep it circular */
    max-width: 900px;
    max-height: 900px;

    /* The "Light" Effect: Thin Golden Ring */
    /* Removed the "bloody blob" fill */
    background: transparent;

    /* The Thin Golden Edge */
    border: 1px solid rgba(215, 180, 110, 0.5);

    /* The Glow around the edge (Inner and Outer) */
    box-shadow:
        0 0 15px rgba(215, 180, 110, 0.3),
        /* Outer Glow */
        inset 0 0 15px rgba(215, 180, 110, 0.1);
    /* Inner Glow */

    border-radius: 50%;
    pointer-events: none;
    /* Ignore clicks */
    z-index: 0;
    /* Just above background, behind text */

    /* Initial positioning handled by JS */
    transform: translate(-50%, -50%);

    /* Smooth rendering */
    will-change: transform;
    mix-blend-mode: normal;
    /* Normal blend for crisp lines */
    opacity: 0.8;
    /* Visible but elegant */
}

/* Subtle Grid Background */
.grid-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: 40px 40px;
    background-image:
        linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
        linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
    z-index: -1;
    opacity: 0.3;
    /* Very faint */
    pointer-events: none;
}

/* Layout Utilities */
.content-wrapper {
    max-width: var(--max-width);
    margin: 0 auto;
    padding-left: var(--space-lg);
    padding-right: var(--space-lg);
}

/* Navigation - Floating or Minimal Fixed */
header {
    position: fixed;
    top: 0;
    width: 100%;
    padding: var(--space-lg) 0;
    background: linear-gradient(to bottom, var(--bg-color) 80%, transparent);
    z-index: 100;
}

nav {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0 var(--space-lg);
}

.nav-logo {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
}

.cn-name {
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 300;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: var(--space-lg);
    padding: 0;
    margin: 0;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: color 0.2s ease;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--accent);
}

.nav-num {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-meta);
    margin-right: 4px;
}

/* Main Content */
main {
    padding-top: 100px;
}

section {
    margin-bottom: var(--section-gap);
}

/* Hero Section */
.hero-section {
    min-height: 60vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.hero-section h1 {
    font-family: var(--font-heading);
    font-size: 4.5rem;
    font-weight: 400;
    margin: 0 0 var(--space-md) 0;
    letter-spacing: -0.02em;
}

.subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin: 0 0 var(--space-lg) 0;
    font-weight: 300;
}

.hero-meta {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-meta);
    display: flex;
    gap: var(--space-md);
}

/* Section Headers */
.section-header {
    max-width: var(--max-width);
    margin: 0 auto var(--space-lg);
    padding: 0 var(--space-lg);
    display: flex;
    align-items: baseline;
    gap: var(--space-md);
}

.section-header h2 {
    font-family: var(--font-mono);
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-meta);
    margin: 0;
    flex-shrink: 0;
}

.section-line {
    height: 1px;
    background-color: var(--text-meta);
    flex-grow: 1;
    opacity: 0.3;
}

/* About Page Layout */
.about-layout {
    position: relative;
    min-height: 80vh;
    /* Ensure space for the image */
}

/* Portrait Wrapper */
.portrait-wrapper {
    position: fixed;
    bottom: var(--space-lg);
    left: var(--space-lg);
    right: auto;
    z-index: 10;
    /* Above text/lights */

    display: inline-block;
}

/* Portrait Image */
.about-portrait {
    /* Remove fixed positioning here, let wrapper handle it */
    display: block;

    /* Responsive Sizing */
    max-height: 45vh;
    max-width: 30vw;
    width: auto;
    height: auto;

    object-fit: contain;

    /* Animation */
    animation: fadeIn 1.5s ease-out;
}

/* Contact Bubble */
.contact-bubble {
    position: absolute;
    /* For tail positioning */
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--text-secondary);
    padding: 10px 18px;
    /* Gap between bubble and person */
    border-radius: 6px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    left: 50%;
    bottom: 100%;

    /* Typography */
    font-family: var(--font-mono);
    font-size: 0.9rem;
    white-space: nowrap;
    /* Keep on one line */

    /* Interaction State 1: Hidden (Default) */
    --bubble-y: -20px;
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, var(--bubble-y));
    /* Slight lift */

    /* Delay hiding for 5 seconds */
    transition:
        opacity 0.5s ease 5s,
        transform 0.5s ease 5s,
        visibility 0.5s step-end 5s;
}

/* Refined Tail: Two triangles for border effect */
.contact-bubble::before {
    /* Outer Border arrow */
    content: '';
    position: absolute;
    left: 50%;
    bottom: -8px;
    transform: translateX(-50%);
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid var(--text-secondary);
}

.contact-bubble::after {
    /* Inner White arrow */
    content: '';
    position: absolute;
    left: 50%;
    bottom: -7px;
    transform: translateX(-50%);
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-top: 7px solid white;
}


/* Interaction State 2: Visible (On Hover) */
.portrait-wrapper:hover .contact-bubble {
    --bubble-y: -12px;
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, var(--bubble-y));

    /* Instant appear */
    transition:
        opacity 0.3s ease 0s,
        transform 0.3s ease 0s,
        visibility 0s step-start 0s;
}

.contact-bubble a {
    color: var(--text-primary);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

.contact-bubble a:hover {
    border-bottom-color: var(--accent-color);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    .about-portrait {
        max-width: 50vw;
        max-height: 40vh;
    }
}

/* List Items (Works & Research) */
.list-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

.list-item {
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid transparent;
    /* Placeholder for hover */
    transition: all 0.3s ease;
}

.list-item:hover {
    transform: translateX(10px);
    /* Minimal Motion rule */
}

.item-main {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: var(--space-sm);
}

.item-title {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    color: var(--text-primary);
}

.item-year {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--text-meta);
}

.item-meta {
    display: flex;
    gap: var(--space-md);
    margin-bottom: var(--space-sm);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--accent);
    /* Highlight meta on default? Or keep grey? Let's try subtle. */
    opacity: 0.7;
}

.item-desc {
    color: var(--text-secondary);
    font-size: 1rem;
    max-width: 60ch;
    /* Optimal reading length */
    margin: 0;
}

/* About Text */
.text-block p {
    margin-bottom: var(--space-md);
    font-size: 1.1rem;
    color: var(--text-primary);
    max-width: 60ch;
}

/* Footer & Contact */
.mono-text {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.email-link {
    color: var(--text-primary);
    text-decoration: none;
    border-bottom: 1px solid var(--text-meta);
    transition: border-color 0.2s;
}

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

footer {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--section-gap) var(--space-lg) var(--space-lg);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    border-top: 1px solid #eee;
    padding-top: var(--space-md);
}

/* Video Embeds */
.video-container {
    position: relative;
    padding-bottom: 56.25%;
    /* 16:9 */
    height: 0;
    overflow: hidden;
    background: #000;
    margin-top: var(--space-md);
    margin-bottom: var(--space-md);
    border-radius: 2px;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Media Sleeve Video */
.media-sleeve {
    --cover-size: clamp(180px, 26vw, 280px);
    display: flex;
    gap: var(--space-md);
    align-items: center;
    flex-wrap: nowrap;
    flex-direction: row-reverse;
    margin-top: var(--space-md);
    margin-bottom: var(--space-md);
}

.media-cover {
    width: var(--cover-size);
    height: var(--cover-size);
    background-color: transparent;
    flex: 0 0 auto;
}

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

.media-frame {
    height: var(--cover-size);
    aspect-ratio: 16 / 9;
    background: #000;
    overflow: hidden;
    flex: 0 0 auto;
}

.media-frame iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

@media (max-width: 720px) {
    .media-sleeve {
        --cover-size: clamp(160px, 70vw, 240px);
        flex-direction: column-reverse;
        align-items: flex-start;
    }

    .media-frame {
        width: 100%;
        height: auto;
        aspect-ratio: 16 / 9;
    }
}

/* About Typography */
body.page-about #about {
    font-family: var(--font-heading);
}

body.page-about #about .about-section {
    font-family: var(--font-heading);
}

body.page-about #about .text-block {
    font-family: var(--font-heading);
}

body.page-about #about .text-block p {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    line-height: 1.8;
    color: var(--text-primary);
}

body.page-about #about .text-block strong {
    font-weight: 600;
}

/* Responsive */
@media (max-width: 600px) {
    .nav-links {
        display: none;
        /* Hide on mobile for now, or simplify */
    }

    .hero-section h1 {
        font-size: 3rem;
    }

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

}
