@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=Source+Sans+3:wght@400;500;600;700&display=swap');

/* ---------- Variables ---------- */

:root {
    --bg-main: #dbe6cd;
    --bg-soft: #edf2e5;
    --section-bg: #fbfcf7;
    --card-bg: #e7ecdc;

    --green-dark: #33483c;
    --green-main: #3f6f4e;
    --green-soft: #b7cfa2;
    --green-muted: #71866b;
    

    --accent-code: #0b6b55;
    --accent-purple: #6e63a6;
    --accent-gold: #b58b3b;

    --text-main: #1d261f;
    --text-soft: #212925;
    --text-muted: #6d786f;

    --border-soft: rgba(63, 111, 78, 0.16);
    --shadow-soft: 0 14px 34px rgba(46, 61, 42, 0.14);
    --shadow-strong: 0 20px 48px rgba(46, 61, 42, 0.24);

    --sidebar-width: 180px;
}

/* ---------- General ---------- */

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: "Source Sans 3", "Open Sans", system-ui, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(183, 207, 162, 0.55), transparent 34%),
        radial-gradient(circle at bottom right, rgba(63, 111, 78, 0.18), transparent 32%),
        linear-gradient(135deg, #dbe6cd 0%, #edf2e5 48%, #d6e1c7 100%);
    color: var(--text-main);
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(63, 111, 78, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(63, 111, 78, 0.045) 1px, transparent 1px);
    background-size: 42px 42px;
    z-index: -1;
}

p {
    font-size: 1.15rem;
    font-weight: 400;
    line-height: 1.65;
    color: var(--text-soft);
}

h1,
h2,
h3 {
    margin-top: 0;
    color: var(--text-main);
    letter-spacing: -0.025em;
}

a {
    color: inherit;
}

/* ---------- Main layout ---------- */

.main-content {
    margin-left: var(--sidebar-width);
    padding: 28px;
    max-width: 1320px;
}

/* ---------- Sidebar ---------- */

.sidebar {
    background:
        linear-gradient(180deg, #212925 0%, #212925 100%);
    width: 160px;
    height: 100vh;
    position: fixed;
    padding-top: 3.3rem;
    padding-left: 1rem;
    padding-right: 0.75rem;
    box-shadow: 8px 0 26px rgba(0, 0, 0, 0.16);
    z-index: 10;
}

.sidebar ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

.sidebar ul li {
    margin-bottom: 16px;
}

.sidebar ul li a {
    color: #f7fbf2;
    text-decoration: none;
    font-size: 1.02rem;
    font-weight: 600;
    display: inline-block;
    padding: 9px 13px;
    border-radius: 9px;
    transition:
        background-color 0.25s ease,
        color 0.25s ease,
        transform 0.25s ease;
}

.sidebar ul li a::before {
    content: ">";
    font-family: "IBM Plex Mono", "Courier New", monospace;
    color: #d7edc4;
    margin-right: 0.45rem;
}

.sidebar ul li a:hover {
    background-color: var(--green-soft);
    color: #172015;
    transform: translateX(4px);
}

.sidebar.scrolled {
    box-shadow: 8px 0 26px rgba(0, 0, 0, 0.18);
}

/* ---------- Scroll Progress ---------- */

#scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 6px;
    background: linear-gradient(90deg, var(--green-main), var(--accent-code), var(--accent-gold));
    width: 0;
    z-index: 9999;
    transition: width 0.2s ease;
}

/* ---------- Sections ---------- */

.section {
    position: relative;
    background-color: var(--section-bg);
    padding: 26px;
    border-radius: 18px;
    margin-bottom: 46px;
    border: 1px solid var(--border-soft);
    box-shadow: var(--shadow-soft);
    transition:
        transform 0.35s ease,
        box-shadow 0.35s ease,
        border-color 0.35s ease;
    overflow: visible;
}

.section::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background:
        linear-gradient(90deg, rgba(183, 207, 162, 0.20), transparent 42%),
        radial-gradient(circle at top right, rgba(63, 111, 78, 0.08), transparent 34%);
    opacity: 0.85;
}

.section > * {
    position: relative;
    z-index: 1;
}

.section:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-strong);
    border-color: rgba(63, 111, 78, 0.28);
}

/* Títulos de sección con # */
.section h1:not(.static-title) {
    font-size: 2.15rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    padding-bottom: 0.35rem;
    border-bottom: 2px solid rgba(63, 111, 78, 0.34);
}

