/* =============================================================================
   STYLE.CSS — Portfolio Global Stylesheet
   =============================================================================
   DESIGN LANGUAGE: "Terminal / Command Center" aesthetic
   
   This portfolio uses a dark, brutalist UI inspired by military command
   interfaces, terminal UIs, and cyberpunk HUDs. Key visual principles:
   
   - Dark background (#080808) with high-contrast white text (#f0f0f0)
   - Neon green (#00ff88) as the sole accent for CTAs and highlights
   - Monospace font (Share Tech Mono) for data, labels, and UI chrome
   - Sans-serif font (Rajdhani) for headings and body text
   - Film grain overlay via WebGL for texture (see main.js)
   - Minimal borders, no rounded corners, no shadows
   
   Z-INDEX LAYERS:
   1    — Bio images and content (above background)
   10   — Code blocks, hero images (above content flow)
   100  — Scroll-to-top button
   1000 — WebGL grain overlay (above everything, pointer-events: none)
   ============================================================================= */

/* ── Design Tokens ─────────────────────────────────────────────────────────── */
:root {
    --bg-color: #080808;          /* Near-black background */
    --text-color: #f0f0f0;        /* Primary text (off-white) */
    --accent-color: #ffffff;      /* Pure white for emphasis */
    --dim-color: #444444;         /* Muted text, borders, labels */
    --border-color: #f0f0f0;      /* Structural borders */
    --highlight-color: #00ff88;   /* Neon green — CTAs, active states */
    --highlight-rgb: 0, 255, 136; /* RGB for translucent borders/backgrounds */
    --code-bg: #1a1a1a;           /* Code block backgrounds */
    --font-main: 'Rajdhani', sans-serif;       /* Headings, body */
    --font-mono: 'Share Tech Mono', monospace;  /* UI chrome, code, labels */
}

/* ── Reset ──────────────────────────────────────────────────────────────────── */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Prevent horizontal scroll on all viewports (safety net) */
html, body {
    overflow-x: hidden;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-main);
    min-height: 100vh;
    width: 100%;
}

/* ── WebGL Grain Overlay ────────────────────────────────────────────────────
   Full-viewport canvas rendered by main.js at 1/4 resolution.
   `mix-blend-mode: overlay` blends the noise with page content.
   `image-rendering: pixelated` keeps the low-res grain sharp (no smoothing).
   `pointer-events: none` ensures it doesn't block clicks on content below. */
#grain-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;  /* Topmost layer — above all content */
    mix-blend-mode: overlay;
    opacity: 0.15;
    image-rendering: pixelated;
}

/* =============================================================================
   LAYOUT — Page Grid Structure
   =============================================================================
   Uses CSS Grid with 3 rows: header (auto) | content (1fr) | footer (auto).
   Max-width: 1600px keeps content readable on ultra-wide monitors.
   The container also receives a load animation (fadeSlideIn, defined below). */
.interface-container {
    display: grid;
    grid-template-rows: auto 1fr auto;  /* header | content | footer */
    grid-template-columns: 1fr;
    min-height: 100vh;
    padding: 1.5rem;
    gap: 1.5rem;
    max-width: 1600px;
    margin: 0 auto;
}

/* -- HEADER -- */
.top-bar {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    padding-bottom: 1rem;
    gap: 2rem;
}

.site-logo {
    font-family: var(--font-mono);
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--text-color);
    text-decoration: none;
    letter-spacing: 2px;
    transition: color 0.3s;
}

.site-logo:hover {
    color: var(--highlight-color);
}


.main-nav {
    display: flex;
    gap: 1.5rem;
    margin-left: 2rem;
}

/* Mobile Hamburger Button (Hidden on Desktop) */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    flex-direction: column;
    gap: 5px;
    padding: 0.5rem;
    z-index: 100;
}

.hamburger-line {
    width: 25px;
    height: 2px;
    background-color: var(--text-color);
    transition: all 0.3s;
}

.nav-link {
    text-decoration: none;
    color: var(--dim-color);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    transition: color 0.3s;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text-color);
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

