/* ===== Reset & Base ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --accent: #b7a5ff;
    --accent-glow: rgba(183, 165, 255, 0.25);
    --accent-subtle: rgba(183, 165, 255, 0.07);
    --bg: #05020b;
    --bg-card: rgba(255, 255, 255, 0.04);
    --bg-card-hover: rgba(255, 255, 255, 0.06);
    --text: #f0f0f5;
    --text-secondary: rgba(255, 255, 255, 0.78);
    --text-dim: rgba(255, 255, 255, 0.5);
    --border: rgba(255, 255, 255, 0.08);
    --border-accent: rgba(183, 165, 255, 0.3);
    --radius: 0.6vw;
    --radius-lg: 1vw;
    --head: 6.25vw;
    --font: "Inter Tight", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    --font-btn: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    line-height: 1.7;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img, video {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: var(--accent);
    text-decoration: none;
}

/* ===== Grid Background ===== */
.grid-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
    background-size: 62px 62px;
    mask-image: radial-gradient(ellipse at 50% 50%, black 15%, transparent 70%);
    -webkit-mask-image: radial-gradient(ellipse at 50% 50%, black 15%, transparent 70%);
}

/* ===== Scroll Progress ===== */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent), #d4a5ff);
    z-index: 9999;
    transition: width 0.1s linear;
}

/* ===== Header / Navbar ===== */
.site-header {
    position: relative;
    z-index: 1000;
    height: var(--head);
    display: flex;
    align-items: center;
    background: transparent;
}

.header-wrap {
    width: 91.666vw;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.6vw;
}

.logo-img {
    height: 1.6vw;
    min-height: 20px;
    width: auto;
    padding: 0.3vw;
    background: var(--accent);
    border-radius: 0.3vw;
}

.logo-text {
    font-family: "Inter Tight", "Space Grotesk", sans-serif;
    font-size: 1.1vw;
    letter-spacing: 0.08em;
    color: var(--accent);
}

.logo-bold {
    font-weight: 700;
}

.logo-light {
    font-weight: 300;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.8vw;
}

.header-nav {
    display: flex;
    gap: 0.8vw;
}

.header-nav a {
    padding: 0.468vw 1.354vw;
    color: #fff;
    font-size: 0.82rem;
    font-weight: 500;
    border-radius: 80px;
    border: 1px solid transparent;
    background: rgba(255, 255, 255, 0.05);
    transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
    font-family: var(--font-btn);
}

.header-github {
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.4vw;
    transition: color 0.2s ease;
    margin-left: 0.6vw;
}

.header-github:hover {
    color: #fff;
}

.header-nav a:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.08);
}

/* ===== Article Hero ===== */
.article-hero {
    position: relative;
    margin-top: calc(-1 * var(--head));
    padding: calc(var(--head) + 4vw) 0 4vw;
    background: radial-gradient(80% 80% at 10% 10%, rgba(183, 165, 255, 0.18), transparent),
        #08060b;
    overflow: hidden;
    z-index: 0;
}

.hero-grid {
    width: 91.666vw;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 3vw;
    align-items: end;
}

.hero-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.52vw;
    padding: 0.31vw 0.83vw;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.05);
    text-transform: uppercase;
    letter-spacing: 0.06vw;
    font-size: 0.78vw;
    margin-bottom: 1vw;
}

.hero-title {
    font-size: 3.75vw;
    font-weight: 700;
    line-height: 1.05;
    letter-spacing: -0.05vw;
    margin: 1vw 0 1.25vw;
    color: #fff;
}

.grad-accent {
    display: inline-block;
    color: var(--accent);
}

.hero-subtitle {
    font-size: 1.1vw;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.72);
    margin-bottom: 1.2vw;
    max-width: 36vw;
}

.hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.94vw;
    margin-top: 1.5vw;
    margin-bottom: 1.2vw;
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.9vw;
}

.hero-meta span {
    position: relative;
}

.hero-meta span + span::before {
    content: '\00b7';
    position: absolute;
    left: -0.6vw;
    color: rgba(255, 255, 255, 0.5);
}

.hero-authors {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3vw 0.9vw;
    margin-bottom: 0.5vw;
}

.hero-authors span {
    font-size: 1vw;
    color: var(--text-secondary);
}

.hero-affiliations {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3vw 1.2vw;
    margin-bottom: 1.5vw;
    font-size: 0.85vw;
    color: var(--text-dim);
}

/* Authors Toggle */
.authors-toggle {
    margin-bottom: 0.8vw;
}

.authors-toggle__btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4vw;
    padding: 0.3vw 0;
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 0.85vw;
    font-family: inherit;
    cursor: pointer;
    transition: color 0.2s ease;
}

