/* ---------- Reset & base ---------- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
}

body {
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 400;
    background: #0a0a0a;
    color: #d1d0c5;
    line-height: 1.65;
    font-size: 17px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: #d1d0c5;
    text-decoration: none;
    border-bottom: 1px solid rgba(209, 208, 197, 0.3);
    transition: color 0.2s ease, border-color 0.2s ease;
}

a:hover {
    color: #ffffff;
    border-color: #ffffff;
}

em {
    font-style: italic;
}

/* ---------- Top nav ---------- */
.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(10, 10, 10, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 100;
}

.topbar-inner {
    max-width: 1000px;
    margin: 0 auto;
    padding: 16px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: 'Instrument Serif', serif;
    font-size: 20px;
    color: #ffffff;
    border: none;
    letter-spacing: 0.02em;
}

.logo:hover {
    color: #d1d0c5;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 28px;
}

.nav-links a {
    font-family: 'Fraunces', serif;
    font-size: 14px;
    font-weight: 400;
    color: #888888;
    border: none;
    letter-spacing: 0.02em;
}

.nav-links a:hover {
    color: #ffffff;
}

/* ---------- Main layout ---------- */
main {
    max-width: 760px;
    margin: 0 auto;
    padding: 120px 40px 60px;
}

.section {
    padding: 60px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.section:last-of-type {
    border-bottom: none;
}

/* ---------- Section headings ---------- */
.section-heading {
    font-family: 'Instrument Serif', serif;
    font-size: 44px;
    font-weight: 400;
    color: #ffffff;
    margin-bottom: 40px;
    letter-spacing: -0.01em;
}

.sub-heading {
    font-family: 'Instrument Serif', serif;
    font-size: 28px;
    font-weight: 400;
    color: #ffffff;
    margin: 0 0 24px;
    letter-spacing: -0.005em;
}

/* ---------- About section ---------- */
.hero-row {
    display: grid;
    grid-template-columns: 1fr 180px;
    gap: 40px;
    align-items: center;
    margin-bottom: 48px;
}

.hero-name {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.chinese-name {
    font-family: 'Songti SC', 'STSong', SimSun, serif;
    font-size: 56px;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 8px;
    letter-spacing: 0.04em;
    line-height: 1;
}

.english-name {
    font-family: 'Instrument Serif', serif;
    font-size: 28px;
    font-weight: 400;
    font-style: italic;
    color: #d1d0c5;
    letter-spacing: 0.01em;
    line-height: 1.2;
}

.hero-photo img {
    width: 100%;
    height: auto;
    border-radius: 4px;
    filter: saturate(0.9);
    display: block;
}

.about-text p {
    margin-bottom: 16px;
}

.about-text p:last-child {
    margin-bottom: 0;
}

.contact-line {
    margin-top: 24px !important;
    font-size: 16px;
    color: #aaa;
}

.contact-line .label {
    font-family: 'Instrument Serif', serif;
    font-style: italic;
    color: #888888;
}

.about-photo img {
    width: 100%;
    height: auto;
    border-radius: 4px;
    filter: saturate(0.9);
}

/* ---------- Item cards (Research, Build) ---------- */
.item {
    margin-bottom: 36px;
}

.item:last-child {
    margin-bottom: 0;
}

.item-title {
    font-family: 'Instrument Serif', serif;
    font-size: 22px;
    font-weight: 400;
    color: #ffffff;
    margin-bottom: 10px;
    letter-spacing: 0;
}

.item-date {
    font-family: 'Fraunces', serif;
    font-style: italic;
    font-size: 15px;
    color: #888888;
    font-weight: 400;
    margin-left: 8px;
}

.item p {
    margin-bottom: 8px;
}

.item.placeholder .item-title {
    color: #666666;
}

.muted {
    color: #888888;
    font-style: italic;
}

.external {
    font-family: 'Fraunces', serif;
    font-size: 15px;
    color: #aaa;
}

.placeholder-link {
    color: #888888;
    font-style: italic;
}

/* ---------- Music section ---------- */
#stl-viewer {
    width: 100%;
    max-width: 500px;
    aspect-ratio: 1 / 1;
    background: #0a0a0a;
    margin: 0 auto 40px;
}

.music-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}

.sc-player {
    background: #111;
    border-radius: 8px;
    overflow: hidden;
}