.decorative-lines {
    flex-grow: 1;
    height: 4px;
    background: repeating-linear-gradient(90deg,
            var(--border-color) 0px,
            var(--border-color) 2px,
            transparent 2px,
            transparent 8px);
}

/* -- MAIN -- */
.main-display {
    grid-column: 1 / 2;
    position: relative;
    border: 1px solid var(--dim-color);
    padding: 2rem;
    display: flex;
    flex-direction: column;
}

.content-frame {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.frame-header {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-mono);
    color: var(--dim-color);
    margin-bottom: 2rem;
    font-size: 0.9rem;
}


/* -- FOOTER -- */
.bottom-bar {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 1rem;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    border-top: 1px solid var(--dim-color);
    padding-top: 1rem;
}

.loader-bar {
    height: 10px;
    width: 100%;
    background: repeating-linear-gradient(45deg,
            var(--dim-color) 0px,
            var(--dim-color) 1px,
            transparent 1px,
            transparent 10px);
}

.grow {
    flex-grow: 1;
}

.blink {
    animation: blink-animation 2s infinite;
}

@keyframes blink-animation {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }
}

/* --- BLOG SPECIFIC STYLES --- */
article {
    max-width: 900px;
    margin: 0 auto;
}

/* Allow list items to fill the available space instead of snapping to 900px */
.blog-entry,
.study-entry {
    max-width: none;
    margin: 0 0 2rem 0;
}

.blog-meta {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--dim-color);
    margin-bottom: 1rem;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.blog-title {
    font-size: 3.5rem;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    line-height: 1.1;
    color: var(--text-color);
}

/* --- BLOG & STUDY ENTRIES --- */
.entry-card {
    border-bottom: 1px solid var(--dim-color);
    padding: 1.5rem; /* Added padding for better hover area */
    margin-bottom: 1rem;
    display: flex;
    gap: 1.5rem;
    transition: background-color 0.3s, border-color 0.3s;
    cursor: pointer;
    position: relative;
    overflow: hidden; /* Prevent anything from leaking out */
}

.entry-card:hover {
    background-color: rgba(0, 255, 136, 0.03);
    border-color: var(--highlight-color);
}

.entry-thumbnail-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 200px;
    flex-shrink: 0;
    padding-top: 0.5rem;
    overflow: hidden; /* Ensure image stays inside */
}

.entry-thumbnail-wrapper img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border: 1px solid var(--dim-color);
    transition: opacity 0.3s, transform 0.3s;
    display: block; /* Remove whitespace below image */
}

.entry-card:hover .entry-thumbnail-wrapper img {
    transform: scale(1.05);
    border-color: var(--highlight-color);
}

.entry-meta {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--dim-color);
    text-transform: uppercase;
}

.entry-content {
    flex-grow: 1;
    min-width: 0; /* Critical for prevents text overflow in flexbox */
}

.entry-content h3 {
    font-size: 2rem;
    margin-top: 0;
    margin-bottom: 0.75rem;
    line-height: 1.1;
    color: var(--text-color);
    transition: color 0.3s;
}

.entry-card:hover .entry-content h3 {
    color: var(--highlight-color);
}

.entry-excerpt {
    font-family: var(--font-mono);
    color: #aaa;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    line-height: 1.4;
}

.entry-tags {
    margin-top: auto; /* Push tags to bottom if needed */
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    max-width: 100%;
}

.entry-tag {
    display: inline-block;
    background: rgba(0, 255, 136, 0.05);
    border: 1px solid var(--dim-color);
    padding: 0.15rem 0.5rem;
    font-size: 0.7rem;
    color: var(--dim-color);
    white-space: nowrap; /* Prevents tag text from wrapping mid-word */
}

