/* ============================================
   sbom.day — Styles
   Neon-on-honey whimsical software anatomy
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --bg-primary: #F5E6CC;
    --bg-secondary: #EDD9B5;
    --text-primary: #3D2B1F;
    --text-secondary: #5C4A3A;
    --neon-tangerine: #E85D26;
    --neon-mint: #00D4AA;
    --neon-pink: #FF6EC7;
    --neon-golden: #FFB347;
    --card-back: #2C1E12;
    --shadow-tone: #C9A87C;
}

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: 'Varela Round', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.5vw, 1.15rem);
    line-height: 1.65;
    letter-spacing: 0.005em;
    color: var(--text-secondary);
    background-color: var(--bg-primary);
    overflow-x: hidden;
    position: relative;
}

/* --- Background Grain Texture --- */
#grain-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    opacity: 0;
    mix-blend-mode: multiply;
    background-image: radial-gradient(circle, #C9A87C 1px, transparent 1px);
    background-size: 4px 4px;
    transition: opacity 400ms ease;
}

#grain-overlay.visible {
    opacity: 0.03;
}

/* --- Typography --- */
h1, h2, h3 {
    font-family: 'Nunito', sans-serif;
    color: var(--text-primary);
    line-height: 1.1;
    letter-spacing: -0.01em;
}

.hero-title {
    font-size: clamp(2.4rem, 5vw, 4.2rem);
    font-weight: 900;
    color: var(--text-primary);
    opacity: 0;
    transform: translateY(20px);
}

.hero-title.animate-in {
    animation: fadeUp 600ms ease-out forwards;
}

.hero-subtitle {
    font-family: 'Varela Round', sans-serif;
    font-size: clamp(1rem, 2vw, 1.4rem);
    color: var(--text-secondary);
    margin-top: 0.6em;
    opacity: 0;
    transform: translateY(20px);
}

.hero-subtitle.animate-in {
    animation: fadeUp 600ms ease-out forwards;
    animation-delay: 400ms;
}

.section-heading {
    font-size: clamp(1.6rem, 3vw, 2.8rem);
    font-weight: 800;
    color: var(--neon-tangerine);
    text-align: center;
    margin-bottom: 0.4em;
}

.section-description {
    font-family: 'Varela Round', sans-serif;
    text-align: center;
    max-width: 560px;
    margin: 0 auto 3rem;
    color: var(--text-secondary);
}

/* Monospace accent */
.dep-name {
    font-family: 'Sono', monospace;
    font-weight: 400;
    font-size: 0.9em;
    background: rgba(232, 93, 38, 0.08);
    border-radius: 4px;
    padding: 0.1em 0.3em;
}

/* --- Exhibit Room (Full viewport section) --- */
.exhibit-room {
    min-height: 100vh;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 40px;
    overflow: hidden;
}

/* --- Breathing Zones --- */
.breathing-zone {
    height: 40vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.breathing-element {
    opacity: 0.6;
}

/* --- Reveal Animation --- */
.reveal-element {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 700ms ease-out, transform 700ms ease-out;
}

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

/* ============================================
   HERO SECTION
   ============================================ */
#hero {
    position: relative;
}

.hero-text {
    position: absolute;
    top: 18%;
    left: 10%;
    z-index: 10;
}

.hero-package {
    position: relative;
    width: clamp(280px, 42vw, 480px);
    margin-left: 20%;
    transform: rotate(3deg);
    filter: drop-shadow(0 12px 40px rgba(201, 168, 124, 0.5));
}

.package-svg {
    width: 100%;
    height: auto;
}

.package-rect {
    stroke-dasharray: 1340;
    stroke-dashoffset: 1340;
    transition: none;
}

.package-rect.draw {
    animation: drawPackage 1200ms ease-in-out forwards;
}

.package-seam {
    opacity: 0;
}

.package-seam.draw {
    animation: fadeIn 400ms ease forwards;
    animation-delay: 800ms;
}

@keyframes drawPackage {
    to {
        stroke-dashoffset: 0;
    }
}

