:root {
    --bg-color: #ffffff;
    --text-color: #1a1a1a;
    --accent-color: #555;
    --hover-color: #000;
    --spacing-unit: 2rem;
    --font-main: 'Inter', sans-serif;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    /* Hide default cursor */
}

p {
    text-align: justify;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.3s ease;
    /* Ensure elements don't show default cursor */
}

a:hover {
    color: var(--hover-color);
}

.container {
    display: flex;
    min-height: 100vh;
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--spacing-unit);
}

/* Sidebar Navigation */
.sidebar {
    width: 180px;
    position: fixed;
    left: 100px;
    top: 2rem;
    height: calc(100vh - 4rem);
    display: flex;
    flex-direction: column;
}

.sidebar h1 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 2rem;
    letter-spacing: -0.02em;
    display: none;
    /* Hide old h1 if present, though replaced in HTML */
}

.sidebar-top {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    flex-shrink: 0;
}

/* Scrollable nav links - positioned at bottom above button */
.sidebar .nav-links {
    list-style: none;
    overflow-y: auto;
    max-height: calc(50vh - 50px);
    margin-top: auto;
    margin-bottom: 1rem;
    padding-right: 0.5rem;
    scrollbar-width: thin;
    scrollbar-color: #ddd transparent;
}

.sidebar .nav-links::-webkit-scrollbar {
    width: 4px;
}

.sidebar .nav-links::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar .nav-links::-webkit-scrollbar-thumb {
    background-color: #ddd;
    border-radius: 4px;
}

.sidebar .nav-links::-webkit-scrollbar-thumb:hover {
    background-color: #bbb;
}

/* Fixed bottom section for language toggle */
.sidebar-bottom {
    flex-shrink: 0;
    padding-top: 1rem;
    border-top: 1px solid #eee;
    margin-top: auto;
}

/* Logo */
.logo {
    width: 120px;
    height: 120px;
    object-fit: contain;
    margin-bottom: 0;
    transition: transform 0.1s linear;
    position: relative;
    z-index: 1;
    mix-blend-mode: multiply;
}

.sidebar h3 {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    position: relative;
    z-index: 10;
    margin-top: -2rem;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}

.photo-placeholder {
    display: none;
}

.profile-photo {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border-radius: 12px;
    transition: transform 0.3s ease;
}

.profile-photo:hover {
    transform: scale(1.02);
}

/* Mobile Profile Photo */
.mobile-profile-container {
    display: none;
    text-align: center;
    margin-bottom: 2rem;
}

.mobile-profile-photo {
    width: 160px;
    height: 160px;
    object-fit: cover;
    border-radius: 12px;
    border: 2px solid #eee;
}

/* Mobile Menu Toggle */
.mobile-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 101;
}

.mobile-menu-toggle span {
    display: block;
    width: 25px;
    height: 3px;
    background-color: var(--text-color);
    margin: 5px 0;
    transition: 0.4s;
}

.sidebar li {
    margin-bottom: 0.8rem;
    position: relative;
}

.sidebar a {
    font-size: 0.95rem;
    color: var(--accent-color);
    position: relative;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    display: block;
    /* Ensure full width for hover */
}

.sidebar a.active,
.sidebar a:hover {
    color: var(--text-color);
    font-weight: 500;
}

/* Language Toggle Switch */
.lang-toggle-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.lang-label {
    font-size: 0.85rem;
    color: var(--accent-color);
    font-weight: 500;
    transition: color 0.3s ease;
}

.lang-label.active {
    color: var(--text-color);
}