@media (max-width: 600px) {
    .entry-card {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    .entry-thumbnail-wrapper {
        width: 100%;
    }

    .entry-thumbnail-wrapper img {
        height: auto;
        aspect-ratio: 16/9;
    }

    .entry-content h3 {
        font-size: 1.5rem;
    }
}

/* Subtitle styling */
.blog-subtitle,
article p:first-of-type {
    font-size: 1.2rem;
    color: #aaa;
    margin-bottom: 2rem;
    font-weight: 400;
    line-height: 1.5;
}

.blog-hero {
    width: 100%;
    aspect-ratio: 16/9;
    background: #222;
    margin-bottom: 3rem;
    border: 1px solid var(--dim-color);
    position: relative;
    z-index: 10;  /* Above normal flow, below grain overlay */
    overflow: hidden;
}

.blog-hero img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Standardized Headers */
article h2,
.blog-content h2 {
    font-size: 2rem;
    margin: 3rem 0 1.5rem;
    color: var(--highlight-color);
    font-family: var(--font-main);
    text-transform: uppercase;
    letter-spacing: 1px;
}

article h3,
.blog-content h3 {
    font-size: 1.5rem;
    margin: 2rem 0 1rem;
    color: var(--text-color);
    font-family: var(--font-mono);
}

article h4,
.blog-content h4 {
    font-size: 1.2rem;
    margin: 1.5rem 0 0.75rem;
    color: var(--text-color);
}

/* Text Content */
article p,
.blog-content p {
    font-family: var(--font-mono);
    line-height: 1.8;
    color: #ccc;
    margin-bottom: 1.5rem;
    font-size: 1rem;
}

article ul,
.blog-content ul,
article ol,
.blog-content ol {
    font-family: var(--font-mono);
    line-height: 1.8;
    color: #ccc;
    margin-bottom: 1.5rem;
    margin-left: 2rem;
}

article li,
.blog-content li {
    margin-bottom: 0.5rem;
}

strong,
.highlight-text {
    color: var(--highlight-color);
    font-weight: 700;
}

/* Code & Tech Elements */
code,
.blog-content code {
    background: #1a1a1a;
    padding: 0.2rem 0.6rem;
    font-family: var(--font-mono);
    font-size: 0.9em;
    color: var(--highlight-color);
    border: 1px solid var(--dim-color);
}

/* Code blocks — preformatted text with syntax highlighting background */
pre,
.blog-content pre,
.code-block {
    background: var(--code-bg);
    padding: 1.5rem;
    overflow-x: auto;
    margin: 2rem 0;
    border: 1px solid var(--dim-color);
    position: relative;
    z-index: 10;  /* Above normal flow, below grain overlay */
    font-family: var(--font-mono);
    font-size: 0.9rem;
    white-space: pre-wrap;
}

pre code,
.blog-content pre code {
    background: none;
    padding: 0;
    border: none;
    color: var(--highlight-color);
    display: block;
}

/* Math Formulas — special block for LaTeX-style expressions */
.math-formula {
    background: var(--code-bg);
    border-left: 3px solid var(--highlight-color);
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    font-family: var(--font-mono);
    font-size: 1.1rem;
    text-align: center;
    position: relative;
    z-index: 10;  /* Above normal flow, below grain overlay */
}

/* Info Boxes */
.info-box,
.example-box,
.warning-box {
    background: rgba(255, 255, 255, 0.05);
    border-left: 3px solid var(--text-color);
    padding: 1rem 1.5rem;
    margin: 2rem 0;
}

.info-box.warning,
.warning-box {
    border-left-color: #ff6b6b;
    background: rgba(255, 107, 107, 0.05);
}

.info-box.tip,
.example-box {
    border-left-color: var(--highlight-color);
    background: rgba(0, 255, 136, 0.05);
}

.info-box.note {
    border-left-color: #339af0;
}

.info-box-title,
.example-box h4,
.warning-box h4 {
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    font-size: 0.9rem;
}

.example-box h4 {
    color: var(--highlight-color);
}

/* Table of Contents */
.toc {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--dim-color);
    padding: 1.5rem;
    margin: 2rem 0;
}

.toc-title {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--text-color);
    text-transform: uppercase;
}

.toc ul {
    list-style: none;
    margin: 0;
}

.toc li {
    margin-bottom: 0.5rem;
}

.toc a {
    color: var(--dim-color);
    text-decoration: none;
    transition: color 0.3s;
}

