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

:root {
    --bg-primary: #f4f1f9;
    --bg-dark: #1b1f3b;
    --text-primary: #1b1f3b;
    --text-inverted: #f4f1f9;
    --accent-teal: #00c9b7;
    --accent-lavender: #8b7cf6;
    --accent-coral: #ff6b6b;
    --neutral: #b8b5c8;
    --code-bg: #f0eef5;
    --slate: #3d4260;
    --gradient: linear-gradient(135deg, #00c9b7, #8b7cf6);
    --gradient-h: linear-gradient(90deg, #00c9b7, #8b7cf6);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Quicksand', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.8vw, 1.25rem);
    line-height: 1.7;
    letter-spacing: 0.01em;
    color: var(--text-primary);
    background: var(--bg-primary);
    overflow-x: hidden;
}

h1, h2, h3 {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    letter-spacing: -0.02em;
}

code {
    font-family: 'Inconsolata', monospace;
    font-size: 0.9em;
    background: var(--code-bg);
    padding: 0.15em 0.4em;
    border-radius: 4px;
}

/* === Navigation Pill === */
#nav-pill {
    position: fixed;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 16px;
    z-index: 100;
    background: linear-gradient(135deg, rgba(0,201,183,0.15), rgba(139,124,246,0.15));
    backdrop-filter: blur(12px);
    padding: 16px 10px;
    border-radius: 24px;
}

.nav-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--neutral);
    transition: background 0.3s, transform 0.3s;
    display: block;
}

.nav-dot.active {
    background: var(--accent-teal);
    transform: scale(1.4);
}

.nav-dot:hover {
    background: var(--accent-lavender);
    transform: scale(1.3);
}

/* === Sections === */
.hero-section {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.section-light {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.section-dark {
    background: var(--bg-dark);
    color: var(--text-inverted);
}

.section-inner {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 80px 24px;
    position: relative;
    z-index: 2;
}

/* === Section 0: Hero === */
#section-0 {
    justify-content: flex-end;
    padding-bottom: 12vh;
}

.hero-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.hero-illustration {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: saturate(0.3) sepia(0.2);
    opacity: 0.4;
}

.vintage-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(244,241,249,0.3) 0%, rgba(244,241,249,0) 40%);
}

.grain-overlay {
    position: absolute;
    inset: 0;
    opacity: 0.06;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-size: 256px 256px;
    mix-blend-mode: multiply;
}

.vignette-overlay {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, transparent 60%, rgba(27,31,59,0.3) 100%);
}

.hero-content {
    position: relative;
    z-index: 3;
    text-align: center;
}

.hero-title {
    font-size: clamp(2.5rem, 6vw, 5.5rem);
    color: var(--text-primary);
    margin-bottom: 0.3em;
    opacity: 0;
    transform: translateY(12px);
    animation: fadeReveal 0.8s 0.5s ease-out forwards;
}

.hero-subtitle {
    font-family: 'Quicksand', sans-serif;
    font-weight: 500;
    font-size: clamp(1.1rem, 2.5vw, 1.6rem);
    color: var(--slate);
    opacity: 0;
    transform: translateY(12px);
    animation: fadeReveal 0.8s 0.9s ease-out forwards;
}

/* === Floating Cards === */
.floating-cards {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
}

.float-card {
    position: absolute;
    background: rgba(244,241,249,0.85);
    backdrop-filter: blur(8px);
    border-radius: 8px;
    padding: 10px 16px;
    box-shadow: 0 4px 20px rgba(27,31,59,0.1);
    display: flex;
    flex-direction: column;
    gap: 2px;
    opacity: 0;
    transform: translateY(12px);
    animation: floatCardIn 0.6s ease-out forwards, float 6s ease-in-out infinite;
    animation-delay: var(--delay, 0.3s), var(--delay, 0.3s);
}

.float-card:nth-child(1) { --delay: 0.6s; }
.float-card:nth-child(2) { --delay: 0.8s; }
.float-card:nth-child(3) { --delay: 1.0s; }
.float-card:nth-child(4) { --delay: 1.2s; }
.float-card:nth-child(5) { --delay: 1.4s; }
.float-card:nth-child(6) { --delay: 1.6s; }