.section h1:not(.static-title)::before {
    content: "# ";
    color: var(--accent-code);
    font-family: "IBM Plex Mono", "Courier New", monospace;
}

/* ---------- About ---------- */

.content-wrapper {
    display: flex;
    align-items: center;
    gap: 32px;
}

.image-content {
    position: relative;
    flex: 0 0 auto;
    display: inline-block;
    transform: rotate(-1.8deg);
    transition: transform 0.35s ease;
}

.image-content:hover {
    transform: rotate(0deg) translateY(-4px);
}

.image-content::before {
    content: "";
    position: absolute;
    inset: -12px;
    border: 1.5px solid rgba(63, 111, 78, 0.42);
    border-radius: 24px;
    transform: rotate(-2.5deg);
    z-index: 0;
}

.image-content img {
    position: relative;
    z-index: 1;
    width: 245px;
    height: 315px;
    object-fit: cover;
    object-position: center;
    border-radius: 20px;
    border: 2px solid rgba(255, 255, 255, 0.78);
    box-shadow: 0 18px 38px rgba(46, 61, 42, 0.28);
    filter: saturate(0.95) contrast(1.03);
}

.static-title {
    font-size: clamp(3rem, 4vw, 3.75rem);
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 15px;
    text-align: left;
    background:
        linear-gradient(135deg, #f7f9f2, #eef4e7);
    padding: 10px 20px;
    border-left: 6px solid var(--green-main);
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(46, 61, 42, 0.10);
}

.text-content h1 {
    font-size: 2.7rem;
    margin-bottom: 2rem;
}

.text-content p {
    max-width: 760px;
    font-size: 1.1rem;
}

/* ---------- Research Projects ---------- */

#research {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.project-wrapper {
    display: flex;
    align-items: center;
    gap: 22px;
    background-color: var(--card-bg);
    padding: 22px;
    border-radius: 18px;
    border: 1px solid rgba(63, 111, 78, 0.14);
    box-shadow: 0 10px 26px rgba(46, 61, 42, 0.12);
    transition:
        transform 0.3s ease,
        box-shadow 0.3s ease,
        border-color 0.3s ease;
}

.project-wrapper:hover {
    transform: translateY(-5px);
    box-shadow: 0 16px 34px rgba(46, 61, 42, 0.20);
    border-color: rgba(63, 111, 78, 0.28);
}

.project-image img,
.project-image2 img {
    object-fit: cover;
    border-radius: 16px;
    border: 2px solid rgba(255, 255, 255, 0.72);
    box-shadow: 0 10px 22px rgba(46, 61, 42, 0.17);
    filter: saturate(0.96) contrast(1.03);
}

.project-image img {
    width: 180px;
    height: 190px;
}

.project-image2 img {
    width: 230px;
    height: 175px;
    object-position: right center;
}

.project-photo img {
    width: 240px;
    height: auto;
    border-radius: 16px;
    border: 2px solid rgba(255, 255, 255, 0.72);
    box-shadow: 0 10px 24px rgba(46, 61, 42, 0.20);
    transition: transform 0.3s ease;
}

.project-photo img:hover {
    transform: scale(1.04);
}

.project-text h2 {
    font-size: 1.55rem;
    margin-bottom: 8px;
    color: var(--text-main);
}

.project-text h2::before {
    color: var(--accent-code);
    font-family: "IBM Plex Mono", "Courier New", monospace;
}

.project-text p {
    font-size: 1.05rem;
    margin-bottom: 1rem;
}

/* Botones Details dentro de Projects */
.project-text .data-link {
    display: inline-block;
    font-family: "IBM Plex Mono", "Courier New", monospace;
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
    background-color: var(--green-main);
    color: #ffffff;
    padding: 8px 13px;
    border-radius: 999px;
    transition:
        background-color 0.25s ease,
        transform 0.25s ease,
        box-shadow 0.25s ease;
}

.project-text .data-link::after {
    content: " ↗";
}

.project-text .data-link:hover {
    background-color: var(--accent-code);
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(46, 61, 42, 0.18);
}

/* ---------- Publications ---------- */

.pub-wrapper {
    display: grid;
    gap: 18px;
}

