/* PhysReal project page — adapted from the Nerfies template. */

/* ============ Design tokens ============ */
:root {
    --bg: #ffffff;
    --bg-cool: #f4f7fb;
    --bg-muted: #f7f9fc;
    --surface: #ffffff;
    --text-strong: #111827;
    --text: #374151;
    --text-muted: #6b7280;
    --border-soft: #e5e9f0;
    --border-stronger: #d3dae6;
    --accent-blue: #2563eb;
    --accent-cyan: #06b6d4;
    --accent-violet: #7c3aed;
    --gradient-brand: linear-gradient(90deg, #2563eb 0%, #06b6d4 50%, #7c3aed 100%);
    --radius-card: 10px;
    --radius-large: 12px;
    --shadow-soft: 0 2px 10px rgba(17, 24, 39, 0.05);
    --shadow-hover: 0 10px 26px rgba(17, 24, 39, 0.10);
    --section-spacing: 5rem;
    --nav-height: 56px;
    --font-display: 'Google Sans', 'Noto Sans', sans-serif;
    --font-body: 'Noto Sans', 'Helvetica', sans-serif;
}

/* ============ Base ============ */
html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: var(--font-body);
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

figure {
    margin: 0;
}

section[id] {
    scroll-margin-top: calc(var(--nav-height) + 24px);
}

.container-narrow {
    max-width: 960px;
    margin: 0 auto;
}

.container-abstract {
    max-width: 900px;
    margin: 0 auto;
}

.container-wide {
    max-width: 1320px;
    margin: 0 auto;
}

.page-section {
    padding: var(--section-spacing) 1.5rem;
}

.section-abstract {
    background: var(--bg-cool);
}

.section-results {
    background: var(--bg-muted);
}

.section-title {
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 3.5vw, 2rem);
    font-weight: 700;
    color: var(--text-strong);
    text-align: center;
    margin: 0 0 2.5rem;
    padding-bottom: 0.9rem;
    position: relative;
}

.section-title::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 56px;
    height: 3px;
    border-radius: 2px;
    background: var(--gradient-brand);
}

.subsection-title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-strong);
    text-align: center;
    margin: 0;
    padding-bottom: 0.7rem;
    position: relative;
}

.subsection-title::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 2.5px;
    border-radius: 2px;
    background: var(--gradient-brand);
    opacity: 0.85;
}

.results-subsection {
    margin-top: 4rem;
}

.results-subsection[id] {
    scroll-margin-top: calc(var(--nav-height) + 24px);
}

.results-subsection + .results-subsection {
    margin-top: 4.5rem;
    padding-top: 3.25rem;
    border-top: 1px solid var(--border-soft);
}

.subsection-text {
    max-width: 860px;
    margin: 1.5rem auto 0;
    font-size: 0.95rem;
    line-height: 1.75;
    color: var(--text);
}

.results-sublinks {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.4rem 1.75rem;
    margin-top: 1.9rem;
}

.results-sublinks a {
    position: relative;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.2rem 0;
    transition: color 0.2s ease;
}

.results-sublinks a::after {
    content: "";
    position: absolute;
    left: 0;
    right: 100%;
    bottom: 0;
    height: 2px;
    border-radius: 1px;
    background: var(--gradient-brand);
    transition: right 0.22s ease;
}

.results-sublinks a:hover {
    color: var(--accent-blue);
}

.results-sublinks a:hover::after {
    right: 0;
}

.lead-text {
    max-width: 900px;
    margin: 0 auto;
    font-size: 1.02rem;
    line-height: 1.75;
    color: var(--text);
}

.body-text {
    margin: 0;
    font-size: 1rem;
    line-height: 1.85;
    color: var(--text);
}

/* ============ Sticky navigation ============ */
.sticky-nav {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.82);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-soft);
}

