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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #334155;
    background: #f8fafc;
    line-height: 1.6;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    background: url('bg.png') center / cover no-repeat;
}

/* ─── Fixed Navbar ─── */

#navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.35);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0;
    padding: 0 16px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.nav-link {
    color: #475569;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 14px 10px;
    transition: color 0.2s, border-color 0.2s;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    letter-spacing: 0.02em;
}

.nav-link:hover {
    color: #0f172a;
}

.nav-link.active {
    color: #0284c7;
    border-bottom-color: #0284c7;
}

/* ─── Scroll Container ─── */

.scroll-container {
    height: 100vh;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
}

/* ─── Sections ─── */

.section {
    height: 100vh;
    scroll-snap-align: start;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 70px 24px 40px;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.20);
}

.section::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background: linear-gradient(
        160deg,
        rgba(255, 255, 255, 0.35) 0%,
        rgba(255, 255, 255, 0.06) 40%,
        rgba(255, 255, 255, 0) 60%,
        rgba(255, 255, 255, 0.10) 100%
    );
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

/* ─── Page-Flip Inner ─── */

.section-page {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transform-style: preserve-3d;
    backface-visibility: hidden;
    will-change: transform, opacity;
    border-radius: inherit;
    padding: inherit;
    box-sizing: border-box;
    perspective: 800px;
    position: relative;
    z-index: 1;
}

.section-content {
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
    position: relative;
}

.section-content h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 28px;
    letter-spacing: -0.02em;
    position: relative;
    padding-bottom: 12px;
}

.section-content h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 48px;
    height: 3px;
    background: #38bdf8;
    border-radius: 2px;
}

/* ─── Personal Info ─── */

.info-wrap {
    display: flex;
    gap: 32px;
    align-items: flex-start;
    position: relative;
}

.geek-tag {
    position: absolute;
    bottom: 4px;
    right: 12px;
    font-weight: 700;
    color: #dc2626;
    font-size: 0.85rem;
    white-space: nowrap;
}

.info-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    font-size: 0.95rem;
    color: #1e293b;
    flex: 1;
}

.info-grid a {
    color: #0284c7;
    text-decoration: none;
}

.info-grid a:hover {
    text-decoration: underline;
}

.profile-img {
    position: relative;
    width: 180px;
    height: 220px;
    border-radius: 12px;
    overflow: hidden;
    flex-shrink: 0;
}

.profile-img img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.4s ease;
}

.profile-img .img-hover {
    opacity: 0;
}

.profile-img:hover .img-default {
    opacity: 0;
}

.profile-img:hover .img-hover {
    opacity: 1;
}

.img-overlay-text {
    position: absolute;
    top: 4px;
    left: 0;
    right: 0;
    font-weight: 700;
    font-style: italic;
    color: #dc2626;
    font-size: 0.75rem;
    text-align: center;
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
    z-index: 2;
}

.profile-img:hover .img-overlay-text {
    opacity: 1;
}

/* ─── Skills ─── */

.skill-list {
    list-style: none;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 24px;
}

.skill-list li {
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 8px;
    font-size: 0.95rem;
    color: #1e293b;
}

/* ─── Timeline (Education) ─── */

