/* ========================================
   sbom.day - Forensic Software Audit HUD
   ======================================== */

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

html {
    scroll-behavior: smooth;
    background: #0d1117;
}

body {
    font-family: 'Inter', sans-serif;
    color: #c9d1d9;
    background: #0d1117;
    overflow-x: hidden;
    line-height: 1.75;
    letter-spacing: 0.01em;
    font-size: clamp(0.95rem, 1.5vw, 1.15rem);
    font-weight: 400;
}

/* === REDUCED MOTION === */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* === SCAN GRID BACKGROUND === */
.scan-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1.2s ease;
    background:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 39px,
            #1a1f2e 39px,
            #1a1f2e 40px
        ),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 39px,
            #1a1f2e 39px,
            #1a1f2e 40px
        );
}

.scan-grid.visible {
    opacity: 0.35;
}

/* === GLOBAL SCANLINE === */
.global-scanline {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, #00e5ff, transparent);
    z-index: 1000;
    pointer-events: none;
    opacity: 0;
    transform: translateY(-2px);
}

.global-scanline.active {
    opacity: 0.6;
    animation: scanlineDown 2s ease-out forwards;
}

@keyframes scanlineDown {
    0% { transform: translateY(0); }
    100% { transform: translateY(100vh); }
}

/* === SECTIONS / ACTS === */
.act {
    position: relative;
    min-height: 100vh;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(2rem, 5vw, 6rem);
}

/* === HUD PANELS === */
.hud-panel {
    position: relative;
    padding: clamp(2rem, 4vw, 4rem);
    background: rgba(26, 31, 46, 0.25);
}

.hud-bracket {
    position: absolute;
    width: 12px;
    height: 12px;
}

.hud-bracket.tl {
    top: 0;
    left: 0;
    border-top: 2px solid #00e5ff;
    border-left: 2px solid #00e5ff;
}

.hud-bracket.tr {
    top: 0;
    right: 0;
    border-top: 2px solid #00e5ff;
    border-right: 2px solid #00e5ff;
}

.hud-bracket.bl {
    bottom: 0;
    left: 0;
    border-bottom: 2px solid #00e5ff;
    border-left: 2px solid #00e5ff;
}

.hud-bracket.br {
    bottom: 0;
    right: 0;
    border-bottom: 2px solid #00e5ff;
    border-right: 2px solid #00e5ff;
}

/* === BARCODE STRIP === */
.barcode-strip {
    position: absolute;
    bottom: 4px;
    left: 20px;
    right: 20px;
    height: 6px;
    opacity: 0.15;
    background: repeating-linear-gradient(
        90deg,
        #00e5ff 0px, #00e5ff 2px,
        transparent 2px, transparent 4px,
        #00e5ff 4px, #00e5ff 5px,
        transparent 5px, transparent 8px,
        #00e5ff 8px, #00e5ff 11px,
        transparent 11px, transparent 13px,
        #00e5ff 13px, #00e5ff 14px,
        transparent 14px, transparent 18px,
        #00e5ff 18px, #00e5ff 20px,
        transparent 20px, transparent 21px,
        #00e5ff 21px, #00e5ff 23px,
        transparent 23px, transparent 27px,
        #00e5ff 27px, #00e5ff 30px,
        transparent 30px, transparent 32px
    );
}

/* === HASH FINGERPRINT === */
.hash-fingerprint {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 1px;
    opacity: 0.3;
}

/* === SECTION HEADINGS === */
.section-heading {
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(1rem, 2vw, 1.6rem);
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #c9d1d9;
    margin-bottom: 2rem;
}

.section-num {
    opacity: 0.4;
    font-size: 0.7em;
    margin-right: 0.5em;
}

/* === NARRATIVE TEXT === */
.narrative-text {
    max-width: 680px;
}

.narrative-text p {
    margin-bottom: 1.25rem;
    color: #c9d1d9;
}

.narrative-text strong {
    font-weight: 600;
    color: #c9d1d9;
}

.narrative-text em {
    font-style: italic;
    color: #c9d1d9;
}

.narrative-text code {
    font-family: 'Overpass Mono', monospace;
    font-size: 0.85em;
    background: rgba(0, 229, 255, 0.08);
    padding: 2px 6px;
    border-radius: 3px;
    color: #00e5ff;
}

/* === ACT 1: THE BLACK BOX === */
.act-1 {
    flex-direction: column;
    background: #0d1117;
}

.act1-panel {
    text-align: center;
    max-width: 900px;
    width: 100%;
    opacity: 0;
    transition: opacity 1s ease 0.8s;
}

.act-1.revealed .act1-panel {
    opacity: 1;
}

