/* ==================== Design Tokens ==================== */
:root {
    --primary: #0c4a6e;          /* deep ocean */
    --primary-600: #075985;
    --primary-500: #0284c7;
    --accent: #06b6d4;           /* cyan accent */
    --accent-soft: #cffafe;
    --highlight: #f59e0b;        /* amber for "best" cells */
    --text: #0f172a;
    --text-soft: #475569;
    --text-mute: #94a3b8;
    --border: #e2e8f0;
    --bg: #ffffff;
    --bg-soft: #f8fafc;
    --bg-darker: #f1f5f9;
    --bg-ocean: linear-gradient(135deg, #0c4a6e 0%, #0369a1 45%, #06b6d4 100%);
    --radius: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 12px 28px rgba(15, 23, 42, 0.10);
    --shadow-xl: 0 24px 48px rgba(15, 23, 42, 0.14);
    --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 80px; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    line-height: 1.65;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.container-wide { max-width: 1360px; margin: 0 auto; padding: 0 24px; }

a { color: var(--primary-500); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-600); }

code, pre { font-family: 'JetBrains Mono', 'Roboto Mono', ui-monospace, monospace; }

/* ==================== Navbar ==================== */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border);
}
.navbar .container { display: flex; align-items: center; justify-content: space-between; padding: 14px 24px; }
.nav-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--primary); font-size: 1.15rem; }
.nav-brand .brand-mark {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; border-radius: 8px;
    background: var(--bg-ocean); color: white; font-size: 14px; font-weight: 700;
}
.nav-menu { display: flex; gap: 6px; list-style: none; align-items: center; }
.nav-menu a {
    color: var(--text);
    padding: 8px 14px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.95rem;
    transition: var(--transition);
}
.nav-menu a:hover, .nav-menu a.active { background: var(--bg-soft); color: var(--primary); }
.nav-actions { display: flex; gap: 8px; align-items: center; }
.lang-toggle {
    border: 1px solid var(--border);
    background: var(--bg);
    border-radius: 999px;
    padding: 6px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-soft);
    cursor: pointer;
    transition: var(--transition);
}
.lang-toggle:hover { border-color: var(--primary-500); color: var(--primary); }
.lang-toggle .lang-active { color: var(--primary); }

/* ==================== Hero ==================== */
.hero {
    position: relative;
    background: var(--bg-ocean);
    color: white;
    padding: 96px 0 80px;
    overflow: hidden;
}
.hero::before {
    content: ''; position: absolute; inset: 0;
    background:
        radial-gradient(60% 60% at 80% 0%, rgba(255,255,255,0.18), transparent 70%),
        radial-gradient(50% 50% at 0% 100%, rgba(6,182,212,0.45), transparent 60%);
    pointer-events: none;
}
.hero .container { position: relative; }
.hero-badges { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.hero-badge {
    background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.25);
    backdrop-filter: blur(8px);
    padding: 5px 12px; border-radius: 999px; font-size: 0.78rem; font-weight: 500; letter-spacing: 0.02em;
}
.hero-title {
    font-size: clamp(2.4rem, 5vw, 3.6rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin-bottom: 12px;
}
.hero-subtitle {
    font-size: clamp(1.1rem, 2vw, 1.35rem);
    font-weight: 500;
    opacity: 0.92;
    margin-bottom: 18px;
}
.hero-description {
    font-size: 1rem;
    max-width: 720px;
    opacity: 0.85;
    margin-bottom: 32px;
}
.hero-buttons { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 20px;
    margin-top: 48px;
    padding-top: 36px;
    border-top: 1px solid rgba(255,255,255,0.15);
}
.hero-stat { text-align: left; }
.hero-stat-value { font-size: 1.9rem; font-weight: 800; letter-spacing: -0.02em; }
.hero-stat-label { font-size: 0.85rem; opacity: 0.75; margin-top: 2px; }

/* ==================== Buttons ==================== */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 12px 22px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}
.btn-primary { background: white; color: var(--primary); }
.btn-primary:hover { background: var(--accent-soft); color: var(--primary-600); transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.btn-secondary { background: rgba(255,255,255,0.1); color: white; border: 1px solid rgba(255,255,255,0.3); }
.btn-secondary:hover { background: rgba(255,255,255,0.18); transform: translateY(-1px); }
.btn-ghost { background: var(--bg-soft); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg-darker); border-color: var(--primary-500); color: var(--primary); }
.btn-solid { background: var(--primary); color: white; }
.btn-solid:hover { background: var(--primary-600); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn .icon { width: 16px; height: 16px; }

/* ==================== Sections ==================== */
.section { padding: 80px 0; }
.section.bg-soft { background: var(--bg-soft); }
.section-eyebrow {
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 10px;
}
.section-title {
    font-size: clamp(1.7rem, 3vw, 2.2rem);
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
    margin-bottom: 14px;
}
.section-description {
    color: var(--text-soft);
    max-width: 760px;
    margin-bottom: 40px;
    font-size: 1.05rem;
}
.section-header { margin-bottom: 48px; }

/* ==================== Overview Cards ==================== */
.overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
}
.overview-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 24px;
    transition: var(--transition);
}
.overview-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-3px); border-color: transparent; }
.overview-card .card-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px;
    background: var(--accent-soft);
    color: var(--primary);
    border-radius: 12px;
    margin-bottom: 16px;
    font-size: 22px;
}
.overview-card h3 { font-size: 1.1rem; margin-bottom: 8px; color: var(--text); }
.overview-card p { color: var(--text-soft); font-size: 0.95rem; }