.timeline {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.timeline-item {
    display: flex;
    gap: 20px;
    padding-left: 20px;
    border-left: 2px solid #e2e8f0;
    position: relative;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -5px;
    top: 6px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #38bdf8;
}

.timeline-year {
    min-width: 100px;
    font-weight: 600;
    color: #64748b;
    font-size: 0.9rem;
}

.timeline-desc {
    color: #1e293b;
    font-size: 0.95rem;
}

/* ─── Publication List ─── */

.pub-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.pub-list li {
    padding: 0;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 8px;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease, background 0.25s ease;
}

.pub-text {
    padding: 14px 18px 6px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.pub-text strong {
    color: #0f172a;
}



.pub-desc {
    font-size: 0.9rem;
    line-height: 1.5;
}

.pub-text[data-href] {
    cursor: pointer;
    position: relative;
    padding-left: 40px;
    padding-right: 40px;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease, background 0.25s ease;
}

.pub-text[data-href]::before,
.pub-text[data-href]::after {
    content: '\00BB';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.1rem;
    color: #64748b;
    opacity: 0.7;
    transition: opacity 0.25s ease;
    line-height: 1;
}

.pub-text[data-href]::before {
    left: 14px;
    content: '\00AB';
}

.pub-text[data-href]::after {
    right: 14px;
}

.pub-list li:has(.pub-text[data-href]):hover {
    transform: scale(1.04);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
    background: rgba(255, 255, 255, 0.8);
}

.pub-list li:has(.pub-text[data-href]):hover .pub-text[data-href]::before,
.pub-list li:has(.pub-text[data-href]):hover .pub-text[data-href]::after {
    opacity: 1;
}

.pub-illus {
    display: block;
    margin: 8px auto 0;
    max-width: 100%;
    border-radius: 6px;
}

.more-coming {
    margin-top: 20px;
    padding: 20px 24px;
    text-align: center;
    font-size: 1rem;
    color: #64748b;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 8px;
    border: 1px dashed rgba(100, 116, 139, 0.3);
    letter-spacing: 0.04em;
}

.see-more-btn {
    display: none;
    width: 100%;
    border: none;
    background: none;
    color: #38bdf8;
    font-weight: 700;
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0 18px 10px;
    text-align: left;
    letter-spacing: 0.02em;
    transition: color 0.2s;
}

.see-more-btn.visible {
    display: block;
}

.see-more-btn:hover {
    color: #0284c7;
}

/* ─── Telescope Time ─── */

.tel-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.tel-list li {
    padding: 0;
    font-size: 0.9rem;
    line-height: 1.5;
}

.tel-link {
    display: block;
    padding: 14px 42px;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    position: relative;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease, background 0.25s ease;
}

.tel-link::before,
.tel-link::after {
    content: '\00BB';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.1rem;
    color: #64748b;
    opacity: 0.7;
    transition: opacity 0.25s ease, transform 0.25s ease;
    line-height: 1;
}

.tel-link::before {
    left: 14px;
    content: '\00AB';
}

.tel-link::after {
    right: 14px;
}

.tel-link:hover {
    background: rgba(255, 255, 255, 0.8);
    transform: scale(1.04);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

.tel-link:hover::before,
.tel-link:hover::after {
    opacity: 1;
}

.tel-link strong {
    color: #0f172a;
}

/* ─── Projects ─── */

.proj-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.proj-list li {
    padding: 0;
    font-size: 0.9rem;
    line-height: 1.5;
}

.proj-link {
    display: block;
    padding: 14px 42px;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    position: relative;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease, background 0.25s ease;
}

.proj-link::before,
.proj-link::after {
    content: '\00BB';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.1rem;
    color: #64748b;
    opacity: 0.7;
    transition: opacity 0.25s ease, transform 0.25s ease;
    line-height: 1;
}

.proj-link::before {
    left: 14px;
    content: '\00AB';
}

.proj-link::after {
    right: 14px;
}

.proj-link:hover {
    background: rgba(255, 255, 255, 0.8);
    transform: scale(1.04);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

.proj-link:hover::before,
.proj-link:hover::after {
    opacity: 1;
}

.proj-link strong {
    color: #0f172a;
}

.proj-illus {
    width: 100%;
    border-radius: 0 0 8px 8px;
    display: block;
}

/* ─── Awards ─── */

.award-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.award-list li {
    padding: 12px 18px;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 8px;
    font-size: 0.9rem;
}

.award-list li strong {
    color: #0f172a;
}

.hobby-tags,
.skill-tags {
    position: relative;
    width: 100%;
    max-width: 520px;
    height: 50vh;
    min-height: 320px;
    overflow: hidden;
    margin: 0 auto;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    aspect-ratio: 1;
    border-radius: 50%;
    white-space: nowrap;
    text-align: center;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    font-size: 0.75rem;
    line-height: 1.2;
    color: #334155;
    border: 1px solid rgba(255, 255, 255, 0.4);
    transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
    cursor: default;
    box-sizing: border-box;
}

.tag:hover {
    transform: scale(1.12);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

.tag.highlighted {
    background: rgba(186, 230, 253, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    font-weight: 700;
    color: #0f172a;
    border-color: rgba(186, 230, 253, 0.75);
    box-shadow: 0 0 0 1px rgba(186, 230, 253, 0.3);
}

.tag[data-full] {
    position: relative;
    overflow: visible;
}

.tag[data-full]::before,
.tag[data-full]::after {
    display: none !important;
    content: none !important;
}

.tag[data-full] .full {
    display: none;
}

.tag[data-full]:hover {
    transform: scale(1.2);
    z-index: 10;
}

.tag[data-full]:hover .short {
    visibility: hidden;
}

.tag[data-full]:hover .full {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: max-content;
    max-width: 90vw;
    padding: 6px 14px;
    text-align: center;
    line-height: 1.25;
    font-size: 0.7rem;
    pointer-events: none;
}

.parens {
    font-size: 0.6rem;
    opacity: 0.75;
    line-height: 1.15;
}

/* ─── Responsive ─── */

@media (max-width: 768px) {
    .hobby-tags {
        min-height: 780px;
        max-width: 100%;
    }
    .skill-tags {
        min-height: 1463px;
        max-width: 100%;
    }
    #navbar {
        padding: 0 8px;
        gap: 0;
    }

    .nav-link {
        font-size: 0.7rem;
        padding: 10px 6px;
    }

    .section {
        padding: 60px 16px 30px;
    }

    .section-content h2 {
        font-size: 1.35rem;
        margin-bottom: 20px;
    }

    .info-grid {
        gap: 8px 16px;
        font-size: 0.9rem;
    }

    .skill-list {
        grid-template-columns: 1fr;
    }

    .timeline-item {
        flex-direction: column;
        gap: 4px;
    }

    .timeline-year {
        min-width: unset;
    }

    .section-content {
        max-width: 100%;
    }

    .info-wrap {
        flex-direction: column;
        align-items: center;
    }

    .profile-img {
        width: 150px;
        height: 190px;
    }

    .section {
        padding: 70px 16px 40px;
    }

    .section-page {
        align-items: flex-start;
    }

    #publications .section-page {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    #hobbies .section-page,
    #other-skills .section-page {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}

@media (min-width: 769px) {
    .hobby-tags,
    .skill-tags {
        height: 72vh;
        min-height: 500px;
        max-width: 600px;
    }

    #publications .section-page {
        overflow-y: auto;
        align-items: flex-start;
    }
}

/* ─── Edit Mode ─── */

.edit-mode .section-page {
    transform: none !important;
    opacity: 1 !important;
}

.edit-mode .section-content.editable {
    outline: 2px dashed #38bdf8;
    outline-offset: 6px;
    border-radius: 6px;
    padding: 16px;
    cursor: text;
    transition: outline-color 0.3s;
}

.edit-mode .section-content.editable:focus {
    outline-color: #0284c7;
    box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.15);
}

.edit-mode .skill-list li,
.edit-mode .pub-list li,
.edit-mode .tel-list li,
.edit-mode .proj-list li,
.edit-mode .award-list li,
.edit-mode .timeline-item {
    resize: both;
    overflow: auto;
    min-width: 100px;
    min-height: 40px;
}

.edit-mode .tag {
    cursor: move;
    user-select: none;
}

.edit-move-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    margin: 0 2px;
    border: 1px solid #94a3b8;
    background: #f1f5f9;
    color: #475569;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.7rem;
    line-height: 1;
    font-weight: 700;
    user-select: none;
}

.edit-move-btn:hover {
    background: #e2e8f0;
}

#edit-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 10000;
    background: #0f172a;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 24px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

.edit-label {
    color: #38bdf8;
    font-weight: 600;
    font-size: 0.9rem;
}

#export-btn {
    background: #38bdf8;
    color: #0f172a;
    border: none;
    padding: 8px 22px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
}

#export-btn:hover {
    background: #7dd3fc;
}

@media (max-width: 480px) {
    .nav-link {
        font-size: 0.6rem;
        padding: 8px 4px;
    }

    .section-content h2 {
        font-size: 1.15rem;
    }

    .info-grid {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .info-grid .label {
        margin-bottom: -4px;
    }

    #edit-bar {
        padding: 8px 12px;
    }

    .edit-label {
        font-size: 0.75rem;
    }

    #export-btn {
        padding: 6px 14px;
        font-size: 0.75rem;
    }
}

