/* index page structure and print styles. */
/* Global Configuration */
:root {
    --primary: #2563eb;
    --bg-body: #f7f5f0;
    --bg-card: #ffffff;
    --text-main: #1c1917;
    --text-sub: #57534e;
    --border: #e5e1d8;
    --shadow: 0 4px 14px rgba(0, 0, 0, 0.05);
    /* Teal accent (Now badge, fun-fact hover, guestbook icon…) */
    --tl-accent: #14c3b6;
    --tl-accent-soft: rgba(20, 195, 182, 0.18);
    --tl-glow: rgba(20, 195, 182, 0.45);
    /* Timeline: OSU scarlet */
    --timeline-accent: #bb0000;
    --timeline-accent-soft: rgba(187, 0, 0, 0.14);
    --timeline-glow: rgba(187, 0, 0, 0.35);
}

[data-theme="dark"] {
    --primary: #3b82f6;
    --bg-body: #000000;
    --bg-card: #0c0c0e;
    --text-main: #f1f5f9;
    --text-sub: #94a3b8;
    --border: #1f1f24;
    --shadow: 0 10px 25px -3px rgba(0, 0, 0, 0.85);
    --tl-accent: #3ee9db;
    --tl-accent-soft: rgba(62, 233, 219, 0.18);
    --tl-glow: rgba(62, 233, 219, 0.6);
    --timeline-accent: #f0433f;
    --timeline-accent-soft: rgba(240, 67, 63, 0.18);
    --timeline-glow: rgba(240, 67, 63, 0.55);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
    transition: background-color 0.3s, color 0.3s, border-color 0.3s;
}

html,
body {
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
}

body::before,
body::after {
    display: none !important;
}

html {
    scroll-behavior: smooth;
}


/* ---- Canvas+ : badge above the name + featured project ---- */
.cp-badge { display: inline-flex; align-items: center; gap: 10px; margin: 0 auto 18px; padding: 6px 16px 6px 6px; border-radius: 999px;
    background: var(--bg-card); border: 1px solid var(--border); box-shadow: 0 6px 20px -8px rgba(0, 0, 0, .18); color: var(--text-main);
    font-weight: 600; font-size: 15px; line-height: 1.2; text-decoration: none; transition: transform .2s, box-shadow .2s, border-color .2s; }
.cp-badge:hover { transform: translateY(-2px); border-color: var(--timeline-accent); box-shadow: 0 10px 26px -8px var(--timeline-glow); }
.cp-badge img { width: 28px; height: 28px; border-radius: 8px; flex: none; }
.cp-badge b { color: var(--timeline-accent); }
.cp-badge .cp-sub { color: var(--text-sub); font-weight: 500; }
.cp-badge .cp-arrow { color: var(--text-sub); transition: transform .2s; }
.cp-badge:hover .cp-arrow { transform: translateX(3px); }
.card.cp-feature { display: grid; grid-template-columns: 1.2fr .8fr; gap: 28px; align-items: start; padding: 28px; margin-bottom: 1.5rem;
    border: 1px solid var(--timeline-accent-soft); background: linear-gradient(135deg, var(--bg-card) 55%, var(--timeline-accent-soft)); }
.cp-feature .cp-label { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--timeline-accent);
    background: var(--timeline-accent-soft); border-radius: 999px; padding: 4px 10px; margin-bottom: 12px; }