.sc-player iframe {
    display: block;
}

.link-row {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

/* ---------- Whatnot links ---------- */
.link-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 60px;
}

.link-list a {
    font-family: 'Instrument Serif', serif;
    font-size: 26px;
    color: #ffffff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 4px;
    width: fit-content;
}

.link-list a:hover {
    color: #d1d0c5;
    border-color: #ffffff;
}

.subsection {
    margin-bottom: 60px;
}

.subsection:last-child {
    margin-bottom: 0;
}

.subsection p {
    margin-bottom: 16px;
}

/* ---------- Questions list ---------- */
.questions {
    list-style: none;
    counter-reset: q;
    padding: 0;
}

.questions li {
    counter-increment: q;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    line-height: 1.7;
    color: rgba(209, 208, 197, 0.85);
    padding-left: 40px;
    position: relative;
    margin-bottom: 20px;
}

.questions li::before {
    content: counter(q, decimal-leading-zero);
    position: absolute;
    left: 0;
    top: 0;
    color: #555555;
    font-size: 13px;
}

/* ---------- Rules list (numbered) ---------- */
.rules {
    list-style: none;
    counter-reset: r;
    padding: 0;
    margin: 20px 0;
}

.rules li {
    counter-increment: r;
    padding-left: 32px;
    position: relative;
    margin-bottom: 12px;
}

.rules li::before {
    content: counter(r) ".";
    font-family: 'Instrument Serif', serif;
    font-style: italic;
    position: absolute;
    left: 0;
    color: #888888;
}

/* ---------- Animal grid ---------- */
.animal-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin: 32px 0;
}

.animal-block {
    font-family: 'Instrument Serif', serif;
    font-size: 26px;
    padding: 36px 16px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.15s ease, opacity 0.15s ease;
    user-select: none;
}

.animal-block:hover {
    transform: scale(1.02);
    opacity: 0.92;
}

.elephant { background: #c41e2a; color: #ffffff; }
.beaver   { background: #f5d000; color: #0a0a0a; }
.owl      { background: #00c853; color: #0a0a0a; }
.dolphin  { background: #7c4dff; color: #ffffff; }
.bookworm { background: #64b5f6; color: #0a0a0a; }
.bees     { background: #1a1a1a; color: #ffffff; border: 1px solid #2a2a2a; }

/* ---------- Popup ---------- */
.popup-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
}

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

.popup-content {
    background: #1a1a1a;
    padding: 40px;
    border-radius: 4px;
    max-width: 500px;
    width: 100%;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.popup-close {
    position: absolute;
    top: 12px;
    right: 18px;
    font-size: 32px;
    color: #888888;
    cursor: pointer;
    line-height: 1;
}

.popup-close:hover {
    color: #ffffff;
}

.popup-title {
    font-family: 'Instrument Serif', serif;
    font-size: 32px;
    font-weight: 400;
    color: #ffffff;
    margin-bottom: 16px;
}

.popup-description {
    color: rgba(209, 208, 197, 0.85);
    font-size: 16px;
    line-height: 1.7;
}

/* ---------- Footer ---------- */
footer {
    text-align: center;
    padding: 60px 0 20px;
    color: #555555;
    font-size: 13px;
}

footer p {
    margin: 0;
}

/* ---------- Responsive ---------- */
@media (max-width: 700px) {
    main {
        padding: 100px 24px 40px;
    }

    .topbar-inner {
        padding: 14px 24px;
    }

    .nav-links {
        gap: 18px;
    }

    .nav-links a {
        font-size: 13px;
    }

    .logo {
        font-size: 18px;
    }

    .chinese-name {
        font-size: 64px;
    }

    .english-name {
        font-size: 26px;
    }

    .section-heading {
        font-size: 36px;
    }

    .hero-row {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .hero-name {
        align-items: center;
    }
    
    .hero-photo {
        max-width: 200px;
        margin: 0 auto;
    }

    .music-grid {
        grid-template-columns: 1fr;
    }

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

    .animal-block {
        font-size: 22px;
        padding: 28px 12px;
    }
}

@media (max-width: 480px) {
    .nav-links {
        gap: 12px;
    }

    .nav-links a {
        font-size: 12px;
    }

    .logo {
        font-size: 16px;
    }
}