.title-typewriter {
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(2.5rem, 6vw, 5.5rem);
    font-weight: 400;
    letter-spacing: 0.08em;
    color: #c9d1d9;
    text-shadow: 0 0 20px rgba(0, 229, 255, 0.4);
    overflow: hidden;
    white-space: nowrap;
    border-right: 2px solid #00e5ff;
    width: 0;
    margin: 0 auto;
    animation: typewriter 1.5s steps(8) 1.5s forwards, blink-caret 0.8s step-end infinite;
}

@keyframes typewriter {
    from { width: 0; }
    to { width: 8.5ch; }
}

@keyframes blink-caret {
    0%, 100% { border-color: #00e5ff; }
    50% { border-color: transparent; }
}

.act1-subtitle {
    font-family: 'Inter', sans-serif;
    font-size: clamp(0.9rem, 1.4vw, 1.1rem);
    color: #6b7b8d;
    margin-top: 2rem;
    opacity: 0;
    animation: fadeIn 1.5s ease 3.5s forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Scroll indicator */
.scroll-indicator {
    position: absolute;
    bottom: 3rem;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    animation: fadeIn 1s ease 4.5s forwards;
}

.scroll-indicator svg {
    animation: pulseAttention 2s ease-in-out infinite;
}

@keyframes pulseAttention {
    0%, 100% { transform: translateY(0); opacity: 0.6; }
    50% { transform: translateY(8px); opacity: 1; }
}

/* QR Watermark */
.qr-watermark {
    position: absolute;
    bottom: 5%;
    right: 5%;
    width: 80px;
    height: 80px;
    display: grid;
    grid-template-columns: repeat(20, 4px);
    grid-template-rows: repeat(20, 4px);
    opacity: 0.05;
    pointer-events: none;
}

.qr-watermark span {
    background: #00e5ff;
}

/* === TRIPTYCH LAYOUT (Acts 2-4) === */
.act-layout {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: clamp(1rem, 3vw, 3rem);
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    align-items: start;
}

/* === SIDEBAR === */
.sidebar {
    position: sticky;
    top: clamp(2rem, 5vw, 6rem);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #6b7b8d;
    border: 1px solid rgba(107, 123, 141, 0.15);
    transition: all 0.3s ease;
}

.sidebar-pill.active {
    color: #c9d1d9;
    border-color: rgba(0, 229, 255, 0.3);
    background: rgba(0, 229, 255, 0.05);
}

.pill-indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #6b7b8d;
}

.pill-indicator.cyan { background: #00e5ff; }
.pill-indicator.red { background: #ff3d71; }
.pill-indicator.amber { background: #ffb830; }
.pill-indicator.green { background: #0eca7a; }

.pill-label {
    flex: 1;
}

/* === METADATA PANEL (Right Column) === */
.metadata-panel {
    position: sticky;
    top: clamp(2rem, 5vw, 6rem);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.meta-card {
    padding: clamp(1rem, 2vw, 1.5rem) !important;
}

.meta-label {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #6b7b8d;
    margin-bottom: 4px;
}

.meta-value {
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(1.5rem, 3vw, 2.2rem);
    color: #00e5ff;
    letter-spacing: 0.05em;
}

.meta-value.small {
    font-size: clamp(0.8rem, 1.2vw, 1rem);
    color: #c9d1d9;
}

/* === CIRCUIT TRACES === */
.circuit-trace {
    position: relative;
    opacity: 0;
    animation: circuitPulse 3s ease-in-out infinite alternate;
}

.circuit-trace.vertical {
    width: 1px;
    height: 40px;
    margin: 0 auto;
    background: #00e5ff;
}

@keyframes circuitPulse {
    0% { opacity: 0.2; }
    100% { opacity: 0.5; }
}

/* === SCAN DIVIDERS === */
.scan-divider {
    position: relative;
    height: 2px;
    width: 100%;
    overflow: hidden;
    z-index: 2;
}

.scan-divider::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #00e5ff, transparent);
    transform: translateX(-100%);
    transition: transform 1s ease;
}

.scan-divider.scanned::after {
    transform: translateX(100%);
}

/* === ACT 2: DEPENDENCY GRAPH === */
.dependency-tree {
    width: 100%;
    margin: 2rem 0;
    position: relative;
}

#dep-tree-svg {
    width: 100%;
    height: auto;
    max-height: 500px;
}

#dep-tree-svg .dep-edge {
    stroke: #6b7b8d;
    stroke-width: 1;
    fill: none;
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 1.5s ease-out;
}

#dep-tree-svg .dep-edge.drawn {
    stroke-dashoffset: 0;
}

#dep-tree-svg .dep-node {
    r: 6;
    fill: #00e5ff;
    transform: scale(0);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#dep-tree-svg .dep-node.visible {
    transform: scale(1);
}

#dep-tree-svg .dep-node.vuln {
    fill: #ff3d71;
}

