/* --- VARIABLES --- */
:root {
    --bg-dark: #121214;
    --panel-grey: #1A1A1D;
    --text-main: #EAEAEA;
    --text-dim: #A0A0A0;
    
    /* The Colors from your image */
    --accent-blue: #4A6B9C;
    --accent-green: #6DAA55;
    --accent-yellow: #F4D75E;
    --terminal-green: #00FF41;

    --font-header: 'Jersey 10', sans-serif;
    --font-body: 'Inter', system-ui, sans-serif;
    --font-mono: 'Fira Code', monospace; /* terminal accents: dates, meta, links, section titles */

    /* Global text size multiplier: tune between 1.0 and 1.2 */
    --font-scale: 1.05;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: calc(1rem * var(--font-scale));
    line-height: 1.6;
    overflow-x: hidden;
}

/* --- TYPOGRAPHY --- */
h1, h2, h3, .logo, .system-bar, nav a {
    font-family: var(--font-header);
    text-transform: uppercase;
}

/* --- SYSTEM BAR --- */
.system-bar {
    background: #0f0f10;
    border-bottom: 2px solid var(--accent-blue);
    color: var(--accent-blue);
    text-align: center;
    padding: 5px 0;
    font-size: calc(1.2rem * var(--font-scale));
    letter-spacing: 1px;
}

.status-online {
    color: var(--accent-green);
    text-shadow: 0 0 5px var(--accent-green);
}

/* --- NAVIGATION --- */
nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 5%;
    background-color: rgba(26, 26, 29, 0.9);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    font-size: calc(2rem * var(--font-scale));
    color: var(--accent-green);
    text-decoration: none;
}

.logo::after {
    content: '_';
    animation: blink 1s infinite;
}

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

.nav-links a {
    text-decoration: none;
    color: var(--text-main);
    font-size: calc(1.2rem * var(--font-scale));
    letter-spacing: 0.05em;
    transition: color 0.3s;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
    color: var(--accent-yellow);
}

.nav-links a[aria-current="page"] {
    border-bottom: 2px solid var(--accent-yellow);
}

/* --- HERO SECTION --- */
.hero-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2rem 10% 0.5rem 10%;
    background: linear-gradient(180deg, var(--bg-dark) 0%, #1a1a1e 100%);
    gap: 2rem;
}

.hero-content {
    display: flex;
    align-items: bottom;
    gap: 2rem;
    flex: 1;
}

.pixel-avatar-placeholder img {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    border: 1px solid var(--panel-grey);
    image-rendering: pixelated;
}

.hero-text h1 {
    font-size: calc(clamp(2.5rem, 6vw, 3.5rem) * var(--font-scale));
    line-height: 1.1;
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: calc(1.1rem * var(--font-scale));
    color: var(--text-main);
}
.subtitle-small {
    font-size: calc(0.9rem * var(--font-scale));
    color: var(--text-dim);
}

/* Social Icons */
.social-icons {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.social-icons a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 43px;
    height: 43px;
    color: var(--accent-green);
    transition: all 0.3s ease;
    border: 2px solid transparent;
    border-radius: 4px;
}

.social-icons a:hover {
    color: var(--accent-yellow);
    border-color: var(--accent-yellow);
    background: rgba(244, 215, 94, 0.1);
    transform: translateY(-2px);
}

.social-icons svg {
    width: 26px;
    height: 26px;
}

/* Machine Area */
.machine-container {
    flex: 1;
    display: flex;
    justify-content: center;
}