.authors-toggle__btn:hover {
    color: var(--text-secondary);
}

.authors-toggle__icon {
    font-size: 0.6vw;
    transition: transform 0.3s ease;
}

.authors-toggle.open .authors-toggle__icon {
    transform: rotate(180deg);
}

.authors-toggle__content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, opacity 0.3s ease;
    opacity: 0;
}

.authors-toggle.open .authors-toggle__content {
    max-height: 20vw;
    opacity: 1;
    margin-top: 0.5vw;
}

/* Release Links */
.release-links {
    margin-top: 1.2vw;
    padding: 1vw;
    border: 1px solid var(--border-accent);
    border-radius: 0.8vw;
    background: var(--accent-subtle);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
    display: grid;
    gap: 0.6vw;
}

.release-links__title {
    font-size: 0.82vw;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
}

.release-links__grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.5vw;
}

.release-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45vw;
    padding: 0.62vw 0.72vw;
    border-radius: 0.6vw;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(6, 3, 10, 0.56);
    color: #fff;
    font-size: 0.84vw;
    font-weight: 500;
    line-height: 1.2;
    transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.release-link:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(255, 255, 255, 0.08);
}

.release-link--dim {
    opacity: 0.35;
    pointer-events: none;
}

.release-link i {
    font-size: 0.9vw;
}

.release-icon {
    width: 0.95vw;
    height: 0.95vw;
    min-width: 14px;
    min-height: 14px;
    vertical-align: middle;
}

/* TL;DR Card */
.tldr-card {
    margin-top: 2.5vw;
    padding: 1.77vw 1.56vw;
    background: rgba(183, 165, 255, 0.06);
    border: 1px solid var(--border);
    border-radius: 1vw;
    backdrop-filter: blur(10px);
    box-shadow: 0 20px 80px rgba(0, 0, 0, 0.4);
}

.tldr-title {
    font-size: 1.04vw;
    font-weight: 700;
    letter-spacing: 0.08vw;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.72);
    margin-bottom: 0.7vw;
}

.tldr-list {
    margin-top: 0.5vw;
    display: grid;
    gap: 0.6vw;
    list-style: none;
    padding: 0;
    color: rgba(255, 255, 255, 0.8);
}

.tldr-list li {
    position: relative;
    padding-left: 1.5vw;
    font-size: 0.95vw;
    line-height: 1.6;
}

.tldr-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.3vw;
    width: 0.36vw;
    height: 0.36vw;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 10px rgba(183, 165, 255, 0.5);
}

.tldr-list li strong {
    color: var(--text);
}

/* Hero Media */
.hero-media {
    position: relative;
    border-radius: 1.25vw;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 25px 90px rgba(0, 0, 0, 0.45);
}

.hero-media img {
    border-radius: 1.25vw;
    border: 1px solid var(--border);
    background: linear-gradient(135deg, rgba(183, 165, 255, 0.12), rgba(183, 165, 255, 0.04));
    box-shadow: 0 25px 90px rgba(0, 0, 0, 0.45);
}

.hero-video {
    width: 100%;
    display: block;
    background: #080610;
}

.video-keyframes {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.6vw;
    padding: 0.5vw 0;
}

.keyframe-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    cursor: pointer;
    transition: all 0.2s ease;
}

.keyframe-dot:hover {
    background: rgba(255, 255, 255, 0.6);
    transform: scale(1.3);
}

.keyframe-dot.active {
    background: var(--accent);
    box-shadow: 0 0 8px rgba(183, 165, 255, 0.5);
    transform: scale(1.4);
}

.hero-video-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 1.25vw;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: #080610;
    box-shadow: 0 25px 90px rgba(0, 0, 0, 0.45);
}

.hero-video-frame iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* ===== Article Body ===== */
.article-body {
    position: relative;
    z-index: 1;
    padding: 2vw 0 4vw;
    background: #08060b;
}

.article-grid {
    width: 91.666vw;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5vw;
    align-items: start;
}

/* Sidebar TOC — dots + line */
.article-toc {
    position: sticky;
    top: calc(var(--head) + 2vw);
    display: flex;
    justify-content: center;
}

.toc-dots {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    position: relative;
}

.toc-dots::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 1px;
    background: rgba(255, 255, 255, 0.12);
    transform: translateX(-50%);
    z-index: 0;
}

.toc-dot {
    position: relative;
    z-index: 1;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    border: none;
    margin: 0.8vw 0;
    transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
    cursor: pointer;
}

.toc-dot:hover,
.toc-dot.active {
    background: var(--accent);
    box-shadow: 0 0 10px rgba(183, 165, 255, 0.5);
    transform: scale(1.4);
}