.cp-feature h3 { display: flex; align-items: center; gap: 12px; margin: 0 0 6px; }
.cp-feature h3 img { width: 40px; height: 40px; border-radius: 10px; flex: none; }
.cp-feature p { color: var(--text-sub); margin: 10px 0 14px; }
.cp-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.cp-tags span { font-size: 12px; font-weight: 600; background: var(--bg-body); border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; color: var(--text-main); }
.cp-links { display: flex; flex-wrap: wrap; gap: 10px; }
.cp-links a { font-size: 14px; font-weight: 700; padding: 9px 16px; border-radius: 999px; text-decoration: none; transition: transform .2s; }
.cp-links a:hover { transform: translateY(-2px); }
.cp-links .cp-store { background: var(--text-main); color: var(--bg-card); }
.cp-links .cp-site { border: 1px solid var(--border); color: var(--text-main); }
.cp-live { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.cp-live iframe { display: block; width: 100%; max-width: 400px; height: 526px; border: 0; border-radius: 18px; background: transparent;
    box-shadow: 0 24px 60px -24px rgba(0, 0, 0, .4); color-scheme: normal; }
.cp-live-hint { font-size: 12px; color: var(--text-sub); }
@media (max-width: 760px) {
    .card.cp-feature { grid-template-columns: 1fr; padding: 22px; }
    .cp-live iframe { max-width: 100%; }
    .cp-badge { font-size: 13.5px; }
    .cp-badge .cp-sub { display: none; }
}

/* Dynamic Scroll animation */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(40px) scale(0.95);
    transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.animate-on-scroll.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.delay-100 {
    transition-delay: 100ms;
}

.delay-200 {
    transition-delay: 200ms;
}

.delay-300 {
    transition-delay: 300ms;
}

/* --------------------------------------------------------------------------
   Capsule Navigation Bar (Pill Header) - Always Fixed to Viewport Top
   -------------------------------------------------------------------------- */
body {
    padding-top: 5.5rem !important;
}

html {
    scroll-behavior: smooth !important;
    scroll-padding-top: 6rem !important;
}

section,
footer {
    scroll-margin-top: 6rem !important;
}

nav,
nav.capsule-nav {
    position: fixed !important;
    top: 1.1rem !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    z-index: 99999 !important;
    max-width: 1180px !important;
    width: min(1180px, calc(100% - 2.4rem)) !important;
    margin: 0 !important;
    padding: 0.5rem 1.4rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    border-radius: 999px !important;
    background: rgba(255, 255, 255, 0.88) !important;
    backdrop-filter: blur(20px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.03) !important;
    transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease !important;
}

[data-theme="dark"] nav,
[data-theme="dark"] nav.capsule-nav {
    background: rgba(16, 16, 20, 0.88) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
}
.logo{
    display: flex !important;
    align-items: center !important;
    gap: 0.65rem !important;
    text-decoration: none !important;
    flex-shrink: 0 !important;
}

.brand-avatar {
    width: 32px !important;
    height: 32px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 50% !important;
    overflow: hidden !important;
}

.brand-title,
.portfolio-title {
    font-size: 1.02rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.02em !important;
    text-transform: none !important;
    color: #1c1917 !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
}

[data-theme="dark"] .brand-title,
[data-theme="dark"] .portfolio-title {
    color: #f4f4f5 !important;
}

/* The iOS Fluid Spring Slider Pill */
.nav-slider-pill {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    border-radius: 999px !important;
    background: #18181b !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18), 0 1px 3px rgba(0, 0, 0, 0.12) !important;
    pointer-events: none !important;
    z-index: 1 !important;
    opacity: 0;
    will-change: transform, width;
    transition: transform 0.42s cubic-bezier(0.2, 0.9, 0.2, 1.15), width 0.42s cubic-bezier(0.2, 0.9, 0.2, 1.15), height 0.42s ease, opacity 0.25s ease !important;
}

[data-theme="dark"] .nav-slider-pill {
    background: #f4f4f5 !important;
    box-shadow: 0 4px 16px rgba(255, 255, 255, 0.25), 0 1px 3px rgba(255, 255, 255, 0.15) !important;
}

.nav-actions,
.nav-right,
.nav-container {
    display: flex !important;
    align-items: center !important;
    gap: 0.55rem !important;
    position: static !important;
}

.nav-resume-btn {
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.3rem !important;
    font-size: 0.82rem !important;
    font-weight: 500 !important;
    color: #27272a !important;
    text-decoration: none !important;
    border: 1px solid rgba(0, 0, 0, 0.14) !important;
    border-radius: 999px !important;
    padding: 0.38rem 0.9rem !important;
    background: rgba(255, 255, 255, 0.7) !important;
    transition: all 0.2s ease !important;
    white-space: nowrap !important;
}

.nav-resume-btn:hover {
    background: #ffffff !important;
    border-color: rgba(0, 0, 0, 0.3) !important;
    color: #000000 !important;
    transform: translateY(-1px) !important;
}

[data-theme="dark"] .nav-resume-btn {
    border: 1px solid rgba(255, 255, 255, 0.18) !important;
    color: #e4e4e7 !important;
    background: rgba(255, 255, 255, 0.04) !important;
}

[data-theme="dark"] .nav-resume-btn:hover {
    background: rgba(255, 255, 255, 0.12) !important;
    border-color: rgba(255, 255, 255, 0.35) !important;
    color: #ffffff !important;
}

.lang-toggle {
    background: rgba(255, 255, 255, 0.7) !important;
    border: 1px solid rgba(0, 0, 0, 0.14) !important;
    color: #44403c !important;
    padding: 0.38rem 0.85rem !important;
    border-radius: 999px !important;
    font-size: 0.82rem !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    white-space: nowrap !important;
}

.lang-toggle:hover {
    background: #ffffff !important;
    border-color: rgba(0, 0, 0, 0.3) !important;
    color: #1c1917 !important;
    transform: translateY(-1px) !important;
}

[data-theme="dark"] .lang-toggle {
    background: rgba(255, 255, 255, 0.04) !important;
    border: 1px solid rgba(255, 255, 255, 0.18) !important;
    color: #e2e8f0 !important;
}

[data-theme="dark"] .lang-toggle:hover {
    background: rgba(255, 255, 255, 0.12) !important;
    border-color: rgba(255, 255, 255, 0.35) !important;
    color: #ffffff !important;
}

#theme-toggle,
.theme-btn,
#theme-btn {
    width: 34px !important;
    height: 34px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: rgba(255, 255, 255, 0.7) !important;
    border: 1px solid rgba(0, 0, 0, 0.14) !important;
    border-radius: 50% !important;
    color: #44403c !important;
    font-size: 0.95rem !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    padding: 0 !important;
}

