/* ================= ROOT ================= */

:root {
    --bg: #f5f6f8;
    --card: #fff;
    --text: #0b0b0b;
    --muted: #6b6b6b;
    --accent: #f07a1a;
    --green: #02f758;
    --radius: 20px;
    --feature-card-height: 340px;
}

/* ================= BASE ================= */

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    overflow-x: hidden;
    overflow-y: auto;
    cursor: none;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font: inherit;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

/* ================= LOADER ================= */

#loader {
    position: fixed;
    inset: 0;
    z-index: 100;
    width: 100%;
    height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: all;
    transition: opacity 0.5s ease-in-out;
}

#loader p {
    position: relative;
    z-index: 4;
    color: #fff;
    cursor: none;
    font-family: Helvetica, sans-serif;
}

canvas {
    position: absolute;
    inset: 0;
    z-index: 3;
    width: 100%;
    height: 100%;
}

/* ================= HEADER ================= */

.sleek-nav {
    width: 100%;
    margin-bottom: 3rem;
    padding: 20px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    font-family: "IBM Plex Mono", monospace;
    font-size: 16px;
    line-height: 1.35;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.nav-col {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-primary {
    color: var(--text);
    font-weight: 600;
    white-space: nowrap;
}

.nav-secondary {
    color: #888;
    font-weight: 400;
    white-space: nowrap;
}

.nav-secondary.links {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.nav-secondary.links a {
    color: inherit;
    transition: color 0.2s ease;
}

.nav-secondary.links a:hover {
    color: var(--text);
}

.nav-location,
#header-time {
    text-align: right;
}

#header-time {
    display: inline-block;
    min-width: 10ch;
}

/* ================= GRID / CARDS ================= */

.grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    margin-top: 26px;
    align-items: stretch;
}

.card {
    min-height: 120px;
    height: 100%;
    padding: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--card);
    border: 1.5px solid var(--text);
    border-radius: var(--radius);
    box-shadow: 5px 5px 0 var(--text);
    transition:
        transform 0.18s ease,
        box-shadow 0.18s ease,
        background-color 0.18s ease;
}

.card:hover {
    transform: translate(-2px, -2px);
    box-shadow: 7px 7px 0 var(--text);
}

.card h2,
.card h3 {
    margin-top: 0;
}

.card a:hover {
    background: var(--text);
    color: var(--bg);
}

/* ================= TIMELINE CARD ================= */

.card.timeline {
    position: relative;
    min-height: 280px;
}

.timeline-header {
    position: relative;
    z-index: 5;
    flex: 0 0 auto;
    margin-bottom: -35px;
}

.timeline-title-ellipse {
    display: inline-block;
    padding: 8px 18px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 999px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    font-size: 18px;
    font-weight: 700;
}

.timeline-content {
    position: relative;
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 40px 10px 10px 40px;
    scrollbar-width: thin;
    scrollbar-color: #ddd transparent;
    -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0) 0, rgba(0, 0, 0, 0.2) 30px, rgba(0, 0, 0, 1) 80px, rgba(0, 0, 0, 1) 100%);
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0) 0, rgba(0, 0, 0, 1) 60px, rgba(0, 0, 0, 1) calc(100% - 40px), rgba(0, 0, 0, 0) 100%);
}

.timeline-content::-webkit-scrollbar {
    width: 6px;
}

.timeline-content::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 999px;
}

.timeline-inner {
    position: relative;
}

.timeline-inner::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: -20px;
    z-index: 1;
    width: 2px;
    background: #111;
    opacity: 0.15;
}

.timeline-item {
    position: relative;
    padding: 14px 0;
}

.timeline-marker {
    position: absolute;
    top: 24px;
    left: -24px;
    z-index: 3;
    width: 10px;
    height: 10px;
    background: #000;
    border-radius: 50%;
}

.timeline-info {
    display: flex;
    flex-direction: column;
}

.item-title {
    color: #222;
    font-size: 16px;
    font-weight: 600;
}

.item-subtitle {
    margin-top: 3px;
    color: var(--muted);
    font-size: 14px;
}

/* ================= ABOUT ME ================= */

.card.about-me {
    grid-column: span 2;
    min-height: 280px;
}