.toc-dot::after {
    content: attr(title);
    position: absolute;
    left: calc(100% + 0.6vw);
    top: 50%;
    transform: translateY(-50%);
    white-space: nowrap;
    font-size: 0.75vw;
    color: rgba(255, 255, 255, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.toc-dot:hover::after {
    opacity: 1;
}

/* Article Content */
.article-content {
    min-width: 0;
    display: grid;
    gap: 1.5vw;
}

.article-content > h2 {
    text-align: left;
    font-size: 2vw;
    letter-spacing: -0.03vw;
    margin-top: 1.5vw;
    margin-bottom: 1vw;
    position: relative;
}

.article-content > h2::before {
    content: '';
    display: block;
    width: 100%;
    height: 1px;
    margin-bottom: 2vw;
    background: rgba(255, 255, 255, 0.16);
    opacity: 0.8;
}

.article-content > h2:first-child {
    margin-top: 0;
}

.article-content > h2:first-child::before {
    display: none;
}

.article-content > p {
    font-size: 1.15vw;
    color: rgba(255, 255, 255, 0.78);
    line-height: 1.7;
    margin-bottom: 0;
}

.article-content > p strong {
    color: var(--accent);
    font-weight: 600;
}

h3 {
    font-size: 1.5vw;
    font-weight: 600;
    letter-spacing: -0.02vw;
    margin: 1.5vw 0 0.8vw;
    color: #fff;
}

.subsection-title {
    text-align: center;
    margin-top: 3vw;
}

/* ===== Stats Scene (Ropedia-inspired) ===== */
.stats-scene {
    position: relative;
    border: 1px solid var(--border);
    border-radius: 1vw;
    padding: 2vw;
    margin: 0;
    background:
        radial-gradient(circle at 50% 22%, rgba(183, 165, 255, 0.08), transparent 30%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0.01));
    overflow: hidden;
    min-height: 30vh;
}

.stats-grid-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.35;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
    background-size: 62px 62px;
    mask-image: radial-gradient(circle at center, black 35%, transparent 95%);
    -webkit-mask-image: radial-gradient(circle at center, black 35%, transparent 95%);
}

.stats-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1vw;
    margin-bottom: 1.2vw;
    position: relative;
}

.stats-header h3 {
    margin: 0;
    font-size: 2.3vw;
    line-height: 0.95;
    letter-spacing: -0.04vw;
}

.stats-subtitle {
    font-size: 1.2vw;
    color: #fff;
    font-weight: 500;
    margin: 0;
}

.stats-kicker {
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-size: 0.75vw;
    white-space: nowrap;
    font-weight: 600;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.7vw;
    position: relative;
}

.stat-card {
    position: relative;
    min-height: 8.5vw;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.02);
    padding: 0.8vw;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}

.stats-scene.is-active .stat-card {
    opacity: 1;
    transform: translateY(0);
}

.stats-scene.is-active .stat-card:nth-child(1) { transition-delay: 0.06s; }
.stats-scene.is-active .stat-card:nth-child(2) { transition-delay: 0.10s; }
.stats-scene.is-active .stat-card:nth-child(3) { transition-delay: 0.14s; }
.stats-scene.is-active .stat-card:nth-child(4) { transition-delay: 0.18s; }
.stats-scene.is-active .stat-card:nth-child(5) { transition-delay: 0.22s; }
.stats-scene.is-active .stat-card:nth-child(6) { transition-delay: 0.26s; }
.stats-scene.is-active .stat-card:nth-child(7) { transition-delay: 0.30s; }
.stats-scene.is-active .stat-card:nth-child(8) { transition-delay: 0.34s; }

.stat-label {
    font-size: 0.75vw;
    color: rgba(255, 255, 255, 0.72);
    line-height: 1.3;
}

.stat-value {
    font-size: 1.8vw;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.03vw;
    color: #fff;
    margin-top: auto;
}

.stat-card--highlight .stat-label,
.stat-card--highlight .stat-value {
    color: var(--accent);
}

/* ===== Two Col ===== */
.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1vw;
    margin: 0;
}

.col {
    padding: 1.8vw 1.6vw;
    border-radius: 1vw;
    border: 1px solid rgba(183, 165, 255, 0.16);
    background: rgba(8, 6, 14, 0.96);
    transition: border-color 0.3s ease, background 0.2s ease, transform 0.2s ease;
}

.col:hover {
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.06);
    transform: translateY(-2px);
}

.col h3 {
    margin-top: 0;
    font-size: 1.2vw;
    color: var(--accent);
}

.col p {
    color: rgba(245, 247, 240, 0.76);
    font-size: 0.95vw;
}

/* ===== G-Buffer Channels ===== */
.gbuffer-channels {
    text-align: center;
    margin-top: 1vw;
}