.toc a:hover {
    color: var(--text-color);
}

/* Images in content */
.blog-content img,
article img {
    width: 100%;
    height: auto;
    margin: 0;
    border: none;
}

/* Image Grid */
.image-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin: 2rem 0;
}

.image-grid.three-col {
    grid-template-columns: repeat(3, 1fr);
}

.image-grid img {
    width: 100%;
    height: auto;
    border: 1px solid var(--dim-color);
    display: block;
}

/* Figure & Figcaption */
figure {
    margin: 2rem 0;
}

figcaption {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--dim-color);
    margin-top: 0.5rem;
    text-align: center;
}

/* Blog Meta Items */
.blog-meta-item {
    color: var(--dim-color);
}

/* Blog Tags */
.blog-tags {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 3rem;
}

.blog-tag {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--dim-color);
    border: 1px solid var(--dim-color);
    padding: 0.25rem 0.75rem;
    transition: color 0.2s, border-color 0.2s;
}

.blog-tag:hover {
    color: var(--highlight-color);
    border-color: var(--highlight-color);
}

/* Footer segments */
.footer-segment {
    display: flex;
    align-items: center;
}

/* Responsive */
@media (max-width: 768px) {
    .interface-container {
        grid-template-columns: 1fr;
        padding: 0.75rem;
        gap: 0.75rem;
    }

    .main-display {
        padding: 1rem;
    }

    .right-sidebar {
        display: none;
    }

    .top-bar {
        display: grid;
        grid-template-columns: 1fr auto auto;
        grid-template-areas: "logo lang nav-btn";
        gap: 1rem;
        align-items: center;
        padding-bottom: 0px; /* Removed extra padding */
    }

    .site-logo {
        grid-area: logo;
        justify-self: start;
        font-size: 1.1rem;
    }

    .lang-toggle {
        grid-area: lang;
        justify-self: end;
    }

    .main-nav {
        grid-area: nav;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background-color: var(--bg-color);
        z-index: 90;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
        margin: 0;
        padding: 0;
        gap: 2.5rem;
        border: none;
    }

    .main-nav.is-open {
        opacity: 0.98;
        visibility: visible;
    }

    .mobile-menu-btn {
        position: relative;
        z-index: 101; /* Ensure hamburger stays above the full-screen nav */
        display: flex;
        grid-area: nav-btn;
    }

    .mobile-menu-btn[aria-expanded="true"] .hamburger-line:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }

    .mobile-menu-btn[aria-expanded="true"] .hamburger-line:nth-child(2) {
        opacity: 0;
    }

    .mobile-menu-btn[aria-expanded="true"] .hamburger-line:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }

    .nav-link {
        font-size: 1.5rem; /* Larger font for full-screen menu overlay */
        letter-spacing: 2px;
    }

    .decorative-lines {
        display: none;
    }

    .blog-title {
        font-size: 2.5rem;
    }
}

/* --- CATEGORY FILTERS (BLOG / STUDIES) --- */
.filter-sidebar {
    position: sticky;
    top: 2rem;
    flex: 0 0 250px;
}

.mobile-filter-toggle {
    display: none;
}

.filter-sidebar h3 {
    font-family: var(--font-mono);
    color: var(--dim-color);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    letter-spacing: 2px;
}

.filter-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.filter-link {
    text-decoration: none;
    color: var(--dim-color);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    transition: all 0.2s;
    display: inline-block;
    padding-left: 0;
    border-left: 0px solid transparent;
}

.filter-link:hover, .filter-link.active {
    color: var(--highlight-color);
    padding-left: 0.5rem;
    border-left: 2px solid var(--highlight-color);
}

/* --- FLEX RESPONSIVE LAYOUT (BLOG / STUDIES) --- */
.flex-responsive {
    display: flex;
    flex-direction: row;
    /* Desktop: side by side */
    gap: 3rem;
    align-items: flex-start;
}