.pub-card {
    position: relative;
    background-color: var(--card-bg);
    padding: 18px 20px;
    border-radius: 18px;
    border: 1px solid rgba(63, 111, 78, 0.14);
    box-shadow: 0 10px 26px rgba(46, 61, 42, 0.12);
    transition:
        transform 0.3s ease,
        box-shadow 0.3s ease,
        border-color 0.3s ease;
}

.pub-card::before {
    content: "paper";
    position: absolute;
    top: 14px;
    right: 16px;
    padding: 4px 8px;
    border-radius: 999px;
    background-color: rgba(63, 111, 78, 0.08);
    color: var(--accent-code);
    border: 1px solid rgba(63, 111, 78, 0.14);
    font-family: "IBM Plex Mono", "Courier New", monospace;
    font-size: 0.72rem;
    font-weight: 600;
}

.pub-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 16px 34px rgba(46, 61, 42, 0.20);
    border-color: rgba(63, 111, 78, 0.28);
}

.pub-card h3 {
    max-width: 920px;
    padding-right: 70px;
    margin-bottom: 8px;
    font-size: 1.18rem;
    line-height: 1.35;
}

.pub-card p {
    margin: 0 0 10px;
    color: var(--text-muted);
}

/* Botones Link dentro de Publications */
.pub-card .data-link {
    display: inline-block;
    font-family: "IBM Plex Mono", "Courier New", monospace;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    background-color: #26322b;
    color: #d9f1de;
    padding: 7px 11px;
    border-radius: 999px;
    transition:
        background-color 0.25s ease,
        color 0.25s ease,
        transform 0.25s ease;
}

.pub-card .data-link::after {
    content: " ↗";
}

.pub-card .data-link:hover {
    background-color: var(--accent-code);
    color: #ffffff;
    transform: translateY(-2px);
}

/* ---------- Codes ---------- */

.data-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

#data .data-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    min-height: 74px;
    min-width: 190px;
    font-family: "IBM Plex Mono", "Courier New", monospace;
    font-size: 0.94rem;
    font-weight: 600;
    text-decoration: none;
    background-color: #26322b;
    color: #02d79f;
    padding: 16px 18px;
    border-radius: 12px;
    border: 1px solid rgba(2, 215, 159, 0.18);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
    transition:
        background-color 0.25s ease,
        color 0.25s ease,
        transform 0.25s ease,
        box-shadow 0.25s ease;
}

#data .data-link::before {
    color: var(--green-soft);
}

#data .data-link::after {
    content: "()";
    color: var(--accent-purple);
}

#data .data-link:hover {
    background-color: #1e2823;
    color: #b7ffdf;
    transform: translateY(-4px);
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.18);
}

/* Tooltips de la sección Codes */
.tooltip {
    position: absolute;
    background-color: #ffffff;
    padding: 12px;
    top: calc(100% + 10px);
    left: 0;
    border-radius: 12px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.20);
    display: block;
    width: 280px;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition:
        opacity 0.25s ease,
        transform 0.25s ease;
    transform: translateY(8px);
    color: var(--text-soft);
}

#data .data-link:hover .tooltip {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.tooltip p {
    margin: 0;
    font-size: 0.92rem;
    line-height: 1.45;
    color: var(--text-soft);
}

.tooltip img {
    width: 100%;
    max-width: 210px;
    height: auto;
    border-radius: 6px;
}

/* ---------- CV ---------- */

.cv-container {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.cv-link {
    font-family: "Source Sans 3", "Open Sans", sans-serif;
    font-size: 1rem;
    font-weight: 700;
    background-color: var(--green-main);
    color: #ffffff;
    padding: 10px 15px;
    border-radius: 999px;
    text-decoration: none;
    transition:
        background-color 0.25s ease,
        transform 0.25s ease,
        box-shadow 0.25s ease;
}

.cv-link:hover {
    background-color: var(--accent-code);
    color: #ffffff;
    transform: translateY(-3px);
    box-shadow: 0 10px 22px rgba(46, 61, 42, 0.18);
}

/* ---------- Funding ---------- */

.funding-logos {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
    align-items: stretch;
    margin-top: 18px;
}

.funding-logos a {
    width: 150px;
    min-height: 105px;
    background-color: #ffffff;
    border: 1px solid rgba(63, 111, 78, 0.14);
    border-radius: 16px;
    box-shadow: 0 10px 24px rgba(46, 61, 42, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px;
    transition:
        transform 0.25s ease,
        box-shadow 0.25s ease,
        border-color 0.25s ease;
}

.funding-logos a:hover {
    transform: translateY(-5px);
    box-shadow: 0 16px 34px rgba(46, 61, 42, 0.20);
    border-color: rgba(63, 111, 78, 0.28);
}

.funding-logos img {
    max-width: 100%;
    max-height: 72px;
    object-fit: contain;
}

/* ---------- Contact ---------- */

#contact-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: stretch;
    justify-content: center;
}

#contact-form input,
#contact-form textarea {
    flex: 1;
    min-width: 180px;
    padding: 12px;
    border: 1px solid rgba(63, 111, 78, 0.22);
    border-radius: 10px;
    font-family: "Source Sans 3", "Open Sans", sans-serif;
    font-size: 1rem;
    background-color: #fbfcf7;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.06);
    transition:
        border-color 0.25s ease,
        box-shadow 0.25s ease;
}