.channel-grid {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.6vw;
    margin-top: 1vw;
}

.channel-toggle {
    display: flex;
    align-items: center;
    gap: 0.5vw;
    background: rgba(255, 255, 255, 0.04);
    padding: 0.468vw 1.354vw;
    border-radius: 80px;
    border: 1px solid var(--border);
    font-size: 0.85vw;
    font-weight: 500;
    color: var(--text-dim);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font-btn);
    opacity: 0.5;
}

.channel-toggle.active {
    opacity: 1;
    color: var(--text);
    border-color: var(--accent);
    background: rgba(183, 165, 255, 0.12);
}

.channel-toggle:hover {
    opacity: 0.85;
}

.channel-color {
    width: 0.9vw;
    height: 0.9vw;
    min-width: 14px;
    min-height: 14px;
    border-radius: 50%;
}

/* ===== Pipeline ===== */
.pipeline-image img {
    border-radius: 1vw;
    border: 1px solid var(--border);
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
    margin-bottom: 1.5vw;
}

.pipeline-stages {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1vw;
}

.stage {
    padding: 1.8vw 1.6vw;
    border-radius: 1vw;
    border: 1px solid rgba(183, 165, 255, 0.16);
    background: rgba(8, 6, 14, 0.96);
    transition: border-color 0.3s ease;
}

.stage:hover {
    border-color: var(--accent);
}

.stage h3 {
    margin-top: 0;
    display: flex;
    align-items: center;
    gap: 0.6vw;
    font-size: 1.1vw;
}

.stage-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.6vw;
    height: 1.6vw;
    min-width: 26px;
    min-height: 26px;
    background: var(--accent);
    color: #05020b;
    border-radius: 0.4vw;
    font-size: 0.78rem;
    font-weight: 700;
    flex-shrink: 0;
}

.stage p {
    color: rgba(245, 247, 240, 0.76);
    font-size: 0.95vw;
    line-height: 1.65;
}

/* ===== Inverse Video ===== */
.inverse-video-wrap {
    position: relative;
    border-radius: 0.8vw;
    overflow: hidden;
    border: 1px solid var(--border);
}

.inverse-video-wrap video {
    width: 100%;
    display: block;
    background: #080610;
}

.inverse-labels {
    position: absolute;
    top: 0.5vw;
    left: 0;
    right: 0;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    z-index: 5;
    pointer-events: none;
}

.inverse-labels span {
    text-align: center;
    font-size: 0.72vw;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #fff;
}

.inverse-labels span::before {
    content: attr(data-label);
}

.inverse-labels span {
    display: flex;
    justify-content: center;
}

.inverse-labels span span {
    background: rgba(0, 0, 0, 0.55);
    padding: 0.2vw 0.6vw;
    border-radius: 0.3vw;
    backdrop-filter: blur(4px);
}

/* ===== Inverse Controls ===== */
.inverse-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5vw;
    align-items: center;
    margin-bottom: 1.2vw;
}

.inverse-group {
    display: flex;
    align-items: center;
    gap: 0.5vw;
}

.inverse-group__label {
    font-size: 0.75vw;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-dim);
    white-space: nowrap;
}

.inverse-scene-btns,
.inverse-channel-btns {
    display: flex;
    gap: 0.4vw;
    flex-wrap: wrap;
}

.scene-btn {
    padding: 0.468vw 1.354vw;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.05);
    border-radius: 80px;
    font-size: 0.85vw;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
    color: #fff;
    font-family: var(--font-btn);
}

.scene-btn.active {
    background: #fff;
    color: #05020b;
    border-color: #fff;
    font-weight: 600;
}

.scene-btn:hover:not(.active) {
    border-color: rgba(255, 255, 255, 0.5);
    color: #fff;
}

/* ===== Method Selector ===== */
.method-selector {
    display: flex;
    align-items: center;
    gap: 0.8vw;
    margin-bottom: 1.2vw;
    flex-wrap: wrap;
}

.method-selector__label {
    font-size: 0.85vw;
    color: var(--text-dim);
    font-weight: 500;
}

.method-selector__btns {
    display: flex;
    gap: 0.5vw;
    flex-wrap: wrap;
}

.method-btn {
    padding: 0.468vw 1.354vw;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.05);
    border-radius: 80px;
    font-size: 0.85vw;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
    color: #fff;
    font-family: var(--font-btn);
}

.method-btn.active {
    background: var(--accent);
    color: #05020b;
    border-color: var(--accent);
    font-weight: 600;
}

.method-btn:hover:not(.active) {
    border-color: var(--accent);
    color: var(--accent);
}

.video-row--3col {
    grid-template-columns: repeat(3, 1fr);
}

