:root {
    --bg-main: #0b0d12;
    --bg-surface: #111827;
    --bg-surface-strong: #0f1421;
    --border: rgba(148, 163, 184, 0.18);
    --text-main: #e5e7eb;
    --text-soft: #9aa3b2;
    --accent: #5eead4;
    --accent-cool: #38bdf8;
    --accent-warm: #f59e0b;
    --font-display: "Sora", sans-serif;
    --font-body: "Manrope", sans-serif;
    --font-mono: "JetBrains Mono", monospace;
}

body.app-shell {
    position: relative;
    min-height: 100vh;
    color: var(--text-main);
    font-family: var(--font-body);
    background-color: var(--bg-main);
    overflow-x: hidden;
    isolation: isolate;
}

body.app-shell::before {
    content: "";
    position: fixed;
    inset: -15%;
    background:
        radial-gradient(420px 420px at 10% 15%, rgba(56, 189, 248, 0.16), transparent 70%),
        radial-gradient(520px 520px at 90% 8%, rgba(94, 234, 212, 0.14), transparent 70%),
        radial-gradient(520px 520px at 60% 90%, rgba(245, 158, 11, 0.12), transparent 70%);
    z-index: -2;
}

body.app-shell::after {
    content: "";
    position: fixed;
    inset: 0;
    background-image: linear-gradient(rgba(148, 163, 184, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(148, 163, 184, 0.06) 1px, transparent 1px);
    background-size: 160px 160px;
    opacity: 0.15;
    z-index: -3;
    pointer-events: none;
}

.ambient-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.orb {
    position: absolute;
    width: 420px;
    height: 420px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(56, 189, 248, 0.25), transparent 65%);
    mix-blend-mode: screen;
    opacity: 0.5;
    filter: blur(2px);
    animation: float-orb 20s ease-in-out infinite;
}

.orb-1 {
    left: -120px;
    top: -80px;
    animation-duration: 26s;
}

.orb-2 {
    right: -140px;
    top: 20%;
    background: radial-gradient(circle at 30% 30%, rgba(94, 234, 212, 0.22), transparent 70%);
    animation-duration: 28s;
}

.orb-3 {
    left: 30%;
    bottom: -220px;
    width: 520px;
    height: 520px;
    background: radial-gradient(circle at 30% 30%, rgba(245, 158, 11, 0.18), transparent 70%);
    animation-duration: 32s;
}

.beam {
    position: absolute;
    left: 20%;
    top: -30%;
    width: 180px;
    height: 140%;
    background: linear-gradient(180deg, rgba(56, 189, 248, 0), rgba(56, 189, 248, 0.18), rgba(56, 189, 248, 0));
    transform: rotate(18deg);
    opacity: 0.35;
    filter: blur(6px);
    animation: beam-sweep 18s ease-in-out infinite;
}

.ambient-noise {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='0.12'/%3E%3C/svg%3E");
    opacity: 0.12;
    mix-blend-mode: soft-light;
}

main {
    position: relative;
    z-index: 1;
}

h1,
h2,
h3,
h4 {
    font-family: var(--font-display);
    letter-spacing: -0.02em;
}

code,
.font-mono {
    font-family: var(--font-mono);
}

.glass {
    position: relative;
    background: rgba(17, 24, 39, 0.58);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow:
        0 24px 60px rgba(5, 7, 12, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(18px) saturate(140%);
    overflow: hidden;
}

.glass::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(140deg, rgba(56, 189, 248, 0.12), transparent 55%);
    opacity: 0.8;
    pointer-events: none;
    z-index: 0;
}

