/* ========================================
   lungi.dev - Graffiti Bibliotheca
   Design: Street art meets scholarly library
   ======================================== */

/* --- CSS Custom Properties --- */
:root {
    --midnight-codex: #12121a;
    --charcoal-tome: #1a1a22;
    --weathered-page: #e8e0d4;
    --margin-note: #7a7568;
    --neon-fuchsia: #ff2d7b;
    --electric-cyan: #00f0ff;
    --acid-lime: #b0f566;
    --ultraviolet: #8b5cf6;
    --amber-tag: #ff9e2c;
    --font-graffiti: 'Permanent Marker', cursive;
    --font-scholarly: 'Crimson Pro', Georgia, serif;
    --font-system: 'Space Grotesk', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--neon-fuchsia) var(--midnight-codex);
}

body {
    background: var(--midnight-codex);
    color: var(--weathered-page);
    font-family: var(--font-scholarly);
    font-size: 18px;
    line-height: 1.7;
    overflow-x: hidden;
    cursor: none;
}

::selection {
    background: var(--neon-fuchsia);
    color: var(--midnight-codex);
}

/* --- Grain Overlay --- */
.grain-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    opacity: 0.04;
    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-repeat: repeat;
    background-size: 256px 256px;
}

/* --- Cursor Glow --- */
.cursor-glow {
    position: fixed;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 45, 123, 0.6) 0%, transparent 70%);
    pointer-events: none;
    z-index: 999;
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s, opacity 0.3s;
    mix-blend-mode: screen;
    opacity: 0;
}

.cursor-glow.active {
    opacity: 1;
}

.cursor-glow.hovering {
    width: 60px;
    height: 60px;
    background: radial-gradient(circle, rgba(0, 240, 255, 0.5) 0%, transparent 70%);
}

/* --- Foreground Layer (Parallax 1.4x) --- */
.foreground-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
    overflow: hidden;
}

.spray-streak {
    position: absolute;
    border-radius: 50%;
    filter: blur(40px);
    opacity: 0;
    transition: opacity 2s ease;
}

.spray-streak.visible {
    opacity: 0.15;
}

.streak-1 {
    width: 300px;
    height: 300px;
    background: var(--neon-fuchsia);
    top: 10%;
    right: -5%;
}

.streak-2 {
    width: 200px;
    height: 400px;
    background: var(--electric-cyan);
    top: 30%;
    left: -3%;
}

.streak-3 {
    width: 250px;
    height: 250px;
    background: var(--acid-lime);
    top: 55%;
    right: 10%;
}

.streak-4 {
    width: 350px;
    height: 200px;
    background: var(--ultraviolet);
    top: 75%;
    left: 15%;
}

.streak-5 {
    width: 180px;
    height: 350px;
    background: var(--amber-tag);
    top: 90%;
    right: 25%;
}

/* --- Chapter Base --- */
.chapter {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    z-index: 1;
}

.background-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
}

.chapter-content {
    position: relative;
    z-index: 2;
    max-width: 900px;
    width: 90%;
    padding: 60px 0;
}

/* --- Spine Lines (Background decoration) --- */
.spine-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
    padding: 40px 0;
}

.spine-line {
    width: 100%;
    height: 1px;
    background: var(--margin-note);
    opacity: 0;
    transform: scaleX(0);
    transform-origin: left;
    transition: opacity 0.8s ease, transform 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.spine-line.visible {
    opacity: 0.15;
    transform: scaleX(1);
}

/* --- Notebook Lines --- */
.notebook-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
    padding: 20px 60px;
}

.notebook-line {
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, var(--margin-note) 5%, var(--margin-note) 95%, transparent 100%);
    opacity: 0.08;
}

/* --- Page Texture --- */
.page-texture {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        linear-gradient(90deg, transparent 79px, rgba(122, 117, 104, 0.08) 79px, rgba(122, 117, 104, 0.08) 80px, transparent 80px),
        linear-gradient(rgba(122, 117, 104, 0.05) 1px, transparent 1px);
    background-size: 100% 100%, 100% 32px;
}

/* --- Chapter Number --- */
.chapter-number {
    font-family: var(--font-graffiti);
    font-size: 14px;
    color: var(--neon-fuchsia);
    letter-spacing: 0.3em;
    text-transform: uppercase;
    margin-bottom: 16px;
    text-shadow: 0 0 20px rgba(255, 45, 123, 0.5);
}

/* --- Chapter Header --- */
.chapter-header {
    margin-bottom: 48px;
}