/* ===== Video Tabs ===== */
.video-tabs {
    display: flex;
    gap: 0.5vw;
    margin-bottom: 1.5vw;
}

.tab-btn {
    padding: 0.468vw 1.354vw;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.05);
    border-radius: 80px;
    font-size: 0.9vw;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
    color: #fff;
    font-family: var(--font-btn);
}

.tab-btn.active {
    background: rgba(255, 255, 255, 0.08);
    color: var(--accent);
    border-color: var(--accent);
    font-weight: 600;
}

.tab-btn:hover:not(.active) {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(255, 255, 255, 0.08);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ===== Channel Selector ===== */
.channel-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5vw;
    margin-bottom: 1.2vw;
}

.channel-btn {
    padding: 0.468vw 1.354vw;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.05);
    border-radius: 80px;
    font-size: 0.85vw;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
    color: #fff;
    font-family: var(--font-btn);
}

.channel-btn.active {
    background: var(--accent);
    color: #05020b;
    border-color: var(--accent);
    font-weight: 600;
}

.channel-btn:hover:not(.active) {
    border-color: var(--accent);
    color: var(--accent);
}

.channel-content {
    display: none;
}

.channel-content.active {
    display: block;
}

/* ===== Video Grid ===== */
.video-comparison {
    margin-bottom: 2vw;
}

.video-comparison h4 {
    font-size: 0.9vw;
    font-weight: 500;
    margin-bottom: 0.6vw;
    color: var(--text-dim);
    letter-spacing: 0.04em;
}

.video-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.7vw;
    align-items: start;
}

.video-item {
    position: relative;
}

.video-label {
    display: block;
    text-align: center;
    font-size: 0.76vw;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.3vw;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.video-item video {
    border-radius: 0.8vw;
    border: 1px solid var(--border);
    width: 100%;
    background: #080610;
    transition: border-color 0.3s ease;
}

.video-item video:hover {
    border-color: rgba(255, 255, 255, 0.2);
}

/* ===== Relighting Interactive ===== */
.relight-interactive {
    display: flex;
    gap: 2vw;
    align-items: center;
    justify-content: center;
}

.relight-dial {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5vw;
    user-select: none;
}

.relight-dial__svg {
    width: 12vw;
    min-width: 140px;
    height: auto;
    cursor: pointer;
}

.relight-sun {
    filter: drop-shadow(0 0 8px var(--accent));
    cursor: grab;
    transition: r 0.15s ease;
}

.relight-sun:hover,
.relight-sun.dragging {
    r: 13;
}

.relight-dial__label {
    font-size: 0.72vw;
    color: var(--text-dim);
    text-align: center;
}

.relight-result {
    position: relative;
    border-radius: 0.8vw;
    overflow: hidden;
    border: 1px solid var(--border);
    max-width: 70%;
}

.relight-result video {
    width: 100%;
    display: block;
    background: #080610;
}

/* ===== Game Editing ===== */
.style-selector {
    display: flex;
    align-items: center;
    gap: 0.8vw;
    margin-bottom: 1.2vw;
    flex-wrap: wrap;
}

.style-selector__label {
    font-size: 0.85vw;
    color: var(--text-dim);
    font-weight: 500;
}

.style-selector__btns {
    display: flex;
    gap: 0.5vw;
    flex-wrap: wrap;
}

.style-btn {
    padding: 0.468vw 1.354vw;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.05);
    border-radius: 80px;
    font-size: 0.85vw;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
    color: #fff;
    font-family: var(--font-btn);
}

.style-btn.active {
    background: var(--accent);
    color: #05020b;
    border-color: var(--accent);
    font-weight: 600;
}

.style-btn:hover:not(.active) {
    border-color: var(--accent);
    color: var(--accent);
}

.editing-compare {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1vw;
}

.editing-col {
    text-align: center;
}

.editing-col video {
    width: 100%;
    border-radius: 0.8vw;
    border: 1px solid var(--border);
    background: #080610;
}

/* ===== Zoomable Wrapper ===== */
.zoomable {
    position: relative;
}

/* ===== Edit Slider ===== */
.edit-slider {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: 0.8vw;
    border: 1px solid var(--border);
    cursor: col-resize;
    user-select: none;
    -webkit-user-select: none;
    background: #080610;
}

.edit-slider video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

.edit-slider__input {
    position: relative !important;
}

.edit-slider__handle {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 3px;
    left: 50%;
    z-index: 10;
    cursor: col-resize;
}

.edit-slider__handle::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: -8px;
    right: -8px;
}

.edit-slider__handle::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.6);
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.5);
}

.edit-label-left {
    left: 12px !important;
    transform: none !important;
}