#theme-toggle:hover,
.theme-btn:hover,
#theme-btn:hover {
    background: #ffffff !important;
    border-color: rgba(0, 0, 0, 0.3) !important;
    color: #1c1917 !important;
    transform: scale(1.06) !important;
}

[data-theme="dark"] #theme-toggle,
[data-theme="dark"] .theme-btn,
[data-theme="dark"] #theme-btn {
    background: rgba(255, 255, 255, 0.04) !important;
    border: 1px solid rgba(255, 255, 255, 0.18) !important;
    color: #f1f5f9 !important;
}

[data-theme="dark"] #theme-toggle:hover,
[data-theme="dark"] .theme-btn:hover,
[data-theme="dark"] #theme-btn:hover {
    background: rgba(255, 255, 255, 0.12) !important;
    border-color: rgba(255, 255, 255, 0.35) !important;
    color: #ffffff !important;
}

/* --------------------------------------------------------------------------
   Capsule Navbar Responsive Behavior (Desktop -> Tablet -> Mobile)
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
    .nav-resume-btn {
        width: 34px;
        height: 34px;
        padding: 0 !important;
        justify-content: center;
        border-radius: 50% !important;
    }

    .nav-resume-btn .nav-resume-label {
        display: none;
    }

    .nav-resume-btn .nav-resume-icon {
        display: inline-block;
    }

    .nav-item-about,
    .nav-item-skills {
        display: none !important;
    }
}

@media (max-width: 768px) {
    body {
        padding-top: 4.5rem !important;
    }

    nav,
    nav.capsule-nav {
        width: calc(100% - 1.4rem) !important;
        max-width: 100% !important;
        top: 0.65rem !important;
        padding: 0.35rem 0.85rem !important;
        box-sizing: border-box !important;
    }
    .logo{
        gap: 0.45rem !important;
        flex-shrink: 0 !important;
    }

    .brand-avatar {
        width: 26px !important;
        height: 26px !important;
    }

    .brand-avatar svg {
        width: 26px !important;
        height: 26px !important;
    }

    .brand-title,
    .portfolio-title {
        font-size: 0.88rem !important;
        letter-spacing: 0.01em !important;
    }.nav-item-hero,
    .nav-item-about,
    .nav-item-experience,
    .nav-item-projects,
    .nav-item-skills{
        display: none !important;
    }

    .nav-actions {
        gap: 0.38rem !important;
        flex-shrink: 0 !important;
    }

    .nav-resume-btn {
        width: 28px;
        height: 28px;
        font-size: 0.82rem !important;
    }

    .lang-toggle {
        padding: 0.3rem 0.55rem !important;
        font-size: 0.75rem !important;
    }

    #theme-toggle,
    .theme-btn,
    #theme-btn {
        width: 28px !important;
        height: 28px !important;
        font-size: 0.82rem !important;
    }
}

/* --------------------------------------------------------------------------
   Collapsible Experience & Project Cards (Mobile-only Accordion)
   -------------------------------------------------------------------------- */
.card-toggle-btn {
    display: none !important;
}

/* --------------------------------------------------------------------------
   Collapsible Experience, Project & Skills Cards (Universal Accordion)
   -------------------------------------------------------------------------- */
.collapsible-card {
    cursor: pointer;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease, border-color 0.25s ease !important;
}

.collapsible-card:active {
    transform: scale(0.995);
}

