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

:root {
    --bg-deep: #0a0a0f;
    --bg-surface: #1a1a28;
    --bg-mid: #2a2a3a;
    --neon-rose: #ff2d6f;
    --neon-cyan: #00e5ff;
    --neon-gold: #ffc857;
    --text-primary: #b5b3a8;
    --text-secondary: #7a786e;
    --text-display: #e0ddd4;
    --text-muted: #8a8a7e;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-deep);
    color: var(--text-primary);
    font-family: 'Cormorant Garamond', 'Georgia', serif;
    font-weight: 400;
    font-size: clamp(1.1rem, 1.4vw, 1.3rem);
    line-height: 1.75;
    overflow-x: hidden;
    position: relative;
}

/* ===== NOISE OVERLAY ===== */
#noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}

/* ===== BACKGROUND BLOBS ===== */
#bg-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.macro-blob {
    position: absolute;
    opacity: 0.12;
}

.macro-blob path {
    fill: var(--bg-surface);
    stroke: var(--neon-cyan);
    stroke-width: 0.5;
    stroke-opacity: 0.2;
}

.blob-1 {
    width: 50vw;
    top: -10%;
    right: -15%;
    animation: drift1 35s ease-in-out infinite;
}

.blob-2 {
    width: 45vw;
    bottom: 10%;
    left: -20%;
    animation: drift2 40s ease-in-out infinite;
}

.blob-3 {
    width: 40vw;
    top: 40%;
    right: -10%;
    animation: drift3 30s ease-in-out infinite;
}

@keyframes drift1 {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(-30px, 20px) rotate(3deg); }
    66% { transform: translate(20px, -15px) rotate(-2deg); }
}

@keyframes drift2 {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(25px, -20px) rotate(-3deg); }
    66% { transform: translate(-15px, 25px) rotate(2deg); }
}

@keyframes drift3 {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    50% { transform: translate(-20px, -20px) rotate(4deg); }
}

/* ===== MICRO BLOBS ===== */
#micro-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.micro-blob {
    position: absolute;
    width: var(--size);
    height: var(--size);
    border-radius: 50% 40% 55% 45%;
    background: radial-gradient(circle, var(--neon-cyan), transparent 70%);
    opacity: 0.1;
    animation: pulse-micro var(--dur) ease-in-out var(--delay) infinite;
}

@keyframes pulse-micro {
    0%, 100% { opacity: 0.1; transform: scale(1); }
    50% { opacity: 0.3; transform: scale(1.1); }
}

/* ===== THRESHOLD SECTION ===== */
#threshold {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

#center-blob {
    position: absolute;
    width: clamp(250px, 40vw, 500px);
    height: clamp(250px, 40vw, 500px);
    opacity: 0;
    animation: blob-fade-in 1.5s ease-out 0.3s forwards, blob-morph 25s ease-in-out 0.3s infinite;
}

#center-blob path {
    fill: transparent;
    stroke: var(--neon-cyan);
    stroke-width: 1;
    filter: drop-shadow(0 0 15px rgba(0, 229, 255, 0.3));
}

@keyframes blob-fade-in {
    to { opacity: 0.6; }
}

@keyframes blob-morph {
    0% { border-radius: 50%; transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.05) rotate(3deg); }
    50% { transform: scale(0.95) rotate(-2deg); }
    75% { transform: scale(1.03) rotate(4deg); }
    100% { transform: scale(1) rotate(0deg); }
}

/* Title SVG */
#site-title {
    position: relative;
    z-index: 3;
}

#title-svg {
    width: clamp(300px, 50vw, 680px);
    height: auto;
    overflow: visible;
}

.title-letter {
    fill: none;
    stroke: var(--neon-rose);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    filter: drop-shadow(0 0 10px rgba(255, 45, 111, 0.4));
    stroke-dasharray: 300;
    stroke-dashoffset: 300;
    animation: draw-letter 2s ease-out forwards;
}