.machine-placeholder {
    width: 100%;
    max-width: 360px;
    aspect-ratio: 1 / 1;
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.machine-art {
    color: var(--accent-green);
    font-family: var(--font-header);
    font-size: calc(1.5rem * var(--font-scale));
}

/* --- GENERAL SECTIONS --- */
.container {
    padding: 2rem 10%;
}

.section-title {
    font-size: calc(2.5rem * var(--font-scale));
    margin-bottom: 1.5rem;
    border-left: 5px solid var(--accent-yellow);
    padding-left: 1rem;
}

.text-block {
    background-color: var(--panel-grey);
    padding: 2rem;
    border: 1px solid #333;
    font-size: calc(1rem * var(--font-scale));
    overflow-wrap: anywhere;
}

/* --- INTRO --- */
.intro-flex {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.intro-flex .text-block {
    flex: 2;
}

.avatar {
    width: 208px;
    height: 208px;
    flex-shrink: 0;
    border: 4px solid var(--accent-blue);
    padding: 5px;
    box-shadow: 0 0 20px rgba(74, 107, 156, 0.4);
    border-radius: 50%;
    object-fit: cover;
    filter: brightness(1.1);
    image-rendering: pixelated;
}

/* Real photo: smooth scaling, no brightness boost */
.avatar.avatar-photo {
    image-rendering: auto;
    filter: none;
}

/* --- SUBHEADINGS & LISTS INSIDE TEXT BLOCKS --- */
.prose p + p {
    margin-top: 1rem;
}

.text-block h3 {
    color: var(--accent-yellow);
    font-size: calc(1.4rem * var(--font-scale));
    margin: 1.75rem 0 0.75rem;
}

.text-block h3:first-child {
    margin-top: 0;
}

.interest-list {
    list-style: none;
}

.interest-list li::before {
    content: '- ';
    color: var(--accent-green);
}

/* --- ENTRIES (publications, code) --- */
.entry-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.pub-profiles {
    color: var(--text-dim);
    margin-bottom: 1.5rem;
}

.pub-profiles a {
    color: var(--accent-green);
}

.pub-profiles a:hover {
    color: var(--accent-yellow);
}

.entry {
    border-left: 3px solid var(--accent-blue);
    padding-left: 1rem;
}

.entry-title {
    color: var(--text-main);
    font-weight: 600;
}

.pub-authors,
.entry-meta {
    color: var(--text-dim);
}

.pub-authors .me {
    color: var(--text-main);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.pub-badge {
    display: inline-block;
    font-size: calc(0.75rem * var(--font-scale));
    color: var(--bg-dark);
    background: var(--accent-yellow);
    padding: 0 0.4rem;
    margin-right: 0.5rem;
    vertical-align: middle;
}

.entry-summary {
    margin-top: 0.5rem;
}

.entry-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.entry-links a,
.bibtex summary {
    color: var(--accent-green);
    text-decoration: none;
    cursor: pointer;
}

.entry-links a::before { content: '['; color: var(--text-dim); }
.entry-links a::after { content: ']'; color: var(--text-dim); }

.entry-links a:hover,
.bibtex summary:hover {
    color: var(--accent-yellow);
}

.bibtex {
    margin-top: 0.75rem;
}

.bibtex summary {
    list-style: none;
}

.bibtex summary::-webkit-details-marker {
    display: none;
}

.bibtex summary::before {
    content: '> ';
}

.bibtex[open] summary::before {
    content: 'v ';
}

.bibtex pre {
    margin-top: 0.5rem;
    padding: 1rem;
    background: var(--bg-dark);
    border: 1px solid #333;
    overflow-x: auto;
    font-size: calc(0.8rem * var(--font-scale));
    line-height: 1.5;
}

/* --- RESUME GRID --- */
.resume-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

/* --- PROJECTS GRID --- */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.project-card {
    background-color: var(--panel-grey);
    border: 1px solid #333;
    padding: 2rem;
    position: relative;
    text-align: center;
    transition: transform 0.2s;
}

.project-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent-green);
}

.icon-area {
    font-size: calc(3rem * var(--font-scale));
    margin-bottom: 1rem;
}

.project-card h3 {
    color: var(--accent-yellow);
    font-size: calc(1.5rem * var(--font-scale));
    margin-bottom: 0.5rem;
}

/* --- THE CORNERS (HUD Style) --- */
.corner {
    position: absolute;
    width: 10px;
    height: 10px;
    border: 2px solid var(--accent-green);
    transition: width 0.3s, height 0.3s;
}

.project-card:hover .corner {
    width: 20px;
    height: 20px;
}

.top-left { top: -1px; left: -1px; border-bottom: none; border-right: none; }
.top-right { top: -1px; right: -1px; border-bottom: none; border-left: none; }
.bottom-left { bottom: -1px; left: -1px; border-top: none; border-right: none; }
.bottom-right { bottom: -1px; right: -1px; border-top: none; border-left: none; }

/* --- FOOTER --- */
footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-dim);
    font-family: var(--font-header);
    border-top: 1px solid #333;
    margin-top: 2rem;
}

