/* ============================================
   HCSP Paper Website — adapted from VS-Bench template
   ============================================ */

html { scroll-behavior: smooth; }

:root {
    --primary-color: #1565c0;
    --bg-color:      #ffffff;
    --text-color:    #333;
    --light-gray:    #f8f9fa;
    --medium-gray:   #e9ecef;
    --border-color:  #dee2e6;
}

body {
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    margin: 0;
    padding: 0;
    padding-top: 52px;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ── Header ── */
header {
    background-color: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
    padding: 40px 0;
}

.header-content { text-align: center; }

h1 {
    font-size: 2.4rem;
    font-weight: 700;
    margin-bottom: 20px;
    line-height: 1.2;
    color: var(--text-color);
}

.venue-badge {
    display: inline-block;
    background-color: var(--primary-color);
    color: #fff;
    font-size: 1.35rem;
    font-weight: 600;
    padding: 6px 20px;
    border-radius: 20px;
    margin-bottom: 20px;
    letter-spacing: 0.02em;
}

.authors {
    margin-bottom: 30px;
    font-size: 1.05rem;
}

.affiliations {
    font-size: 0.9rem;
    color: #666;
    margin-top: 10px;
}

.authors a { color: #3273dc; text-decoration: none; }
.authors a:hover { text-decoration: underline; }

.links {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    background-color: #333;
    color: #fff;
    padding: 10px 20px;
    border-radius: 30px;
    text-decoration: none;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    transition: background-color 0.3s ease;
    border: none;
    cursor: pointer;
}
.btn:hover { background-color: var(--primary-color); color: #fff; text-decoration: none; }
.btn i { margin-right: 8px; }
.btn .ai { margin-right: 8px; }

/* ── Main ── */
main { padding: 40px 0; }

main a:not(.btn):not(.yt-link) { color: #3273dc; text-decoration: none; }
main a:not(.btn):not(.yt-link):hover { text-decoration: underline; }

section {
    margin-bottom: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    scroll-margin-top: 52px;
}
section:first-of-type { border-top: none; }

h2 {
    font-size: 2rem;
    margin-top: 10px;
    margin-bottom: 16px;
    color: var(--primary-color);
}

h3 {
    font-size: 1.3rem;
    margin-top: 28px;
    margin-bottom: 15px;
    color: #444;
    border-left: 4px solid var(--primary-color);
    padding-left: 10px;
}

p { margin-bottom: 1em; }
main p { text-align: justify; }

/* ── Figures ── */
img { max-width: 100%; height: auto; }

.figure-container { text-align: center; margin: 20px 0; }

.caption {
    font-size: 0.9rem;
    color: #555;
    margin-top: 10px;
    text-align: center;
    font-style: italic;
    line-height: 1.5;
}

.figures-row {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    margin: 20px 0;
}
.figures-row .figure-container { flex: 1; margin: 0; }

/* ── Stage boxes ── */
.stage-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin: 20px 0 30px;
}

.stage-card {
    background: var(--light-gray);
    border: 1px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 8px;
    padding: 16px;
}

.stage-card h4 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0 0 8px 0;
}

.stage-card p {
    font-size: 0.9rem;
    color: #555;
    margin: 0;
    text-align: left;
}

/* ── YouTube Video Grid ── */
.video-grid { display: grid; gap: 20px; margin: 20px 0; }
.video-grid-2 { grid-template-columns: repeat(2, 1fr); }
.video-grid-3 { grid-template-columns: repeat(3, 1fr); }
.video-grid-1 { grid-template-columns: 1fr; max-width: 640px; margin: 20px auto; }

.video-item { display: flex; flex-direction: column; }

.yt-link { display: block; text-decoration: none !important; }

.yt-thumbnail {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.yt-thumbnail:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,0.2); }

.yt-thumbnail img {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
}

.yt-play-btn {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 64px; height: 64px;
    background: rgba(255,0,0,0.85);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 24px;
    transition: background 0.2s ease, transform 0.2s ease;
}
.yt-thumbnail:hover .yt-play-btn {
    background: rgba(255,0,0,1);
    transform: translate(-50%, -50%) scale(1.1);
}

.video-caption {
    text-align: center;
    font-style: italic;
    margin-top: 8px;
    padding-top: 4px;
    font-size: 0.9rem;
    color: #666;
}

/* ── Citation ── */
.citation-block { position: relative; }

.copy-btn {
    position: absolute;
    top: 10px; right: 10px;
    background: rgba(0,0,0,0.08);
    border: none;
    border-radius: 5px;
    padding: 5px 8px;
    cursor: pointer;
    color: #555;
    font-size: 0.85rem;
    transition: background 0.15s ease, color 0.15s ease;
    z-index: 1;
}
.copy-btn:hover { background: rgba(0,0,0,0.15); color: #1a1a1a; }

pre {
    background-color: var(--light-gray);
    padding: 20px;
    border-radius: 5px;
    overflow-x: auto;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    border: 1px solid var(--border-color);
}

/* ── Footer ── */
footer {
    text-align: center;
    padding: 20px 0;
    margin-top: 40px;
    border-top: 1px solid var(--border-color);
    color: #666;
    font-size: 0.9rem;
    background-color: var(--light-gray);
}
footer a { color: #666; text-decoration: none; }
footer a:hover { text-decoration: underline; }

/* ── Scroll-to-Top ── */
.scroll-top {
    position: fixed;
    bottom: 32px; right: 32px;
    width: 48px; height: 48px;
    border-radius: 50%;
    background: #333;
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease, background 0.2s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.scroll-top.visible { opacity: 1; visibility: visible; }
.scroll-top:hover { background: var(--primary-color); transform: translateY(-4px); }

/* ============================================
   Navigation Bars
   ============================================ */

/* ── Global Project Nav (always visible at top, hides on scroll) ── */
.nav-global {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 52px;
    background: rgba(251,251,253,0.92);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid rgba(0,0,0,0.1);
    z-index: 1001;
    transition: transform 0.3s cubic-bezier(0.4,0,0.2,1), opacity 0.3s cubic-bezier(0.4,0,0.2,1);
}
.nav-global.hidden { transform: translateY(-100%); opacity: 0; pointer-events: none; }

.nav-global-content {
    max-width: 1000px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 24px;
}

.nav-global-links { display: flex; align-items: center; gap: 4px; }

.nav-global-links a {
    font-size: 0.875rem;
    font-weight: 500;
    color: #444;
    text-decoration: none;
    padding: 6px 14px;
    border-radius: 6px;
    transition: background 0.15s ease, color 0.15s ease;
    white-space: nowrap;
}
.nav-global-links a:hover { background: rgba(0,0,0,0.06); color: #1a1a1a; text-decoration: none; }
.nav-global-links a.active { background: rgba(0,0,0,0.08); color: var(--primary-color); font-weight: 600; }

/* ── Section Sticky Bar (hidden, appears on scroll replacing global nav) ── */
.nav-sticky-bar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 52px;
    background: rgba(251,251,253,0.92);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid rgba(0,0,0,0.1);
    z-index: 1000;
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s cubic-bezier(0.4,0,0.2,1), opacity 0.3s cubic-bezier(0.4,0,0.2,1);
}
.nav-sticky-bar.visible { transform: translateY(0); opacity: 1; pointer-events: auto; }

.nav-sticky-content {
    max-width: 1000px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}

/* ── Title + Dropdown ── */
.nav-title-wrapper {
    position: relative;
    flex-shrink: 0;
}

.nav-sticky-title {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 1rem;
    font-weight: 700;
    color: #1a1a1a;
    text-decoration: none;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s ease;
    user-select: none;
}
.nav-sticky-title:hover { background: rgba(0,0,0,0.06); text-decoration: none; color: #1a1a1a; }

.nav-title-chevron {
    font-size: 0.7rem;
    color: #888;
    transition: transform 0.25s ease;
}
.nav-title-wrapper.open .nav-title-chevron { transform: rotate(180deg); }

.nav-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 340px;
    background: rgba(251,251,253,0.98);
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
    padding: 12px 8px 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
    z-index: 100;
}
.nav-title-wrapper.open .nav-dropdown { opacity: 1; visibility: visible; transform: translateY(0); }

.nav-dropdown-header {
    font-size: 0.7rem;
    font-weight: 600;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0 8px 8px;
}

.nav-project-card {
    display: block;
    padding: 8px 10px;
    border-radius: 7px;
    text-decoration: none;
    transition: background 0.15s ease;
}
.nav-project-card:hover { background: rgba(0,0,0,0.05); text-decoration: none; }

.nav-project-card-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 2px;
}
.nav-project-card-title.active-project { color: var(--primary-color); }

.nav-project-card-desc {
    font-size: 0.75rem;
    color: #777;
    line-height: 1.4;
}

/* ── Section links ── */
.nav-sticky-links { display: flex; align-items: center; gap: 4px; }

.nav-sticky-links a {
    font-size: 0.875rem;
    font-weight: 500;
    color: #444;
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 6px;
    transition: background 0.15s ease, color 0.15s ease;
    white-space: nowrap;
}
.nav-sticky-links a:hover { background: rgba(0,0,0,0.06); color: #1a1a1a; text-decoration: none; }
.nav-sticky-links a.active { background: rgba(0,0,0,0.06); color: var(--primary-color); font-weight: 600; }

.nav-mobile-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #444;
    padding: 4px 8px;
    transition: transform 0.3s ease;
}
.nav-mobile-toggle.active { transform: rotate(90deg); }

/* ── Responsive ── */
@media (max-width: 768px) {
    .nav-mobile-toggle { display: block; }

    .nav-sticky-links {
        display: none;
        position: absolute;
        top: 52px; left: 0; right: 0; /* relative to sticky bar top */
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        background: rgba(251,251,253,0.98);
        border-bottom: 1px solid rgba(0,0,0,0.1);
        padding: 8px 0;
    }
    .nav-sticky-links.mobile-open { display: flex; }
    .nav-sticky-links a { padding: 10px 24px; border-radius: 0; font-size: 0.95rem; }

    h1 { font-size: 1.8rem; }
    .figures-row { flex-direction: column; }
    .video-grid-2, .video-grid-3 { grid-template-columns: 1fr; }
    .stage-grid { grid-template-columns: 1fr; }
}
