/* ============================================================
   munj.uk - Hand-Drawn Retro-Tech Aurora Horizontal Scroll
   ============================================================ */

/* --- Palette Reference ---
   Polar Night:    #0b0e14
   Deep Fjord:     #141a24
   Signal Charcoal:#1a1e24
   Borealis Teal:  #2ee8a5
   Solar Wind:     #e84595
   Ionosphere:     #8b5cf6
   Magnetosphere:  #22d3ee
   Phosphor Cream: #e8f0e4
   Frost Mist:     #94a3b8
*/

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

html {
    overflow: hidden;
    height: 100%;
}

body {
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(0.95rem, 1.8vw, 1.15rem);
    line-height: 1.7;
    letter-spacing: 0.03em;
    color: #e8f0e4;
    background: #0b0e14;
    overflow: hidden;
    height: 100%;
    -webkit-font-smoothing: antialiased;
}

/* --- Scroll Container --- */
#scroll-container {
    display: flex;
    flex-direction: row;
    width: max-content;
    height: 100vh;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

#scroll-container::-webkit-scrollbar {
    display: none;
}

/* --- Panels --- */
.panel {
    position: relative;
    width: 100vw;
    height: 100vh;
    min-width: 100vw;
    flex-shrink: 0;
    scroll-snap-align: start;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.panel-content {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
}

/* --- Graph Paper Texture --- */
.graph-paper {
    position: absolute;
    inset: 0;
    z-index: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
    background-size: 24px 24px;
    pointer-events: none;
}

/* --- Aurora Background (Panel 4) --- */
.aurora-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    background: linear-gradient(135deg, #2ee8a5 0%, #22d3ee 25%, #8b5cf6 50%, #e84595 75%, #2ee8a5 100%);
    background-size: 300% 300%;
    animation: aurora-shift 12s ease-in-out infinite;
    opacity: 0.25;
}

@keyframes aurora-shift {
    0%   { background-position: 0% 0%; }
    50%  { background-position: 100% 100%; }
    100% { background-position: 0% 0%; }
}

.panel-4 .aurora-bg {
    animation: aurora-shift 12s ease-in-out infinite, aurora-pulse 15s ease-in-out infinite;
}

@keyframes aurora-pulse {
    0%   { background-size: 200% 200%; }
    50%  { background-size: 400% 400%; }
    100% { background-size: 200% 200%; }
}

/* --- Organic Blobs --- */
.blob {
    position: absolute;
    z-index: 1;
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    animation: blob-morph 8s ease-in-out infinite alternate;
    pointer-events: none;
    will-change: border-radius, transform;
}

@keyframes blob-morph {
    0%   { border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%; }
    25%  { border-radius: 58% 42% 38% 62% / 54% 60% 40% 46%; }
    50%  { border-radius: 40% 60% 54% 46% / 62% 38% 56% 44%; }
    75%  { border-radius: 66% 34% 48% 52% / 36% 58% 42% 64%; }
    100% { border-radius: 50% 50% 34% 66% / 44% 56% 66% 34%; }
}

.blob-teal {
    background: rgba(46, 232, 165, 0.08);
    filter: blur(60px);
}

.blob-magenta {
    background: rgba(232, 69, 149, 0.06);
    filter: blur(60px);
}

.blob-violet {
    background: rgba(139, 92, 246, 0.07);
    filter: blur(60px);
}

/* Individual blob positions */
.blob-1 { width: 500px; height: 500px; top: -10%; left: -5%; animation-delay: 0s; }
.blob-2 { width: 420px; height: 420px; bottom: -8%; right: -3%; animation-delay: -3s; }
.blob-3 { width: 460px; height: 460px; top: 5%; right: 10%; animation-delay: -2s; }
.blob-4 { width: 380px; height: 380px; bottom: 10%; left: 5%; animation-delay: -5s; }
.blob-5 { width: 350px; height: 350px; top: -5%; left: 15%; animation-delay: -1s; }
.blob-6 { width: 300px; height: 300px; bottom: 5%; right: 5%; animation-delay: -4s; }
.blob-7 { width: 520px; height: 520px; top: -15%; left: 10%; animation-delay: -2.5s; }
.blob-8 { width: 440px; height: 440px; bottom: -10%; right: -5%; animation-delay: -1.5s; }
.blob-9 { width: 380px; height: 380px; top: 30%; left: -8%; animation-delay: -4.5s; }
.blob-10 { width: 480px; height: 480px; top: -10%; right: 5%; animation-delay: -3.5s; }
.blob-11 { width: 360px; height: 360px; bottom: -5%; left: 10%; animation-delay: -6s; }

/* Blob visibility control - hidden until loaded */
.blob {
    opacity: 0;
    transition: opacity 0.8s ease;
}

.blob.visible {
    opacity: 1;
}

/* --- Glassmorphic Cards --- */
.glass-card {
    position: relative;
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(16px) saturate(1.4);
    -webkit-backdrop-filter: blur(16px) saturate(1.4);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    padding: 2rem;
    overflow: hidden;
    transition: border-color 0.3s ease;
}

.glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(135deg, #2ee8a5 0%, #22d3ee 25%, #8b5cf6 50%, #e84595 75%, #2ee8a5 100%);
    background-size: 300% 300%;
    animation: aurora-shift 12s ease-in-out infinite;
    opacity: 0.2;
}

.glass-card:hover {
    border-color: rgba(46, 232, 165, 0.25);
}

/* Hand-drawn SVG borders */
.hand-drawn-border {
    position: absolute;
    inset: -2px;
    width: calc(100% + 4px);
    height: calc(100% + 4px);
    z-index: 1;
    pointer-events: none;
}

.hand-drawn-border path {
    stroke-dasharray: 1200;
    stroke-dashoffset: 1200;
    transition: stroke-dashoffset 1.2s ease-out;
}

.panel.in-view .hand-drawn-border path {
    stroke-dashoffset: 0;
}

/* Card rotations */
.card-rotate-neg2 { transform: rotate(-2deg); }
.card-rotate-pos1 { transform: rotate(1deg); }
.card-rotate-pos1p5 { transform: rotate(1.5deg); }
.card-rotate-neg0p8 { transform: rotate(-0.8deg); }

/* --- Panel 1: Title Card --- */
.title-content {
    gap: 2rem;
}

.title-svg {
    width: clamp(300px, 60vw, 600px);
    height: auto;
    opacity: 0;
}

.title-svg.animate {
    opacity: 1;
}

.title-text-stroke {
    font-family: 'Caveat', cursive;
    font-weight: 700;
    font-size: 96px;
    fill: none;
    stroke: #22d3ee;
    stroke-width: 2;
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
    stroke-linecap: round;
}

.title-svg.animate .title-text-stroke {
    animation: draw-title 2s ease-out forwards;
}

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

.title-text-fill {
    font-family: 'Caveat', cursive;
    font-weight: 700;
    font-size: 96px;
    fill: #e8f0e4;
    opacity: 0;
}

.title-svg.animate .title-text-fill {
    animation: fade-in-fill 0.4s ease-out 1.8s forwards;
}

@keyframes fade-in-fill {
    to { opacity: 1; }
}

.title-card {
    max-width: 520px;
    text-align: center;
    opacity: 0;
    transform: translateY(30px);
}

.title-card.animate {
    animation: card-rise 0.5s ease-out forwards;
}

@keyframes card-rise {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.site-description {
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(0.9rem, 1.6vw, 1.05rem);
    color: #94a3b8;
    line-height: 1.7;
}

/* Scroll Hint Arrow */
.scroll-hint {
    position: absolute;
    right: 3rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
    animation: pulse-hint 2s ease-in-out infinite alternate;
}

@keyframes pulse-hint {
    0%   { opacity: 0.4; }
    100% { opacity: 0.8; }
}

.hint-arrow {
    display: block;
}

/* --- Panel 2: About --- */
.about-content {
    gap: 1.5rem;
    max-width: 700px;
    margin: 0 auto;
}

.about-card {
    max-width: 600px;
    width: 100%;
}

/* Typewriter Effect */
.typewriter-text {
    font-family: 'Share Tech Mono', monospace;
    color: #e8f0e4;
    line-height: 1.7;
    overflow: hidden;
    white-space: normal;
}

/* --- Panel 3: Projects --- */
.projects-content {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: center;
    justify-content: center;
    max-width: 900px;
    margin: 0 auto;
    position: relative;
}

.projects-content .section-heading {
    width: 100%;
    text-align: center;
    margin-bottom: 0.5rem;
}

.project-card {
    width: 280px;
    flex-shrink: 0;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
    transition-delay: var(--card-delay, 0ms);
}

.panel.in-view .project-card {
    opacity: 1;
    transform: translateY(0) rotate(var(--rot, 0deg));
}

.panel.in-view .card-rotate-neg2 { --rot: -2deg; }
.panel.in-view .card-rotate-pos1p5 { --rot: 1.5deg; }
.panel.in-view .card-rotate-neg0p8 { --rot: -0.8deg; }
.panel.in-view .card-rotate-pos1 { --rot: 1deg; }

.card-title {
    font-family: 'Caveat', cursive;
    font-weight: 700;
    font-size: clamp(1.4rem, 3vw, 1.8rem);
    color: #2ee8a5;
    margin-bottom: 0.5rem;
}

.card-description {
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(0.8rem, 1.4vw, 0.95rem);
    color: #94a3b8;
    line-height: 1.6;
}

/* --- Panel 4: Interests --- */
.interests-content {
    position: relative;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 2rem;
    align-items: center;
    justify-content: center;
    max-width: 900px;
    margin: 0 auto;
}

.interests-content .section-heading {
    width: 100%;
    text-align: center;
}

.interest-blob {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.2rem 2rem;
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    animation: blob-morph 8s ease-in-out infinite alternate;
    min-width: 200px;
    text-align: center;
}

.interest-1 {
    background: rgba(46, 232, 165, 0.12);
    animation-delay: -1s;
}
.interest-2 {
    background: rgba(232, 69, 149, 0.10);
    animation-delay: -3s;
}
.interest-3 {
    background: rgba(139, 92, 246, 0.10);
    animation-delay: -5s;
}
.interest-4 {
    background: rgba(34, 211, 238, 0.10);
    animation-delay: -2s;
}
.interest-5 {
    background: rgba(46, 232, 165, 0.10);
    animation-delay: -4s;
}
.interest-6 {
    background: rgba(232, 69, 149, 0.08);
    animation-delay: -6s;
}

.interest-label {
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(0.8rem, 1.4vw, 1rem);
    color: #e8f0e4;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

/* --- Panel 5: Contact --- */
.contact-content {
    gap: 2.5rem;
}

.contact-card {
    max-width: 500px;
    width: 100%;
    text-align: center;
}

.contact-heading {
    margin-bottom: 1.5rem;
}

.contact-links {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
    padding-left: 2rem;
}

.contact-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: #e8f0e4;
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(0.95rem, 1.6vw, 1.1rem);
    transition: color 0.3s ease;
}

.contact-link:hover {
    color: #2ee8a5;
}

.contact-link .sketch-arrow path {
    transition: stroke 0.3s ease;
}

.contact-link:hover .sketch-arrow path {
    stroke: #e84595;
}

.end-doodle {
    opacity: 0.5;
}

.end-text-path {
    stroke-dasharray: 300;
    stroke-dashoffset: 300;
}

.panel.in-view .end-text-path {
    animation: draw-end 1.5s ease-out 0.5s forwards;
}

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

/* --- Typography --- */
.section-heading {
    font-family: 'Caveat', cursive;
    font-weight: 700;
    font-size: clamp(1.8rem, 4vw, 3rem);
    color: #e8f0e4;
    margin-bottom: 1rem;
}

/* --- Annotations --- */
.annotation {
    position: absolute;
    z-index: 3;
    opacity: 0.6;
}

.annotation path {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
}

.panel.in-view .annotation path {
    animation: draw-annotation 0.8s ease-out forwards;
}

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

.annotation-text {
    font-family: 'Caveat', cursive;
    font-size: 14px;
    fill: #94a3b8;
}

.annotation-1 {
    bottom: 20%;
    right: 10%;
}

.annotation-2 {
    top: 15%;
    right: 8%;
}

.annotation-3 {
    bottom: 15%;
    left: 10%;
}

/* --- Accent Labels --- */
.accent-label {
    font-family: 'Space Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.7rem, 1.2vw, 0.85rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #94a3b8;
}

/* --- Progress Bar --- */
#progress-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.05);
    z-index: 100;
}

#progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #2ee8a5 0%, #22d3ee 25%, #8b5cf6 50%, #e84595 75%, #2ee8a5 100%);
    background-size: 300% 300%;
    animation: aurora-shift 12s ease-in-out infinite;
    transition: width 0.3s ease-out;
}