.nav-inner {
    max-width: 1320px;
    margin: 0 auto;
    padding: 0 1.5rem;
    height: var(--nav-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.nav-brand {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.05rem;
    letter-spacing: -0.01em;
    text-decoration: none;
    background: var(--gradient-brand);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    flex-shrink: 0;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    overflow-x: auto;
    scrollbar-width: none;
}

.nav-links::-webkit-scrollbar {
    display: none;
}

.nav-links a {
    position: relative;
    color: var(--text);
    font-size: 0.92rem;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    padding: 0.3rem 0;
    transition: color 0.2s ease;
}

.nav-links a::after {
    content: "";
    position: absolute;
    left: 0;
    right: 100%;
    bottom: 0;
    height: 2px;
    border-radius: 1px;
    background: var(--gradient-brand);
    transition: right 0.22s ease;
}

.nav-links a:hover {
    color: var(--accent-blue);
}

.nav-links a:hover::after {
    right: 0;
}

/* ============ Hero ============ */
.hero-section {
    position: relative;
    overflow: hidden;
    text-align: center;
    padding: 6.5rem 1.5rem 5.5rem;
    background:
        radial-gradient(1200px 520px at 50% -12%, rgba(37, 99, 235, 0.07), transparent 62%),
        var(--bg);
}

.hero-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    pointer-events: none;
}

.hero-glow-blue {
    width: 480px;
    height: 480px;
    top: -160px;
    left: 6%;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.20), transparent 70%);
}

.hero-glow-cyan {
    width: 420px;
    height: 420px;
    top: 12%;
    right: 5%;
    background: radial-gradient(circle, rgba(6, 182, 212, 0.17), transparent 70%);
}

.hero-glow-violet {
    width: 460px;
    height: 460px;
    bottom: -200px;
    left: 38%;
    background: radial-gradient(circle, rgba(124, 58, 237, 0.15), transparent 70%);
}

.hero-content {
    position: relative;
    z-index: 1;
}

.publication-title {
    font-family: var(--font-display);
    margin: 0;
    color: var(--text-strong);
}

.publication-title .title-main,
.publication-title .title-subtitle {
    display: block;
}

.publication-title .title-main {
    font-size: clamp(3rem, 8vw, 4.75rem);
    font-weight: 900;
    letter-spacing: -0.02em;
    line-height: 1.05;
    background: var(--gradient-brand);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

.publication-title .title-subtitle {
    margin: 1.1rem auto 0;
    max-width: 900px;
    font-size: clamp(1.12rem, 2.6vw, 1.55rem);
    font-weight: 600;
    line-height: 1.35;
    color: var(--text-strong);
}

.hero-authors {
    margin: 1.9rem 0 0;
    font-size: 1.05rem;
    color: var(--text-muted);
}

/* ============ Figures ============ */
.figure-card {
    margin: 0 auto 2.25rem;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-large);
    box-shadow: var(--shadow-soft);
    padding: 0.75rem;
    transition: box-shadow 0.25s ease, border-color 0.25s ease;
}

.figure-card:hover {
    box-shadow: var(--shadow-hover);
    border-color: var(--border-stronger);
}

.figure-card img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 8px;
}

/* ============ Video grid (Qualitative Results) ============ */
.video-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    margin-top: 1.75rem;
}

.video-card {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-card);
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.video-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
    border-color: var(--border-stronger);
}

.video-card video {
    display: block;
    width: 100%;
    height: auto;
    background: #0b0f14;
}

.video-caption {
    margin: 0;
    padding: 0.55rem 0.6rem;
    font-size: 0.72rem;
    line-height: 1.4;
    color: var(--text-muted);
    text-align: center;
    word-break: break-all;
}

/* ============ Comparison with Baselines ============ */
.scene-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 2.25rem;
}

.scene-selector-label {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-muted);
}

#comparison-scene-select {
    appearance: none;
    -webkit-appearance: none;
    font-family: var(--font-body);
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--text-strong);
    background-color: var(--surface);
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.8' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.9rem center;
    background-size: 0.7rem;
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    padding: 0.55rem 2.4rem 0.55rem 1rem;
    box-shadow: var(--shadow-soft);
    cursor: pointer;
    max-width: 100%;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#comparison-scene-select:hover {
    border-color: var(--border-stronger);
}