.evidence-btn {
    display: inline;
    background: none;
    border: none;
    color: #3b82f6;
    cursor: pointer;
    font-size: inherit;
    text-decoration: underline;
    padding: 0;
    margin-left: 4px;
    font-family: inherit;
}

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 10000;
    justify-content: center;
    align-items: center;
}

.modal-overlay.active {
    display: flex;
}

.modal-popup {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 12px;
    padding: 28px 24px 20px;
    max-width: 380px;
    width: 90%;
    position: relative;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}

.modal-close {
    position: absolute;
    top: 6px;
    right: 10px;
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: #94a3b8;
    line-height: 1;
    padding: 4px;
}

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

.modal-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.evidence-card {
    display: block;
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    text-decoration: none;
    color: #334155;
    font-size: 0.95rem;
    transition: background 0.15s;
    cursor: default;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.evidence-card:hover {
    background: rgba(255, 255, 255, 0.9);
}

a.evidence-card {
    color: #2563eb;
    font-weight: 500;
    cursor: pointer;
}

.evidence-footnote {
    text-align: center;
    color: #fff;
    font-size: 0.85rem;
    margin-top: 4px;
}

.lightbox-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 11000;
    background: rgba(0,0,0,0.55);
    justify-content: center;
    align-items: center;
}

.lightbox-overlay.active {
    display: flex;
}

.lightbox-popup {
    position: relative;
    max-width: 85vw;
    max-height: 85vh;
}

.lightbox-img {
    display: block;
    max-width: 85vw;
    max-height: 85vh;
    border-radius: 8px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.35);
}

.lightbox-close {
    position: absolute;
    top: -32px;
    right: 0;
    background: none;
    border: none;
    font-size: 1.6rem;
    color: #fff;
    cursor: pointer;
    line-height: 1;
    opacity: 0.8;
}

.lightbox-close:hover {
    opacity: 1;
}

.proj-illus {
    cursor: pointer;
}