.lang-toggle {
    position: relative;
    width: 50px;
    height: 26px;
    background: linear-gradient(135deg, #017c9c 0%, #015a73 100%);
    border: none;
    border-radius: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(255, 140, 0, 0.3);
    flex-shrink: 0;
}

.lang-toggle:hover {
    box-shadow: 0 4px 12px rgba(255, 140, 0, 0.5);
    transform: translateY(-1px);
}

.lang-toggle:active {
    transform: translateY(0);
}

.toggle-slider {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.lang-toggle.es .toggle-slider {
    transform: translateX(24px);
}

/* Main Content */
.content {
    margin-left: 250px;
    /* Keep content in original position */
    flex: 1;
    padding-top: 0.5rem;
    max-width: 800px;
    /* Limit width to keep it tighter */
}

section {
    margin-bottom: 8rem;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeIn 0.8s ease forwards;
}

section h2 {
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent-color);
    margin-bottom: 2rem;
    font-weight: 400;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.5rem;
}

/* Lists (Writings) */
.list {
    list-style: none;
}

.list li {
    display: flex;
    margin-bottom: 1rem;
    align-items: flex-start;
    gap: 0;
}

.writing-item {
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.writing-item:hover {
    opacity: 0.7;
}

.writing-link {
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s ease;
}

.writing-item:hover .writing-link {
    border-color: var(--text-color);
}

.writing-link-container {
    display: flex;
    flex-direction: column;
}

.writing-subtitle {
    display: block;
    font-size: 0.7rem;
    color: var(--accent-color);
    font-style: italic;
    margin-top: 0.15rem;
}

.list .date {
    min-width: 60px;
    width: 60px;
    flex-shrink: 0;
    font-size: 0.85rem;
    color: var(--accent-color);
    font-feature-settings: "tnum";
    padding-top: 0.1rem;
}

/* Projects Grid */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 2rem;
}

.project-card {
    padding: 1.5rem;
    border: 1px solid #eee;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

.project-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    border-color: #ddd;
}

.project-card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.project-card p {
    font-size: 0.9rem;
    color: var(--accent-color);
}

/* Project Status Indicator */
.project-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.status-light {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.status-light.finished {
    background-color: #22c55e;
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.6);
}

.status-light.aborted {
    background-color: #ef4444;
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.6);
}

.status-light.in-progress {
    background-color: #eab308;
    box-shadow: 0 0 6px rgba(234, 179, 8, 0.6);
}

.status-text {
    font-size: 0.75rem;
    color: #22c55e;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-light.aborted+.status-text {
    color: #ef4444;
}

.status-light.in-progress+.status-text {
    color: #eab308;
}

/* Experience */
.experience-item {
    margin-bottom: 2rem;
}

/* Experience - Grouped by Employer */
.experience-group {
    margin-bottom: 2rem;
}

.employer-header {
    margin-bottom: 1rem;
}

.employer-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.2rem;
}

.employer-period {
    font-size: 0.8rem;
    color: #999;
}

.roles-container {
    padding-left: 1.25rem;
    border-left: 2px solid #eee;
}

.role-item {
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #f5f5f5;
}

.role-item:last-child {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
}

.role-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}

.role-title {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-color);
}

.role-date {
    font-size: 0.75rem;
    color: #999;
    background-color: #f5f5f5;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
}

.role-desc {
    font-size: 0.85rem;
    color: #666;
    line-height: 1.5;
    margin: 0;
}

/* Education */
.education-item {
    margin-bottom: 2rem;
}

.education-item h3 {
    font-size: 1.1rem;
    font-weight: 500;
    display: inline-block;
    margin-right: 0.5rem;
}

.education-item .institution {
    color: var(--accent-color);
}

.education-item .date {
    display: block;
    font-size: 0.85rem;
    color: #999;
    margin-bottom: 0.5rem;
    margin-top: 0.2rem;
}

/* Fellowships & Awards */
.award-item {
    margin-bottom: 1.75rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #f0f0f0;
}

.award-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.award-item h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--text-color);
}

.award-item .organization {
    color: var(--accent-color);
    display: block;
    font-size: 0.85rem;
    margin-bottom: 0.2rem;
}

.award-item .date {
    display: inline-block;
    font-size: 0.75rem;
    color: #999;
    background-color: #f5f5f5;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    margin-bottom: 0.5rem;
}

.award-item p {
    font-size: 0.85rem;
    color: #666;
    margin-top: 0.4rem;
    line-height: 1.5;
}

/* Contact Form */
.contact-intro {
    margin-bottom: 2rem;
    color: var(--accent-color);
}