@media (max-width: 768px) {
    .flex-responsive {
        flex-direction: column;
        gap: 1.5rem;
    }

    /* Mobile Filters: Accordion Dropdown */
    .filter-sidebar {
        width: 100%;
        position: static;
        flex: none;
    }

    .mobile-filter-toggle {
        display: block;
        width: 100%;
        background: transparent;
        border: 1px solid var(--dim-color);
        color: var(--highlight-color);
        font-family: var(--font-mono);
        font-size: 1rem;
        text-align: left;
        padding: 0.8rem 1rem;
        cursor: pointer;
        transition: all 0.2s;
        border-radius: 4px;
        letter-spacing: 2px;
    }

    .mobile-filter-toggle.active {
        background: rgba(0, 255, 136, 0.05);
        border-color: var(--highlight-color);
    }

    .filter-list-container {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease-out;
        width: 100%;
    }

    .filter-list-container.is-open {
        max-height: 500px; /* Arbitrary high value to allow expansion */
        margin-top: 1rem;
    }

    .filter-sidebar h3 {
        display: none; /* Hide to save vertical space */
    }

    .filter-list {
        flex-direction: column;
        gap: 0.5rem;
        padding-bottom: 0.5rem;
    }

    .filter-link {
        font-size: 0.9rem;
        padding: 0.6rem 1rem !important;
        border: 1px solid rgba(255,255,255,0.05) !important;
        background: transparent;
        text-transform: uppercase;
        letter-spacing: 1px;
        display: block;
        width: 100%;
    }

    .filter-link.active, .filter-link:hover {
        background: rgba(0, 255, 136, 0.05);
        color: var(--highlight-color);
        border-color: var(--highlight-color) !important;
    }
}


/* Language Toggle Button Group */
.lang-toggle {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--dim-color);
}

.lang-btn {
    background: none;
    border: 1px solid var(--dim-color);
    color: var(--dim-color);
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    padding: 0.15rem 0.45rem;
    letter-spacing: 1px;
    transition: color 0.2s, border-color 0.2s;
    line-height: 1;
}

.lang-btn:hover {
    color: var(--text-color);
    border-color: var(--text-color);
}

/* Active lang button highlighted */
.lang-btn.active,
html:not([lang="es"]) .lang-btn[data-lang="en"],
html[lang="es"] .lang-btn[data-lang="es"] {
    border-color: var(--highlight-color);
    color: var(--highlight-color);
}


/* --- HOME PAGE HERO --- */
.hero-section {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 60vh;
    padding: 2rem 0;
}

.hero-title {
    font-size: clamp(4rem, 15vw, 10rem);
    line-height: 0.9;
    letter-spacing: -2px;
    margin-bottom: 1rem;
    font-weight: 700;
    text-transform: uppercase;
}

.hero-subtitle {
    font-family: var(--font-mono);
    font-size: 1.5rem;
    color: var(--highlight-color);
    letter-spacing: 4px;
    margin-bottom: 2rem;
}

/* Hero social links row — home page only */
.hero-socials {
    margin-top: 2rem;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.tech-specs {
    font-family: var(--font-mono);
    color: var(--dim-color);
    font-size: 0.9rem;
    line-height: 1.6;
}

/* --- ABOUT PAGE --- */
.about-container {
    display: flex;
    gap: 4rem;
    align-items: flex-start;
    margin-top: 2rem;
}

.about-photo-column {
    flex: 0 0 300px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.about-content-column {
    flex: 1;
}

@media (max-width: 900px) {
    .about-container {
        flex-direction: column;
        gap: 2rem;
    }

    .about-photo-column {
        flex: 1;
        width: 100%;
        align-items: flex-start;
    }

    .hero-title {
        font-size: 5rem;
    }

    .hero-section {
        min-height: auto;
        padding-top: 0;
    }
}

/* --- PROJECTS GRID --- */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

@media (max-width: 600px) {
    .projects-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

/* --- PROJECT DETAIL LAYOUT --- */
.project-detail-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 3rem;
}

@media (max-width: 900px) {
    .project-detail-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

.action-btn {
    color: var(--highlight-color);
    text-decoration: none;
    transition: text-shadow 0.3s;
}

.action-btn:hover {
    text-shadow: 0 0 8px var(--highlight-color);
}

/* --- PROJECT CARDS --- */
/* Link wrapper — removes default anchor styling */
.project-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.project-card {
    border: 1px solid var(--border-color);
    padding: 0;
    color: var(--text-color);
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.02);
}

.project-card:hover {
    border-color: var(--highlight-color);
    background: rgba(0, 255, 136, 0.03);
}

.project-card-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #0a0a0a;
    overflow: hidden;
    position: relative;
    border-bottom: 1px solid var(--border-color);
}

.project-card-image img,
.project-card-image video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s, opacity 0.3s;
}