/* High-End Black & White Luxury Pill Button */
.card-toggle-btn {
    display: inline-flex !important;
    align-items: center;
    gap: 0.45rem;
    margin-top: 0.85rem;
    margin-bottom: 0.15rem;
    padding: 0.4rem 1.05rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.015em;
    color: #1c1917;
    background: rgba(28, 25, 23, 0.05);
    border: 1px solid rgba(28, 25, 23, 0.16);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    width: fit-content;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
    cursor: pointer;
}

/* Light theme hover */
.card-toggle-btn:hover,
.collapsible-card:hover .card-toggle-btn {
    background: #1c1917;
    color: #ffffff;
    border-color: #1c1917;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}

/* Dark theme base */
[data-theme="dark"] .card-toggle-btn {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.18);
    color: #f4f4f5;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* Dark theme hover */
[data-theme="dark"] .card-toggle-btn:hover,
[data-theme="dark"] .collapsible-card:hover .card-toggle-btn {
    background: #ffffff;
    color: #000000;
    border-color: #ffffff;
    box-shadow: 0 4px 18px rgba(255, 255, 255, 0.25);
}

/* Arrow indicator */
.card-toggle-arrow {
    display: inline-block;
    font-size: 1.05rem;
    line-height: 1;
    font-weight: 700;
    transition: transform 0.35s cubic-bezier(0.2, 0.9, 0.2, 1.15);
    transform-origin: center center;
    color: currentColor;
}

.collapsible-card.is-expanded .card-toggle-arrow {
    transform: rotate(90deg);
}

/* When expanded, slight active tone */
.collapsible-card.is-expanded .card-toggle-btn {
    background: rgba(28, 25, 23, 0.09);
    border-color: rgba(28, 25, 23, 0.28);
    color: #1c1917;
}

[data-theme="dark"] .collapsible-card.is-expanded .card-toggle-btn {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.3);
    color: #ffffff;
}

.collapsible-card.is-expanded .card-toggle-btn:hover,
.collapsible-card.is-expanded:hover .card-toggle-btn {
    background: #1c1917;
    color: #ffffff;
    border-color: #1c1917;
}

[data-theme="dark"] .collapsible-card.is-expanded .card-toggle-btn:hover,
[data-theme="dark"] .collapsible-card.is-expanded:hover .card-toggle-btn {
    background: #ffffff;
    color: #000000;
    border-color: #ffffff;
}

/* Collapsible body */
.card-collapsible-body {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
    transition: max-height 0.45s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.35s ease, margin-top 0.3s ease;
    margin-top: 0;
    width: 100%;
}

.collapsible-card.is-expanded .card-collapsible-body {
    max-height: 2500px;
    opacity: 1;
    pointer-events: auto;
    margin-top: 0.95rem;
}

/* Hero */
.hero {
    padding: 5rem 5%;
    text-align: center;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.1) 0%, rgba(37, 99, 235, 0.05) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
}

@keyframes tech-shockwave {
    0% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.8), 0 0 0 0 rgba(96, 165, 250, 0.8);
    }

    100% {
        box-shadow: 0 0 0 60px rgba(37, 99, 235, 0), 0 0 0 120px rgba(96, 165, 250, 0);
    }
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.5);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.hero h1 {
    font-size: 3rem;
    color: var(--text-main);
    margin-bottom: 1rem;
    line-height: 1.2;
}

.hero p {
    font-size: 1.2rem;
    color: var(--text-sub);
    max-width: 800px;
    margin: 0 auto 2rem;
}

/* Rotating fun fact under the hero subtitle */
.fun-fact {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    margin: -0.75rem auto 2rem;
    padding: 0.45rem 1rem 0.45rem 0.8rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.45);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: var(--text-sub);
    font-size: 0.9rem;
    line-height: 1.4;
    cursor: pointer;
    user-select: none;
    max-width: min(92vw, 560px);
    transition: opacity 0.35s ease, transform 0.35s ease, border-color 0.2s ease;
}

.fun-fact:hover {
    border-color: var(--tl-accent);
}

.fun-fact.swap {
    opacity: 0;
    transform: translateY(6px);
}

.fun-fact .fun-fact-emoji {
    font-size: 1.05rem;
    line-height: 1;
    flex-shrink: 0;
}

.fun-fact .fun-fact-text {
    text-align: left;
}

.fun-fact .fun-fact-next {
    flex-shrink: 0;
    font-size: 0.75rem;
    opacity: 0.45;
    transition: opacity 0.2s ease, transform 0.3s ease;
}

.fun-fact:hover .fun-fact-next {
    opacity: 0.9;
    transform: rotate(180deg);
}