.chapter-title {
    font-family: var(--font-graffiti);
    font-size: clamp(48px, 8vw, 96px);
    color: var(--weathered-page);
    letter-spacing: 0.02em;
    text-transform: uppercase;
    line-height: 1.1;
    text-shadow: 
        0 0 40px rgba(255, 45, 123, 0.3),
        0 0 80px rgba(255, 45, 123, 0.1);
    margin-bottom: 16px;
}

.chapter-rule {
    width: 80px;
    height: 3px;
    background: linear-gradient(90deg, var(--neon-fuchsia), var(--electric-cyan));
    border-radius: 2px;
}

/* --- Opening Section --- */
.chapter-opening {
    background: var(--charcoal-tome);
}

.title-graffiti {
    font-family: var(--font-graffiti);
    font-size: clamp(64px, 12vw, 140px);
    line-height: 0.95;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    text-align: center;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 1s ease 0.8s, transform 1s cubic-bezier(0.22, 1, 0.36, 1) 0.8s;
}

.title-graffiti.visible {
    opacity: 1;
    transform: translateY(0);
}

.title-line {
    display: block;
    color: var(--weathered-page);
    text-shadow: 
        0 0 40px rgba(255, 45, 123, 0.4),
        0 0 80px rgba(255, 45, 123, 0.2),
        4px 4px 0 var(--neon-fuchsia);
}

.title-accent {
    color: var(--electric-cyan);
    text-shadow: 
        0 0 40px rgba(0, 240, 255, 0.4),
        0 0 80px rgba(0, 240, 255, 0.2),
        4px 4px 0 var(--ultraviolet);
}

.subtitle-scholarly {
    font-family: var(--font-scholarly);
    font-size: clamp(16px, 2.5vw, 22px);
    font-style: italic;
    color: var(--margin-note);
    text-align: center;
    margin-top: 24px;
    letter-spacing: 0.1em;
    opacity: 0;
    transition: opacity 1.5s ease 1.5s;
}

.subtitle-scholarly.visible {
    opacity: 1;
}

/* --- Scroll Indicator --- */
.scroll-indicator {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    opacity: 0;
    transition: opacity 1s ease 2.5s;
    z-index: 5;
}

.scroll-indicator.visible {
    opacity: 1;
}

.scroll-text {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--margin-note);
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.scroll-arrow {
    color: var(--neon-fuchsia);
    animation: bounceDown 2s ease-in-out infinite;
}

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

/* --- Spray Mist Gradients --- */
.spray-mist {
    position: absolute;
    pointer-events: none;
    z-index: 1;
}

.spray-mist-opening {
    bottom: -100px;
    left: -10%;
    width: 120%;
    height: 300px;
    background: radial-gradient(ellipse at 30% 100%, rgba(255, 45, 123, 0.15) 0%, transparent 60%),
                radial-gradient(ellipse at 70% 100%, rgba(0, 240, 255, 0.1) 0%, transparent 50%);
}

.spray-mist-about {
    top: -50px;
    right: -10%;
    width: 60%;
    height: 200px;
    background: radial-gradient(ellipse at 80% 0%, rgba(139, 92, 246, 0.12) 0%, transparent 60%);
}

.spray-mist-work {
    bottom: -80px;
    left: -5%;
    width: 80%;
    height: 250px;
    background: radial-gradient(ellipse at 20% 100%, rgba(176, 245, 102, 0.1) 0%, transparent 60%);
}

.spray-mist-skills {
    top: -30px;
    left: -10%;
    width: 50%;
    height: 180px;
    background: radial-gradient(ellipse at 10% 0%, rgba(255, 158, 44, 0.1) 0%, transparent 60%);
}

.spray-mist-terminal {
    bottom: -60px;
    right: -5%;
    width: 70%;
    height: 200px;
    background: radial-gradient(ellipse at 90% 100%, rgba(0, 240, 255, 0.12) 0%, transparent 50%);
}

.spray-mist-contact {
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 160px;
    background: radial-gradient(ellipse at 50% 0%, rgba(255, 45, 123, 0.08) 0%, transparent 60%);
}

/* --- About Section --- */
.chapter-about {
    background: var(--midnight-codex);
}

.prose-block {
    max-width: 680px;
}