.glass::after {
    content: "";
    position: absolute;
    inset: -40%;
    background: linear-gradient(120deg, transparent 35%, rgba(255, 255, 255, 0.18) 45%, transparent 55%);
    opacity: 0.35;
    transform: translateX(-60%);
    animation: glass-sheen 12s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

.glass > * {
    position: relative;
    z-index: 1;
}

.glass-strong {
    background: rgba(10, 14, 24, 0.75);
}

.glow-card {
    box-shadow:
        0 28px 70px rgba(5, 7, 12, 0.5),
        0 0 35px rgba(56, 189, 248, 0.18),
        0 0 55px rgba(94, 234, 212, 0.12);
}

.nav-shell {
    position: relative;
    background: rgba(9, 12, 20, 0.75);
    backdrop-filter: blur(18px);
}

.nav-shell::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(56, 189, 248, 0.5), transparent);
    opacity: 0.5;
}

.nav-brand {
    font-family: var(--font-display);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.brand-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--accent);
    box-shadow: 0 0 12px rgba(94, 234, 212, 0.7);
    margin-left: 0.35rem;
}

.nav-tab {
    padding: 0.55rem 1.05rem;
    border-radius: 999px;
    text-transform: uppercase;
    font-size: 0.68rem;
    letter-spacing: 0.2em;
    color: var(--text-soft);
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: rgba(15, 23, 42, 0.35);
    transition: all 0.2s ease;
}

.nav-tab:hover {
    color: var(--text-main);
    border-color: rgba(94, 234, 212, 0.4);
}

.nav-tab.is-active {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.95), rgba(94, 234, 212, 0.95));
    color: #0b0f16;
    border-color: transparent;
    box-shadow: 0 10px 24px rgba(56, 189, 248, 0.25);
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.35em;
    font-size: 0.7rem;
    color: var(--text-soft);
}

.section-title {
    font-size: clamp(2.4rem, 4vw, 3.8rem);
    line-height: 1.05;
}

.section-subtitle {
    font-size: 1.1rem;
    color: var(--text-soft);
    max-width: 40rem;
}

.title-accent {
    background: linear-gradient(120deg, #38bdf8, #5eead4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-chips {
    margin-top: 1.5rem;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    border: 1px solid rgba(148, 163, 184, 0.25);
    color: var(--text-soft);
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(12px);
}

.chip-accent {
    color: #0b0f16;
    background: linear-gradient(120deg, rgba(56, 189, 248, 0.9), rgba(94, 234, 212, 0.9));
    border-color: transparent;
    box-shadow: 0 10px 20px rgba(56, 189, 248, 0.25);
}

.chip-outline {
    border-color: rgba(56, 189, 248, 0.4);
    color: var(--text-main);
}

.panel-title {
    font-size: 0.7rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--text-soft);
}

.theory-specs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.spec-card {
    padding: 1.1rem 1.2rem;
    border-radius: 18px;
}

.spec-label {
    font-size: 0.65rem;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--text-soft);
}

.spec-value {
    display: block;
    margin-top: 0.4rem;
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-main);
}

.spec-note {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-soft);
}

.theory-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: 1fr;
    align-items: start;
}

.theory-diagram-card {
    min-height: 420px;
    grid-column: 1 / -1;
}

.theory-legend-card {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem 1.4rem;
}

.theory-legend-card .panel-title {
    grid-column: 1 / -1;
    margin-bottom: 0;
}

.legend-item {
    display: flex;
    gap: 0.9rem;
    align-items: flex-start;
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    margin-top: 4px;
    box-shadow: 0 0 16px rgba(94, 234, 212, 0.35);
}