/* ==================== Stats Grid ==================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}
.stat-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    text-align: left;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
    background: var(--bg-ocean);
}
.stat-card:hover { box-shadow: var(--shadow-lg); }
.stat-number {
    font-size: 2.4rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.02em;
    line-height: 1;
    margin-bottom: 8px;
}
.stat-label { font-weight: 600; color: var(--text); margin-bottom: 4px; }
.stat-description { color: var(--text-soft); font-size: 0.85rem; }

/* ==================== Hero overview image ==================== */
.hero-figure {
    margin: 40px auto 0;
    max-width: 980px;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.35);
    border: 1px solid rgba(255,255,255,0.18);
}
.hero-figure img { width: 100%; display: block; }

/* ==================== Features ==================== */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}
.feature-item {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    position: relative;
    transition: var(--transition);
}
.feature-item:hover { border-color: var(--accent); box-shadow: var(--shadow-md); }
.feature-number {
    display: inline-block;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 0.1em;
    margin-bottom: 12px;
}
.feature-item h3 { font-size: 1.1rem; margin-bottom: 8px; }
.feature-item p { color: var(--text-soft); font-size: 0.95rem; }

/* ==================== Limitation callout ==================== */
.callout {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 32px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    align-items: center;
}
.callout-text h3 { font-size: 1.4rem; margin-bottom: 10px; }
.callout-text p { color: var(--text-soft); margin-bottom: 12px; }
.callout-figure img { width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--border); }
@media (max-width: 760px) { .callout { grid-template-columns: 1fr; } }