#comparison-scene-select:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.scene-current {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-strong);
    text-align: center;
    margin: 1.5rem 0 0;
}

.comparison-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
    margin-top: 1.5rem;
    transition: opacity 0.2s ease;
}

.comparison-grid.scene-switching {
    opacity: 0;
}

.comparison-method-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.68rem 0.75rem;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text);
    text-align: center;
    border-bottom: 1px solid var(--border-soft);
}

.ours-badge {
    display: inline-block;
    padding: 0.14rem 0.55rem;
    border-radius: 999px;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #ffffff;
    background: var(--gradient-brand);
}

.ours-card {
    position: relative;
    border-color: rgba(37, 99, 235, 0.38);
}

.ours-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    z-index: 1;
    background: var(--gradient-brand);
}

/* ============ Downstream Applications (shared carousel) ============ */
.section-applications {
    background: var(--bg);
}

.section-applications .results-subsection {
    margin-top: 2.75rem;
}

.app-carousel {
    margin-top: 2.1rem;
}

.carousel-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.carousel-viewport {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
}

.carousel-track {
    display: flex;
    gap: 1.5rem;
    transition: transform 0.4s ease;
}

.carousel-slide {
    flex: 0 0 auto;
}

.app-carousel .video-caption {
    font-size: 0.78rem;
    padding: 0.65rem 0.75rem;
}

.app-carousel.is-single-page .carousel-btn,
.app-carousel.is-single-page .carousel-dots {
    display: none;
}

.carousel-btn {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--border-soft);
    background: var(--surface);
    color: var(--text-strong);
    font-size: 0.95rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-soft);
    transition: box-shadow 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}

.carousel-btn:hover {
    box-shadow: var(--shadow-hover);
    border-color: var(--border-stronger);
    color: var(--accent-blue);
}

.carousel-dots {
    display: flex;
    justify-content: center;
    gap: 0.55rem;
    margin-top: 1.35rem;
}

.carousel-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    border: none;
    padding: 0;
    background: var(--border-stronger);
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease;
}

.carousel-dot.active {
    background: var(--gradient-brand);
    transform: scale(1.2);
}

/* ============ Footer ============ */
.site-footer {
    background: #fafbfc;
    color: #9ca3af;
    padding: 2.2rem 1.5rem;
    text-align: center;
    font-size: 0.85rem;
    border-top: 1px solid var(--border-soft);
}

.site-footer p {
    margin: 0;
}

.site-footer a {
    color: #6b7280;
}

/* ============ Scroll reveal ============ */
.reveal {
    transition: opacity 0.55s ease, transform 0.55s ease;
}

body.js-enabled .reveal:not(.revealed) {
    opacity: 0;
    transform: translateY(12px);
}

/* ============ Responsive ============ */
@media (max-width: 1199px) {
    .video-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    :root {
        --section-spacing: 3.5rem;
    }

    .hero-section {
        padding: 4.5rem 1.25rem 3.75rem;
    }

    .nav-inner {
        padding: 0 1rem;
    }
}

@media (max-width: 1100px) {
    .comparison-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .comparison-grid {
        grid-template-columns: 1fr;
    }

    .scene-selector {
        flex-direction: column;
        gap: 0.5rem;
    }
}

@media (max-width: 600px) {
    .video-grid {
        grid-template-columns: 1fr;
    }

    .carousel-row {
        gap: 0.6rem;
    }

    .carousel-btn {
        width: 38px;
        height: 38px;
        font-size: 0.8rem;
    }
}

/* ============ Reduced motion ============ */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .reveal {
        transition: none;
    }

    body.js-enabled .reveal:not(.revealed) {
        opacity: 1;
        transform: none;
    }

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

    .carousel-track {
        transition: none;
    }

    .nav-links a::after {
        transition: none;
    }
}