.pkg-name {
    font-family: 'Inconsolata', monospace;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.pkg-license {
    font-family: 'Quicksand', sans-serif;
    font-size: 0.7rem;
    color: var(--neutral);
}

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

@keyframes floatCardIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeReveal {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* === Scan Line === */
.scan-line {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    width: 0;
    background: var(--gradient-h);
    z-index: 10;
    transition: width 0.6s ease-out;
}

.scan-line.active {
    width: 100%;
}

/* === Dependency Tree === */
.dependency-tree-container,
.vuln-tree-container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto 48px;
}

.dep-tree {
    width: 100%;
    height: auto;
}

.tree-node {
    opacity: 0;
    transition: opacity 0.5s ease-out;
}

.tree-node.visible {
    opacity: 1;
}

.tree-path {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    transition: stroke-dashoffset 0.8s ease-out;
}

.tree-path.drawn {
    stroke-dashoffset: 0;
}

/* === Section 1 text === */
.section-text {
    max-width: 700px;
    margin: 0 auto;
    text-align: center;
}

.section-text h2 {
    font-size: clamp(1.8rem, 4vw, 3rem);
    margin-bottom: 0.6em;
}

.section-text p {
    color: var(--text-inverted);
    opacity: 0.9;
}

.section-light .section-text p {
    color: var(--slate);
}

/* === Fade Reveal === */
.fade-reveal {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

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

/* === Section 2: Manifest === */
.manifest-hero {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 auto 48px;
    min-height: 400px;
}

.clipboard-illustration {
    width: 100%;
    height: auto;
    filter: saturate(0.3) sepia(0.2);
    opacity: 0.4;
}

.manifest-cards {
    position: absolute;
    inset: 0;
}

.manifest-card {
    position: absolute;
    background: rgba(244,241,249,0.9);
    backdrop-filter: blur(8px);
    border-radius: 8px;
    padding: 10px 16px;
    box-shadow: 0 4px 16px rgba(27,31,59,0.1);
    border-left: 3px solid var(--accent-teal);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.field-label {
    font-family: 'Inconsolata', monospace;
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--accent-lavender);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.field-value {
    font-family: 'Quicksand', sans-serif;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.field-value.code {
    font-family: 'Inconsolata', monospace;
}

.sbom-document {
    max-width: 700px;
    margin: 0 auto;
    text-align: center;
}

.sbom-document h2 {
    font-size: clamp(1.8rem, 4vw, 3rem);
    margin-bottom: 0.4em;
}

.sbom-document p {
    color: var(--slate);
    margin-bottom: 1.5em;
}

.code-block {
    background: var(--code-bg);
    border-radius: 12px;
    padding: 24px 28px;
    text-align: left;
    overflow-x: auto;
}

.code-block pre {
    margin: 0;
}

.code-block code {
    font-family: 'Inconsolata', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    background: none;
    padding: 0;
    color: var(--slate);
}

.hl-teal { color: var(--accent-teal); font-weight: 600; }
.hl-lavender { color: var(--accent-lavender); font-weight: 600; }
.hl-coral { color: var(--accent-coral); font-weight: 600; }

/* === Section 3: Vulnerability === */
.vuln-tree-container {
    max-width: 700px;
}

.vuln-node {
    opacity: 0;
    transition: opacity 0.5s ease-out;
}

.vuln-node.visible {
    opacity: 1;
}

.vuln-path {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    transition: stroke-dashoffset 0.8s ease-out;
}

.vuln-path.drawn {
    stroke-dashoffset: 0;
}

.vuln-rect {
    transition: fill 0.6s ease-out;
}

.vuln-node.infected .vuln-rect {
    fill: var(--accent-coral);
}

.vuln-pulse {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; r: 6; }
    50% { opacity: 0.5; r: 10; }
}

.section-dark .section-text code {
    background: rgba(240,238,245,0.15);
    color: var(--accent-coral);
}

/* === Section 4: Closing === */
.section-final {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
}

.verified-cards {
    position: absolute;
    inset: 0;
    z-index: 1;
}

.verified-cards .float-card {
    animation: float 6s ease-in-out infinite;
    opacity: 0;
    border-left: 3px solid var(--accent-teal);
}

.verified-cards .float-card.revealed {
    opacity: 1;
}

.check-mark {
    color: var(--accent-teal);
    font-size: 1rem;
    font-weight: 700;
    margin-left: 8px;
}

.float-card.verified {
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.closing-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 40px;
}

.closing-statement {
    font-size: clamp(1.8rem, 4.5vw, 3.5rem);
    line-height: 1.3;
    color: var(--text-primary);
}

.final-scan {
    position: relative;
    width: 0;
    height: 2px;
    background: var(--gradient-h);
    margin-top: 32px;
}

.final-scan.active {
    width: 300px;
}

/* === Responsive === */
@media (max-width: 768px) {
    #nav-pill {
        right: 12px;
        padding: 12px 8px;
    }

    .section-inner {
        padding: 60px 16px;
    }

    .float-card {
        transform: scale(0.85);
    }

    .manifest-card {
        max-width: 160px;
    }

    .code-block {
        padding: 16px;
    }
}