.legend-dot--cyan { background: #38bdf8; }
.legend-dot--teal { background: #14b8a6; }
.legend-dot--slate { background: #94a3b8; }
.legend-dot--amber { background: #f59e0b; }

.legend-title {
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.2rem;
}

.legend-text {
    color: var(--text-soft);
    font-size: 0.9rem;
}

.hero-grid {
    display: grid;
    gap: 2rem;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    align-items: center;
}

.hero-copy {
    max-width: 38rem;
}

.hero-panel {
    position: relative;
    min-height: 220px;
}

.hero-panel::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(300px 300px at 20% 0%, rgba(56, 189, 248, 0.16), transparent 60%);
    opacity: 0.7;
    pointer-events: none;
    z-index: 0;
}

.hero-panel > * {
    position: relative;
    z-index: 1;
}

.hero-orb {
    position: absolute;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(56, 189, 248, 0.5), transparent 65%);
    right: -40px;
    top: -40px;
    opacity: 0.55;
    filter: blur(2px);
    pointer-events: none;
    z-index: 0;
}

.hero-panel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-top: 0.5rem;
}

.hero-stat {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 0.75rem;
    border-radius: 14px;
    background: rgba(11, 15, 24, 0.55);
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.hero-stat--wide {
    grid-column: span 2;
}

.hero-stat-value {
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.95rem;
    line-height: 1.3;
    word-break: break-word;
}

.hero-panel-footer {
    margin-top: 1.2rem;
    font-size: 0.85rem;
    color: var(--text-soft);
}

.label {
    font-size: 0.72rem;
    color: var(--text-soft);
    text-transform: uppercase;
    letter-spacing: 0.16em;
}

.extra-feature-label {
    min-height: 2.2em;
    line-height: 1.15;
}

.input-field {
    background: rgba(11, 15, 24, 0.55);
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 16px;
    padding: 0.85rem 1rem;
    color: var(--text-main);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input-field:focus {
    outline: none;
    border-color: rgba(56, 189, 248, 0.6);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.18);
}

.input-field::placeholder {
    color: rgba(148, 163, 184, 0.6);
}

.input-field:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.95), rgba(94, 234, 212, 0.95));
    color: #0b0f16;
    border-radius: 16px;
    font-weight: 700;
    letter-spacing: 0.1em;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
}

.btn-primary:hover {
    box-shadow: 0 18px 32px rgba(56, 189, 248, 0.25);
    transform: translateY(-1px);
}

.btn-primary::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.35), transparent);
    transform: translateX(-80%);
    animation: button-sheen 6s ease-in-out infinite;
    opacity: 0.6;
}

.meta-box {
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 14px;
    padding: 0.7rem 0.9rem;
    color: var(--text-soft);
    font-family: var(--font-mono);
    background: rgba(11, 15, 24, 0.6);
    backdrop-filter: blur(10px);
}

.diagram-frame {
    --diagram-frame-bg: #f8fafc;
    --diagram-frame-border: rgba(15, 23, 42, 0.12);
    background: var(--diagram-frame-bg);
    border-radius: 18px;
    border: 1px solid var(--diagram-frame-border);
    padding: 1rem;
    box-shadow: 0 18px 50px rgba(7, 11, 19, 0.2);
    width: 100%;
}

.diagram-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 0.5rem;
    width: 100%;
    -webkit-overflow-scrolling: touch;
}

.diagram-stage {
    position: relative;
    width: min(100%, 980px);
    min-width: 0;
    margin: 0 auto;
}

.diagram-stage[data-dataset="breast_cancer_4q"][data-feature-map="zz"] {
    width: 242%;
}

.diagram-stage[data-dataset="breast_cancer_4q"][data-feature-map="pauli"] {
    width: 254%;
}

.diagram-image {
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
    margin: 0 auto;
}

.diagram-overlay {
    top: 0;
    bottom: 0;
}

.plot-shell {
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.6), rgba(15, 23, 42, 0.3));
    position: relative;
}

.plot-shell::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 20% 0%, rgba(56, 189, 248, 0.16), transparent 60%);
    opacity: 0.6;
    pointer-events: none;
}

.step-badge {
    height: 60px;
    width: 60px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: #0b0f16;
    color: var(--text-main);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
    z-index: 2;
}

