/*
 * SWM Project Page Styles
 * Based on ReNoV template
 */

:root {
    /* Typography */
    --font-primary: 'Wanted Sans Variable', 'Wanted Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: monospace;

    /* Caption Font Size Configuration */
    --caption-font-size: 1rem;

    /* Colors - Brand */
    --color-primary: #1a7a3a;
    --color-primary-light: #2a9d4e;
    --color-primary-dark: #14612e;

    /* Colors - Grayscale */
    --color-bg: #ffffff;
    --color-bg-alt: #f6fdf8;
    --color-text-main: #1e293b;
    /* Slate 800 */
    --color-text-muted: #64748b;
    /* Slate 500 */
    --color-text-light: #94a3b8;
    /* Slate 400 */
    --color-border: #e2e8f0;
    /* Slate 200 */
    --color-border-light: #f1f5f9;
    /* Slate 100 */

    /* Layout */
    --container-width: 68rem;
    --header-height: 4rem;
    --sidebar-width: 160px;
}

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

html {
    scroll-behavior: smooth;
    font-size: 14.5px;
    /* Global Scale */
}

body {
    font-family: var(--font-primary);
    background-color: var(--color-bg);
    color: var(--color-text-main);
    line-height: 1.6;
    padding-left: var(--sidebar-width);
}

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

a {
    text-decoration: none;
    color: inherit;
}

/* Typography Defaults */
h1,
h2,
h3,
h4 {
    color: #0f172a;
    /* Slate 900 */
    font-weight: 700;
    line-height: 1.2;
}


p {
    margin-top: 0.8rem;
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
    color: var(--color-text-main);
    text-align: left;
    line-height: 1.625;
}

/* Layout Components */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 1rem;
}

.section {
    width: 100%;
    padding: 3rem 0;
    border-top: 1px solid var(--color-border);
}

.section.alt-bg {
    background-color: var(--color-bg-alt);
}

.section-title {
    font-size: 1.75rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--color-primary-dark);
    margin-bottom: 2rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--color-border);
    display: block;
    width: fit-content;
}

/* Navigation Sidebar */
.sidebar {
    position: fixed;
    top: 50%;
    left: 2rem;
    transform: translateY(-50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 6px;
    width: 3px;
    background: #e2e8f0;
    z-index: 0;
}

.sidebar::after {
    content: '';
    position: absolute;
    left: 6px;
    width: 3px;
    background: linear-gradient(to bottom, transparent, var(--color-primary), var(--color-primary), transparent);
    z-index: 1;
    transition: all 0.3s ease;
    top: var(--active-position, 0);
    height: 100px;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.3s ease;
    position: relative;
}

.sidebar-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #cbd5e1;
    /* Slate 300 */
    transition: all 0.3s ease;
    border: 2px solid var(--color-bg);
    box-sizing: content-box;
    position: relative;
    z-index: 2;
}

.sidebar-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text-muted);
    transition: all 0.3s ease;
}

.sidebar-item:hover .sidebar-dot,
.sidebar-item.active .sidebar-dot {
    background-color: #03c75a;
    transform: scale(1.3);
}

.sidebar-item:hover .sidebar-label,
.sidebar-item.active .sidebar-label {
    color: #03c75a;
    font-weight: 700;
}

@media (max-width: 1280px) {
    body {
        padding-left: 0;
    }

    .sidebar {
        position: sticky;
        top: 0;
        left: 0;
        transform: none;
        width: 100%;
        height: auto;

        display: flex;
        flex-direction: row;
        justify-content: center;
        align-items: center;
        gap: 1.5rem;
        padding: 1rem;

        background-color: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        border-bottom: 1px solid var(--color-border);
        box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);

        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;

        z-index: 1000;

        -ms-overflow-style: none;
        scrollbar-width: none;
    }

    .sidebar::-webkit-scrollbar {
        display: none;
    }

    .sidebar::before,
    .sidebar::after {
        display: none;
    }

    .sidebar-dot {
        display: none;
    }

    .sidebar-item {
        gap: 0;
        padding: 0.5rem;
    }

    .sidebar-label {
        font-size: 0.95rem;
    }
}

@media (max-width: 640px) {
    .sidebar {
        justify-content: flex-start;
        padding: 1rem 1.5rem;
        gap: 1rem;
    }
}

/* Hero Section */
.hero-section {
    padding-top: 4rem;
    text-align: center;
    margin-bottom: 3rem;
}

.hero-container {
    max-width: 64rem;
    margin: 0 auto 3rem auto;
}

.hero-title {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 1.15rem;
    line-height: 1.25;
}

.hero-title .hero-subtitle {
    font-weight: 400;
    font-size: 0.8em;
    line-height: 1.3;
    display: inline-block;
    margin-top: 0.2em;
}

