:root {
    --bg-primary: #07090e;
    /* Card surfaces are slightly see-through so the page artwork shows behind them */
    --bg-secondary: rgba(12, 16, 24, 0.72);
    --bg-card: rgba(18, 24, 36, 0.72);
    --bg-card-hover: rgba(24, 34, 51, 0.85);
    --bg-card-solid: #121824;
    --border: #1e283b;
    --border-hover: #314260;
    --border-glow: rgba(0, 229, 255, 0.45);
    --text-main: #f0f4fc;
    --text-muted: #8c9cb6;
    --text-dim: #54647e;
    --accent-cyan: #00e5ff;
    --accent-blue: #3d8bfd;
    --accent-green: #39d98a;
    --accent-yellow: #ffd166;
    --accent-gold: #ffbd2e;
    --accent-red: #ff5c70;
    --accent-purple: #b388ff;
    --code-bg: rgba(9, 12, 19, 0.82);
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
    scroll-behavior: smooth;
    /* Keeps anchor targets clear of the sticky header */
    scroll-padding-top: 88px;
    -webkit-text-size-adjust: 100%;
    overflow-x: hidden;
    max-width: 100%;
}

:focus-visible {
    outline: 2px solid var(--accent-cyan);
    outline-offset: 3px;
    border-radius: 4px;
}

/* ───────── GRAPH PAPER GRID BACKGROUND ───────── */
body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-primary);
    /* High-density dual graph paper grid */
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
        linear-gradient(rgba(0, 229, 255, 0.012) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 229, 255, 0.012) 1px, transparent 1px);
    background-size: 20px 20px, 20px 20px, 100px 100px, 100px 100px;
    background-position: -1px -1px;
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    max-width: 100%;
    position: relative;
}

/* Full-page artwork, fixed behind everything. It covers the body's own
   background, so the graph-paper grid is repeated here above a dark tint
   that keeps text readable over the bright painting. */
.hero-backdrop {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px) -1px -1px / 20px 20px,
        linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px) -1px -1px / 20px 20px,
        linear-gradient(180deg,
            rgba(7, 9, 14, 0.74) 0%,
            rgba(7, 9, 14, 0.8) 45%,
            rgba(7, 9, 14, 0.88) 100%),
        url('assets/mondstadt.jpg') center / cover no-repeat;
    animation: fade-in 1.2s ease backwards;
}

/* Ambient Radial Cyan Glow */
.ambient-glow {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: min(1200px, 100%);
    height: 650px;
    background: radial-gradient(circle, rgba(0, 229, 255, 0.08) 0%, rgba(61, 139, 253, 0.03) 40%, transparent 70%);
    z-index: 0;
    pointer-events: none;
}

.container {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 clamp(16px, 4vw, 24px);
    position: relative;
    z-index: 1;
}

/* ───────── NAVIGATION ───────── */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(7, 9, 14, 0.78);
    border-bottom: 1px solid var(--border);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
    animation: fade-in 0.6s ease backwards;
}

/* Set by script.js once the page has scrolled away from the top */
.site-header.scrolled {
    background: rgba(7, 9, 14, 0.92);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

/* Scoped under .site-header so the vertical padding outranks .container's */
.site-header nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-top: 14px;
    padding-bottom: 14px;
}

.logo-wrap {
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    color: #ffffff;
}

.logo-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent-cyan);
    box-shadow: 0 0 16px rgba(0, 229, 255, 0.35);
    animation: pulse-border 3.2s infinite ease-in-out;
    image-rendering: auto;
    transform: translateZ(0);
    backface-visibility: hidden;
}