.contact-form {
    max-width: 600px;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-color);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    font-family: var(--font-main);
    font-size: 0.95rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    background-color: var(--bg-color);
    color: var(--text-color);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--hover-color);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.submit-btn {
    background: linear-gradient(135deg, #017c9c 0%, #015a73 100%);
    color: white;
    border: none;
    padding: 0.85rem 2rem;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: 4px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(255, 140, 0, 0.3);
}

.submit-btn:hover {
    box-shadow: 0 4px 12px rgba(255, 140, 0, 0.5);
    transform: translateY(-2px);
}

.submit-btn:active {
    transform: translateY(0);
}

.form-status {
    margin-top: 1rem;
    padding: 0.75rem;
    border-radius: 4px;
    display: none;
    font-size: 0.9rem;
}

.form-status.success {
    display: block;
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.form-status.error {
    display: block;
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}


/* Animations */
@keyframes fadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

button {
    cursor: pointer;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
        padding: 1.5rem;
    }

    .sidebar {
        position: sticky;
        top: 0;
        z-index: 100;
        background-color: var(--bg-color);
        padding-bottom: 0;

        /* Full width fix */
        margin-left: -1.5rem;
        margin-right: -1.5rem;
        width: calc(100% + 3rem);
        padding-left: 1.5rem;
        padding-right: 1.5rem;

        height: auto;
        margin-bottom: 2rem;
        border-bottom: 1px solid #eee;
    }

    .sidebar-top {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding-bottom: 1rem;
        width: 100%;
        flex-wrap: wrap;
    }

    .mobile-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        width: 100%;
    }

    .logo {
        width: 60px;
        height: 60px;
    }

    .sidebar h3 {
        margin-top: 0;
        margin-left: 1rem;
        display: none;
        /* Hide name in header on mobile if desired, or keep it */
    }

    .profile-photo {
        display: none;
    }

    .mobile-menu-toggle {
        display: block;
    }

    /* Hamburger Animation */
    .mobile-menu-toggle.active span:nth-child(1) {
        transform: rotate(-45deg) translate(-5px, 6px);
    }

    .mobile-menu-toggle.active span:nth-child(2) {
        opacity: 0;
    }

    .mobile-menu-toggle.active span:nth-child(3) {
        transform: rotate(45deg) translate(-5px, -6px);
    }

    .nav-links {
        display: none;
        width: 100%;
        padding-top: 1rem;
        border-top: 1px solid #eee;
        max-height: none;
        overflow-y: visible;
    }

    .nav-links.active {
        display: block;
    }

    .sidebar-bottom {
        display: none;
        border-top: none;
        padding-top: 0.5rem;
        margin-top: 0;
    }

    .nav-links.active+.sidebar-bottom {
        display: block;
    }

    .content {
        margin-left: 0;
    }

    .cursor-light {
        display: none;
    }

    body,
    a,
    button,
    .project-card {
        cursor: auto;
    }
}

/* Film Tapestry */
/* Film Tapestry - Flexbox Masonry */
.film-tapestry {
    display: flex;
    gap: 1rem;
}

.film-col {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    flex: 1;
}

.film-tapestry img {
    width: 100%;
    border-radius: 4px;
    transition: transform 0.3s ease;
    display: block;
    /* Removes bottom space */
}

.film-tapestry img:hover {
    transform: scale(1.02);
}

@media (max-width: 768px) {
    .film-tapestry {
        flex-direction: column;
    }

    .film-col {
        width: 100%;
    }

    .mobile-profile-container {
        display: block;
    }
}

/* Film Controls */
.film-controls {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
}

/* Music Section Lazy Loading */
.music-embed-container {
    width: 100%;
    min-height: 352px;
    border-radius: 12px;
    overflow: hidden;
}

.music-embed-container iframe {
    border-radius: 12px;
    width: 100%;
    height: 352px;
    border: none;
}

.music-placeholder {
    width: 100%;
    height: 352px;
    background: transparent;
    border: 1px dashed #ddd;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.music-loading-text {
    color: var(--accent-color);
    font-size: 0.9rem;
}

.secondary-btn {
    background: transparent;
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.secondary-btn:hover {
    border-color: var(--text-color);
    color: var(--text-color);
    background-color: rgba(0, 0, 0, 0.05);
}

.film-tapestry img.hidden {
    display: none;
}

/* PDF Viewer Styles */
.cv-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    width: 100%;
}

#pdf-render {
    border: 1px solid #eee;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    max-width: 100%;
    height: auto;
}

.pdf-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background-color: #fff;
    padding: 2rem;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    position: relative;
    transform: translateY(20px);
    transition: transform 0.3s ease;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #555;
    transition: color 0.3s ease;
}

.modal-close:hover {
    color: #000;
}

.modal-image {
    width: 100%;
    max-height: 400px;
    object-fit: contain;
    margin-bottom: 1rem;
    display: none;
    /* Hidden by default */
    border-radius: 8px;
}

.modal-body h3 {
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

.modal-body p {
    color: #555;
    line-height: 1.6;
    text-align: justify;
    margin-bottom: 1rem;
}