/* =========================================================
   Fonts
   ========================================================= */

@font-face {
    font-family: "Neue Kabel W01 Book";
    src:
        url("https://db.onlinewebfonts.com/t/18997729e452a082c38ae1a86a873674.woff2") format("woff2"),
        url("https://db.onlinewebfonts.com/t/18997729e452a082c38ae1a86a873674.woff") format("woff");
    font-display: swap;
    font-weight: 400;
    font-style: normal;
}

@font-face {
    font-family: "Mexcellent";
    src:
        url("https://db.onlinewebfonts.com/t/a71dd5d04430a5d021186c05537a34f6.woff2") format("woff2"),
        url("https://db.onlinewebfonts.com/t/a71dd5d04430a5d021186c05537a34f6.woff") format("woff");
    font-display: swap;
    font-weight: 400;
    font-style: normal;
}

/* =========================================================
   Design tokens
   ========================================================= */

:root {
    --bg: #f0e9df;
    --text: #1c1c1e;
    --accent: #15886b;
    --accent-hover: #e61b68;
    --heading-accent: #904601;
    --muted: #707070;
    --surface-hover: rgba(0, 0, 0, 0.05);

    --content-max: 1200px;
    --content-width: min(92vw, var(--content-max));
    --section-gap: clamp(3.5rem, 9vw, 8rem);
    --column-gap: clamp(2rem, 8vw, 7rem);

    --focus-ring: 0 0 0 3px rgba(21, 136, 107, 0.28);
}

/* =========================================================
   Reset / base
   ========================================================= */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    min-height: 100vh;
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Neue Kabel W01 Book", system-ui, sans-serif;
    font-size: clamp(1rem, 0.96rem + 0.2vw, 1.125rem);
    line-height: 1.55;
    overflow-x: hidden;
    text-rendering: optimizeLegibility;
}

img {
    display: block;
    max-width: 100%;
    height: auto;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

button {
    font: inherit;
}

a {
    color: inherit;
}

h1,
h2,
h3,
h4,
p {
    margin-top: 0;
}

h1,
h2,
h3,
h4 {
    line-height: 1.15;
}

p {
    overflow-wrap: anywhere;
}

:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
    border-radius: 0.4rem;
}

/* =========================================================
   Main layout
   ========================================================= */

.content {
    width: var(--content-width);
    max-width: var(--content-max);
    margin: clamp(2rem, 5vw, 4rem) auto 0;
}

.container {
    display: grid;
    grid-template-columns: minmax(0, 0.32fr) minmax(0, 0.68fr);
    column-gap: var(--column-gap);
    align-items: start;
    margin-bottom: var(--section-gap);
}

.container .left,
.container .right {
    min-width: 0;
}

.container .left h3 {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    margin: 0;
    color: var(--text);
    font-family: "Space Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: clamp(1.4rem, 2.5vw, 2rem);
    font-weight: 700;
    letter-spacing: -0.03em;
}

/* =========================================================
   Hero
   ========================================================= */

.profile-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    width: 100%;
}

.profile-img {
    width: min(100%, 260px);
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 50%;
    background: #e2dacd;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.email {
    display: inline-block;
    max-width: 100%;
    color: var(--text);
    font-size: 0.9rem;
    line-height: 1.3;
    text-align: center;
    text-decoration: none;
    overflow-wrap: anywhere;
}

.email:hover,
.email:focus-visible {
    color: var(--accent-hover);
    text-decoration: underline;
}

.social-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    width: 100%;
}

.social-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    border-radius: 50%;
}

.social-links img {
    width: 25px;
    height: 25px;
    transition: transform 0.2s ease, filter 0.2s ease;
}

.social-links a:hover img {
    transform: translateY(-3px);
    filter: brightness(1.1);
}

.about-section {
    padding-top: clamp(0rem, 2vw, 1rem);
}

.name {
    margin: 0 0 0.5rem;
    font-family: "Mexcellent", cursive;
    font-size: clamp(3.7rem, 10vw, 7rem);
    font-weight: 400;
    line-height: 0.95;
    letter-spacing: -0.03em;
    overflow-wrap: anywhere;
}

.about-section h2 {
    margin: 0;
    font-size: clamp(1.25rem, 2vw, 1.75rem);
}

.about-section h3 {
    margin: 0;
    color: var(--heading-accent);
    font-size: clamp(1.05rem, 1.6vw, 1.35rem);
}