.edit-label-right {
    left: auto !important;
    right: 12px;
    transform: none !important;
}

/* ===== Tables ===== */
.table-wrapper {
    overflow-x: auto;
    margin: 1vw 0 2vw;
    border-radius: 1vw;
    border: 1px solid var(--border);
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(255, 255, 255, 0.02);
    font-size: 0.84vw;
}

thead {
    background: rgba(255, 255, 255, 0.04);
}

th {
    padding: 0.6vw 0.8vw;
    text-align: center;
    font-weight: 600;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    white-space: nowrap;
    font-size: 0.78vw;
    letter-spacing: 0.02em;
}

td {
    padding: 0.5vw 0.8vw;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    white-space: nowrap;
    color: var(--text-secondary);
}

tbody tr {
    transition: background 0.2s ease;
}

tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.highlight-row {
    background: rgba(183, 165, 255, 0.06) !important;
}

.highlight-row td {
    color: var(--accent);
}

/* ===== Channel Slider ===== */
.ch-slider {
    position: relative;
    width: 100%;
    min-height: 200px;
    overflow: hidden;
    border-radius: 0.8vw;
    border: 1px solid var(--border);
    cursor: col-resize;
    user-select: none;
    -webkit-user-select: none;
    background: #080610;
}

.ch-slider video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

.ch-slider video.ch-sizer {
    position: relative;
}

.ch-slider-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 3px;
    z-index: 10;
    cursor: col-resize;
}

.ch-slider-handle::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: -8px;
    right: -8px;
}

.ch-slider-handle::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.6);
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.5);
}

.ch-slider-label {
    position: absolute;
    top: 8px;
    z-index: 5;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    pointer-events: none;
    white-space: nowrap;
}

/* ===== Dataset Carousel ===== */
.carousel {
    position: relative;
    transition: all 0.3s ease;
}

.carousel-resize-controls {
    position: absolute;
    top: 0.6vw;
    right: 0.6vw;
    z-index: 20;
    display: flex;
    gap: 4px;
}

.carousel-resize-controls button {
    width: 2vw;
    height: 2vw;
    min-width: 28px;
    min-height: 28px;
    border: none;
    border-radius: 0.3vw;
    background: rgba(0, 0, 0, 0.6);
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.2vw;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    backdrop-filter: blur(4px);
    font-family: inherit;
    line-height: 1;
}

.carousel-resize-controls button:hover {
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
}

.carousel-slides {
    position: relative;
}

.carousel-slide {
    display: none;
}

.carousel-slide.active {
    display: block;
}

.carousel-slide video {
    border-radius: 0.8vw;
    border: 1px solid var(--border);
    width: 100%;
    background: #080610;
}

.gallery-caption {
    display: block;
    width: 100%;
    text-align: center;
    font-size: 0.85vw;
    color: var(--text-dim);
    margin-top: 0.5vw;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.carousel-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1vw;
    margin-top: 0.8vw;
}

.carousel-arrow {
    width: 2vw;
    height: 2vw;
    min-width: 28px;
    min-height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5vw;
    color: rgba(255, 255, 255, 0.25);
    cursor: pointer;
    user-select: none;
    transition: color 0.2s ease, transform 0.2s ease;
}

.carousel-arrow:hover {
    color: rgba(255, 255, 255, 0.75);
    transform: scale(1.1);
}

.carousel-dots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4vw;
}

.carousel-dot {
    width: 0.55vw;
    height: 0.55vw;
    min-width: 8px;
    min-height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    cursor: pointer;
    transition: all 0.25s ease;
}

.carousel-dot:hover {
    background: rgba(255, 255, 255, 0.6);
}

.carousel-dot.active {
    background: var(--accent);
    transform: scale(1.3);
}

/* ===== BibTeX ===== */
.bibtex-block {
    position: relative;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 1vw;
    padding: 1.5vw;
    overflow-x: auto;
}

.bibtex-block pre {
    margin: 0;
}

.bibtex-block code {
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', 'Fira Code', 'Menlo', monospace;
    font-size: 0.8rem;
    line-height: 1.7;
}

.copy-btn {
    position: absolute;
    top: 0.8vw;
    right: 0.8vw;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-dim);
    border: 1px solid var(--border);
    padding: 0.3vw 1vw;
    border-radius: 0.4vw;
    font-size: 0.76rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.2);
}

/* ===== Hero Team Link ===== */
.hero-team-link {
    font-size: 0.9vw;
    margin-bottom: 1vw;
}

.hero-team-link a {
    color: var(--text-dim);
    transition: color 0.2s ease;
    border-bottom: 1px dashed var(--text-dim);
}

.hero-team-link a:hover {
    color: var(--accent);
    border-color: var(--accent);
}