.about-content {
    flex: 1 1 auto;
    max-width: 100%;
    padding-top: 50px;
    color: #444;
    font-size: 17px;
    line-height: 1.6;
    overflow-wrap: break-word;
}

.about-content p {
    margin: 0 0 16px;
    text-align: left;
    white-space: normal;
}

/* ================= FEATURE ROW ================= */

.feature-row {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 18px;
    align-items: stretch;
    transition: grid-template-columns 1.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.feature-row:has(.blog-panel:hover) {
    grid-template-columns: 1fr 2fr;
}

.feature-row:has(.publications-panel:hover) {
    grid-template-columns: 2fr 1fr;
}

.feature-panel {
    min-width: 0;
    overflow: hidden;
}

.publications-panel,
.blog-slider-card {
    height: var(--feature-card-height);
    min-height: var(--feature-card-height);
}

/* ================= SHARED FEATURE TYPOGRAPHY ================= */

.feature-title,
.pub-title,
.blog-post-title {
    margin: 0 0 12px;
    color: var(--text);
    font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: clamp(19px, 1.45vw, 25px);
    line-height: 1.2;
    font-weight: 800;
    letter-spacing: -0.035em;
    text-transform: none;
}

/* ================= PUBLICATIONS ================= */

.card.publications {
    grid-column: auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.pub-display-area {
    position: relative;
    flex: 1;
    min-height: 0;
    margin-top: 50px;
    overflow: hidden;
}

.pub-content {
    position: absolute;
    inset: 0;
    padding-right: 6px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
}

.pub-content.active {
    opacity: 1;
    visibility: visible;
}

.pub-authors {
    margin: 0 0 14px;
    color: var(--muted);
    font-size: 18px;
    font-weight: 300;
    line-height: 1.45;
}

.pub-description {
    color: var(--muted);
    font-size: 16px;
    line-height: 1.5;
}

.pub-meta-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 4px;
}

.pub-conference {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    margin: 0;
    padding: 6px 18px;
    background: #2f80ed;
    color: #fff;
    border-radius: 4px;
    box-shadow: 0 4px 10px rgba(47, 128, 237, 0.35);
    font-family: "IBM Plex Mono", monospace;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.02em;
}

.pub-link-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    padding: 6px 14px;
    color: #111;
    border: 1px solid #111;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    text-decoration: none;
    cursor: none;
    transition: all 0.3s ease;
}