.project-card:hover .project-card-image img,
.project-card:hover .project-card-image video {
    transform: scale(1.05);
    opacity: 0.8;
}

.project-card-body {
    padding: 1.25rem;
}

.project-card-body h3 {
    font-family: var(--font-main);
    text-transform: uppercase;
    margin-bottom: 0.5rem;
    transition: color 0.3s;
}

.project-card:hover .project-card-body h3 {
    color: var(--highlight-color);
}

.project-card-body p {
    font-family: var(--font-mono);
    font-size: 0.85rem; /* Slightly larger for readability */
    color: var(--dim-color);
    line-height: 1.4;
    margin: 0;
}

/* --- SOCIAL LINKS --- */
.social-link {
    color: var(--text-color);
    text-decoration: none;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    transition: color 0.3s, text-shadow 0.3s;
}

.social-link:hover {
    color: var(--highlight-color);
    text-shadow: 0 0 6px rgba(0, 255, 136, 0.3);
}

/* --- FILTER SIDEBAR --- */
.filter-sidebar {
    min-width: 200px;
}

.filter-sidebar h3 {
    font-family: var(--font-mono);
    font-size: 1rem;
    color: var(--dim-color);
    margin-bottom: 1.5rem;
}

.filter-list {
    list-style: none;
    font-family: var(--font-mono);
    line-height: 2;
}

.filter-link {
    color: var(--dim-color);
    text-decoration: none;
    transition: color 0.3s, padding-left 0.3s;
    display: inline-block;
    border-left: 2px solid transparent;
    padding-left: 0;
}

.filter-link:hover {
    color: var(--text-color);
}

.filter-link.active {
    color: var(--text-color);
    border-left-color: var(--highlight-color);
    padding-left: 0.5rem;
}

/* --- ABOUT PAGE INLINE STYLE REPLACEMENTS --- */
.bio-image {
    width: 100%;
    aspect-ratio: 1/1;
    background: var(--dim-color);
    border: 1px solid var(--text-color);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

.bio-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
    filter: grayscale(100%);
    image-rendering: auto;
}

.social-bar {
    font-family: var(--font-mono);
}

.social-bar .handle {
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
    font-weight: bold;
}

.social-bar .links {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.social-bar .email {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: var(--dim-color);
    text-decoration: none;
    display: block;
    transition: color 0.3s;
}

.social-bar .email:hover {
    color: var(--highlight-color);
}

.bio-heading {
    font-size: 3rem;
    margin-bottom: 1rem;
    text-transform: uppercase;
    margin-top: 0;
}

.bio-body {
    font-family: var(--font-mono);
    line-height: 1.6;
    color: #ccc;
}

.bio-body p {
    margin-bottom: 1rem;
}

/* --- PAGE SECTION HEADING --- */
.section-heading {
    font-size: 3rem;
    margin-bottom: 2rem;
    text-transform: uppercase;
}

.entries-column {
    flex-grow: 1;
}

/* --- LOAD ANIMATION --- */
@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.interface-container {
    animation: fadeSlideIn 0.5s ease-out;
}

/* --- VIEW TRANSITIONS (cross-page fade) --- */
@view-transition {
    navigation: auto;
}

::view-transition-old(root) {
    animation: 150ms ease-out fade-out;
}

::view-transition-new(root) {
    animation: 200ms ease-in fade-in;
}

@keyframes fade-out {
    from { opacity: 1; }
    to   { opacity: 0; }
}

@keyframes fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* --- SCROLL TO TOP BUTTON --- */
.scroll-top-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 40px;
    height: 40px;
    background: var(--bg-color);
    border: 1px solid var(--dim-color);
    color: var(--dim-color);
    font-family: var(--font-mono);
    font-size: 1.2rem;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;  /* Above content, below grain overlay */
    transition: border-color 0.3s, color 0.3s;
}