@keyframes pulse-border {
    0%, 100% { box-shadow: 0 0 12px rgba(0, 229, 255, 0.3); border-color: var(--accent-cyan); }
    50% { box-shadow: 0 0 24px rgba(0, 229, 255, 0.7); border-color: #ffffff; }
}

.logo-title {
    display: flex;
    align-items: center;
    font-weight: 800;
    font-size: 1.35rem;
    letter-spacing: -0.02em;
    white-space: nowrap;
}

.logo-badge {
    font-size: 0.7rem;
    background: rgba(0, 229, 255, 0.1);
    color: var(--accent-cyan);
    border: 1px solid rgba(0, 229, 255, 0.3);
    padding: 2px 8px;
    border-radius: 999px;
    margin-left: 8px;
    font-weight: 600;
}

.nav-links {
    display: flex;
    gap: 18px;
    align-items: center;
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: var(--text-main);
}

/* Underline that grows from the left on hover (inline desktop nav only) */
@media (min-width: 1241px) {
    .nav-links a {
        position: relative;
        padding: 6px 0;
    }

    .nav-links a::after {
        content: '';
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        height: 2px;
        border-radius: 2px;
        background: var(--accent-cyan);
        transform: scaleX(0);
        transform-origin: left;
        transition: transform 0.3s var(--ease-out);
    }

    .nav-links a:hover::after {
        transform: scaleX(1);
    }
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Hamburger toggle: only shown once the links collapse (see RESPONSIVE) */
.nav-toggle {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.2s;
}

.nav-toggle:hover {
    border-color: var(--accent-cyan);
}

.nav-toggle span {
    width: 18px;
    height: 2px;
    border-radius: 2px;
    background: var(--text-main);
    transition: transform 0.25s ease, opacity 0.2s ease;
}

.nav-open .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Star on GitHub Button: Normal dark card style, ONLY star icon is Golden */
.btn-star {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-card);
    color: var(--text-main);
    border: 1px solid var(--border);
    padding: 7px 15px;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.btn-star .star-icon {
    color: var(--accent-gold);
    filter: drop-shadow(0 0 4px rgba(255, 189, 46, 0.55));
    transition: transform 0.25s ease;
}

.btn-star:hover {
    border-color: var(--border-hover);
    background: var(--bg-secondary);
    color: #ffffff;
    box-shadow: 0 0 12px rgba(255, 189, 46, 0.15);
    transform: translateY(-1px);
}

.btn-star:hover .star-icon {
    transform: scale(1.22) rotate(12deg);
}

.btn-gh {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-card);
    color: #ffffff;
    border: 1px solid var(--border);
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.2s;
}

.btn-gh:hover {
    border-color: var(--accent-cyan);
    background: var(--bg-secondary);
    box-shadow: 0 0 14px rgba(0, 229, 255, 0.2);
}

/* ───────── HERO SECTION ───────── */
.hero {
    padding: clamp(36px, 7vw, 65px) 0 clamp(24px, 5vw, 45px);
    text-align: center;
}

/* Page-load entrance: hero blocks rise in one after another */
.hero > * {
    animation: rise-in 0.8s var(--ease-out) backwards;
}

.hero > :nth-child(2) { animation-delay: 0.08s; }
.hero > :nth-child(3) { animation-delay: 0.16s; }
.hero > :nth-child(4) { animation-delay: 0.24s; }
.hero > :nth-child(5) { animation-delay: 0.34s; }

@keyframes rise-in {
    from { opacity: 0; transform: translateY(18px); }
}

@keyframes fade-in {
    from { opacity: 0; }
}

.hero-avatar-wrap {
    position: relative;
    display: inline-block;
    margin-bottom: 22px;
}

.hero-avatar-wrap .hero-avatar {
    animation: float-avatar 6s ease-in-out infinite;
}

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

.hero-avatar {
    width: 104px;
    height: 104px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--accent-cyan);
    box-shadow: 0 0 35px rgba(0, 229, 255, 0.45);
    image-rendering: auto;
    transform: translateZ(0);
    backface-visibility: hidden;
}

.tagline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(7, 14, 22, 0.6);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(0, 229, 255, 0.35);
    color: var(--accent-cyan);
    padding: 6px 16px;
    border-radius: 999px;
    font-size: 0.88rem;
    font-weight: 600;
    margin-bottom: 22px;
}

.hero h1 {
    font-size: clamp(2rem, 6.4vw, 3.6rem);
    text-wrap: balance;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.15;
    margin-bottom: 18px;
    background: linear-gradient(180deg, #ffffff 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero p {
    font-size: clamp(1rem, 2.4vw, 1.25rem);
    color: #c5d0e2;
    text-shadow: 0 1px 12px rgba(7, 9, 14, 0.85);
    max-width: 780px;
    margin: 0 auto 36px;
}

/* ───────── INSTALL TERMINAL BOX (CYBER GLOW) ───────── */
.install-box {
    max-width: 740px;
    margin: 0 auto clamp(40px, 7vw, 65px);
    background: var(--code-bg);
    border: 1px solid rgba(0, 229, 255, 0.28);
    border-radius: 14px;
    overflow: hidden;
    text-align: left;
    box-shadow: 0 16px 45px rgba(0, 0, 0, 0.65), 0 0 32px rgba(0, 229, 255, 0.12);
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}

.install-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(0, 229, 255, 0.7) 50%, transparent 100%);
    pointer-events: none;
}