/* --- Panel Indicators --- */
#panel-indicators {
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
    z-index: 100;
}

.indicator {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    opacity: 0.4;
    transition: opacity 0.3s ease;
}

.indicator.active {
    opacity: 1;
}

.indicator:hover {
    opacity: 0.8;
}

.indicator svg circle {
    transition: fill 0.3s ease;
}

.indicator.active svg circle {
    fill: rgba(46, 232, 165, 0.5);
}

/* --- Ripple Effect --- */
.ripple {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(46, 232, 165, 0.15) 0%, transparent 70%);
    pointer-events: none;
    transform: scale(0);
    animation: ripple-expand 0.6s ease-out forwards;
    z-index: 10;
}

@keyframes ripple-expand {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* --- Card entrance animation --- */
.glass-card.card-enter {
    opacity: 0;
    transform: translateY(20px);
}

.panel.in-view .glass-card.card-enter {
    animation: card-enter-anim 0.5s ease-out forwards;
}

@keyframes card-enter-anim {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Panel backgrounds --- */
.panel-1 { background: #0b0e14; }
.panel-2 { background: #141a24; }
.panel-3 { background: #0b0e14; }
.panel-4 { background: #0b0e14; }
.panel-5 { background: #141a24; }

/* --- Mobile Vertical Fallback --- */
@media (max-width: 768px) {
    html {
        overflow: auto;
    }

    body {
        overflow: auto;
    }

    #scroll-container {
        flex-direction: column;
        width: 100%;
        height: auto;
        overflow-x: hidden;
        overflow-y: auto;
        scroll-snap-type: y mandatory;
    }

    .panel {
        width: 100vw;
        min-width: 100vw;
        height: 100vh;
        min-height: 100vh;
        scroll-snap-align: start;
    }

    .panel-content {
        padding: 2rem 1.5rem;
    }

    .scroll-hint {
        right: auto;
        bottom: 2rem;
        top: auto;
        left: 50%;
        transform: translateX(-50%);
    }

    .hint-arrow {
        transform: rotate(90deg);
    }

    .projects-content {
        flex-direction: column;
        gap: 1rem;
    }

    .project-card {
        width: 90%;
        max-width: 320px;
    }

    .interests-content {
        flex-direction: column;
        gap: 1rem;
    }

    .interest-blob {
        min-width: unset;
        width: 80%;
        max-width: 280px;
    }

    #progress-bar {
        position: fixed;
        right: 0;
        top: 0;
        bottom: auto;
        left: auto;
        width: 4px;
        height: 100%;
    }

    #progress-fill {
        width: 100%;
        height: 0%;
        background: linear-gradient(180deg, #2ee8a5 0%, #22d3ee 25%, #8b5cf6 50%, #e84595 75%, #2ee8a5 100%);
    }

    #panel-indicators {
        position: fixed;
        right: 16px;
        bottom: auto;
        left: auto;
        top: 50%;
        transform: translateY(-50%) translateX(0);
        flex-direction: column;
    }

    .blob {
        width: 300px !important;
        height: 300px !important;
    }

    .contact-links {
        padding-left: 0;
        align-items: center;
    }

    .about-card {
        max-width: 100%;
    }
}