/* --- ANIMATIONS --- */
@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* --- RESPONSIVE MOBILE --- */
@media (max-width: 768px) {
    nav {
        flex-direction: column;
        gap: 0.5rem;
    }

    .nav-links {
        gap: 1.25rem;
    }

    .intro-flex {
        flex-direction: column;
    }

    .container {
        padding: 1.5rem 1rem;
    }

    .section-title {
        font-size: calc(1.8rem * var(--font-scale));
    }

    .text-block {
        padding: 1.25rem;
    }

    .social-icons {
        justify-content: center;
    }
    
    .hero-section {
        flex-direction: column-reverse;
        text-align: center;
        padding: 2rem 5%;
    }

    .hero-content {
        flex-direction: column;
    }
    
    .resume-grid {
        grid-template-columns: 1fr;
    }

    .machine-container {
        width: 100%;
    }
}
/* --- PRINTER ANIMATION --- */
.printer-animation {
    width: 100%;
    height: 100%;
    background-image: url('../assets/images/printer.png');
    background-repeat: no-repeat;
    background-size: 1600% 1500%;
    /* Use pixelated to keep the retro/pixel art feel sharp when scaled */
    image-rendering: pixelated; 
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* Printed part (under the sprite) and sparks (over it), on the sprite's 128x128 pixel grid */
.print-canvas,
.spark-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    pointer-events: none;
}

.spark-canvas {
    z-index: 2;
}