/* Hero floating nodes */
.hero-floaters {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

.hero-floaters .dep-node {
    position: absolute;
    left: var(--x);
    top: var(--y);
    opacity: 0;
    transform: scale(0.5);
}

.hero-floaters .dep-node.animate-in {
    animation: emergeNode 800ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    animation-delay: var(--delay);
}

@keyframes emergeNode {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ============================================
   FLOATING ELEMENTS
   ============================================ */

/* Dependency Nodes */
.dep-node {
    display: inline-flex;
    align-items: center;
    padding: 10px 18px;
    border: 2px solid var(--neon-tangerine);
    border-radius: 16px;
    background: var(--bg-primary);
    box-shadow:
        0 0 8px rgba(232, 93, 38, 0.2),
        0 0 24px rgba(232, 93, 38, 0.15),
        0 0 48px rgba(232, 93, 38, 0.08);
    transition: box-shadow 300ms ease-out;
    color: var(--text-primary);
}

.dep-node:hover {
    box-shadow:
        0 0 12px rgba(232, 93, 38, 0.3),
        0 0 36px rgba(232, 93, 38, 0.25),
        0 0 72px rgba(232, 93, 38, 0.18);
}

/* License Badges */
.license-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 2px solid var(--neon-mint);
    background: var(--bg-primary);
    box-shadow:
        0 0 8px rgba(0, 212, 170, 0.2),
        0 0 24px rgba(0, 212, 170, 0.15),
        0 0 48px rgba(0, 212, 170, 0.08);
    font-family: 'Sono', monospace;
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-primary);
    transition: box-shadow 300ms ease-out;
}

.license-badge:hover {
    box-shadow:
        0 0 12px rgba(0, 212, 170, 0.3),
        0 0 36px rgba(0, 212, 170, 0.25),
        0 0 72px rgba(0, 212, 170, 0.18);
}

/* Version Bubbles */
.version-bubble {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 16px;
    border-radius: 999px;
    border: 1.5px solid var(--neon-golden);
    background: var(--bg-primary);
    box-shadow:
        0 0 8px rgba(255, 179, 71, 0.2),
        0 0 24px rgba(255, 179, 71, 0.15),
        0 0 48px rgba(255, 179, 71, 0.08);
    font-family: 'Sono', monospace;
    font-weight: 400;
    font-size: 0.85rem;
    color: var(--text-primary);
    transition: box-shadow 300ms ease-out;
}

.version-bubble:hover {
    box-shadow:
        0 0 12px rgba(255, 179, 71, 0.3),
        0 0 36px rgba(255, 179, 71, 0.25),
        0 0 72px rgba(255, 179, 71, 0.18);
}

/* --- Floating Animations --- */
.floating-node {
    animation:
        floatVertical var(--float-dur, 8s) ease-in-out infinite,
        floatRotation var(--rot-dur, 11s) ease-in-out infinite;
    animation-delay: var(--delay, 0s);
}

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

@keyframes floatRotation {
    0%, 100% { rotate: -2deg; }
    50% { rotate: 2deg; }
}

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

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

/* Version bubbles rising in background */
.version-bubbles-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.version-bubbles-bg .version-bubble {
    position: absolute;
    bottom: 10%;
    opacity: 0.35;
    animation:
        riseBubble var(--float-dur, 10s) ease-in-out infinite;
    animation-delay: var(--delay, 0s);
}

@keyframes riseBubble {
    0% {
        transform: translateY(0);
        opacity: 0.35;
    }
    100% {
        transform: translateY(-200px);
        opacity: 0.05;
    }
}

/* ============================================
   DEPENDENCY TREE SECTION
   ============================================ */
.tree-container {
    position: relative;
    width: 100%;
    max-width: 900px;
    height: 500px;
    margin: 0 auto;
}

.tree-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.tree-line {
    fill: none;
    stroke: var(--shadow-tone);
    stroke-width: 1.5;
    stroke-dasharray: 6, 4;
    stroke-dashoffset: 300;
    transition: stroke-dashoffset 1200ms ease-in-out;
}

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

.tree-node {
    position: absolute;
    transform: translate(-50%, -50%) scale(var(--scale, 1));
    z-index: 2;
    white-space: nowrap;
}

.root-node {
    border-color: var(--neon-golden);
    box-shadow:
        0 0 8px rgba(255, 179, 71, 0.25),
        0 0 24px rgba(255, 179, 71, 0.2),
        0 0 48px rgba(255, 179, 71, 0.1);
}

.level1-node {
    opacity: 0.95;
}

.level2-node {
    opacity: 0.8;
    font-size: 0.85em;
}

.level2-node .dep-name {
    font-size: 0.8em;
}