#dep-tree-svg .dep-node.safe {
    fill: #0eca7a;
}

#dep-tree-svg .dep-label {
    font-family: 'Overpass Mono', monospace;
    font-size: 8px;
    fill: #6b7b8d;
    opacity: 0;
    transition: opacity 0.5s ease;
}

#dep-tree-svg .dep-label.visible {
    opacity: 0.8;
}

/* === COUNTER ANIMATION === */
.counter-animate {
    font-variant-numeric: tabular-nums;
}

/* === ACT 3: VULNERABILITY SCAN === */
.vuln-scan-area {
    position: relative;
    width: 100%;
    min-height: 200px;
    margin: 2rem 0;
    overflow: hidden;
}

.scan-sweep {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent 10%, #00e5ff 50%, transparent 90%);
    opacity: 0;
    z-index: 5;
    pointer-events: none;
}

.scan-sweep.active {
    opacity: 0.8;
    animation: sweepDown 2s ease-out forwards;
}

@keyframes sweepDown {
    from { transform: translateY(0); }
    to { transform: translateY(200px); }
}

.vuln-nodes {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 20px 0;
}

.vuln-node {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #6b7b8d;
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

.vuln-node.scanned-safe {
    background: #0eca7a;
    box-shadow: 0 0 8px rgba(14, 202, 122, 0.4);
}

.vuln-node.scanned-critical {
    background: #ff3d71;
    box-shadow: 0 0 8px rgba(255, 61, 113, 0.4);
}

.vuln-node.scanned-medium {
    background: #ffb830;
    box-shadow: 0 0 8px rgba(255, 184, 48, 0.4);
}

/* Severity legend */
.severity-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin: 1.5rem 0;
    padding: 16px 0;
    border-top: 1px solid rgba(107, 123, 141, 0.15);
    border-bottom: 1px solid rgba(107, 123, 141, 0.15);
}