/* ==================== Samples Gallery ==================== */
.samples-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}
.sample-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
}
.sample-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.sample-viewer {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #0f172a;
    cursor: ew-resize;
    user-select: none;
}
.sample-viewer img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}
.sample-viewer .img-mask {
    clip-path: inset(0 0 0 50%);
    transition: clip-path 50ms linear;
}
.sample-viewer .slider-line {
    position: absolute;
    top: 0; bottom: 0;
    left: 50%;
    width: 2px;
    background: white;
    transform: translateX(-1px);
    box-shadow: 0 0 12px rgba(0,0,0,0.5);
    pointer-events: none;
}
.sample-viewer .slider-handle {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 36px; height: 36px;
    border-radius: 50%;
    background: white;
    transform: translate(-50%, -50%);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    display: flex; align-items: center; justify-content: center;
    color: var(--primary);
    font-weight: 700;
    pointer-events: none;
}
.sample-viewer .viewer-label {
    position: absolute; top: 10px;
    color: white; font-size: 0.75rem; font-weight: 600;
    padding: 4px 10px; border-radius: 4px;
    background: rgba(15,23,42,0.65); backdrop-filter: blur(6px);
    pointer-events: none;
}
.sample-viewer .label-rgb { left: 10px; }
.sample-viewer .label-mask { right: 10px; }
.sample-body { padding: 18px 20px 22px; }
.sample-title { font-size: 1.05rem; font-weight: 700; margin-bottom: 4px; }
.sample-id { font-size: 0.78rem; color: var(--text-mute); font-weight: 500; }
.sample-desc { color: var(--text-soft); font-size: 0.9rem; margin: 10px 0 14px; }
.sample-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
    font-size: 0.72rem; font-weight: 500;
    padding: 3px 10px; border-radius: 999px;
    background: var(--bg-soft);
    color: var(--text-soft);
    border: 1px solid var(--border);
}
.tag.tag-port { background: #fef3c7; color: #92400e; border-color: transparent; }
.tag.tag-openwater { background: #dbeafe; color: #1e40af; border-color: transparent; }
.tag.tag-coastal { background: #d1fae5; color: #065f46; border-color: transparent; }
.tag.tag-backlight { background: #fee2e2; color: #991b1b; border-color: transparent; }
.tag.tag-occlusion { background: #f3e8ff; color: #6b21a8; border-color: transparent; }
.tag.tag-smallobj { background: #ffedd5; color: #9a3412; border-color: transparent; }
.tag.tag-reflection { background: #cffafe; color: #155e75; border-color: transparent; }

/* ==================== Filter Chips ==================== */
.filter-bar {
    display: flex; flex-wrap: wrap; gap: 8px;
    margin-bottom: 28px;
    padding: 14px; background: var(--bg-soft);
    border-radius: var(--radius); border: 1px solid var(--border);
}
.filter-label { font-size: 0.85rem; color: var(--text-soft); font-weight: 600; align-self: center; margin-right: 4px; }
.filter-chip {
    padding: 6px 14px;
    border-radius: 999px;
    background: white; border: 1px solid var(--border);
    font-size: 0.85rem; font-weight: 500;
    color: var(--text-soft); cursor: pointer;
    transition: var(--transition);
}
.filter-chip:hover { border-color: var(--primary-500); color: var(--primary); }
.filter-chip.active { background: var(--primary); color: white; border-color: var(--primary); }

/* ==================== Metadata Side Panel ==================== */
.meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.meta-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}
.meta-card h3 { font-size: 1.05rem; margin-bottom: 14px; color: var(--primary); }
.meta-list { list-style: none; }
.meta-list li {
    padding: 8px 0;
    border-bottom: 1px dashed var(--border);
    display: flex; justify-content: space-between; gap: 10px;
    font-size: 0.9rem;
}
.meta-list li:last-child { border-bottom: none; }
.meta-list li > span:first-child { color: var(--text-soft); font-weight: 500; }
.meta-list li > span:last-child { color: var(--text); font-weight: 600; }
.code-block {
    background: #0f172a; color: #e2e8f0;
    padding: 18px; border-radius: var(--radius-sm);
    font-size: 0.78rem; line-height: 1.5;
    overflow-x: auto;
}
@media (max-width: 760px) { .meta-grid { grid-template-columns: 1fr; } }

/* ==================== Comparison Table ==================== */
.table-wrap {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 32px;
}
.table-scroll { overflow-x: auto; }
table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
table.data-table thead { background: var(--bg-soft); }
table.data-table th {
    text-align: left;
    padding: 14px 16px;
    font-weight: 700;
    color: var(--text);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
table.data-table th.sortable { cursor: pointer; user-select: none; }
table.data-table th.sortable:hover { color: var(--primary); }
table.data-table th.sortable::after { content: ' ↕'; opacity: 0.4; font-size: 0.75rem; }
table.data-table th.sort-asc::after { content: ' ↑'; opacity: 1; color: var(--primary); }
table.data-table th.sort-desc::after { content: ' ↓'; opacity: 1; color: var(--primary); }
table.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: middle;
}
table.data-table tr:last-child td { border-bottom: none; }
table.data-table tr:hover td { background: var(--bg-soft); }
table.data-table tr.row-highlight td { background: linear-gradient(90deg, rgba(6,182,212,0.10), rgba(6,182,212,0.02)); font-weight: 600; }
table.data-table tr.row-highlight td:first-child { border-left: 3px solid var(--accent); }
table.data-table .group-header td {
    background: var(--bg-darker); color: var(--text-soft);
    font-size: 0.78rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.06em;
    padding: 10px 16px;
}
.cell-best { color: var(--primary); font-weight: 700; }
.cell-second { text-decoration: underline; text-decoration-color: var(--primary-500); text-underline-offset: 3px; }
.task-pill {
    display: inline-block; font-size: 0.7rem; font-weight: 700;
    padding: 2px 8px; border-radius: 4px; margin-right: 2px;
}
.task-D { background: #fef3c7; color: #92400e; }
.task-S { background: #f3e8ff; color: #6b21a8; }
.task-P { background: #fee2e2; color: #991b1b; }
.task-T { background: #cffafe; color: #155e75; }

/* ==================== Leaderboard tabs ==================== */
.lb-tabs {
    display: flex; gap: 6px;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--border);
}
.lb-tab {
    padding: 12px 20px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 0.95rem; font-weight: 600;
    color: var(--text-soft);
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: -1px;
}
.lb-tab:hover { color: var(--primary); }
.lb-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.lb-note {
    color: var(--text-soft);
    font-size: 0.85rem;
    margin-bottom: 20px;
    padding-left: 14px;
    border-left: 3px solid var(--accent);
}

/* ==================== Download cards ==================== */
.download-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}
.download-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    display: flex; flex-direction: column;
    transition: var(--transition);
}
.download-card:hover { box-shadow: var(--shadow-lg); border-color: var(--primary-500); }
.download-card h3 { font-size: 1.2rem; margin-bottom: 6px; }
.download-card .size { color: var(--text-soft); font-size: 0.85rem; margin-bottom: 14px; }
.download-list { list-style: none; flex: 1; margin-bottom: 18px; }
.download-list li {
    font-size: 0.9rem;
    padding: 6px 0;
    color: var(--text-soft);
    padding-left: 22px;
    position: relative;
}
.download-list li::before {
    content: '✓'; position: absolute; left: 0;
    color: var(--accent); font-weight: 700;
}
.download-note {
    background: var(--bg-soft);
    border-left: 3px solid var(--accent);
    padding: 18px 22px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.download-note h4 { margin-bottom: 6px; }
.download-note p { color: var(--text-soft); font-size: 0.9rem; }

/* ==================== Citation ==================== */
.citation-box {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 26px 28px;
    position: relative;
    margin-bottom: 24px;
}
.citation-box pre {
    background: var(--bg-soft);
    padding: 18px 22px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    font-size: 0.85rem;
    line-height: 1.6;
}
.citation-box code { color: var(--text); }
.copy-btn {
    position: absolute;
    top: 18px; right: 18px;
    background: var(--primary);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}
.copy-btn:hover { background: var(--primary-600); }
.copy-btn.copied { background: #10b981; }

/* ==================== Footer ==================== */
.footer {
    background: var(--text);
    color: rgba(255,255,255,0.7);
    padding: 48px 0 32px;
    margin-top: 0;
}
.footer .container { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 36px; }
.footer h4 { color: white; font-size: 0.95rem; margin-bottom: 14px; }
.footer ul { list-style: none; }
.footer ul li { margin-bottom: 6px; font-size: 0.88rem; }
.footer ul li a { color: rgba(255,255,255,0.7); }
.footer ul li a:hover { color: white; }
.footer .copyright {
    grid-column: 1 / -1;
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 20px;
    font-size: 0.82rem;
    color: rgba(255,255,255,0.5);
}
@media (max-width: 760px) { .footer .container { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .footer .container { grid-template-columns: 1fr; } }

/* ==================== Scroll-to-top ==================== */
.scroll-top {
    position: fixed; bottom: 28px; right: 28px;
    width: 44px; height: 44px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translateY(20px);
    transition: var(--transition);
    z-index: 50;
}
.scroll-top.visible { opacity: 1; transform: translateY(0); }
.scroll-top:hover { background: var(--primary-600); transform: translateY(-2px); }

/* ==================== Mobile menu ==================== */
.menu-toggle {
    display: none;
    background: none; border: none;
    font-size: 1.4rem; cursor: pointer; color: var(--text);
}
@media (max-width: 880px) {
    .nav-menu { display: none; flex-direction: column; align-items: stretch;
        position: absolute; top: 100%; left: 0; right: 0;
        background: var(--bg); border-bottom: 1px solid var(--border); padding: 16px; gap: 4px;
        box-shadow: var(--shadow-md);
    }
    .nav-menu.open { display: flex; }
    .menu-toggle { display: block; }
}

/* ==================== Animation utilities ==================== */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 600ms ease, transform 600ms ease;
}
.fade-in.visible { opacity: 1; transform: translateY(0); }