.machine-placeholder {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* --- HERO CALL TO ACTION --- */
.hero-tagline {
    margin-top: 0.75rem;
    max-width: 38rem;
    color: var(--text-dim);
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
}

.hero-actions .social-icons {
    margin-top: 0;
}

.btn {
    display: inline-block;
    font-family: var(--font-header);
    font-size: calc(1.3rem * var(--font-scale));
    letter-spacing: 0.05em;
    color: var(--bg-dark);
    background: var(--accent-green);
    padding: 0.2rem 1rem;
    text-decoration: none;
    border: 2px solid var(--accent-green);
    transition: background 0.2s, color 0.2s;
}

.btn:hover {
    background: transparent;
    color: var(--accent-green);
}

.btn-ghost {
    background: transparent;
    color: var(--accent-green);
}

.btn-ghost:hover {
    background: var(--accent-green);
    color: var(--bg-dark);
}

/* --- NEWS --- */
.news-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.news-list li {
    display: grid;
    grid-template-columns: 7.5rem 1fr;
    gap: 1rem;
}

.news-date {
    color: var(--accent-yellow);
    white-space: nowrap;
}

.news-list a,
.prose a,
.timeline a {
    color: var(--accent-green);
}

.news-list a:hover,
.prose a:hover,
.timeline a:hover {
    color: var(--accent-yellow);
}

/* --- TAGS --- */
.tag {
    display: inline-block;
    font-size: calc(0.7rem * var(--font-scale));
    letter-spacing: 0.05em;
    padding: 0 0.4rem;
    margin-right: 0.5rem;
    border: 1px solid currentColor;
    vertical-align: middle;
    text-transform: uppercase;
}

.tag-industry { color: var(--accent-yellow); }
.tag-research { color: var(--accent-green); }
.tag-teaching { color: #8FA9D6; }

/* --- TIMELINE (experience, education) --- */
.timeline {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.timeline li {
    border-left: 3px solid var(--accent-blue);
    padding-left: 1rem;
}

.timeline-date {
    color: var(--text-dim);
    font-size: calc(0.85rem * var(--font-scale));
}

.timeline-title {
    font-weight: 600;
}

.timeline-org {
    color: var(--text-dim);
}

.timeline p + p {
    margin-top: 0.25rem;
}

/* --- FACT GRID (awards, skills) --- */
.fact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 2rem;
}

.fact-grid h3 {
    margin-top: 0;
}

.fact-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.fact-list strong {
    color: var(--text-main);
}

.fact-list span {
    color: var(--text-dim);
}

/* --- RICH PROJECT CARDS --- */
a.project-card {
    display: flex;
    flex-direction: column;
    padding: 0;
    text-align: left;
    color: var(--text-main);
    text-decoration: none;
}

.project-thumb {
    position: relative;
    aspect-ratio: 4 / 3;
    background: var(--panel-grey);
    border-bottom: 1px solid #333;
    overflow: hidden;
}

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

/* Dithered in the sprite greys by default (tools/dither_thumbs.py);
   the real image fades in on hover or keyboard focus */
.thumb-dither {
    image-rendering: pixelated;
}

.thumb-colour {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.3s;
}

a.project-card:hover .thumb-colour,
a.project-card:focus-visible .thumb-colour {
    opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
    .thumb-colour {
        transition: none;
    }
}

.project-body {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1.25rem 1.5rem 1.5rem;
    flex: 1;
}

a.project-card h3 {
    margin-bottom: 0;
}

.project-meta {
    color: var(--text-dim);
    font-size: calc(0.8rem * var(--font-scale));
}

.project-desc {
    flex: 1;
}

.project-more {
    color: var(--accent-green);
}

a.project-card:hover .project-more {
    color: var(--accent-yellow);
}

/* --- PROJECT PAGES --- */
.breadcrumb {
    color: var(--text-dim);
    margin-bottom: 0.5rem;
}

.breadcrumb a {
    color: var(--accent-green);
    text-decoration: none;
}

.breadcrumb a:hover {
    color: var(--accent-yellow);
}

.project-lede {
    font-size: calc(1.1rem * var(--font-scale));
    max-width: 52rem;
}

.project-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 2rem;
    align-items: start;
}

.project-facts {
    position: sticky;
    top: 6rem;
}

.project-facts dl {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.project-facts dt {
    color: var(--accent-yellow);
    font-family: var(--font-header);
    font-size: calc(1.1rem * var(--font-scale));
    text-transform: uppercase;
}

.project-facts dd {
    color: var(--text-main);
}

.project-facts .entry-links {
    margin-top: 1.25rem;
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.stat {
    border: 1px solid #333;
    border-top: 3px solid var(--accent-green);
    background: var(--bg-dark);
    padding: 0.75rem 1rem;
}

.stat-value {
    display: block;
    font-family: var(--font-header);
    font-size: calc(2.2rem * var(--font-scale));
    line-height: 1;
    color: var(--accent-green);
}

.stat-label {
    display: block;
    margin-top: 0.35rem;
    color: var(--text-dim);
    font-size: calc(0.8rem * var(--font-scale));
}

.prose ul {
    margin: 0.75rem 0 0 1.25rem;
}

.prose li + li {
    margin-top: 0.35rem;
}

.figure {
    margin: 1.75rem 0;
    max-width: 760px;
}

.figure img,
.figure video {
    display: block;
    width: 100%;
    height: auto;
    border: 1px solid #333;
}

/* Paper figures have a white background: frame them as a light panel */
.figure-light img {
    background: #fff;
    padding: 0.75rem;
}

.figure-narrow {
    max-width: 560px;
}

.figure-portrait {
    max-width: 400px;
}

.figure figcaption {
    margin-top: 0.5rem;
    color: var(--text-dim);
    font-size: calc(0.85rem * var(--font-scale));
}

.figure-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
}

.figure-row .figure {
    margin: 0;
    max-width: none;
}

/* Side-by-side figures share one frame size; photos are cropped, plots are letterboxed */
.figure-row img {
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

.figure-row .figure-light img {
    object-fit: contain;
}

.project-nav {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.project-nav a {
    color: var(--accent-green);
    text-decoration: none;
}

.project-nav a:hover {
    color: var(--accent-yellow);
}

@media (max-width: 900px) {
    .project-layout {
        grid-template-columns: 1fr;
    }

    .project-facts {
        position: static;
        order: -1;
    }
}

@media (max-width: 768px) {
    .hero-actions {
        justify-content: center;
    }

    .news-list li {
        grid-template-columns: 1fr;
        gap: 0;
    }
}

/* --- HYBRID TYPOGRAPHY ---
   Pixel font only for the identity (hero name, logo, nav, buttons, big numbers);
   readable sans-serif for prose; monospace for terminal-style details. */
.section-title {
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: calc(1.5rem * var(--font-scale));
    letter-spacing: 0.04em;
    padding-left: 0.75rem;
}

.text-block h3,
a.project-card h3 {
    font-family: var(--font-body);
    font-weight: 600;
    text-transform: none;
    font-size: calc(1.15rem * var(--font-scale));
}

.subtitle-small,
.news-date,
.timeline-date,
.entry-meta,
.project-meta,
.tag,
.pub-badge,
.entry-links,
.bibtex summary,
.breadcrumb,
.project-more,
.project-nav,
.project-facts dt,
.stat-label,
.figure figcaption,
.interest-list li::before,
footer {
    font-family: var(--font-mono);
}

.project-facts dt {
    font-size: calc(0.8rem * var(--font-scale));
    letter-spacing: 0.05em;
}

.prose p,
.prose ul,
.project-lede {
    max-width: 75ch;
}

footer {
    font-size: calc(0.8rem * var(--font-scale));
}

@media (max-width: 768px) {
    .section-title {
        font-size: calc(1.25rem * var(--font-scale));
    }
}