.severity-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.severity-dot.critical { background: #ff3d71; }
.severity-dot.high { background: #ff3d71; opacity: 0.7; }
.severity-dot.medium { background: #ffb830; }
.severity-dot.safe { background: #0eca7a; }

.severity-label {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    color: #c9d1d9;
}

.severity-code {
    font-family: 'Overpass Mono', monospace;
    font-size: 0.65rem;
    color: #6b7b8d;
}

/* Vulnerability cards */
.vuln-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 2rem;
}

.vuln-card {
    display: flex;
    background: rgba(26, 31, 46, 0.4);
    overflow: hidden;
    opacity: 0;
    transform: translateX(-10px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.vuln-card.revealed {
    opacity: 1;
    transform: translateX(0);
}

.vuln-card-border {
    width: 3px;
    flex-shrink: 0;
}

.vuln-card.critical .vuln-card-border { background: #ff3d71; }
.vuln-card.high .vuln-card-border { background: #ff3d71; opacity: 0.7; }
.vuln-card.medium .vuln-card-border { background: #ffb830; }

.vuln-card-content {
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.vuln-id {
    font-family: 'Overpass Mono', monospace;
    font-size: 0.85em;
    color: #ff3d71;
}

.vuln-card.medium .vuln-id {
    color: #ffb830;
}

.vuln-pkg {
    font-family: 'Overpass Mono', monospace;
    font-size: 0.8em;
    color: #00e5ff;
}

.vuln-severity {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #6b7b8d;
}

.vuln-desc {
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    color: #c9d1d9;
    line-height: 1.5;
}

/* Vuln counts */
.vuln-count {
    font-variant-numeric: tabular-nums;
}

.critical-count { color: #ff3d71; }
.high-count { color: #ff3d71; opacity: 0.8; }
.medium-count { color: #ffb830; }
.safe-count { color: #0eca7a; }

/* === ACT 4: THE MANIFEST === */
.manifest-viewer {
    margin: 2rem 0;
    border: 1px solid rgba(0, 229, 255, 0.1);
    overflow: hidden;
}

.manifest-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: rgba(26, 31, 46, 0.6);
    border-bottom: 1px solid rgba(0, 229, 255, 0.1);
}

.manifest-format {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    color: #00e5ff;
    text-transform: uppercase;
}

.manifest-file {
    font-family: 'Overpass Mono', monospace;
    font-size: 0.75rem;
    color: #6b7b8d;
}

.manifest-code {
    padding: 24px;
    background: rgba(13, 17, 23, 0.8);
    overflow-x: auto;
    font-family: 'Overpass Mono', monospace;
    font-size: 0.8rem;
    line-height: 1.8;
    tab-size: 2;
    color: #c9d1d9;
}

.manifest-code code {
    display: block;
}

.manifest-code .line-num {
    color: #6b7b8d;
    user-select: none;
    display: inline-block;
    width: 2.5em;
    text-align: right;
    margin-right: 1.5em;
    opacity: 0.6;
}

.json-key { color: #00e5ff; }
.json-string { color: #c9d1d9; }
.json-brace { color: #6b7b8d; }
.json-value-safe { color: #0eca7a; }
.json-flagged { color: #ff3d71; }

/* Manifest lines slide in */
.manifest-code code > span:not(.line-num):not(.json-key):not(.json-string):not(.json-brace):not(.json-value-safe):not(.json-flagged) {
    /* Line-level spans are not used; animation handled by JS on lines */
}

/* License bar chart */
.license-bars {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 12px;
}

.license-bar-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.license-name {
    font-family: 'Overpass Mono', monospace;
    font-size: 0.65rem;
    color: #6b7b8d;
    width: 70px;
    text-align: right;
    flex-shrink: 0;
}

.license-bar-track {
    flex: 1;
    height: 6px;
    background: rgba(26, 31, 46, 0.5);
    overflow: hidden;
}

.license-bar-fill {
    height: 100%;
    background: #00e5ff;
    transition: width 1s ease;
}

.license-bar-fill.amber { background: #ffb830; }
.license-bar-fill.red { background: #ff3d71; }

.license-pct {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.65rem;
    color: #6b7b8d;
    width: 30px;
    text-align: right;
    flex-shrink: 0;
}

/* === ACT 5: THE SEALED REPORT === */
.act-5 {
    flex-direction: column;
    text-align: center;
}

.act5-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3rem;
    max-width: 700px;
    width: 100%;
}

.report-card {
    width: 100%;
    text-align: center;
    padding: clamp(3rem, 6vw, 5rem) !important;
}

.report-status {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.checkmark-svg {
    opacity: 0;
    transition: opacity 0.5s ease;
}

.checkmark-svg.visible {
    opacity: 1;
}

#checkmark-path {
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    transition: stroke-dashoffset 1s ease 0.3s;
}

.checkmark-svg.visible #checkmark-path {
    stroke-dashoffset: 0;
}

.report-title {
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(1.2rem, 2.5vw, 2rem);
    font-weight: 400;
    letter-spacing: 0.1em;
    color: #0eca7a;
    text-transform: uppercase;
}

.report-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
    margin-bottom: 2rem;
}

.report-stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-value {
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    color: #00e5ff;
    letter-spacing: 0.05em;
}

.stat-value.critical-text {
    color: #ff3d71;
}

.stat-label {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.6rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #6b7b8d;
}

.report-hash {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-top: 2rem;
    border-top: 1px solid rgba(107, 123, 141, 0.15);
}

.hash-label {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.6rem;
    letter-spacing: 0.1em;
    color: #6b7b8d;
    text-transform: uppercase;
}

.hash-value {
    font-family: 'Overpass Mono', monospace;
    font-size: 0.65rem;
    color: #6b7b8d;
    word-break: break-all;
    opacity: 0.6;
}

.act5-domain {
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(1rem, 2vw, 1.4rem);
    letter-spacing: 0.08em;
    color: #c9d1d9;
    opacity: 0;
    transition: opacity 1.5s ease;
}

.act5-domain.visible {
    opacity: 1;
}

.act5-final {
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(0.85rem, 1.5vw, 1.1rem);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #c9d1d9;
    opacity: 0;
    transition: opacity 1.5s ease 0.3s;
}

.act5-final.visible {
    opacity: 1;
}

/* === MOBILE RESPONSIVE === */
@media (max-width: 900px) {
    .act-layout {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .sidebar {
        position: relative;
        top: 0;
        flex-direction: row;
        overflow-x: auto;
        gap: 6px;
        padding-bottom: 8px;
    }

    .sidebar-pill {
        white-space: nowrap;
        font-size: 0.6rem;
        padding: 6px 10px;
    }

    .metadata-panel {
        position: relative;
        top: 0;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 12px;
    }

    .metadata-panel .meta-card {
        flex: 1;
        min-width: 120px;
    }

    .circuit-trace.vertical {
        display: none;
    }

    .report-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .qr-watermark {
        display: none;
    }

    .act {
        padding: clamp(1.5rem, 4vw, 3rem);
    }
}

@media (max-width: 500px) {
    .report-stats {
        grid-template-columns: 1fr;
    }

    .severity-legend {
        flex-direction: column;
        gap: 10px;
    }
}