/* ===== Team ===== */
.team-section {
    text-align: center;
    padding: 4vw 0 2vw;
    background: #08060b;
    border-top: 1px solid var(--border);
}

.team-wrap {
    width: 91.666vw;
    margin: 0 auto;
}

.team-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.6vw;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    margin-bottom: 1vw;
}

.team-toggle h2 {
    font-size: 1.8vw;
    font-weight: 600;
    color: #fff;
    margin: 0;
}

.team-toggle__icon {
    font-size: 0.9vw;
    color: var(--text-dim);
    transition: transform 0.3s ease;
}

.team-section.open .team-toggle__icon {
    transform: rotate(180deg);
}

.team-content {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.4s ease, opacity 0.3s ease;
}

.team-section.open .team-content {
    max-height: 15vw;
    opacity: 1;
}

.team-authors {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.3vw 1.2vw;
    margin-bottom: 1vw;
}

.team-authors span {
    font-size: 1vw;
    color: var(--text-secondary);
}

.team-affiliations {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.3vw 1.5vw;
    font-size: 0.85vw;
    color: var(--text-dim);
}

/* ===== Footer ===== */
footer {
    text-align: center;
    padding: 2.5vw 1.5vw;
    color: var(--text-dim);
    font-size: 0.9vw;
    border-top: 1px solid var(--border);
    position: relative;
    z-index: 1;
    background: #000;
}

