/* ── Reset / Base ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    scroll-snap-type: y proximity;
    scroll-padding-top: 52px; /* height of sticky TOC nav */
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    color: #111827;
    background: #fff;
    line-height: 1.6;
}

a { color: #1d4ed8; text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

/* ── Layout ──────────────────────────────────────────────── */
.wrap {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 24px;
}

.wrap--narrow {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 24px;
}

.page-section {
    padding: 64px 0;
    min-height: 100vh;
    scroll-snap-align: start;
}
.page-section--alt { background: #f5f6f8; }

.section-title {
    font-size: 1.75rem;
    font-weight: 700;
    text-align: center;
    margin: 0 0 16px;
}

.section-desc {
    text-align: center;
    color: #6b7280;
    max-width: 640px;
    margin: 0 auto 32px;
    font-size: 1rem;
}

/* ── Hero ────────────────────────────────────────────────── */
.hero .wrap { max-width: 1100px; }

.hero {
    background: #0f172a;
    text-align: center;
    min-height: 100vh;
    scroll-snap-align: start;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scroll-arrow {
    position: absolute;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(248,250,252,0.5);
    animation: bounce 2s ease-in-out infinite;
    transition: color 0.2s;
}
.scroll-arrow:hover { color: #f8fafc; }

@keyframes bounce {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50%       { transform: translateX(-50%) translateY(6px); }
}

.project-title {
    font-size: 2.6rem;
    font-weight: 900;
    color: #f8fafc;
    line-height: 1.1;
    letter-spacing: -0.03em;
    margin: 0 0 16px;
}

.hero-venue {
    color: #60a5fa;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin: 0 0 16px;
}

.hero-desc {
    color: rgba(248,250,252,0.7);
    font-size: 1.1rem;
    max-width: 560px;
    margin: 0 auto;
    line-height: 1.6;
}

/* ── Paper Info ──────────────────────────────────────────── */
.paper-info {
    padding: 48px 0;
    border-bottom: 1px solid #e5e7eb;
    min-height: 100vh;
    scroll-snap-align: start;
}

.paper-info-grid {
    display: grid;
    grid-template-columns: 42% 1fr;
    gap: 48px;
    align-items: start;
}

.paper-title-text {
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.45;
    margin: 0 0 14px;
    color: #111827;
}

.venue-badge {
    display: inline-block;
    background: #dbeafe;
    color: #1d4ed8;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 3px 10px;
    border-radius: 12px;
    margin: 0 0 16px;
}

.authors {
    font-size: 0.9rem;
    margin-bottom: 4px;
    line-height: 1.9;
    color: #374151;
}

.authors a { font-weight: 500; color: #1d4ed8; }
.authors sup { font-size: 0.7em; }

.affiliations {
    font-size: 0.82rem;
    color: #6b7280;
    margin: 0 0 20px;
}

/* Paper link buttons */
.paper-links {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.paper-links a {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 20px;
    border: 2px solid #1d4ed8;
    color: #1d4ed8;
    font-weight: 600;
    font-size: 0.82rem;
    transition: background 0.15s, color 0.15s;
}

.paper-links a:hover {
    background: #1d4ed8;
    color: #fff;
    text-decoration: none;
}

.abstract-heading {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #9ca3af;
    margin: 0 0 10px;
}

.abstract-text {
    font-size: 0.875rem;
    line-height: 1.8;
    color: #374151;
    margin: 0 0 0.9em;
}

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

/* ── Table of Contents ───────────────────────────────────── */
.toc-nav {
    position: sticky;
    top: 0;
    z-index: 50;
    background: #0f172a;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toc-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 24px;
    overflow-x: auto;
    /* hide scrollbar on desktop but allow scroll on mobile */
    scrollbar-width: none;
}

.toc-inner::-webkit-scrollbar { display: none; }

.toc-list {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    white-space: nowrap;
}

.toc-list li a {
    display: block;
    padding: 14px 18px;
    color: rgba(248,250,252,0.55);
    font-size: 0.875rem;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s;
}

.toc-list li a:hover,
.toc-list li a.toc-active {
    color: #f8fafc;
    border-bottom-color: #60a5fa;
    text-decoration: none;
}

/* ── Video Placeholder ───────────────────────────────────── */
.video-placeholder {
    background: #e9ecef;
    border: 2px dashed #ced4da;
    border-radius: 10px;
    aspect-ratio: 16 / 9;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.vp-icon { font-size: 2rem; color: #9ca3af; line-height: 1; }
.vp-label { font-weight: 600; color: #4b5563; font-size: 0.95rem; }
.vp-sub { font-size: 0.85rem; color: #9ca3af; }

/* ── Videos ──────────────────────────────────────────────── */
video {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 8px;
    display: block;
}

/* ── Tabs ────────────────────────────────────────────────── */
.tab-nav {
    display: flex;
    border-bottom: 2px solid #e5e7eb;
    margin-bottom: 32px;
    overflow-x: auto;
    scrollbar-width: none;
    white-space: nowrap;
}
.tab-nav::-webkit-scrollbar { display: none; }

.tab-btn {
    padding: 10px 22px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.925rem;
    font-weight: 500;
    color: #6b7280;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: color 0.15s, border-color 0.15s;
    font-family: inherit;
}

.tab-btn:hover { color: #1d4ed8; }

.tab-btn.active {
    color: #1d4ed8;
    border-bottom-color: #1d4ed8;
}

.tab-panel.hidden { display: none; }

/* ── Result Grid ─────────────────────────────────────────── */
.result-grid {
    display: grid;
    grid-template-columns: 38% 1fr;
    gap: 32px;
    align-items: center;
}

.result-img {
    width: 100%;
    border-radius: 8px;
}

.result-caption {
    margin: 12px 0 0;
    font-size: 0.9rem;
    color: #4b5563;
    line-height: 1.6;
    text-align: left;
}

/* ── Applications Grid ───────────────────────────────────── */
.applications-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
}

.application-card { text-align: center; }

.application-card img {
    width: 100%;
    border-radius: 8px;
    margin-bottom: 16px;
}

.application-card h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0 0 8px;
}

.application-card p {
    font-size: 0.9rem;
    color: #4b5563;
    line-height: 1.6;
    margin: 0;
    text-align: left;
}

/* ── Try It Yourself ─────────────────────────────────────── */
#try-it { min-height: unset; }

.try-it-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    align-items: center;
}

.steps-list {
    counter-reset: step;
    list-style: none;
    padding: 0;
    margin: 0;
}

.steps-list li {
    counter-increment: step;
    position: relative;
    padding-left: 1.6em;
    margin-bottom: 12px;
    font-size: 1rem;
    line-height: 1.6;
}

.steps-list li::before {
    content: counter(step) ".";
    position: absolute;
    left: 0;
    font-weight: 700;
    color: #1d4ed8;
}

/* ── FAQ ─────────────────────────────────────────────────── */
#faq { min-height: unset; }

.faq-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 32px;
}

.faq-item {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
}

.faq-item[open] {
    border-color: #bfdbfe;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.faq-question {
    padding: 18px 24px;
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    gap: 16px;
}

.faq-question::-webkit-details-marker { display: none; }

.faq-question::after {
    content: "+";
    font-size: 1.25rem;
    font-weight: 400;
    color: #9ca3af;
    flex-shrink: 0;
    transition: transform 0.2s;
}

.faq-item[open] .faq-question::after {
    transform: rotate(45deg);
}

.faq-answer {
    padding: 16px 24px;
    font-size: 0.9rem;
    line-height: 1.8;
    color: #374151;
    margin: 0;
    background: #f0f5ff;
    border-top: 1px solid #bfdbfe;
}

.faq-answer + .faq-answer { border-top: none; padding-top: 0; }
.faq-answer:last-child { padding-bottom: 20px; }

/* ── Join Us ─────────────────────────────────────────────── */
.join-us-section {
    background: #0f172a;
    min-height: unset;
}

.join-us-title {
    color: #f8fafc;
}

.join-us-lead {
    text-align: center;
    color: rgba(248,250,252,0.65);
    font-size: 1.05rem;
    max-width: 580px;
    margin: 0 auto 40px;
    line-height: 1.7;
}

.join-us-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 48px;
}

.join-us-card {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 24px 20px;
}

.join-us-icon {
    font-size: 1.6rem;
    display: block;
    margin-bottom: 12px;
}

.join-us-card h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: #f8fafc;
    margin: 0 0 8px;
}

.join-us-card p {
    font-size: 0.875rem;
    color: rgba(248,250,252,0.55);
    line-height: 1.7;
    margin: 0;
}

.join-us-cta {
    text-align: center;
}

.join-us-cta-text {
    color: rgba(248,250,252,0.55);
    font-size: 0.95rem;
    margin: 0 0 16px;
}

.join-us-btn {
    display: inline-block;
    padding: 12px 32px;
    background: #1d4ed8;
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    border-radius: 28px;
    transition: background 0.15s, transform 0.15s;
}

.join-us-btn:hover {
    background: #2563eb;
    transform: translateY(-1px);
    text-decoration: none;
}

@media (max-width: 700px) {
    .join-us-cards { grid-template-columns: 1fr; }
}

/* ── Citation ────────────────────────────────────────────── */
#citation {
    min-height: unset;
    background: #f5f6f8;
}

.bibtex-block {
    background: #e5e7eb;
    color: #1f2937;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.875rem;
    padding: 28px 32px;
    border-radius: 10px;
    overflow-x: hidden;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.7;
    margin-top: 24px;
}

/* ── Background grid ─────────────────────────────────────── */
.background-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 700px) {
    .project-title { font-size: 1.8rem; }
    .section-title { font-size: 1.4rem; }
    .paper-info-grid,
    .result-grid,
    .try-it-grid,
    .applications-grid,
    .background-grid { grid-template-columns: 1fr; }
    .page-section { padding: 48px 0; }
    .tab-btn { padding: 8px 14px; font-size: 0.85rem; }
    .hero .wrap { max-width: 100%; }
}