.install-box:hover {
    border-color: rgba(0, 229, 255, 0.6);
    box-shadow: 0 22px 55px rgba(0, 0, 0, 0.75), 0 0 45px rgba(0, 229, 255, 0.25);
    transform: translateY(-2px);
}

.install-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-secondary);
    padding: 10px 18px;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
    color: var(--text-muted);
}

.window-dots {
    display: flex;
    gap: 6px;
}

.window-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.dot-red { background: #ff5f56; }
.dot-yellow { background: #ffbd2e; }
.dot-green { background: #27c93f; }

.btn-copy {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 229, 255, 0.12);
    color: var(--accent-cyan);
    border: 1px solid rgba(0, 229, 255, 0.4);
    padding: 7px 16px;
    border-radius: 8px;
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    font-family: inherit;
    box-shadow: 0 0 14px rgba(0, 229, 255, 0.2);
}

.btn-copy:hover {
    background: rgba(0, 229, 255, 0.28);
    border-color: var(--accent-cyan);
    box-shadow: 0 0 22px rgba(0, 229, 255, 0.55);
    transform: translateY(-1px);
}

.btn-copy.copied {
    background: rgba(57, 217, 138, 0.28);
    border-color: var(--accent-green);
    color: var(--accent-green);
    box-shadow: 0 0 24px rgba(57, 217, 138, 0.55);
}

.install-code {
    padding: 22px 26px;
    font-family: 'Fira Code', monospace;
    font-size: 0.92rem;
    line-height: 1.85;
    color: #d1d9e6;
    /* Commands stay on one line and scroll sideways instead of breaking mid-URL */
    white-space: nowrap;
    overflow-x: auto;
}

.install-code .prompt {
    color: var(--accent-cyan);
    user-select: none;
    margin-right: 8px;
}

.install-code .comment {
    color: #556677;
    user-select: none;
}

/* ───────── SECTION TITLES ───────── */
.section-title {
    text-align: center;
    margin-bottom: 40px;
}

.section-title h2 {
    font-size: clamp(1.55rem, 4.4vw, 2.3rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin-bottom: 12px;
    text-wrap: balance;
}

.section-title p {
    color: var(--text-muted);
    font-size: clamp(0.95rem, 2vw, 1.05rem);
    max-width: 680px;
    margin: 0 auto;
}

.section-title-left {
    text-align: left;
    margin-bottom: 24px;
}

.section-title-left p {
    margin-left: 0;
}

/* ───────── ARCHITECTURE DIAGRAM & LIGHTBOX ───────── */
.arch-diagram-wrapper {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: clamp(18px, 3.5vw, 28px);
    margin-bottom: 50px;
    text-align: center;
    position: relative;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.45);
}

.diagram-switch-bar {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.btn-diagram-type {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-diagram-type.active, .btn-diagram-type:hover {
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
    background: var(--bg-card-hover);
}

.arch-preview-container {
    position: relative;
    display: inline-block;
    cursor: zoom-in;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
    transition: all 0.3s ease;
    background: #121212;
}

.arch-preview-container:hover {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 25px rgba(0, 229, 255, 0.25);
}

.arch-diagram-img {
    width: 100%;
    max-width: 1020px;
    display: block;
    border-radius: 10px;
}

.zoom-badge {
    position: absolute;
    bottom: 16px;
    right: 16px;
    background: rgba(13, 18, 29, 0.85);
    border: 1px solid var(--accent-cyan);
    color: var(--accent-cyan);
    backdrop-filter: blur(8px);
    padding: 8px 16px;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
    transition: all 0.2s;
}

.arch-preview-container:hover .zoom-badge {
    background: var(--accent-cyan);
    color: #07090e;
}

/* Lightbox Modal */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(4, 7, 12, 0.94);
    backdrop-filter: blur(12px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    /* Hidden with opacity/visibility (not display) so open and close can fade */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}

.lightbox-overlay.active {
    opacity: 1;
    visibility: visible;
    transition-delay: 0s;
}

.lightbox-overlay .lightbox-img-wrapper {
    transform: scale(0.94);
    transition: transform 0.4s var(--ease-out);
}

.lightbox-overlay.active .lightbox-img-wrapper {
    transform: none;
}

.lightbox-controls {
    position: fixed;
    top: 24px;
    right: 24px;
    display: flex;
    gap: 12px;
    z-index: 10000;
}

.btn-lightbox {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: #ffffff;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-lightbox:hover {
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
    transform: scale(1.05);
}

.lightbox-img-wrapper {
    width: 94vw;
    height: 84vh;
    height: 84dvh;
    overflow: auto;
    display: flex;
    cursor: grab;
    overscroll-behavior: contain;
}

.lightbox-img-wrapper:active {
    cursor: grabbing;
}

/* Zoom is applied as a real width (set in script.js) so the zoomed image stays
   fully scrollable; margin:auto centres it without clipping the top/left edge. */
.lightbox-img {
    flex: none;
    margin: auto;
    width: 100%;
    max-width: none;
    border-radius: 8px;
    transition: width 0.25s ease;
    box-shadow: 0 20px 60px rgba(0,0,0,0.8);
    background: #121212;
    user-select: none;
}

/* ───────── INTERACTIVE ARCHITECTURE PIPELINE ───────── */
.arch-interactive-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: clamp(22px, 4vw, 34px) clamp(16px, 3.5vw, 28px);
    margin-bottom: 80px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
}

.flow-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 20px;
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
    color: var(--accent-cyan);
    margin-bottom: 24px;
    overflow-x: auto;
}

.flow-step {
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

.flow-arrow {
    color: var(--text-dim);
    animation: pulse-arrow 1.5s infinite;
}

@keyframes pulse-arrow {
    0%, 100% { opacity: 0.4; transform: translateX(0); }
    50% { opacity: 1; transform: translateX(3px); color: var(--accent-cyan); }
}

.arch-flow-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin: 26px 0;
}

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

@media (max-width: 560px) {
    .arch-flow-grid { grid-template-columns: 1fr; }
}

.arch-node {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 22px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.arch-node:hover, .arch-node.active {
    border-color: var(--accent-cyan);
    background: var(--bg-card-hover);
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(0, 229, 255, 0.15);
}

.arch-node-badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 6px;
    margin-bottom: 12px;
    letter-spacing: 0.04em;
}

.badge-cyan { background: rgba(0, 229, 255, 0.15); color: var(--accent-cyan); }
.badge-green { background: rgba(57, 217, 138, 0.15); color: var(--accent-green); }
.badge-yellow { background: rgba(255, 209, 102, 0.15); color: var(--accent-yellow); }
.badge-purple { background: rgba(179, 136, 255, 0.15); color: var(--accent-purple); }

.arch-node h4 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: #ffffff;
}

.arch-node p {
    color: var(--text-muted);
    font-size: 0.88rem;
    line-height: 1.5;
}

.inspector-box {
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    text-align: left;
}

.inspector-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.05rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 8px;
}