#contact-form input:focus,
#contact-form textarea:focus {
    border-color: var(--green-main);
    box-shadow: 0 0 0 3px rgba(63, 111, 78, 0.12);
    outline: none;
}

#contact-form textarea {
    flex: 2;
    height: 48px;
    resize: none;
}

#contact-form button {
    background-color: var(--green-soft);
    color: #172015;
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition:
        background-color 0.25s ease,
        color 0.25s ease,
        transform 0.25s ease;
    font-weight: 700;
}

#contact-form button:hover {
    background-color: var(--green-main);
    color: #ffffff;
    transform: translateY(-2px);
}

/* ---------- Typewriter ---------- */

#typewriter {
    font-size: 1.5rem;
    font-weight: 700;
    color: #214107;
    white-space: nowrap;
    overflow: hidden;
    animation: blink 0.7s step-end infinite;
}

@keyframes blink {
    from, to {
        border-color: transparent;
    }
    50% {
        border-color: #214107;
    }
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
    .content-wrapper {
        align-items: flex-start;
    }

    .image-content img {
        width: 220px;
        height: 290px;
    }

    .project-wrapper {
        align-items: flex-start;
    }
}

@media (max-width: 768px) {
    .sidebar {
        position: sticky;
        top: 0;
        width: 100%;
        height: auto;
        padding: 12px;
        z-index: 50;
    }

    .sidebar ul {
        display: flex;
        gap: 8px;
        overflow-x: auto;
        padding-bottom: 4px;
    }

    .sidebar ul li {
        margin-bottom: 0;
        flex: 0 0 auto;
    }

    .sidebar ul li a {
        font-size: 0.9rem;
        padding: 8px 10px;
    }

    .main-content {
        margin-left: 0;
        padding: 18px;
    }

    .content-wrapper {
        flex-direction: column;
        gap: 24px;
    }

    .image-content {
        transform: rotate(-1.2deg);
    }

    .image-content img {
        width: min(100%, 320px);
        height: 340px;
    }

    .project-wrapper {
        flex-direction: column;
    }

    .project-image img,
    .project-image2 img {
        width: 100%;
        height: 240px;
    }

    .pub-card h3 {
        padding-right: 0;
    }

    .pub-card::before {
        position: static;
        display: inline-block;
        margin-bottom: 10px;
    }

    .data-wrapper {
        flex-direction: column;
    }

    #data .data-link {
        width: 100%;
    }

    .tooltip {
        width: min(280px, calc(100vw - 60px));
    }

    #contact-form {
        flex-direction: column;
    }

    #contact-form input,
    #contact-form textarea,
    #contact-form button {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .section {
        padding: 18px;
        border-radius: 15px;
    }

    .static-title {
        font-size: 1.85rem;
    }

    .section h1:not(.static-title) {
        font-size: 1.55rem;
    }

    .image-content img {
        height: 300px;
    }

    .funding-logos a {
        width: 100%;
    }
}

/* Language selector in sidebar */

.sidebar .language-menu {
    margin-top: 25px;
    padding-top: 25px;
    border-top: 1px solid rgba(210, 230, 205, 0.3);
    list-style: none;
}

.sidebar .language-menu a {
    display: block;
    padding: 8px 5px;
    background: transparent;
    color: #d9e7d3;
    font-size: 16px;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: 0;
    transition: color 0.2s ease;
}

.sidebar .language-menu a:hover {
    background: transparent;
    color: #ffffff;
}

.sidebar .language-menu a::before {
    content: none !important;
}