[data-theme="dark"] .fun-fact {
    border-color: rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.btn-container {
    display: grid;
    grid-template-columns: repeat(3, minmax(160px, 1fr));
    gap: 1rem 1.5rem;
    justify-items: stretch;
    margin-top: 20px;
}

.btn-container .btn {
    width: 100%;
    justify-content: center;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem 1.8rem;
    background-color: var(--primary);
    color: white;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    transition: transform 0.2s, filter 0.2s;
    border: none;
}

.btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
}

.btn-outline {
    background-color: transparent;
    color: var(--text-main);
    border: 1.5px solid var(--text-main);
}

.btn-outline:hover {
    background-color: var(--text-main);
    color: var(--bg-card);
}

#leetcode .btn-outline {
    background: transparent !important;
    border: 1.5px solid #1c1917 !important;
    color: #1c1917 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
}

#leetcode .btn-outline:hover {
    background: #1c1917 !important;
    border-color: #1c1917 !important;
    color: #ffffff !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12) !important;
}

[data-theme="dark"] #leetcode .btn-outline {
    background: rgba(255, 255, 255, 0.06) !important;
    border: 1.5px solid rgba(255, 255, 255, 0.25) !important;
    color: #f3f4f6 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4) !important;
}

[data-theme="dark"] #leetcode .btn-outline:hover {
    background: #ffffff !important;
    border-color: #ffffff !important;
    color: #000000 !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 18px rgba(255, 255, 255, 0.2) !important;
}

.btn-dark {
    background-color: var(--text-main);
    color: var(--bg-card);
}

.btn-dark:hover {
    opacity: 0.9;
}

.btn-insta {
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    color: white;
}

section {
    padding: 4rem 5%;
    max-width: 1200px;
    margin: 0 auto;
}

h2 {
    font-size: 2rem;
    color: var(--text-main);
    margin-bottom: 2rem;
    border-left: none !important;
    padding-left: 0 !important;
    display: flex;
    align-items: baseline;
    gap: 0.55rem;
}

#about h2::before {
    content: "01/";
}

#experience h2::before {
    content: "02/";
}

#leetcode h2::before {
    content: "03/";
}

#projects h2::before {
    content: "04/";
}

#skills h2::before {
    content: "05/";
}

#guestbook h2::before {
    content: "06/";
}

/* Guestbook (giscus) */
.guestbook-intro {
    color: var(--text-sub);
    margin: -0.75rem 0 1.5rem;
    line-height: 1.6;
}

.guestbook-card {
    padding: 1.25rem 1.5rem 0.75rem;
}

.guestbook-card:hover {
    transform: none;
}

.guestbook-note {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 0.5rem 1.5rem;
    color: var(--text-sub);
    line-height: 1.6;
}

.guestbook-note i {
    font-size: 1.4rem;
    color: var(--tl-accent);
}

.giscus,
.giscus-frame {
    width: 100%;
}

section>h2::before {
    display: inline-block;
    font-size: 0.88em;
    font-weight: 700;
    color: var(--text-sub);
    letter-spacing: -0.01em;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
    flex-shrink: 0;
    user-select: none;
}

[data-theme="dark"] section>h2::before {
    color: #94a3b8;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

/* "Now" — what I'm up to at the moment (edit the text in the #now section) */
#now {
    padding-top: 1rem;
    padding-bottom: 2rem;
}

#now h2 {
    margin-bottom: 1.25rem;
}

.now-updated {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-left: 0.25rem;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    /* "live" green, same hue as the online dot in the footer */
    color: #15803d;
    background: rgba(34, 197, 94, 0.14);
    vertical-align: middle;
}

[data-theme="dark"] .now-updated {
    color: #4ade80;
    background: rgba(74, 222, 128, 0.14);
}

.now-updated::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5);
    animation: now-pulse 1.8s ease-out infinite;
}

@keyframes now-pulse {
    0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.55); }
    70% { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.now-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 1rem;
}

.now-card {
    padding: 1.25rem 1.35rem;
}

.now-card:hover {
    transform: translateY(-3px);
}

.now-card .now-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-sub);
    margin-bottom: 0.55rem;
}

.now-card .now-label i {
    color: var(--tl-accent);
    font-size: 0.85rem;
}

.now-card .now-main {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
    line-height: 1.4;
}

.now-card .now-sub {
    margin-top: 0.35rem;
    font-size: 0.86rem;
    color: var(--text-sub);
    line-height: 1.5;
}

.now-card .now-sub a {
    color: var(--primary);
    text-decoration: none;
}

.now-card .now-sub a:hover {
    text-decoration: underline;
}