.step-badge--cyan { border-color: rgba(56, 189, 248, 0.35); color: #7dd3fc; }
.step-badge--teal { border-color: rgba(20, 184, 166, 0.35); color: #5eead4; }
.step-badge--slate { border-color: rgba(148, 163, 184, 0.3); color: #cbd5f5; }
.step-badge--amber { border-color: rgba(245, 158, 11, 0.35); color: #fbbf24; }

.timeline {
    position: relative;
}

.timeline-line {
    position: absolute;
    left: 30px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, rgba(56, 189, 248, 0.6), rgba(94, 234, 212, 0.35), rgba(245, 158, 11, 0.3));
    opacity: 0.6;
}

.timeline-track {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

.timeline-item {
    position: relative;
    display: grid;
    grid-template-columns: 60px 1fr;
    column-gap: 1.5rem;
    align-items: start;
}

.timeline-item .step-badge {
    justify-self: center;
}

.timeline-card {
    border: 1px solid rgba(148, 163, 184, 0.2);
    box-shadow: 0 18px 40px rgba(5, 7, 12, 0.35);
    margin-left: 0 !important;
}

.timeline-meta {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 0.9rem;
}

.timeline-tag {
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    font-size: 0.65rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--text-soft);
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: rgba(15, 23, 42, 0.4);
}

.timeline-chip {
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    font-size: 0.65rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #0b0f16;
    background: linear-gradient(120deg, rgba(56, 189, 248, 0.9), rgba(94, 234, 212, 0.9));
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.metric-card {
    background: rgba(17, 24, 39, 0.45);
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 16px;
    padding: 0.85rem;
    backdrop-filter: blur(12px);
}

.metric-title {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.28em;
    color: var(--text-soft);
    margin-bottom: 0.6rem;
}

.metric-row {
    display: flex;
    justify-content: space-between;
    gap: 0.8rem;
    color: var(--text-soft);
}

.metric-value {
    color: var(--text-main);
    font-weight: 600;
}

.tooltip-label {
    color: var(--text-soft);
    font-size: 0.7rem;
}

.tooltip-bubble {
    background: rgba(10, 12, 18, 0.98);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 8px;
    padding: 0.35rem 0.5rem;
    font-size: 0.65rem;
    color: var(--text-main);
    box-shadow: 0 14px 32px rgba(3, 6, 12, 0.45);
}

.section-reveal {
    animation: fade-up 0.6s ease both;
}

.animate-fade-in {
    animation: fade-up 0.5s ease both;
}

.stagger-children > * {
    opacity: 0;
    transform: translateY(14px);
    animation: fade-up 0.6s ease forwards;
}

.stagger-children > *:nth-child(1) { animation-delay: 0.05s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.12s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.18s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.24s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.3s; }
.stagger-children > *:nth-child(6) { animation-delay: 0.36s; }

@keyframes fade-up {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes glass-sheen {
    0% { transform: translateX(-60%); }
    50% { transform: translateX(0%); }
    100% { transform: translateX(60%); }
}

@keyframes button-sheen {
    0% { transform: translateX(-80%); }
    40% { transform: translateX(80%); }
    100% { transform: translateX(80%); }
}

@keyframes float-orb {
    0%, 100% { transform: translate3d(0, 0, 0); }
    50% { transform: translate3d(30px, -40px, 0); }
}

@keyframes beam-sweep {
    0%, 100% { transform: translateX(-40%) rotate(18deg); }
    50% { transform: translateX(40%) rotate(18deg); }
}

@media (prefers-reduced-motion: reduce) {
    .section-reveal,
    .animate-fade-in,
    .stagger-children > *,
    .orb,
    .beam,
    .btn-primary::after,
    .glass::after {
        animation: none;
        opacity: 1;
        transform: none;
    }
}

@media (max-width: 640px) {
    .hero-stat--wide {
        grid-column: span 1;
    }
}

/* Scrollbar */
body.app-shell {
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.5) transparent;
}

body.app-shell::-webkit-scrollbar {
    width: 10px;
}

body.app-shell::-webkit-scrollbar-track {
    background: transparent;
}

body.app-shell::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.4);
    border-radius: 999px;
}