.inspector-desc {
    color: var(--text-muted);
    font-size: 0.92rem;
    line-height: 1.6;
}

/* Re-applied by script.js each time a stage is picked */
.inspector-swap .inspector-title,
.inspector-swap .inspector-desc {
    animation: rise-in 0.45s var(--ease-out) backwards;
}

.inspector-swap .inspector-desc {
    animation-delay: 0.06s;
}

/* ───────── BENCHMARK SUITE & EXPLANATIONS ───────── */
.benchmark-section {
    margin-bottom: 80px;
}

.bench-tabs-nav {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.bench-tab-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.bench-tab-btn.active, .bench-tab-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
}

.bench-tab-pane {
    display: none;
}

.bench-tab-pane.active {
    display: block;
    animation: pane-in 0.45s var(--ease-out) backwards;
}

@keyframes pane-in {
    from { opacity: 0; transform: translateY(12px); }
}

.metrics-cards-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 30px;
}

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

.metric-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 24px 14px;
    text-align: center;
}

.metric-val {
    font-size: clamp(1.5rem, 3.3vw, 2.4rem);
    font-weight: 800;
    color: var(--accent-cyan);
    letter-spacing: -0.03em;
    line-height: 1.25;
    margin-bottom: 4px;
    /* Fixed-width digits stop the count-up animation from jittering */
    font-variant-numeric: tabular-nums;
}

.metric-sub {
    color: var(--text-muted);
    font-size: 0.88rem;
    font-weight: 500;
}

.comparison-table-wrap {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow-x: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    margin-bottom: 24px;
}