/* ============================================
   LICENSE SPECIMENS (Card Flip)
   ============================================ */
.specimen-cluster {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

.specimen-card {
    perspective: 1200px;
    width: 100%;
    height: 260px;
    cursor: pointer;
    transform: translate(var(--card-x, 0), var(--card-y, 0)) rotate(var(--card-rot, 0deg));
    transition: transform 300ms ease;
}

.specimen-card:hover {
    transform: translate(var(--card-x, 0), var(--card-y, 0)) rotate(var(--card-rot, 0deg)) scale(1.02);
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 600ms cubic-bezier(0.4, 0, 0.2, 1);
}

.specimen-card.flipped .card-inner {
    transform: rotateY(180deg);
}

.card-front,
.card-back {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 16px;
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.card-front {
    background: var(--bg-secondary);
    border: 1.5px solid var(--shadow-tone);
    box-shadow:
        0 4px 20px rgba(201, 168, 124, 0.3);
    /* Paper grain texture */
    background-image: radial-gradient(circle, rgba(201, 168, 124, 0.15) 1px, transparent 1px);
    background-size: 3px 3px;
}

.card-back {
    background: var(--card-back);
    border: 2px solid var(--neon-pink);
    box-shadow:
        0 0 12px rgba(255, 110, 199, 0.3),
        0 0 36px rgba(255, 110, 199, 0.15);
    transform: rotateY(180deg);
    text-align: left;
    align-items: flex-start;
}

.card-icon {
    margin-bottom: 14px;
}

.card-title {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.card-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-align: center;
}

.card-back-title {
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--neon-pink);
    text-shadow: 0 0 12px rgba(255, 110, 199, 0.6);
    margin-bottom: 14px;
}

.card-back-list {
    list-style: none;
    padding: 0;
    width: 100%;
}

.card-back-list li {
    font-family: 'Sono', monospace;
    font-size: 0.85rem;
    padding: 4px 0;
    border-bottom: 1px solid rgba(255, 110, 199, 0.15);
}

.card-back-list li:last-child {
    border-bottom: none;
}

.card-back-list .permission {
    color: var(--neon-mint);
    text-shadow: 0 0 8px rgba(0, 212, 170, 0.4);
}

.card-back-list .permission::before {
    content: '+ ';
}

.card-back-list .limitation {
    color: var(--neon-tangerine);
    text-shadow: 0 0 8px rgba(232, 93, 38, 0.4);
}

.card-back-list .limitation::before {
    content: '- ';
}

.card-back-list .condition {
    color: var(--neon-golden);
    text-shadow: 0 0 8px rgba(255, 179, 71, 0.4);
}

.card-back-list .condition::before {
    content: '~ ';
}

/* ============================================
   VERSION TIMELINE
   ============================================ */
.timeline-container {
    position: relative;
    width: 100%;
    max-width: 1000px;
    height: 400px;
    margin: 0 auto;
}

.timeline-line-svg {
    position: absolute;
    bottom: 50%;
    left: 0;
    width: 100%;
    height: 80px;
    z-index: 0;
}

.timeline-golden-line {
    fill: none;
    stroke: var(--neon-golden);
    stroke-width: 1.5;
    opacity: 0.4;
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke-dashoffset 1500ms ease-in-out;
}

.timeline-golden-line.drawn {
    stroke-dashoffset: 0;
}

.timeline-bubbles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.timeline-bubble {
    position: absolute;
    bottom: 50%;
    left: var(--bubble-x, 50%);
    transform: translateX(-50%) translateY(var(--bubble-rise, -60px));
    cursor: pointer;
    z-index: 2;
    padding: 10px 20px;
    border-radius: 999px;
    border: 1.5px solid var(--neon-golden);
    background: var(--bg-primary);
    box-shadow:
        0 0 8px rgba(255, 179, 71, 0.2),
        0 0 24px rgba(255, 179, 71, 0.15),
        0 0 48px rgba(255, 179, 71, 0.08);
    transition: transform 400ms cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 300ms ease-out;
    opacity: 0;
}

.timeline-bubble.visible {
    opacity: 1;
    animation: bubbleSettle 800ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.timeline-bubble:hover {
    box-shadow:
        0 0 12px rgba(255, 179, 71, 0.3),
        0 0 36px rgba(255, 179, 71, 0.25),
        0 0 72px rgba(255, 179, 71, 0.18);
    transform: translateX(-50%) translateY(var(--bubble-rise, -60px)) scale(1.1);
}

.timeline-bubble.expanded {
    transform: translateX(-50%) translateY(var(--bubble-rise, -60px)) scale(2.5);
    z-index: 20;
    box-shadow:
        0 0 20px rgba(255, 179, 71, 0.4),
        0 0 60px rgba(255, 179, 71, 0.25);
}

.bubble-label {
    font-family: 'Sono', monospace;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    white-space: nowrap;
}

@keyframes bubbleSettle {
    0% {
        transform: translateX(-50%) translateY(0);
        opacity: 0;
    }
    100% {
        transform: translateX(-50%) translateY(var(--bubble-rise, -60px));
        opacity: 1;
    }
}

/* Changelog Overlay */
.changelog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(44, 30, 18, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 1;
    transition: opacity 300ms ease;
}

.changelog-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.changelog-card {
    background: var(--card-back);
    border: 2px solid var(--neon-golden);
    border-radius: 20px;
    padding: 40px;
    max-width: 440px;
    text-align: center;
    box-shadow:
        0 0 20px rgba(255, 179, 71, 0.3),
        0 0 60px rgba(255, 179, 71, 0.15);
    transform: scale(0.9);
    transition: transform 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.changelog-overlay:not(.hidden) .changelog-card {
    transform: scale(1);
}

.changelog-version {
    font-family: 'Sono', monospace;
    font-weight: 600;
    font-size: 1.6rem;
    color: var(--neon-golden);
    text-shadow: 0 0 12px rgba(255, 179, 71, 0.6);
    margin-bottom: 16px;
}

.changelog-text {
    font-family: 'Varela Round', sans-serif;
    color: var(--bg-primary);
    font-size: 1.05rem;
    line-height: 1.6;
    margin-bottom: 24px;
}

.changelog-close {
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    font-size: 0.95rem;
    padding: 10px 28px;
    border: 1.5px solid var(--neon-golden);
    border-radius: 999px;
    background: transparent;
    color: var(--neon-golden);
    cursor: pointer;
    transition: background 200ms ease, color 200ms ease;
}

.changelog-close:hover {
    background: var(--neon-golden);
    color: var(--card-back);
}

/* ============================================
   CLOSING SECTION
   ============================================ */
#closing {
    text-align: center;
}

.closing-content {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.closing-package {
    width: clamp(240px, 36vw, 400px);
    margin-bottom: 40px;
    opacity: 0.7;
    filter: drop-shadow(0 8px 30px rgba(255, 179, 71, 0.3));
}

.closing-heading {
    font-size: clamp(1.8rem, 4vw, 3.2rem);
    font-weight: 900;
    color: var(--text-primary);
    margin-bottom: 0.3em;
}

.closing-tagline {
    font-family: 'Varela Round', sans-serif;
    font-size: clamp(1.1rem, 2vw, 1.5rem);
    color: var(--neon-tangerine);
    text-shadow: 0 0 12px rgba(232, 93, 38, 0.3);
}

.closing-floaters {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 500px;
    height: 400px;
    pointer-events: none;
}

.closing-drift {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(var(--start-x, 0), var(--start-y, 0));
    opacity: 0.5;
    transition: transform 2000ms cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 2000ms ease;
}

.closing-drift.settle {
    transform: translate(0, 0);
    opacity: 0.25;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .exhibit-room {
        padding: 60px 20px;
    }

    .hero-text {
        top: 10%;
        left: 6%;
        right: 6%;
    }

    .hero-package {
        margin-left: 10%;
        margin-top: 30px;
    }

    .specimen-cluster {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    .specimen-card {
        height: 220px;
        transform: rotate(var(--card-rot, 0deg));
    }

    .tree-container {
        height: 400px;
        overflow: visible;
    }

    .tree-node {
        font-size: 0.8rem;
    }

    .tree-node .dep-name {
        font-size: 0.75em;
    }

    .level2-node {
        display: none;
    }

    .closing-floaters {
        width: 300px;
        height: 300px;
    }

    .timeline-bubble {
        padding: 8px 14px;
    }

    .bubble-label {
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .specimen-cluster {
        grid-template-columns: 1fr;
        max-width: 300px;
    }

    .specimen-card {
        height: 200px;
    }
}