.prose-text {
    font-family: var(--font-scholarly);
    font-size: clamp(16px, 2vw, 20px);
    color: var(--weathered-page);
    line-height: 1.8;
    margin-bottom: 24px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.prose-text.visible {
    opacity: 0.9;
    transform: translateY(0);
}

/* --- Work Section --- */
.chapter-work {
    background: var(--charcoal-tome);
    padding: 80px 0;
}

.project-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.project-card {
    position: relative;
    background: rgba(18, 18, 26, 0.8);
    border: 1px solid rgba(122, 117, 104, 0.15);
    border-radius: 4px;
    padding: 32px;
    overflow: hidden;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease, border-color 0.4s ease;
}

.project-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.project-card:hover {
    border-color: var(--neon-fuchsia);
}

.project-card:hover .project-glow {
    opacity: 1;
}

.project-glow {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(255, 45, 123, 0.06) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.project-tag {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--acid-lime);
    letter-spacing: 0.1em;
    margin-bottom: 12px;
}

.project-name {
    font-family: var(--font-graffiti);
    font-size: 28px;
    color: var(--weathered-page);
    margin-bottom: 12px;
    text-shadow: 0 0 20px rgba(255, 45, 123, 0.2);
}

.project-desc {
    font-family: var(--font-scholarly);
    font-size: 15px;
    color: var(--margin-note);
    line-height: 1.6;
    margin-bottom: 16px;
}

.project-tech {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tech-tag {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--electric-cyan);
    background: rgba(0, 240, 255, 0.08);
    border: 1px solid rgba(0, 240, 255, 0.2);
    padding: 4px 10px;
    border-radius: 2px;
    letter-spacing: 0.05em;
}

/* --- Skills Section --- */
.chapter-skills {
    background: var(--midnight-codex);
    padding: 80px 0;
}

.skills-codex {
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.skill-entry {
    display: flex;
    align-items: flex-start;
    gap: 24px;
    opacity: 0;
    transform: translateX(-20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.skill-entry.visible {
    opacity: 1;
    transform: translateX(0);
}

.skill-marker {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--neon-fuchsia);
    margin-top: 6px;
    flex-shrink: 0;
    box-shadow: 0 0 12px rgba(255, 45, 123, 0.4);
}

.skill-entry:nth-child(2) .skill-marker { background: var(--electric-cyan); box-shadow: 0 0 12px rgba(0, 240, 255, 0.4); }
.skill-entry:nth-child(3) .skill-marker { background: var(--acid-lime); box-shadow: 0 0 12px rgba(176, 245, 102, 0.4); }
.skill-entry:nth-child(4) .skill-marker { background: var(--amber-tag); box-shadow: 0 0 12px rgba(255, 158, 44, 0.4); }

.skill-category {
    font-family: var(--font-system);
    font-size: 13px;
    color: var(--margin-note);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 12px;
    font-weight: 600;
}

.skill-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.skill-tag {
    font-family: var(--font-mono);
    font-size: 13px;
    padding: 6px 16px;
    border-radius: 3px;
    background: rgba(232, 224, 212, 0.05);
    border: 1px solid rgba(232, 224, 212, 0.1);
    color: var(--weathered-page);
    transition: all 0.3s ease;
}

.skill-tag:hover {
    transform: translateY(-2px);
}

.skill-tag.glow-fuchsia:hover { border-color: var(--neon-fuchsia); color: var(--neon-fuchsia); box-shadow: 0 0 15px rgba(255, 45, 123, 0.3); }
.skill-tag.glow-cyan:hover { border-color: var(--electric-cyan); color: var(--electric-cyan); box-shadow: 0 0 15px rgba(0, 240, 255, 0.3); }
.skill-tag.glow-lime:hover { border-color: var(--acid-lime); color: var(--acid-lime); box-shadow: 0 0 15px rgba(176, 245, 102, 0.3); }
.skill-tag.glow-amber:hover { border-color: var(--amber-tag); color: var(--amber-tag); box-shadow: 0 0 15px rgba(255, 158, 44, 0.3); }
.skill-tag.glow-violet:hover { border-color: var(--ultraviolet); color: var(--ultraviolet); box-shadow: 0 0 15px rgba(139, 92, 246, 0.3); }

/* --- Terminal Section --- */
.chapter-terminal {
    background: var(--charcoal-tome);
    padding: 80px 0;
}

.terminal-window {
    background: rgba(18, 18, 26, 0.95);
    border: 1px solid rgba(122, 117, 104, 0.2);
    border-radius: 8px;
    overflow: hidden;
    max-width: 700px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.terminal-window.visible {
    opacity: 1;
    transform: translateY(0);
}

.terminal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(26, 26, 34, 0.8);
    border-bottom: 1px solid rgba(122, 117, 104, 0.1);
}

.terminal-dots {
    display: flex;
    gap: 6px;
}

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

.dot-red { background: #ff5f56; }
.dot-yellow { background: #ffbd2e; }
.dot-green { background: #27c93f; }

.terminal-title {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--margin-note);
}

.terminal-body {
    padding: 20px;
    min-height: 200px;
}

.terminal-line {
    display: flex;
    align-items: center;
    gap: 8px;
}

.terminal-prompt {
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--acid-lime);
}

.terminal-command {
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--weathered-page);
}

.terminal-cursor {
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--electric-cyan);
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.terminal-output {
    margin-top: 12px;
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.6;
    color: var(--margin-note);
}

.terminal-output .output-line {
    margin-bottom: 4px;
}

.terminal-output .output-highlight {
    color: var(--electric-cyan);
}

.terminal-output .output-success {
    color: var(--acid-lime);
}

.terminal-output .output-fuchsia {
    color: var(--neon-fuchsia);
}

/* --- Contact Section --- */
.chapter-contact {
    background: var(--midnight-codex);
    padding: 80px 0;
    min-height: 100vh;
}

.contact-block {
    max-width: 600px;
}

.contact-prose {
    font-family: var(--font-scholarly);
    font-size: 17px;
    font-style: italic;
    color: var(--margin-note);
    line-height: 1.8;
    margin-bottom: 48px;
}

.contact-links {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.contact-link {
    display: flex;
    align-items: baseline;
    gap: 20px;
    text-decoration: none;
    padding: 16px 0;
    border-bottom: 1px solid rgba(122, 117, 104, 0.1);
    transition: all 0.3s ease;
}

.contact-link:hover {
    padding-left: 12px;
}

.link-label {
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--margin-note);
    min-width: 80px;
}

.link-value {
    font-family: var(--font-system);
    font-size: 18px;
    font-weight: 500;
    transition: color 0.3s ease, text-shadow 0.3s ease;
}

.link-fuchsia .link-value { color: var(--neon-fuchsia); }
.link-fuchsia:hover .link-value { text-shadow: 0 0 20px rgba(255, 45, 123, 0.5); }

.link-cyan .link-value { color: var(--electric-cyan); }
.link-cyan:hover .link-value { text-shadow: 0 0 20px rgba(0, 240, 255, 0.5); }

.link-lime .link-value { color: var(--acid-lime); }
.link-lime:hover .link-value { text-shadow: 0 0 20px rgba(176, 245, 102, 0.5); }

.closing-tag {
    margin-top: 80px;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 14px;
    opacity: 0.3;
}

.tag-bracket {
    color: var(--margin-note);
}

.tag-name {
    color: var(--neon-fuchsia);
}

/* --- Chapter Markers (Side Nav) --- */
.chapter-markers {
    position: fixed;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 16px;
    z-index: 500;
}

.marker {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.marker span {
    font-family: var(--font-graffiti);
    font-size: 12px;
    color: var(--margin-note);
    transition: color 0.3s ease, text-shadow 0.3s ease, transform 0.3s ease;
}

.marker:hover span {
    color: var(--neon-fuchsia);
    text-shadow: 0 0 10px rgba(255, 45, 123, 0.5);
    transform: scale(1.3);
}

.marker.active span {
    color: var(--neon-fuchsia);
    text-shadow: 0 0 15px rgba(255, 45, 123, 0.6);
}

/* --- Reveal Animations --- */
.chapter-content {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.chapter.in-view .chapter-content {
    opacity: 1;
    transform: translateY(0);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .project-grid {
        grid-template-columns: 1fr;
    }

    .chapter-markers {
        right: 8px;
    }

    .marker {
        width: 24px;
        height: 24px;
    }

    .marker span {
        font-size: 10px;
    }

    .chapter-content {
        width: 92%;
        padding: 40px 0;
    }

    .title-graffiti {
        font-size: clamp(48px, 14vw, 100px);
    }

    .terminal-window {
        max-width: 100%;
    }

    body {
        cursor: auto;
    }

    .cursor-glow {
        display: none;
    }

    .contact-link {
        flex-direction: column;
        gap: 4px;
    }
}

@media (max-width: 480px) {
    .chapter-title {
        font-size: clamp(36px, 10vw, 64px);
    }

    .project-card {
        padding: 20px;
    }

    .skill-tags {
        gap: 6px;
    }

    .skill-tag {
        font-size: 12px;
        padding: 4px 12px;
    }
}