/* ===== Scroll Animations ===== */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.stage,
.col,
.gallery-item,
.video-comparison,
.relighting-example,
.channel-item {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.is-visible .stage,
.is-visible .col,
.is-visible .gallery-item,
.is-visible .video-comparison,
.is-visible .relighting-example,
.is-visible .channel-item {
    opacity: 1;
    transform: translateY(0);
}

.is-visible .stage:nth-child(1) { transition-delay: 0.04s; }
.is-visible .stage:nth-child(2) { transition-delay: 0.12s; }
.is-visible .stage:nth-child(3) { transition-delay: 0.20s; }

.is-visible .col:nth-child(1) { transition-delay: 0.04s; }
.is-visible .col:nth-child(2) { transition-delay: 0.12s; }

.is-visible .gallery-item:nth-child(1) { transition-delay: 0.04s; }
.is-visible .gallery-item:nth-child(2) { transition-delay: 0.08s; }
.is-visible .gallery-item:nth-child(3) { transition-delay: 0.12s; }
.is-visible .gallery-item:nth-child(4) { transition-delay: 0.16s; }

.is-visible .channel-item:nth-child(1) { transition-delay: 0.0s; }
.is-visible .channel-item:nth-child(2) { transition-delay: 0.05s; }
.is-visible .channel-item:nth-child(3) { transition-delay: 0.10s; }
.is-visible .channel-item:nth-child(4) { transition-delay: 0.15s; }
.is-visible .channel-item:nth-child(5) { transition-delay: 0.20s; }
.is-visible .channel-item:nth-child(6) { transition-delay: 0.25s; }

.table-wrapper {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}

.is-visible .table-wrapper {
    opacity: 1;
    transform: translateY(0);
}

.bibtex-block {
    opacity: 0;
    transform: scale(0.97);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.is-visible .bibtex-block {
    opacity: 1;
    transform: scale(1);
}

/* ===== Responsive ===== */
@media (max-width: 1100px) {
    .hero-grid {
        grid-template-columns: 1fr;
        gap: 3vw;
    }

    .hero-media {
        position: static;
    }

    .article-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .article-toc {
        position: static;
        margin-bottom: 2vw;
    }

    .toc-dots {
        flex-direction: row;
    }

    .toc-dots::before {
        top: 50%;
        bottom: auto;
        left: 0;
        right: 0;
        width: auto;
        height: 1px;
        transform: translateY(-50%);
    }

    .toc-dot {
        margin: 0 12px;
    }

    .toc-dot::after {
        left: 50%;
        top: calc(100% + 8px);
        transform: translateX(-50%);
    }

    .stats-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    :root {
        --head: 56px;
    }

    .hero-grid,
    .article-grid {
        width: calc(100% - 32px);
    }

    .header-wrap {
        width: calc(100% - 32px);
    }

    .article-hero {
        padding: 76px 16px 40px;
    }

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

    .hero-team-link {
        font-size: 14px;
    }

    .hero-subtitle,
    .article-content > p {
        font-size: 0.95rem;
    }

    .hero-authors span,
    .hero-affiliations span {
        font-size: 0.85rem;
    }

    /* Release links */
    .release-links {
        margin-top: 16px;
        padding: 14px;
        border-radius: 12px;
    }

    .release-links__title { font-size: 11px; }

    .release-links__grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .release-link {
        padding: 10px 12px;
        gap: 8px;
        border-radius: 10px;
        font-size: 13px;
    }

    .release-link i {
        font-size: 14px;
    }

    .release-icon {
        width: 14px;
        height: 14px;
    }

    /* TL;DR */
    .tldr-card {
        padding: 16px;
        margin-top: 16px;
        border-radius: 12px;
    }

    .tldr-title {
        font-size: 12px;
    }

    .tldr-list li {
        font-size: 14px;
        padding-left: 16px;
    }

    .tldr-list li::before {
        top: 7px;
        width: 5px;
        height: 5px;
    }

    /* Stats */
    .stats-scene {
        padding: 16px;
        border-radius: 12px;
    }

    .stats-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .stats-header h3 {
        font-size: 1.2rem;
    }

    .stats-subtitle {
        font-size: 14px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .stat-card {
        min-height: 80px;
        padding: 10px;
    }

    .stat-label { font-size: 11px; }
    .stat-value { font-size: 20px; }

    /* Two col */
    .two-col {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .col {
        padding: 16px;
    }

    .col h3 { font-size: 15px; }
    .col p { font-size: 14px; }

    /* Channel toggles */
    .gbuffer-channels h3 {
        font-size: 14px;
    }

    .channel-toggle {
        padding: 6px 14px;
        font-size: 12px;
    }

    .channel-grid {
        gap: 6px;
    }

    /* Carousel */
    .carousel-resize-controls {
        display: none;
    }

    .gallery-caption {
        font-size: 12px;
    }

    .carousel-arrow {
        font-size: 20px;
        min-width: 24px;
        min-height: 24px;
    }

    .carousel-dot {
        min-width: 6px;
        min-height: 6px;
    }

    /* Channel slider labels */
    .ch-slider-label {
        font-size: 9px;
        padding: 2px 6px;
    }

    /* Section headings */
    .article-content > h2 {
        font-size: 1.4rem;
    }

    h3 {
        font-size: 1.1rem;
    }

    /* Style selector */
    .style-selector {
        gap: 6px;
    }

    .style-selector__label {
        font-size: 12px;
    }

    .style-btn, .method-btn, .scene-btn {
        padding: 6px 12px;
        font-size: 12px;
    }

    /* Inverse controls */
    .inverse-controls {
        gap: 10px;
    }

    .inverse-group {
        gap: 6px;
        flex-wrap: wrap;
    }

    .inverse-group__label {
        font-size: 11px;
    }

    .inverse-labels span span {
        font-size: 10px;
        padding: 2px 6px;
    }

    /* Edit slider labels */
    .edit-label-left,
    .edit-label-right {
        font-size: 10px !important;
    }

    /* Tab/channel buttons */
    .tab-btn, .channel-btn {
        font-size: 12px;
        padding: 6px 14px;
    }

    /* Video row */
    .video-row {
        grid-template-columns: 1fr;
    }

    .video-row--3col {
        grid-template-columns: 1fr;
    }

    .video-label {
        font-size: 11px;
    }

    /* Keyframes */
    .video-keyframes {
        gap: 6px;
        padding: 6px 0;
    }

    .keyframe-dot {
        width: 6px;
        height: 6px;
    }

    /* Relight */
    .relight-interactive {
        flex-direction: column;
        gap: 16px;
    }

    .relight-dial__svg {
        min-width: 100px;
        width: 100px;
    }

    .relight-dial__label {
        font-size: 11px;
    }

    .relight-result {
        max-width: 100%;
    }

    /* Team */
    .team-section {
        padding: 32px 0 16px;
    }

    .team-section h2 {
        font-size: 1.4rem;
    }

    .team-authors span {
        font-size: 14px;
    }

    .team-affiliations {
        font-size: 12px;
    }

    /* Header */
    .logo {
        gap: 8px;
    }

    .logo-img {
        height: 24px;
        min-height: 24px;
        padding: 4px;
        border-radius: 4px;
    }

    .logo-text {
        font-size: 14px;
    }

    .header-nav {
        display: none;
    }

    .header-github {
        font-size: 20px;
        margin-left: 0;
    }

    /* Footer */
    footer {
        font-size: 12px;
        padding: 16px;
    }

    /* Pipeline */
    .pipeline-stages {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .release-links__grid {
        grid-template-columns: 1fr;
    }

    .style-selector__btns {
        gap: 4px;
    }

    .style-btn, .scene-btn {
        padding: 5px 10px;
        font-size: 11px;
    }

    .inverse-scene-btns,
    .inverse-channel-btns {
        gap: 4px;
    }

    .channel-btn {
        padding: 5px 10px;
        font-size: 11px;
    }
}
