:root {
    --bg: #f1f4f8;
    --surface: #ffffffcc;
    --text: #152335;
    --muted: #4d5f79;
    --line: #d7e1ec;
    --accent: #0f7f73;
}

* {
    box-sizing: border-box;
}

body {
    font-family: "Space Grotesk", "Segoe UI", sans-serif;
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(900px 500px at 20% -10%, #d9f0ff, transparent 70%),
        radial-gradient(900px 500px at 100% -10%, #d4fce6, transparent 60%),
        var(--bg);
}

header {
    padding: 64px 24px 34px;
    text-align: center;
}

h1 {
    margin: 0;
    font-size: clamp(2rem, 4vw, 3rem);
    letter-spacing: 0.02em;
}

.hero-copy {
    max-width: 700px;
    margin: 14px auto 22px;
    color: var(--muted);
    font-size: 1.05rem;
}

.socials {
    display: flex;
    justify-content: center;
    gap: 14px;
}

.socials a {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: #0f1726;
    border: 1px solid #2a3345;
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.socials a:hover {
    transform: translateY(-2px);
    background: #1d2940;
}

.projects,
.softwares,
.publications {
    padding: 14px 20px;
    max-width: 1020px;
    margin: 0 auto;
}

h2 {
    margin: 12px 0 18px;
    font-size: 1.35rem;
}

.projects-carousel {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 12px;
}

.project-viewport {
    overflow: hidden;
}

.project-track {
    --project-gap: 16px;
    display: flex;
    gap: var(--project-gap);
    transition: transform 0.35s ease;
}

.carousel-arrow {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: 1px solid #2a3345;
    background: #0f1726;
    color: #ffffff;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.carousel-arrow:hover {
    background: #1d2940;
    transform: translateY(-1px);
}

.carousel-arrow:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

.project-link {
    display: block;
    flex: 0 0 calc((100% - (var(--project-gap, 16px) * 2)) / 3);
    color: inherit;
    text-decoration: none;
}

.project-link:focus-visible {
    outline: none;
}

.project-link:focus-visible .expand-card {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.expand-card {
    background: var(--surface);
    border: 1px solid var(--line);
    backdrop-filter: blur(8px);
    border-radius: 16px;
    box-shadow: 0 10px 28px rgba(21, 35, 53, 0.08);
    padding: 14px;
    min-height: 330px;
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
    transform-origin: center top;
}

.expand-card-reveal {
    transition:
        transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
        box-shadow 0.35s cubic-bezier(0.22, 1, 0.36, 1),
        min-height 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.expand-card:hover,
.expand-card:focus-within {
    transform: translateY(-4px);
    box-shadow: 0 14px 34px rgba(21, 35, 53, 0.14);
    z-index: 5;
}

.expand-card-reveal:hover,
.expand-card-reveal:focus-within {
    min-height: 500px;
}

.expand-card h3 {
    margin: 0 0 8px;
}

.expand-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.45;
}

.project-video {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
    margin-top: 16px;
    border-radius: 12px;
    border: 1px solid #d4dfeb;
    background: #dce5ef;
}

.project-video-embed {
    border: 1px solid #d4dfeb;
}

.project-video-contain {
    object-fit: contain;
    background: #0d1522;
}

.project-detail-video.project-video-contain {
    aspect-ratio: 9 / 16;
    max-height: min(72vh, 780px);
}

.project-video-reveal {
    object-fit: cover;
    aspect-ratio: 16 / 9;
    width: 100%;
    height: auto;
    align-self: stretch;
    background: #dce5ef;
    transition:
        width 0.35s cubic-bezier(0.22, 1, 0.36, 1),
        height 0.35s cubic-bezier(0.22, 1, 0.36, 1),
        aspect-ratio 0.35s cubic-bezier(0.22, 1, 0.36, 1),
        background-color 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: width, height;
}

.expand-card:hover .project-video-reveal,
.expand-card:focus-within .project-video-reveal {
    object-fit: contain;
    background: #0d1522;
    aspect-ratio: 9 / 16;
    width: auto;
    max-width: 100%;
    height: 320px;
    align-self: center;
}

.simple-card-overflow {
    background: var(--surface);
    border: 1px solid var(--line);
    padding: 14px;
    margin: 10px 0;
    max-width: 1000px;
    border-radius: 16px;
    display: flex;
    overflow-x: hidden;
    mask-image: linear-gradient(to right, transparent, black 8%, black 92%, transparent);
}

.software-ball-group {
    margin: 0;
    display: flex;
    flex-direction: row;
    flex: 0 0 auto;
}

.long-card {
    display: flex;
    width: max-content;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    will-change: transform;
    animation: scrolling var(--marquee-duration, 16s) linear infinite;
}

.long-card:hover {
    animation-play-state: paused;
}

@keyframes scrolling {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(calc(-1 * var(--marquee-shift, 0px)));
    }
}

.software-ball {
    width: 96px;
    height: 96px;
    display: inline-block;
    margin: 6px 10px;
    border-radius: 50%;
    background: var(--surface);
    border: 0;
    background-image: var(--bg-url);
    background-size: 62%;
    background-position: center;
    background-repeat: no-repeat;
}

.project-card {
    border-radius: 16px;
    border: 1px dashed var(--line);
    padding: 22px;
    background: #ffffff99;
    color: var(--muted);
}

.project-page {
    min-height: 100vh;
}

.project-main {
    max-width: 980px;
    margin: 0 auto;
    padding: 36px 20px;
}

.back-home {
    display: inline-flex;
    align-items: center;
    margin-bottom: 16px;
    padding: 8px 12px;
    border-radius: 10px;
    background: #0f1726;
    border: 1px solid #2a3345;
    color: #ffffff;
    text-decoration: none;
}

.back-home:hover {
    background: #1d2940;
}

.project-detail-card h1 {
    margin: 0 0 12px;
    font-size: clamp(1.6rem, 3vw, 2.2rem);
}

.project-detail-card p {
    margin: 0;
    line-height: 1.55;
}

.project-detail-video {
    margin: 18px 0;
}

.project-note {
    color: var(--muted);
}

.gablecore-layout {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(280px, 420px);
    gap: 22px;
    align-items: start;
}

.gablecore-copy {
    display: grid;
    gap: 12px;
}

.gablecore-media .project-detail-video {
    margin: 0;
}

.pub-list {
    display: grid;
    gap: 14px;
}

.pub-card {
    border-style: solid;
    background: var(--surface);
}

.pub-title {
    margin: 0 0 8px;
    color: var(--text);
    font-weight: 700;
    line-height: 1.35;
}

.pub-authors,
.pub-venue,
.pub-doi,
.pub-keywords {
    margin: 0 0 8px;
    line-height: 1.5;
}

.pub-keywords {
    margin-bottom: 0;
}

.pub-doi a {
    color: var(--accent);
    text-decoration: none;
}

.pub-doi a:hover {
    text-decoration: underline;
}

footer {
    text-align: center;
    padding: 22px;
    font-size: 0.9rem;
    color: #627389;
}

@media (max-width: 640px) {
    header {
        padding-top: 48px;
    }

    .projects,
    .softwares,
    .publications {
        padding-left: 14px;
        padding-right: 14px;
    }

    .projects-carousel {
        grid-template-columns: auto 1fr auto;
        gap: 8px;
    }

    .carousel-arrow {
        width: 36px;
        height: 36px;
        font-size: 1.25rem;
    }

    .project-link {
        flex-basis: 100%;
    }

    .expand-card {
        min-height: 0;
    }

    .expand-card:hover,
    .expand-card:focus-within {
        transform: translateY(-2px) scale(1);
        z-index: 1;
    }

    .gablecore-layout {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 641px) and (max-width: 960px) {
    .project-link {
        flex-basis: calc((100% - var(--project-gap, 16px)) / 2);
    }
}

@media (prefers-reduced-motion: reduce) {
    .long-card {
        animation: none;
    }
}