.scroll-top-btn.visible {
    display: flex;
}

.scroll-top-btn:hover {
    border-color: var(--highlight-color);
    color: var(--highlight-color);
}

/* =============================================================================
   i18n — Language Visibility System
   =============================================================================
   Enables toggling between English (en) and Spanish (es) content.
   Relies on the `html[lang]` attribute being set by i18n.js.
   ============================================================================= */

/* 1. Base State: Show English, Hide Spanish (Fallback if JS fails) */
.lang-es, .lang-block[data-lang="es"] {
    display: none;
}

.lang-en, .lang-block[data-lang="en"] {
    display: block;
}

/* Special cases for inline elements */
span.lang-en, a.lang-en, small.lang-en { display: inline-block; }
span.lang-es, a.lang-es, small.lang-es { display: none; }

/* 2. Spanish Active State */
html[lang="es"] .lang-en,
html[lang="es"] .lang-block[data-lang="en"] {
    display: none !important;
}

html[lang="es"] .lang-es,
html[lang="es"] .lang-block[data-lang="es"] {
    display: block !important;
}

html[lang="es"] span.lang-en, 
html[lang="es"] a.lang-en, 
html[lang="es"] small.lang-en {
    display: none !important;
}

html[lang="es"] span.lang-es, 
html[lang="es"] a.lang-es, 
html[lang="es"] small.lang-es {
    display: inline-block !important;
}

/* 3. English Active State (Optional but good for specificity if lang is explicitly "en") */
html[lang="en"] .lang-es,
html[lang="en"] .lang-block[data-lang="es"] {
    display: none !important;
}

/* --- Study-Specific Layout Components --- */
.info-box {
    background: rgba(var(--highlight-rgb), 0.05);
    border: 1px solid var(--dim-color);
    padding: 1.5rem;
    margin: 2rem 0;
    font-family: var(--font-mono);
}

.info-box.note { border-left: 4px solid var(--highlight-color); }
.info-box.warning { border-left: 4px solid #ff3300; }

.info-box-title {
    color: var(--highlight-color);
    font-weight: bold;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.image-grid.three-col {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.image-grid img {
    width: 100%;
    height: auto;
    border: 1px solid var(--dim-color);
    transition: border-color 0.3s;
}

.image-grid img:hover {
    border-color: var(--highlight-color);
}

/* --- Toolkit / Tag Cloud --- */
.tag-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.tag {
    font-family: var(--font-mono);
    font-size: 0.95rem;
    padding: 0.5rem 1rem;
    border: 1px solid rgba(var(--highlight-rgb), 0.6);
    color: var(--highlight-color);
    text-transform: uppercase;
    background: rgba(var(--highlight-rgb), 0.05);
    transition: all 0.2s ease;
    display: inline-block;
}

.tag:hover {
    border-color: var(--highlight-color);
    background: rgba(var(--highlight-rgb), 0.15);
    transform: translateY(-1px);
}

figure {
    margin: 2rem 0;
    text-align: center;
}

figcaption {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--dim-color);
    margin-top: 0.5rem;
}

/* --- Section Utilities --- */
.section-premium {
    background: linear-gradient(180deg, rgba(255,255,255,0.02) 0%, rgba(255,255,255,0) 100%);
    padding: 2rem;
    border: 1px solid rgba(255,255,255,0.05);
    margin-bottom: 2rem;
}

@media (max-width: 768px) {
    .bottom-bar {
        flex-wrap: wrap;
        font-size: 0.75rem;
        gap: 0.5rem;
    }

    .bottom-bar .footer-segment:first-child span {
        font-size: 0.7rem;
    }

    .loader-bar {
        height: 6px;
    }
}