.pub-link-btn:hover {
    background: #111;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.pub-dots-container,
.blog-dots-container {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.pub-dots-container {
    align-items: center;
    margin-top: 20px;
    padding: 8px 0 0;
}

.pub-dot,
.blog-dot {
    width: 12px;
    height: 12px;
    padding: 0;
    background: #d3d3d3;
    border: none;
    border-radius: 50%;
    cursor: none;
    transition: transform 0.3s ease, background 0.3s ease, opacity 0.3s ease;
}

.pub-dot:hover,
.blog-dot:hover {
    background: #999;
    transform: scale(1.25);
}

.pub-dot.active,
.blog-dot.active {
    background: #000;
    transform: scale(1.2);
}

.pub-dot.active {
    animation: dotPulse 0.4s ease 0.2s forwards;
}

/* ================= BLOG SLIDER CARD ================= */

.blog-slider-card {
    position: relative;
    justify-content: space-between;
}

.blog-slide {
    display: none;
    flex: 1;
    margin-top: 50px;
    padding: 0 46px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
}

.blog-slide.active {
    display: flex;
    opacity: 1;
    visibility: visible;
}

.blog-slide-content {
    width: 100%;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.blog-date {
    width: fit-content;
    margin: 0 0 12px;
    color: var(--muted);
    font-family: "IBM Plex Mono", monospace;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.blog-notes {
    margin: 0 0 18px;
    color: var(--muted);
    font-size: 17px;
    line-height: 1.5;
}

.blog-label-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: auto;
    margin-bottom: 0;
}

.blog-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    padding: 6px 14px;
    background: #000;
    color: #fff;
    border-radius: 999px;
    font-family: "IBM Plex Mono", monospace;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.blog-read-link {
    margin-left: auto;
}

.blog-nav {
    position: absolute;
    top: 50%;
    z-index: 10;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1.5px solid var(--text);
    border-radius: 50%;
    box-shadow: 3px 3px 0 var(--text);
    cursor: none;
    transform: translateY(-50%);
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.blog-nav:hover {
    background: var(--text);
    color: var(--bg);
    transform: translate(-2px, calc(-50% - 2px));
    box-shadow: 5px 5px 0 var(--text);
}

.blog-nav-left {
    left: 14px;
}

.blog-nav-right {
    right: 14px;
}

.blog-dots-container {
    padding-top: 8px;
}

/* ================= COLLAPSED FEATURE STATES ================= */
/* 1. Smooth transition base ONLY for blog-notes */
.blog-panel .blog-notes {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* 2. Hide blog-notes immediately when blog shrinks */
.feature-row:not(:has(.blog-panel:hover)) .blog-panel .blog-notes {
    opacity: 0;
    visibility: hidden;
    transition-delay: 0s;
}

/* 3. Show blog-notes smoothly when blog expands to 2/3 */
.feature-row:has(.blog-panel:hover) .blog-panel .blog-notes {
    opacity: 1;
    visibility: visible;
    transition-delay: 0.2s;
    /* Waits for the panel to expand before fading in */
}

/* --------------------------------------------------- */
/* 4. Your original display logic for the other elements */
/* --------------------------------------------------- */

.feature-row:not(:has(.blog-panel:hover)) .blog-panel .feature-secondary {
    display: none;
}

.feature-row:not(:has(.blog-panel:hover)) .publications-panel .feature-secondary {
    display: block;
}

.feature-row:has(.blog-panel:hover) .blog-panel .feature-secondary {
    display: block;
}

.feature-row:has(.blog-panel:hover) .publications-panel .feature-secondary {
    display: none;
}

.feature-row:has(.blog-panel:hover) .publications-panel .pub-extra-link {
    display: inline-flex;
}

.feature-row:not(:has(.blog-panel:hover)) .blog-panel .blog-slide {
    padding: 0 34px;
}

.feature-row:has(.blog-panel:hover) .publications-panel .pub-display-area {
    margin-top: 48px;
}

.feature-row:has(.blog-panel:hover) .publications-panel .pub-title,
.feature-row:not(:has(.blog-panel:hover)) .blog-panel .blog-post-title {
    font-size: clamp(20px, 1.2vw, 28px);
}

/* ================= RESUME BUTTON ================= */

.resume-slide-btn {
    position: relative;
    display: inline-flex;
    align-self: flex-start;
    flex: 0 0 auto;
    width: fit-content;
    padding: 14px 22px;
    overflow: hidden;
    background-color: #000;
    border-radius: 100px;
    font-family: sans-serif;
    text-decoration: none;
    cursor: none;
    transition: all 0.35s ease-out;
}

.resume-slide-btn .mask {
    position: relative;
    overflow: hidden;
}

.resume-slide-btn .slider {
    position: relative;
    top: 0;
    display: flex;
    animation: slideText 3s linear infinite;
    transition: top 0.75s ease-out;
}

.resume-slide-btn .slider p:nth-of-type(2) {
    position: absolute;
    left: calc(100% + 15px);
}

.resume-slide-btn p {
    margin: 0;
    color: #fff;
    white-space: nowrap;
}

.resume-slide-btn .animated-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.resume-slide-btn .animated-text span {
    position: relative;
    top: 18px;
    color: #000;
    transition: top 0.25s ease-out;
}

.resume-slide-btn .animated-text span:nth-child(5) {
    width: 0.35em;
}

.resume-slide-btn:hover {
    background-color: #c9ff18;
}

.resume-slide-btn:hover .slider {
    top: -18px;
}

.resume-slide-btn:hover .animated-text span {
    top: 0;
}

/* ================= CUSTOM CURSOR ================= */

.cursor-dot,
.cursor-outline {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 9999;
    pointer-events: none;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: opacity 0.3s ease-in-out, transform 0.1s ease-out;
}

.cursor-dot {
    width: 8px;
    height: 8px;
    background-color: var(--text);
}

.cursor-outline {
    width: 10px;
    height: 10px;
    background-color: var(--text);
    border: none;
    opacity: 0.5;
    filter: blur(1px);
}

a,
button,
.cta,
.pub-dot,
.blog-dot,
.blog-nav,
.pub-link-btn,
.resume-slide-btn {
    cursor: none;
}

/* ================= VIEW TRANSITIONS ================= */



/* ================= RESPONSIVE: TABLET ================= */

@media (max-width: 980px) {
    .container {
        padding: 16px;
    }

    .sleek-nav {
        flex-wrap: wrap;
        row-gap: 1.5rem;
        font-size: 14px;
    }

    .nav-col {
        width: 50%;
    }

    .nav-location,
    #header-time {
        text-align: left;
    }

    .grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .card.about-me {
        grid-column: span 2;
    }

    .feature-row,
    .feature-row:has(.blog-panel:hover),
    .feature-row:has(.publications-panel:hover) {
        grid-template-columns: 1fr;
    }

    .publications-panel,
    .blog-slider-card {
        height: auto;
        min-height: 280px;
    }

    .feature-row .feature-secondary {
        display: block !important;
    }

    .feature-row .pub-extra-link {
        display: inline-flex !important;
    }

    .blog-slide {
        padding: 0 34px;
    }
}

/* ================= RESPONSIVE: MOBILE ================= */

@media (max-width: 640px) {
    .container {
        padding: 14px;
    }

    .sleek-nav {
        flex-direction: column;
        gap: 1rem;
        padding: 16px;
        margin-bottom: 2rem;
        font-size: 13px;
    }

    .nav-col {
        width: 100%;
    }

    .hide-on-mobile {
        display: none;
    }

    .nav-secondary.links {
        gap: 14px;
    }

    .grid {
        grid-template-columns: 1fr;
        gap: 16px;
        align-items: start;
    }

    .card,
    .card.about-me,
    .card.timeline,
    .card.publications {
        grid-column: span 1 !important;
        width: 100%;
        min-width: 0;
        height: auto !important;
        min-height: 0;
        align-self: start;
    }

    .card:hover {
        transform: none;
        box-shadow: 5px 5px 0 var(--text);
    }

    .card.timeline {
        min-height: 240px;
    }

    .about-content {
        padding-top: 55px;
        line-height: 1.6;
        overflow-wrap: break-word;
        word-break: break-word;
    }

    .about-content p {
        margin-bottom: 12px;
    }

    .pub-display-area {
        position: relative;
        flex: none;
        min-height: auto;
        margin-top: 55px;
        overflow: visible;
    }

    .pub-content {
        position: relative;
        inset: auto;
        display: none;
        height: auto;
        padding-right: 0;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.25s ease;
    }

    .pub-content.active {
        display: block;
        opacity: 1;
        visibility: visible;
    }

    .pub-authors,
    .blog-notes {
        font-size: 15px;
        line-height: 1.4;
    }

    .pub-description {
        font-size: 15px;
    }

    .pub-meta-row {
        gap: 10px;
    }

    .pub-conference,
    .pub-link-btn {
        padding: 7px 12px;
        font-size: 12px;
    }

    .blog-label-row {
        align-items: flex-start;
    }

    .blog-read-link {
        margin-left: 0;
    }

    .timeline-content {
        padding: 40px 8px 8px 34px;
    }

    .timeline-inner::before {
        left: -18px;
    }

    .timeline-marker {
        left: -22px;
    }

    .resume-slide-btn {
        padding: 12px 18px;
    }

    .feature-row .blog-panel .blog-notes,
    .feature-row:not(:has(.blog-panel:hover)) .blog-panel .blog-notes,
    .feature-row:has(.blog-panel:hover) .blog-panel .blog-notes {
        opacity: 1 !important;
        visibility: visible !important;
        max-height: none !important;
        margin-bottom: 18px !important;
        overflow: visible !important;
        pointer-events: auto !important;
        transform: none !important;
        transition: none !important;
    }
}

/* ================= FOOTER ================= */

.site-footer {
    width: 100%;
    padding: 16px 20px 20px;
    color: #888;
    font-family: "IBM Plex Mono", monospace;
    font-size: 12px;
    line-height: 1.5;
    letter-spacing: 0.05em;
    text-align: center;
    text-transform: uppercase;
}

.site-footer p {
    margin: 0;
}

.site-footer a {
    color: inherit;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

.site-footer a:hover {
    color: var(--text);
}