table {
    width: 100%;
    min-width: 680px;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.95rem;
}

th {
    background: var(--bg-card);
    color: var(--text-muted);
    padding: 16px 20px;
    font-weight: 600;
    border-bottom: 1px solid var(--border);
    text-transform: uppercase;
    font-size: 0.78rem;
    letter-spacing: 0.05em;
}

td {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    color: #d1d9e6;
}

tr:last-child td { border-bottom: none; }

/* ───────── FIXED LATENCY METER (NO MORE TINY DOTS!) ───────── */
.latency-meter-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.latency-bar {
    height: 10px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    position: relative;
    flex-grow: 1;
    min-width: 110px;
    max-width: 160px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.4);
}

.latency-fill {
    width: 0%;
    height: 100%;
    border-radius: 6px;
    background: linear-gradient(90deg, #27c93f 0%, #39d98a 100%);
    box-shadow: 0 0 10px rgba(57, 217, 138, 0.4);
    transition: width 1.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.meter-pct {
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent-green);
    min-width: 48px;
}

.badge-pill {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
}

.pill-speedup { background: rgba(57, 217, 138, 0.15); color: var(--accent-green); border: 1px solid rgba(57, 217, 138, 0.3); }

/* Educational Explanation Cards */
.bench-explanation-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent-cyan);
    border-radius: 10px;
    padding: 20px 24px;
    font-size: 0.92rem;
    line-height: 1.65;
    color: #cbd5e1;
}

.bench-explanation-card h4 {
    font-size: 1rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ───────── FEATURES GRID ───────── */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
    gap: clamp(16px, 2.5vw, 24px);
    margin-bottom: 80px;
}

.feature-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: clamp(20px, 3.5vw, 28px);
    transition: all 0.25s ease;
}

.feature-card:hover {
    border-color: var(--border-glow);
    transform: translateY(-3px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4);
}

.feature-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    margin-bottom: 18px;
}

.icon-cyan { background: rgba(0, 229, 255, 0.12); color: var(--accent-cyan); }
.icon-green { background: rgba(57, 217, 138, 0.12); color: var(--accent-green); }
.icon-purple { background: rgba(179, 136, 255, 0.12); color: var(--accent-purple); }
.icon-blue { background: rgba(61, 139, 253, 0.12); color: var(--accent-blue); }

.feature-card h3 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: #ffffff;
}

.feature-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* ───────── PROTOCOL BOX ───────── */
.protocol-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: clamp(18px, 3.5vw, 30px);
    margin-bottom: 80px;
}

.protocol-label {
    margin-bottom: 12px;
}

.protocol-code {
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px 20px;
    font-family: 'Fira Code', monospace;
    font-size: 0.92rem;
    white-space: nowrap;
    overflow-x: auto;
}

.protocol-code + .protocol-label {
    margin-top: 20px;
}

.protocol-eoq {
    color: var(--accent-cyan);
}

.code-inline {
    font-family: 'Fira Code', monospace;
    background: var(--code-bg);
    padding: 3px 8px;
    border-radius: 6px;
    color: var(--accent-cyan);
    font-size: 0.9rem;
}

/* ───────── UNIVERSAL DATABASE ADAPTABILITY ───────── */
.db-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
    gap: clamp(14px, 2.5vw, 20px);
    margin-bottom: 24px;
}

.db-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 24px;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.db-card:hover {
    border-color: var(--accent-cyan);
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
}

.db-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.db-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.db-badge {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 6px;
    letter-spacing: 0.04em;
}

.db-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.55;
    flex-grow: 1;
    margin-bottom: 14px;
}

.db-code-hint {
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 12px;
    font-family: 'Fira Code', monospace;
    font-size: 0.8rem;
    color: var(--accent-cyan);
}

/* ───────── CLIENT INTEGRATION GUIDE ───────── */
.integration-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: clamp(18px, 3.5vw, 32px);
    margin-bottom: 80px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
}

.code-tabs-nav {
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
    flex-wrap: wrap;
}

.code-tab-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.code-tab-btn.active, .code-tab-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--border-hover);
    color: var(--accent-cyan);
}

.code-pane {
    display: none;
    position: relative;
}

.code-pane.active {
    display: block;
    animation: pane-in 0.4s var(--ease-out) backwards;
}

.code-snippet {
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    font-family: 'Fira Code', monospace;
    font-size: 0.88rem;
    line-height: 1.7;
    color: #cbd5e1;
    overflow-x: auto;
}