.hero-title .gradient-text {
    background: linear-gradient(to right, #02a94c, #02a94c);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

@media (min-width: 768px) {
    .hero-title {
        font-size: 2.9rem;
    }
}

.hero-authors {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    column-gap: 1rem;
    row-gap: 0.2rem;
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    max-width: 56rem;
    margin-left: auto;
    margin-right: auto;
}

.hero-authors span {
    color: #2450b5;
    font-weight: 500;
    white-space: nowrap;
}

.hero-authors a {
    color: #2450b5;
    text-decoration: none;
    transition: color 0.2s;
}

.hero-authors a:hover {
    color: #2563eb;
    text-decoration: underline;
}

.hero-affiliations {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
    color: var(--color-text-muted);
    font-size: 1rem;
}

.hero-notes {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    color: var(--color-text-light);
    font-size: 0.875rem;
    font-style: italic;
}

.hero-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 3rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1.25rem;
    border-radius: 9999px;
    background-color: #1e293b;
    /* Slate 800 */
    color: white;
    font-weight: 500;
    transition: background-color 0.3s;
}

.btn:hover {
    background-color: #334155;
    /* Slate 700 */
}

.btn.disabled {
    opacity: 0.5;
    pointer-events: none;
    cursor: default;
}

.btn.btn-outline {
    background-color: white;
    color: var(--color-text-main);
    border: 1px solid #cbd5e1;
    /* Slate 300 */
}

.btn.btn-outline:hover {
    background-color: var(--color-bg-alt);
}

.btn.btn-outline.disabled {
    opacity: 0.5;
    pointer-events: none;
    cursor: default;
}

/* Teaser & TL;DR */
.teaser-container {
    width: 100%;
    max-width: 1800px;
    margin: 0 auto;
    padding: 0 1rem;
}

.tldr-box {
    width: 100%;
    max-width: 72rem;
    margin: 0 auto 0rem auto;
    background-color: var(--color-bg-alt);
    border: 2px solid var(--color-primary);
    border-radius: 12px;
    padding: 2rem;
}

.tldr-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

@media (min-width: 768px) {
    .tldr-content {
        flex-direction: row;
        align-items: center;
    }
}

.tldr-label {
    background-color: var(--color-primary);
    color: white;
    font-size: 1.125rem;
    font-weight: 700;
    padding: 0.25rem 1rem;
    border-radius: 0.5rem;
    flex-shrink: 0;
}

.tldr-text {
    font-size: 1.25rem;
    color: var(--color-text-main);
    font-weight: 500;
    line-height: 1.625;
    margin-bottom: 0px !important;
    margin-top: 0px !important;
    text-align: center;
}

.tldr-highlight {
    color: var(--color-primary);
    font-weight: 800;
}

/* Demo Section */
.demo-block {
    margin-bottom: 4rem;
}

.demo-block:last-child {
    margin-bottom: 0;
}

.video-container {
    position: relative;
    width: 100%;
    border-radius: 0.5rem;
    overflow: hidden;
}

.video-container video {
    width: 100%;
    display: block;
    border-radius: 0.5rem;
}

/* Video loading shimmer */
video.hero-video {
    min-height: 120px;
    background: linear-gradient(110deg, #e2e8f0 30%, #f1f5f9 50%, #e2e8f0 70%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
}

video.hero-video.loaded {
    background: none;
    animation: none;
}

video.lazy-video {
    min-height: 120px;
    background: linear-gradient(110deg, #e2e8f0 30%, #f1f5f9 50%, #e2e8f0 70%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
}

video.lazy-video.loaded {
    background: none;
    animation: none;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.figure-caption {
    display: block;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text-main);
    margin-top: 0.5rem;
}

.video-caption {
    display: block;
    text-align: center;
    font-size: 0.8rem;
    color: var(--color-text-light);
    margin-top: 0.05rem;
}

.speed-label {
    position: absolute;
    bottom: 12px;
    right: 12px;
    font-size: 0.8rem;
    color: #fff;
    background: rgba(0, 0, 0, 0.5);
    padding: 2px 8px;
    border-radius: 4px;
}

/* Figure Container */
.figure-container {
    width: 100%;
    margin-bottom: 1.5rem;
    border-radius: 0.5rem;
    overflow: hidden;
}

.figure-container img {
    width: 100%;
    display: block;
    border-radius: 0.5rem;
}

/* Subsection Title */
.subsection-title {
    font-size: 1.35rem;
    font-weight: 600;
    margin-top: 3rem;
    margin-bottom: 1rem;
    color: var(--color-text-main);
}

/* Two-Column Layout */
.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

@media (max-width: 768px) {
    .two-col {
        grid-template-columns: 1fr;
    }
}

/* Text + Figure Row (desktop: text left / image right, mobile: image on top) */
.text-figure-row {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.text-figure-text {
    flex: 1;
}

.text-figure-img {
    flex: 0 0 45%;
}

@media (max-width: 768px) {
    .text-figure-row {
        flex-direction: column-reverse;
    }

    .text-figure-img {
        flex: none;
        width: 100%;
    }
}

/* Abstract Section */
.abstract-text {
    font-size: 1.25rem;
    color: var(--color-text-main);
    text-align: left;
    line-height: 1.625;
}

/* Analysis subtitle (reused for demo subtitles) */
.analysis-subtitle {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

/* Citation Section */
.citation-section {
    padding: 8rem 0;
    border-top: 1px solid var(--color-border);
    margin-top: 2rem;
}

.citation-block {
    background-color: var(--color-bg-alt);
    color: var(--color-text-muted);
    padding: 1rem;
    border-radius: 0.25rem;
    border: 1px solid var(--color-border);
    overflow-x: auto;
    position: relative;
    text-align: left;
}

.citation-block:hover .citation-copy-btn {
    opacity: 1;
}

.citation-copy-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background-color: white;
    border: 1px solid #cbd5e1;
    color: var(--color-text-muted);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    transition: opacity 0.2s;
    opacity: 0;
    cursor: pointer;
}

.citation-code {
    font-family: var(--font-mono);
    font-size: 1.0rem;
    line-height: 1.625;
}

/* Footer */
.footer {
    padding: 2rem 0;
    text-align: center;
    background-color: var(--color-bg);
    border-top: 1px solid var(--color-border);
}

.footer p {
    margin: 0;
    color: var(--color-text-muted);
}

/* Animations */
.fade-in-section {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-in-section.is-visible {
    opacity: 1;
    transform: none;
}

@media (max-width: 768px) {
    p {
        font-size: 1rem;
    }

    :root {
        --caption-font-size: 0.875rem;
    }
}