.title-letter:nth-child(1) { animation-delay: 0.8s; }
.title-letter:nth-child(2) { animation-delay: 1.0s; }
.title-letter:nth-child(3) { animation-delay: 1.2s; }
.title-letter:nth-child(4) { animation-delay: 1.4s; }
.title-letter:nth-child(5) { animation-delay: 1.6s; }
.title-letter:nth-child(6) { animation-delay: 1.8s; }
.title-letter:nth-child(7) { animation-delay: 2.0s; }
.title-letter:nth-child(8) { animation-delay: 2.2s; }
.title-letter:nth-child(9) { animation-delay: 2.4s; }

.title-dot {
    fill: var(--neon-rose);
    fill-opacity: 0;
    animation: draw-letter 2s ease-out forwards, dot-fill 0.5s ease-out 2.3s forwards;
}

@keyframes draw-letter {
    to { stroke-dashoffset: 0; }
}

@keyframes dot-fill {
    to { fill-opacity: 1; }
}

/* Subtitle */
#subtitle {
    font-family: 'Cormorant Garamond', 'Georgia', serif;
    font-style: italic;
    font-size: clamp(1rem, 2vw, 1.5rem);
    color: var(--text-muted);
    margin-top: 2rem;
    opacity: 0;
    animation: fade-up 1s ease-out 2.5s forwards;
    position: relative;
    z-index: 3;
}

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

/* ===== SECTION LABELS ===== */
.section-label {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: clamp(1.2rem, 2vw, 1.5rem);
    color: var(--text-display);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-bottom: 3rem;
    position: relative;
    display: inline-block;
}

.section-label::after {
    content: '';
    display: block;
    width: 100%;
    height: 2px;
    background: var(--neon-cyan);
    margin-top: 0.5rem;
    opacity: 0.4;
    border-radius: 2px;
    filter: drop-shadow(0 0 6px rgba(0, 229, 255, 0.3));
}

/* ===== THE SHELF ===== */
#shelf {
    position: relative;
    z-index: 2;
    padding: 6rem 5% 4rem;
    min-height: 50vh;
}

#shelf-track {
    display: flex;
    gap: 2rem;
    overflow-x: auto;
    padding: 2rem 1rem 3rem;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--bg-mid) var(--bg-deep);
}

#shelf-track::-webkit-scrollbar {
    height: 4px;
}

#shelf-track::-webkit-scrollbar-track {
    background: var(--bg-deep);
}

#shelf-track::-webkit-scrollbar-thumb {
    background: var(--bg-mid);
    border-radius: 2px;
}

.quirk-card {
    flex: 0 0 280px;
    background: var(--bg-surface);
    border-radius: 24px 32px 28px 36px;
    padding: 2rem 1.5rem;
    transform: rotate(var(--rot)) scale(var(--sc));
    transition: transform 0.6s ease-in-out, box-shadow 0.3s ease;
    position: relative;
    border: 1px solid rgba(0, 229, 255, 0.15);
    box-shadow: 0 0 20px rgba(0, 229, 255, 0.05);
    opacity: 0;
    scroll-snap-align: center;
}

.quirk-card.revealed {
    opacity: 1;
    transition: opacity 0.6s ease-out, transform 0.6s ease-in-out, box-shadow 0.3s ease;
}

.quirk-card:hover {
    transform: rotate(var(--rot)) scale(1.03);
    border-color: rgba(0, 229, 255, 0.4);
    box-shadow: 0 0 30px rgba(0, 229, 255, 0.15);
}

.quirk-icon {
    width: 80px;
    height: 80px;
    margin-bottom: 1.2rem;
}

.quirk-icon path,
.quirk-icon circle,
.quirk-icon line {
    fill: none;
    stroke: var(--neon-cyan);
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    transition: stroke-dashoffset 2s ease-out;
}

.quirk-card.revealed .quirk-icon path,
.quirk-card.revealed .quirk-icon circle,
.quirk-card.revealed .quirk-icon line {
    stroke-dashoffset: 0;
}