/* Syntax highlight tokens (snippets are tokenised in script.js;
   the install terminal and protocol boxes are marked up by hand) */
.tok-comment { color: #6b7c93; font-style: italic; }
.tok-str { color: var(--accent-green); }
.tok-num { color: var(--accent-yellow); }
.tok-kw { color: var(--accent-purple); }
.tok-builtin { color: var(--accent-cyan); }
.tok-fn { color: #6aa9ff; }

.code-pane .btn-copy-code {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.code-pane .btn-copy-code:hover {
    background: rgba(0, 229, 255, 0.15);
    color: var(--accent-cyan);
    border-color: var(--accent-cyan);
}

/* ───────── FOOTER ───────── */
footer {
    border-top: 1px solid var(--border);
    padding: 40px 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

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

.footer-credit {
    margin-top: 12px;
    font-size: 0.8rem;
    color: var(--text-muted);
    opacity: 0.85;
}

/* ───────── SCROLL REVEAL ANIMATIONS ───────── */
.reveal-on-scroll {
    opacity: 0;
    transform: translateY(22px);
    transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1), transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: opacity, transform;
}

.reveal-on-scroll.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Frosted-glass blur behind the translucent card surfaces */
.install-box,
.arch-diagram-wrapper,
.arch-interactive-container,
.metric-card,
.comparison-table-wrap,
.bench-explanation-card,
.feature-card,
.db-card,
.integration-box,
.protocol-box {
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

/* ───────── ICONS (Bootstrap Icons) ───────── */
.bi {
    line-height: 1;
}

.inspector-title .bi {
    color: var(--accent-cyan);
}

.bench-explanation-card h4 .bi {
    color: var(--accent-yellow);
}

.code-tab-btn .bi {
    font-size: 1.05rem;
}

/* Press feedback shared by every button-like control */
.btn-star:active,
.btn-gh:active,
.btn-copy:active,
.btn-copy-code:active,
.btn-diagram-type:active,
.btn-lightbox:active,
.bench-tab-btn:active,
.code-tab-btn:active,
.nav-toggle:active {
    transform: scale(0.96);
}

/* ───────── RESPONSIVE ───────── */

/* Sideways-scrolling blocks stay scrollable but never show a scrollbar */
.install-code,
.flow-banner,
.comparison-table-wrap,
.code-snippet,
.protocol-code,
.lightbox-img-wrapper {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.install-code::-webkit-scrollbar,
.flow-banner::-webkit-scrollbar,
.comparison-table-wrap::-webkit-scrollbar,
.code-snippet::-webkit-scrollbar,
.protocol-code::-webkit-scrollbar,
.lightbox-img-wrapper::-webkit-scrollbar {
    display: none;
}

@media (max-width: 1024px) {
    .flow-banner {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px 10px;
    }
}

/* Below the full container width the nav links no longer fit on one line,
   so they collapse into a dropdown under the header */
@media (max-width: 1240px) {
    .nav-toggle {
        display: flex;
    }

    .nav-links {
        position: absolute;
        top: calc(100% + 8px);
        left: clamp(16px, 4vw, 24px);
        right: clamp(16px, 4vw, 24px);
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
        padding: 8px;
        background: var(--bg-card-solid);
        border: 1px solid var(--border);
        border-radius: 12px;
        box-shadow: 0 18px 40px rgba(0, 0, 0, 0.6);
        /* Closed state: faded, nudged up and non-interactive */
        opacity: 0;
        visibility: hidden;
        transform: translateY(-10px) scale(0.98);
        transform-origin: top center;
        transition: opacity 0.22s ease, transform 0.3s var(--ease-out), visibility 0s linear 0.3s;
    }

    .nav-open .nav-links {
        opacity: 1;
        visibility: visible;
        transform: none;
        transition-delay: 0s;
    }

    .nav-links a {
        padding: 12px 14px;
        border-radius: 8px;
        font-size: 0.98rem;
    }

    .nav-links a:hover {
        background: var(--bg-card-hover);
    }
}

/* Phones: stack benchmark tables into cards, tighten spacing */
@media (max-width: 760px) {
    html {
        scroll-padding-top: 76px;
    }

    .btn-gh {
        display: none;
    }

    .logo-avatar {
        width: 38px;
        height: 38px;
    }

    .logo-wrap {
        gap: 10px;
    }

    .logo-title {
        font-size: 1.2rem;
    }

    .hero-avatar {
        width: 88px;
        height: 88px;
    }

    .tagline {
        font-size: 0.8rem;
        border-radius: 14px;
        text-align: left;
    }

    .install-code {
        padding: 16px 18px;
        font-size: 0.8rem;
    }

    .section-title {
        margin-bottom: 28px;
    }

    .arch-interactive-container,
    .benchmark-section,
    .features-grid,
    .protocol-box,
    .integration-box {
        margin-bottom: 56px;
    }

    .zoom-badge {
        bottom: 8px;
        right: 8px;
        padding: 5px 10px;
        font-size: 0.72rem;
    }

    .flow-banner {
        font-size: 0.78rem;
        padding: 12px 14px;
    }

    .arch-node {
        padding: 18px;
    }

    .inspector-box {
        padding: 18px;
    }

    /* Feature cards: icon sits beside the heading instead of above it */
    .feature-card {
        display: grid;
        grid-template-columns: auto 1fr;
        align-items: center;
        gap: 12px 14px;
    }

    .feature-icon {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
        margin-bottom: 0;
    }

    .feature-card h3 {
        font-size: 1.08rem;
        line-height: 1.3;
        margin-bottom: 0;
    }

    .feature-card p {
        grid-column: 1 / -1;
        font-size: 0.92rem;
    }

    .db-card {
        padding: 20px;
    }

    .db-title {
        font-size: 1.08rem;
    }

    .db-code-hint {
        font-size: 0.76rem;
        overflow-wrap: anywhere;
    }

    .bench-tabs-nav {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .bench-tab-btn {
        padding: 10px 8px;
        font-size: 0.8rem;
    }

    .metrics-cards-grid {
        gap: 12px;
    }

    .metric-card {
        padding: 18px 10px;
    }

    /* Each table row becomes a card; column headers move into data-label
       attributes that script.js copies from the <thead>. */
    .comparison-table-wrap {
        background: transparent;
        border: none;
        border-radius: 0;
        box-shadow: none;
        overflow: visible;
    }

    .comparison-table-wrap table {
        min-width: 0;
    }

    .comparison-table-wrap table,
    .comparison-table-wrap tbody,
    .comparison-table-wrap tr,
    .comparison-table-wrap td {
        display: block;
    }

    .comparison-table-wrap thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
    }

    .comparison-table-wrap tr {
        background: var(--bg-secondary);
        border: 1px solid var(--border);
        border-radius: 12px;
        padding: 6px 16px;
        margin-bottom: 12px;
    }

    .comparison-table-wrap td {
        padding: 11px 0;
        text-align: right;
        font-size: 0.9rem;
        overflow: hidden;
    }

    .comparison-table-wrap td::before {
        content: attr(data-label);
        float: left;
        max-width: 50%;
        margin-right: 12px;
        text-align: left;
        color: var(--text-muted);
        font-size: 0.7rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        line-height: 1.5;
        padding-top: 2px;
    }

    .comparison-table-wrap td:first-child {
        text-align: left;
        font-size: 1rem;
    }

    .comparison-table-wrap td:first-child::before {
        content: none;
    }

    .latency-meter-wrap {
        justify-content: flex-end;
    }

    .latency-bar {
        min-width: 60px;
        max-width: 90px;
    }

    .meter-pct {
        min-width: 0;
    }

    .bench-explanation-card {
        padding: 16px 18px;
    }

    .code-tab-btn {
        padding: 7px 10px;
        font-size: 0.82rem;
    }

    /* Leaves room for the absolutely-positioned "Copy Code" button */
    .code-snippet {
        padding: 48px 16px 16px;
        font-size: 0.8rem;
    }

    .protocol-code {
        padding: 12px 14px;
        font-size: 0.8rem;
    }

    .lightbox-controls {
        top: 12px;
        right: 12px;
        gap: 8px;
    }

    footer {
        padding: 28px 0;
    }
}

/* Small phones: the star button drops its label */
@media (max-width: 420px) {
    .btn-star {
        padding: 0;
        width: 40px;
        height: 40px;
        justify-content: center;
    }

    .btn-star span {
        display: none;
    }

    .logo-badge {
        display: none;
    }

    .nav-actions {
        gap: 8px;
    }
}

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

    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }

    .reveal-on-scroll {
        opacity: 1;
        transform: none;
    }
}