.card {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 16px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: transform 0.3s;
}

.card:hover {
    transform: translateY(-5px);
}

.card h3 {
    color: var(--text-main);
    margin-bottom: 0.5rem;
    font-size: 1.25rem;
}

.card .date {
    color: var(--primary);
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 1rem;
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card ul {
    padding-left: 1.2rem;
    color: var(--text-sub);
}

.card li {
    margin-bottom: 0.5rem;
}

.card p {
    color: var(--text-sub);
}

.card-uta {
    position: relative;
}

.card-uta .date {
    text-transform: none;
}

.coe-logo {
    position: absolute;
    right: 1.75rem;
    top: 1.5rem;
}

.coe-logo img {
    width: 200px;
    height: auto;
    display: block;
}

.card-nano,
.card-spic {
    position: relative;
}

.nano-logo,
.spic-logo {
    position: absolute;
    right: 1.75rem;
    top: 1.5rem;
}

.nano-logo img {
    width: 110px;
    height: auto;
    display: block;
}

.spic-logo img {
    width: 140px;
    height: auto;
    display: block;
}

.edu-card {
    position: relative;
    overflow: hidden;
    /* Reserve room on the right so text never runs under the logo */
    padding-right: calc(150px + 2.5rem + 2rem);
}

.edu-logo {
    position: absolute;
    right: 2.5rem;
    top: 50%;
    transform: translateY(-50%);
    opacity: 1;
    pointer-events: none;
}

.edu-logo img {
    width: 150px;
    height: auto;
    display: block;
}

.card-images {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.card-img-wrapper {
    flex: 1;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 5px;
    background: var(--bg-body);
}

.card-img-wrapper img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 4px;
}

.card-img-caption {
    font-size: 0.8rem;
    color: var(--text-sub);
    text-align: center;
    margin-top: 5px;
}

.skills-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-top: 1rem;
    margin-bottom: 1.5rem;
}

.skill-tag {
    background: var(--bg-body);
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-weight: 500;
    color: var(--text-main);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: border-color 0.3s;
}

.skill-tag:hover {
    border-color: var(--primary);
}

.skill-tag i,
.skill-tag .skill-icon {
    font-size: 1.2rem;
}

.skill-tag .skill-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
    vertical-align: -4px;
    margin-right: 0.15rem;
}

footer {
    background: var(--bg-card);
    color: var(--text-sub);
    text-align: center;
    padding: 3rem 1rem;
    margin-top: 4rem;
    border-top: 1px solid var(--border);
}