/* =========================================================
   About text
   ========================================================= */

.about {
    margin-bottom: 1.4rem;
    text-align: justify;
    text-justify: inter-word;
}

.about a {
    color: var(--accent);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.15em;
}

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

/* =========================================================
   Section toggles
   ========================================================= */

.toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    margin-left: 0.35rem;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.toggle-btn:hover {
    background: var(--surface-hover);
}

.toggle-btn .arrow {
    display: inline-block;
    font-size: 1.35rem;
    transition: transform 0.3s ease;
}

.toggle-btn.collapsed .arrow {
    transform: rotate(-90deg);
}

.collapsible-content {
    display: grid;
    grid-template-rows: 1fr;
    opacity: 1;
    transition:
        grid-template-rows 0.45s ease,
        opacity 0.3s ease;
}

.collapsible-inner {
    min-height: 0;
    overflow: hidden;
}

.collapsible-content.collapsed {
    grid-template-rows: 0fr;
    opacity: 0;
}

/* =========================================================
   Cards / publications / teaching / students
   ========================================================= */

.item {
    margin: 0;
}

.link-publicacion,
.teach-item,
.student-item {
    display: block;
    color: inherit;
    border-radius: 1.25rem;
}

.link-publicacion {
    padding: 1rem 1.25rem;
    margin: 0 1rem;
    text-decoration: none;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.publication-venue{
    font-size: medium !important;
}

.link-publicacion:hover,
.teach-item:hover,
.student-item:hover {
    background: var(--surface-hover);
}

.teach-item,
.student-item {
    padding: 0.65rem 1rem;
    margin-inline: 1rem;
    text-decoration: none;
}

.item h3,
.item h4 {
    margin-bottom: 0;
    overflow-wrap: anywhere;
}

.item h3 {
    font-size: clamp(1.05rem, 1.5vw, 1.3rem);
}

.item h4 {
    font-size: 1.1rem;
}

.authors,
.student-date {
    color: var(--muted);
    font-size: 0.9rem;
}

.authors {
    margin: 0.25rem 0 0;
}

.years,
.student-date {
    margin: 0.35rem 0 0;
    font-size: smaller;
}

.student-project {
    margin: 0.25rem 0 0;
    font-size: 1rem;
}

/* =========================================================
   Tags
   ========================================================= */

.tags {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
    margin-top: 0.45rem;
}

.tag,
.tags > p:not(.authors) {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    margin: 0;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.1;
}

.conference-tag,
.tag-supervisor {
    background: #f3b51a;
    color: #904601;
}

.abstract-tag,
.tag-status {
    background: #1e4a7bb3;
    color: #161e33;
}

.thesis-tag,
.tag-examiner {
    background: #d65e75db;
    color: #73162a;
}

.def-tag {
    background: #d5d1d1;
    color: #666;
}

.unam {
    background: #e2b77b;
    color: #7b5410;
}

.uob {
    background: #d98b8e;
    color: #860409;
}

/* =========================================================
   Responsive layout
   ========================================================= */

@media (max-width: 800px) {
    :root {
        --content-width: min(92vw, 680px);
        --section-gap: 4.5rem;
    }

    .container {
        grid-template-columns: 1fr;
        row-gap: 1.25rem;
    }

    .container .left {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .about-section {
        padding-top: 0;
    }

    .name {
        font-size: clamp(3.5rem, 13vw, 6rem);
    }
}

@media (max-width: 520px) {
    :root {
        --content-width: calc(100% - 2rem);
        --section-gap: 3.5rem;
    }

    body {
        font-size: 1rem;
    }

    .content {
        margin-top: 1.5rem;
    }

    .profile-img {
        width: min(60vw, 220px);
    }

    .name {
        font-size: clamp(3rem, 16vw, 4.8rem);
    }

    .link-publicacion {
        padding: 0.9rem;
        margin-inline: -0.9rem;
        border-radius: 1rem;
    }

    .teach-item,
    .student-item {
        padding-inline: 0.75rem;
        margin-inline: -0.75rem;
    }
}

@media (max-width: 360px) {
    :root {
        --content-width: calc(100% - 1.25rem);
    }

    .social-links {
        gap: 0.5rem;
    }

    .name {
        font-size: clamp(2.7rem, 16vw, 4rem);
    }
}

/* =========================================================
   Reduced motion
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