.quirk-card:nth-child(even) .quirk-icon path,
.quirk-card:nth-child(even) .quirk-icon circle,
.quirk-card:nth-child(even) .quirk-icon line {
    stroke: var(--neon-rose);
}

.quirk-card h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: 1.1rem;
    color: var(--text-display);
    margin-bottom: 0.75rem;
    letter-spacing: 0.03em;
}

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

/* ===== READING SECTION ===== */
#reading {
    position: relative;
    z-index: 2;
    display: flex;
    padding: 6rem 5% 8rem;
    min-height: 80vh;
    gap: 2rem;
}

#reading-content {
    flex: 0 0 58%;
    padding-left: 3%;
}

#reading-void {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.drift-blob {
    position: absolute;
    opacity: 0.08;
}

.drift-blob path {
    fill: var(--bg-surface);
    stroke: var(--neon-cyan);
    stroke-width: 0.5;
    stroke-opacity: 0.3;
}

.drift-1 {
    width: 20vw;
    top: 5%;
    right: 10%;
    animation: drift-float1 35s ease-in-out infinite;
}

.drift-2 {
    width: 15vw;
    top: 40%;
    right: 5%;
    animation: drift-float2 28s ease-in-out infinite;
}

.drift-3 {
    width: 18vw;
    top: 70%;
    right: 15%;
    animation: drift-float3 32s ease-in-out infinite;
}

@keyframes drift-float1 {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-40px) rotate(5deg); }
}

@keyframes drift-float2 {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(30px) rotate(-4deg); }
}

@keyframes drift-float3 {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-25px) rotate(3deg); }
}

.reading-heading {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: clamp(1.5rem, 3vw, 2.2rem);
    color: var(--text-display);
    margin-bottom: 1rem;
}

.text-block {
    margin-bottom: 3rem;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.text-block.revealed {
    opacity: 1;
    transform: translateY(0);
}

.text-block p {
    margin-bottom: 1rem;
}

/* Glow links */
.glow-link {
    color: var(--text-primary);
    text-decoration: none;
    border-bottom: 1px solid rgba(0, 229, 255, 0.3);
    transition: color 0.3s ease, text-shadow 0.3s ease, border-color 0.3s ease;
}

.glow-link:hover {
    color: var(--neon-cyan);
    text-shadow: 0 0 20px rgba(0, 229, 255, 0.3);
    border-color: var(--neon-cyan);
}

/* ===== THE CELLAR ===== */
#cellar {
    position: relative;
    z-index: 2;
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(to bottom, var(--bg-deep), #000000);
}

#cellar-content {
    text-align: center;
    padding: 4rem 2rem;
}

.cellar-text {
    font-family: 'Cormorant Garamond', 'Georgia', serif;
    font-style: italic;
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    color: var(--text-secondary);
    margin-bottom: 3rem;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.cellar-text.revealed {
    opacity: 1;
    transform: translateY(0);
}

#keyhole {
    width: 40px;
    height: auto;
    opacity: 0;
    transition: opacity 1.5s ease-out;
}

#keyhole.revealed {
    opacity: 1;
}

#keyhole path {
    fill: none;
    stroke: var(--neon-cyan);
    stroke-width: 1.5;
    stroke-linecap: round;
    filter: drop-shadow(0 0 10px rgba(0, 229, 255, 0.3));
    stroke-dasharray: 400;
    stroke-dashoffset: 400;
    transition: stroke-dashoffset 3s ease-out;
}

#keyhole.revealed path {
    stroke-dashoffset: 0;
}

/* ===== REVEAL ANIMATIONS ===== */
[data-reveal] {
    /* handled by JS intersection observer */
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    #reading {
        flex-direction: column;
    }

    #reading-content {
        flex: 1;
        padding-left: 0;
    }

    #reading-void {
        display: none;
    }

    .quirk-card {
        flex: 0 0 240px;
    }

    #shelf {
        padding: 4rem 3% 3rem;
    }
}