footer.watermark-footer {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    min-height: 320px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 4rem;
    padding: 7rem 1rem 2.25rem;   /* room above the contact bar so the watermark isn't clipped */
    color: var(--text-main);
    background: #000000 !important;
    border-top: 1px solid #18181b !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

footer.watermark-footer::before {
    content: "BAOWEN";
    position: absolute;
    left: 50%;
    top: var(--wm-top, 46%);
    transform: translate(-50%, -50%);
    z-index: -1;
    font-size: clamp(5rem, 20vw, 16.5rem);
    line-height: 0.8;
    font-weight: 800;
    letter-spacing: 0;
    color: rgba(0, 0, 0, 0.05);
    white-space: nowrap;
    pointer-events: none;
    user-select: none;
}

[data-theme="dark"] footer.watermark-footer::before {
    color: rgba(255, 255, 255, 0.18) !important;
}

footer.watermark-footer::after {
    display: none !important;
}

.footer-socials {
    margin-top: 0.35rem;
}

/* Footer contact info layout */
.footer-contact {
    width: min(100%, 760px);
    margin: 0 auto 0.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0;
    padding: 0.8rem 1.45rem;
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.03);
    box-shadow:
        0 6px 20px rgba(0, 0, 0, 0.03),
        inset 0 1px 0 rgba(255, 255, 255, 0.45),
        inset 0 -1px 0 rgba(0, 0, 0, 0.02);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.footer-contact p {
    margin: 0;
    color: #1c1917;
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
}

.footer-contact p+p {
    border-left: 1px solid rgba(0, 0, 0, 0.12);
    margin-left: 1.25rem;
    padding-left: 1.25rem;
}

[data-theme="dark"] .footer-contact {
    background: rgba(255, 255, 255, 0.015) !important;
    border: 1px solid rgba(255, 255, 255, 0.10) !important;
    box-shadow:
        0 8px 24px rgba(0, 0, 0, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.10),
        inset 0 -1px 0 rgba(0, 0, 0, 0.25) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

[data-theme="dark"] .footer-contact p {
    color: #ffffff !important;
}

[data-theme="dark"] .footer-contact p+p {
    border-left: 1px solid rgba(255, 255, 255, 0.25) !important;
}

.footer-socials a {
    color: rgba(51, 65, 85, 0.58);
    margin: 0 10px;
    font-size: 1.5rem;
    transition: color 0.3s;
}

.footer-socials a:hover {
    color: var(--primary);
}

.footer-copyright {
    margin-top: 0.25rem;
    color: rgba(51, 65, 85, 0.48);
    font-size: 0.86rem;
}

.copy-toast {
    position: fixed;
    left: 50%;
    bottom: 5rem;
    transform: translateX(-50%);
    padding: 0.5rem 1rem;
    border-radius: 999px;
    background-color: var(--text-main);
    color: #ffffff;
    font-size: 0.85rem;
    box-shadow: var(--shadow);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 130;
}

.copy-toast.show {
    opacity: 1;
    transform: translate(-50%, -6px);
}

/* Timeline Styles — centered line, alternating cards, teal accent */
.timeline {
    position: relative;
    margin: 2rem 0 0;
    padding: 1rem 0 0.5rem;
}

.timeline::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 3px;
    transform: translateX(-50%);
    border-radius: 999px;
    background: linear-gradient(to bottom, transparent 0, var(--timeline-accent) 4%, var(--timeline-accent) 96%, transparent 100%);
    box-shadow: 0 0 14px var(--timeline-glow);
}

.timeline-item {
    position: relative;
    width: 50%;
    margin-bottom: 2.5rem;
}

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

/* odd = left side, even = right side */
.timeline-item:nth-child(odd) {
    padding-right: calc(3rem + 11px);
}

.timeline-item:nth-child(even) {
    margin-left: 50%;
    padding-left: calc(3rem + 11px);
}

.timeline-dot {
    position: absolute;
    top: 2rem;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--bg-body);
    border: 3px solid var(--timeline-accent);
    box-shadow: 0 0 0 5px var(--timeline-accent-soft), 0 0 18px var(--timeline-glow);
    z-index: 2;
}

.timeline-dot::after {
    content: "";
    position: absolute;
    inset: 4px;
    border-radius: 50%;
    background: var(--timeline-accent);
    box-shadow: 0 0 8px var(--timeline-glow);
}

.timeline-item:nth-child(odd) .timeline-dot {
    right: -11px;
}

.timeline-item:nth-child(even) .timeline-dot {
    left: -11px;
}

.timeline-content {
    position: relative;
}

/* Short connector from card to dot */
.timeline-content::after {
    content: "";
    position: absolute;
    top: calc(2rem + 10px);
    width: 3rem;
    height: 2px;
    background: var(--timeline-accent);
    opacity: 0.85;
}

.timeline-item:nth-child(odd) .timeline-content::after {
    right: -3rem;
}

.timeline-item:nth-child(even) .timeline-content::after {
    left: -3rem;
}

/* Teal edge on the outer side of each card */
.timeline-item:nth-child(odd) .timeline-content .card {
    border-left: 4px solid var(--timeline-accent) !important;
}

.timeline-item:nth-child(even) .timeline-content .card {
    border-left: 1px solid var(--border) !important;
    border-right: 4px solid var(--timeline-accent) !important;
}

/* Date lives inside the card now */
.timeline-date {
    position: relative;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.9rem;
    padding-bottom: 0.6rem;
}

.timeline-date::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 44px;
    height: 3px;
    border-radius: 999px;
    background: var(--timeline-accent);
}

/* Cards are half-width now: shrink logos and keep text clear of them */
.timeline-content .card .coe-logo img {
    width: 120px;
}

.timeline-content .card .spic-logo img {
    width: 100px;
}

.timeline-content .card-uta .timeline-date,
.timeline-content .card-uta h3,
.timeline-content .card-uta .date,
.timeline-content .card-spic .timeline-date,
.timeline-content .card-spic h3,
.timeline-content .card-spic .date {
    padding-right: 140px;
}

@media (max-width: 768px) {
    .hero {
        padding: 3rem 1rem;
    }

    .hero h1 {
        font-size: 1.8rem;
    }

    .hero p {
        font-size: 0.95rem;
        padding: 0 0.5rem;
    }

    /* Mobile font-size tweaks */
    body {
        font-size: 0.95rem;
    }

    h2 {
        font-size: 1.6rem;
    }

    .card h3 {
        font-size: 1.05rem;
    }

    .skills-container .skill-tag {
        font-size: 0.85rem;
        padding: 0.4rem 0.8rem;
    }

    footer p {
        font-size: 0.85rem;
    }

    footer.watermark-footer {
        min-height: 360px;
        padding: 4rem 1rem 2rem;
    }

    footer.watermark-footer::before {
        top: var(--wm-top, 42%);
        font-size: clamp(4.75rem, 28vw, 7rem);
    }

    .footer-contact {
        width: min(100%, 360px);
        flex-direction: column;
        align-items: center;
        gap: 0.65rem;
        padding: 1rem 1.1rem;
        border-radius: 14px;
    }

    .footer-contact p {
        width: 100%;
        text-align: center;
        white-space: normal;
        margin: 0;
    }

    .footer-contact p+p {
        border-left: none !important;
        border-top: 1px solid rgba(0, 0, 0, 0.08) !important;
        margin-left: 0 !important;
        padding-left: 0 !important;
        padding-top: 0.65rem !important;
    }

    [data-theme="dark"] .footer-contact p+p {
        border-left: none !important;
        border-top: 1px solid rgba(255, 255, 255, 0.12) !important;
    }

    .btn-container {
        display: flex;
        flex-direction: column;
        width: 100%;
        gap: 0.8rem;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    /* Ensure Hero About Me button is visible on mobile */
    .btn-container .btn[data-en="About Me"] {
        display: inline-flex !important;
    }

    /* Hide top hero About Me button on mobile (keep desktop unchanged) */
    .btn-container a:first-child {
        display: none;
    }

    section {
        padding: 2.5rem 1rem;
    }

    .card {
        padding: 1.5rem;
    }

    .grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .card-images {
        flex-direction: column;
    }

    .card-img-wrapper {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .card-img-wrapper img {
        height: auto;
        max-height: 200px;
    }

    .timeline {
        margin-top: 1.5rem;
        padding: 0.5rem 0 0;
    }

    .timeline::before {
        left: 12px;
        transform: none;
    }

    .timeline-item,
    .timeline-item:nth-child(odd),
    .timeline-item:nth-child(even) {
        width: 100%;
        margin-left: 0;
        padding-left: 2.6rem;
        padding-right: 0;
    }

    .timeline-item:nth-child(odd) .timeline-dot,
    .timeline-item:nth-child(even) .timeline-dot {
        left: 2.5px;
        right: auto;
        top: 1.6rem;
    }

    .timeline-content::after {
        display: none;
    }

    /* Single column: teal edge always on the left */
    .timeline-item:nth-child(even) .timeline-content .card {
        border-right: 1px solid var(--border) !important;
        border-left: 4px solid var(--timeline-accent) !important;
    }

    .timeline-content .card .timeline-date {
        order: -1;
        width: 100%;
    }

    .timeline-content .card-uta .timeline-date,
    .timeline-content .card-uta h3,
    .timeline-content .card-uta .date,
    .timeline-content .card-spic .timeline-date,
    .timeline-content .card-spic h3,
    .timeline-content .card-spic .date {
        padding-right: 0;
    }

    /* Mobile: Education card logo on top & centered */
    .edu-card {
        position: relative;
        padding-right: 2rem;
    }

    .edu-logo {
        position: static;
        display: flex;
        justify-content: center;
        align-items: center;
        margin-bottom: 1rem;
        pointer-events: auto;
        transform: none;
    }

    .edu-logo img {
        width: 120px;
        height: auto;
    }

    /* Mobile: make work-ex cards flex so logo can occupy first row alone */
    .timeline-content .card {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
    }

    .card-uta,
    .card-nano,
    .card-spic {
        padding-top: 1.2rem;
        padding-left: 1.2rem;
    }

    /* Logo on first row, top-left, smaller on mobile */
    .coe-logo,
    .nano-logo,
    .spic-logo {
        position: static !important;
        order: 0;
        margin: 0 0 0.5rem 0;
        text-align: left;
    }

    .coe-logo img,
    .nano-logo img,
    .spic-logo img {
        width: 70px !important;
        height: auto;
        display: block;
    }

    /* Title & date appear below logo, full-width */
    .timeline-content .card h3 {
        order: 1 !important;
        width: 100%;
    }

    .timeline-content .card .date {
        order: 2 !important;
        width: 100%;
    }

    /* "View details" button appears below company name/date */
    .timeline-content .card .card-toggle-btn {
        order: 3 !important;
    }

    /* Collapsible body follows after button */
    .timeline-content .card .card-collapsible-body {
        order: 4 !important;
        width: 100%;
    }
}
