/* ============================================================
   namu.works — Memphis Aesthetic / Tree-Themed Creative Works
   Palette: Midnight #141838, Pink #FF6B8A, Yellow #FFD84A,
            Teal #4AE8C8, Orange #FF8840, Cream #F0ECE0
   Fonts: Nunito (rounded sans), Share Tech Mono (HUD)
   ============================================================ */

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

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

body {
    background: #141838;
    color: #F0ECE0;
    font-family: 'Nunito', sans-serif;
    font-weight: 400;
    font-size: clamp(14px, 1vw, 16px);
    line-height: 1.75;
    overflow-x: hidden;
}

/* --- Memphis Background Pattern (8% opacity margin fill) --- */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0.08;
    background:
        repeating-radial-gradient(circle at 20% 30%, #FF6B8A 0px, #FF6B8A 4px, transparent 4px, transparent 48px),
        repeating-radial-gradient(circle at 70% 60%, #4AE8C8 0px, #4AE8C8 3px, transparent 3px, transparent 52px),
        repeating-radial-gradient(circle at 50% 80%, #FFD84A 0px, #FFD84A 5px, transparent 5px, transparent 60px),
        repeating-linear-gradient(45deg, transparent 0px, transparent 20px, #FF8840 20px, #FF8840 22px, transparent 22px, transparent 44px),
        repeating-linear-gradient(-45deg, transparent 0px, transparent 30px, #FF6B8A 30px, #FF6B8A 32px, transparent 32px, transparent 64px);
}

/* --- Floating Memphis Shapes (persistent background) --- */
.memphis-shapes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.memphis-float {
    position: absolute;
    pointer-events: none;
    opacity: 0.35;
}

/* --- Gateway Section (Hero 100vh) --- */
.gateway {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    overflow: hidden;
}

.gateway-shapes {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* Geometric shapes */
.geo-shape {
    position: absolute;
    opacity: 0;
    transform: scale(0);
    transition: none;
}

.geo-shape.animate-in {
    opacity: 1;
    transform: scale(1);
}

.shape-circle {
    border-radius: 50%;
}

.shape-triangle {
    width: 0;
    height: 0;
    background: none;
}

.shape-squiggle {
    border-radius: 40%;
    transform-origin: center;
}

.shape-zigzag {
    border-radius: 0;
}

/* Individual shape styles and positions */
.s1 { width: 48px; height: 48px; background: #FF6B8A; top: 12%; left: 8%; }
.s2 { border-left: 24px solid transparent; border-right: 24px solid transparent; border-bottom: 42px solid #FFD84A; top: 20%; left: 85%; }
.s3 { width: 40px; height: 20px; background: #4AE8C8; top: 70%; left: 12%; }
.s4 { width: 32px; height: 32px; background: #FF8840; top: 80%; left: 78%; }
.s5 { border-left: 18px solid transparent; border-right: 18px solid transparent; border-bottom: 32px solid #FF6B8A; top: 15%; left: 72%; }
.s6 { width: 36px; height: 12px; background: #FFD84A; top: 60%; left: 88%; border-radius: 0; }
.s7 { width: 24px; height: 24px; background: #4AE8C8; top: 35%; left: 5%; }
.s8 { width: 32px; height: 16px; background: #FF8840; top: 45%; left: 92%; }
.s9 { border-left: 20px solid transparent; border-right: 20px solid transparent; border-bottom: 36px solid #4AE8C8; top: 85%; left: 20%; }
.s10 { width: 20px; height: 20px; background: #FFD84A; top: 8%; left: 45%; }
.s11 { width: 28px; height: 10px; background: #FF6B8A; top: 75%; left: 55%; }
.s12 { width: 24px; height: 12px; background: #FF8840; top: 30%; left: 30%; }

/* --- Gateway Title --- */
.gateway-title {
    text-align: center;
    z-index: 10;
    opacity: 0;
    transform: translateY(-20px);
}

.gateway-title.animate-in {
    opacity: 1;
    transform: translateY(0);
    animation: bounceIn 400ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes bounceIn {
    0% { opacity: 0; transform: translateY(-20px); }
    60% { opacity: 1; transform: translateY(4px); }
    100% { opacity: 1; transform: translateY(0); }
}

.site-title {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: clamp(32px, 4vw, 64px);
    letter-spacing: -0.01em;
    color: #F0ECE0;
    text-shadow: 0 0 40px rgba(74, 232, 200, 0.3);
}

.site-subtitle {
    font-family: 'Share Tech Mono', monospace;
    font-weight: 400;
    font-size: 14px;
    color: #4AE8C8;
    margin-top: 8px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* --- HUD Panels --- */
.hud-panel {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 180px;
    padding: 20px 16px;
    background: rgba(240, 236, 224, 0.12);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(240, 236, 224, 0.18);
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 10;
    opacity: 0;
}

.hud-panel.animate-in {
    opacity: 1;
}

.hud-left {
    left: 5%;
    transform: translateY(-50%) translateX(-40px);
}

.hud-left.animate-in {
    transform: translateY(-50%) translateX(0);
    transition: transform 200ms ease-out, opacity 200ms ease-out;
}

.hud-right {
    right: 5%;
    transform: translateY(-50%) translateX(40px);
}

.hud-right.animate-in {
    transform: translateY(-50%) translateX(0);
    transition: transform 200ms ease-out, opacity 200ms ease-out;
}

.hud-corner {
    position: absolute;
    width: 12px;
    height: 12px;
    border-color: #4AE8C8;
    border-style: solid;
    border-width: 0;
}

.hud-corner-tl { top: -1px; left: -1px; border-top-width: 2px; border-left-width: 2px; }
.hud-corner-tr { top: -1px; right: -1px; border-top-width: 2px; border-right-width: 2px; }
.hud-corner-bl { bottom: -1px; left: -1px; border-bottom-width: 2px; border-left-width: 2px; }
.hud-corner-br { bottom: -1px; right: -1px; border-bottom-width: 2px; border-right-width: 2px; }

.hud-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #4AE8C8;
    margin-bottom: 8px;
    animation: hudPulse 2s infinite;
}

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

.hud-label {
    font-family: 'Share Tech Mono', monospace;
    font-size: 10px;
    color: rgba(240, 236, 224, 0.5);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    line-height: 1;
}

.hud-data {
    font-family: 'Share Tech Mono', monospace;
    font-size: 12px;
    color: #F0ECE0;
    letter-spacing: 0.04em;
    line-height: 1;
    margin-bottom: 8px;
}

/* --- Scroll Hint --- */
.scroll-hint {
    position: absolute;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    z-index: 10;
}

.scroll-hint-text {
    font-family: 'Share Tech Mono', monospace;
    font-size: 10px;
    color: rgba(240, 236, 224, 0.4);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.scroll-hint-line {
    width: 1px;
    height: 32px;
    background: rgba(240, 236, 224, 0.3);
    animation: scrollPulse 2s infinite;
}

@keyframes scrollPulse {
    0% { transform: scaleY(0); transform-origin: top; opacity: 0; }
    50% { transform: scaleY(1); transform-origin: top; opacity: 1; }
    100% { transform: scaleY(0); transform-origin: bottom; opacity: 0; }
}

/* --- Works Catalog Section --- */
.works-catalog {
    position: relative;
    z-index: 2;
    padding: 80px 0 120px;
    max-width: 1200px;
    margin: 0 auto;
    padding-left: 15%;
    padding-right: 8%;
}

.works-header {
    margin-bottom: 64px;
}

.section-label {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: clamp(24px, 3vw, 40px);
    letter-spacing: -0.01em;
    color: #F0ECE0;
}

.section-line {
    width: 60px;
    height: 3px;
    background: #FF6B8A;
    margin-top: 12px;
    border-radius: 2px;
}

/* --- Work Entry --- */
.work-entry {
    display: grid;
    grid-template-columns: 48px 1fr;
    gap: 24px;
    align-items: start;
    margin-bottom: 48px;
    opacity: 0;
    clip-path: inset(0 100% 0 0);
    transition: opacity 600ms ease-out, clip-path 600ms ease-out;
    cursor: pointer;
}

.work-entry.visible {
    opacity: 1;
    clip-path: inset(0 0% 0 0);
}

.work-entry:hover .work-title {
    text-decoration-color: currentColor;
}

/* nth-child underline colors */
.work-entry:nth-child(2) .work-title { text-decoration-color: transparent; }
.work-entry:nth-child(2):hover .work-title { text-decoration-color: #FF6B8A; }
.work-entry:nth-child(3) .work-title { text-decoration-color: transparent; }
.work-entry:nth-child(3):hover .work-title { text-decoration-color: #FFD84A; }
.work-entry:nth-child(4) .work-title { text-decoration-color: transparent; }
.work-entry:nth-child(4):hover .work-title { text-decoration-color: #4AE8C8; }
.work-entry:nth-child(5) .work-title { text-decoration-color: transparent; }
.work-entry:nth-child(5):hover .work-title { text-decoration-color: #FF8840; }
.work-entry:nth-child(6) .work-title { text-decoration-color: transparent; }
.work-entry:nth-child(6):hover .work-title { text-decoration-color: #FF6B8A; }
.work-entry:nth-child(7) .work-title { text-decoration-color: transparent; }
.work-entry:nth-child(7):hover .work-title { text-decoration-color: #FFD84A; }

/* --- Pattern Swatches (48x48, unique per entry) --- */
.work-pattern-swatch {
    width: 48px;
    height: 48px;
    border-radius: 4px;
    flex-shrink: 0;
    transform: scale(0);
    transition: transform 200ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.work-entry.visible .work-pattern-swatch {
    transform: scale(1);
}

.work-pattern-swatch:hover {
    transform: rotate(10deg) scale(1.05);
}

/* Pattern 1: Pink circles */
.pattern-1 {
    background:
        radial-gradient(circle at 25% 25%, #FF6B8A 4px, transparent 4px),
        radial-gradient(circle at 75% 75%, #FF6B8A 4px, transparent 4px),
        radial-gradient(circle at 50% 50%, #FF6B8A 2px, transparent 2px);
    background-size: 16px 16px;
    background-color: rgba(255, 107, 138, 0.15);
    border: 1px solid rgba(255, 107, 138, 0.4);
}

/* Pattern 2: Teal zigzags */
.pattern-2 {
    background:
        repeating-linear-gradient(45deg, transparent 0px, transparent 4px, #4AE8C8 4px, #4AE8C8 6px, transparent 6px, transparent 12px),
        repeating-linear-gradient(-45deg, transparent 0px, transparent 4px, #4AE8C8 4px, #4AE8C8 6px, transparent 6px, transparent 12px);
    background-color: rgba(74, 232, 200, 0.1);
    border: 1px solid rgba(74, 232, 200, 0.4);
}

/* Pattern 3: Yellow triangles (dots arranged) */
.pattern-3 {
    background:
        linear-gradient(60deg, transparent 45%, #FFD84A 45%, #FFD84A 55%, transparent 55%),
        linear-gradient(-60deg, transparent 45%, #FFD84A 45%, #FFD84A 55%, transparent 55%),
        linear-gradient(0deg, #FFD84A 0%, #FFD84A 8%, transparent 8%);
    background-size: 16px 14px;
    background-color: rgba(255, 216, 74, 0.1);
    border: 1px solid rgba(255, 216, 74, 0.4);
}

/* Pattern 4: Orange horizontal stripes */
.pattern-4 {
    background: repeating-linear-gradient(
        0deg,
        transparent 0px,
        transparent 4px,
        #FF8840 4px,
        #FF8840 6px,
        transparent 6px,
        transparent 12px
    );
    background-color: rgba(255, 136, 64, 0.1);
    border: 1px solid rgba(255, 136, 64, 0.4);
}

/* Pattern 5: Pink + Teal checkerboard */
.pattern-5 {
    background:
        repeating-conic-gradient(#FF6B8A 0% 25%, transparent 0% 50%) 0 0 / 12px 12px,
        repeating-conic-gradient(#4AE8C8 0% 25%, transparent 0% 50%) 6px 6px / 12px 12px;
    background-color: rgba(255, 107, 138, 0.08);
    border: 1px solid rgba(255, 107, 138, 0.3);
}

/* Pattern 6: Yellow + Orange dots grid */
.pattern-6 {
    background:
        radial-gradient(circle at 30% 30%, #FFD84A 3px, transparent 3px),
        radial-gradient(circle at 70% 70%, #FF8840 3px, transparent 3px);
    background-size: 12px 12px;
    background-color: rgba(255, 216, 74, 0.1);
    border: 1px solid rgba(255, 136, 64, 0.4);
}

/* --- Work Content --- */
.work-content {
    max-width: 60%;
}

.work-title {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: clamp(20px, 2.5vw, 32px);
    letter-spacing: -0.01em;
    color: #F0ECE0;
    text-decoration: underline;
    text-decoration-color: transparent;
    text-decoration-thickness: 3px;
    text-underline-offset: 4px;
    transition: text-decoration-color 300ms ease;
    margin-bottom: 8px;
}

.work-description {
    font-family: 'Nunito', sans-serif;
    font-weight: 400;
    font-size: clamp(14px, 1vw, 16px);
    line-height: 1.75;
    color: rgba(240, 236, 224, 0.75);
    margin-bottom: 12px;
}

.work-meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.meta-tag {
    font-family: 'Share Tech Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #4AE8C8;
    padding: 2px 8px;
    border: 1px solid rgba(74, 232, 200, 0.3);
    border-radius: 2px;
}

/* --- Detail Overlay --- */
.detail-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(20, 24, 56, 0.85);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 300ms ease;
}

.detail-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.detail-panel {
    position: relative;
    width: 90%;
    max-width: 640px;
    padding: 40px;
    background: rgba(240, 236, 224, 0.12);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(240, 236, 224, 0.18);
    border-radius: 8px;
    transform: translateY(20px);
    transition: transform 300ms ease, background 300ms ease;
}

.detail-overlay.active .detail-panel {
    transform: translateY(0);
}

.detail-panel:hover {
    background: rgba(240, 236, 224, 0.2);
}

.detail-close {
    position: absolute;
    top: 16px;
    right: 20px;
    font-size: 28px;
    color: #F0ECE0;
    cursor: pointer;
    line-height: 1;
    transition: color 200ms ease;
    z-index: 10;
}

.detail-close:hover {
    color: #FF6B8A;
}

.detail-hud-top {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 16px;
}

.detail-title {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: clamp(24px, 3vw, 36px);
    letter-spacing: -0.01em;
    color: #F0ECE0;
    margin-bottom: 12px;
}

.detail-description {
    font-family: 'Nunito', sans-serif;
    font-weight: 400;
    font-size: clamp(14px, 1vw, 16px);
    line-height: 1.75;
    color: rgba(240, 236, 224, 0.8);
    margin-bottom: 24px;
}

.detail-svg-container {
    width: 100%;
    height: 200px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.detail-svg-container svg {
    width: 100%;
    height: 100%;
}

.detail-svg-container svg path {
    fill: none;
    stroke: #F0ECE0;
    stroke-width: 1.5;
    stroke-dasharray: var(--path-length, 1000);
    stroke-dashoffset: var(--path-length, 1000);
    transition: stroke-dashoffset 1200ms ease-in-out;
}

.detail-svg-container svg path.draw {
    stroke-dashoffset: 0;
}

.detail-hud-bottom {
    display: flex;
    gap: 32px;
    flex-wrap: wrap;
    padding-top: 16px;
    border-top: 1px solid rgba(240, 236, 224, 0.12);
}

.detail-hud-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* --- Pattern Library (Footer) --- */
.pattern-library {
    position: relative;
    z-index: 2;
    padding: 80px 15% 60px;
}

.pattern-library .section-line {
    margin-bottom: 40px;
}

.pattern-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 16px;
    margin-bottom: 48px;
}

.pattern-grid-item {
    aspect-ratio: 1;
    border-radius: 6px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 8px;
    transition: transform 200ms ease;
}

.pattern-grid-item:hover {
    transform: rotate(10deg) scale(1.08);
}

.pattern-label {
    font-family: 'Nunito', sans-serif;
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(240, 236, 224, 0.8);
    text-shadow: 0 1px 4px rgba(20, 24, 56, 0.6);
}

.footer-hud {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    padding-top: 24px;
    border-top: 1px solid rgba(240, 236, 224, 0.1);
}

.footer-hud .hud-data {
    font-size: 11px;
    color: rgba(240, 236, 224, 0.4);
}

/* --- Floating Memphis Shape Animations --- */
@keyframes floatDrift1 {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(15px, -20px) rotate(5deg); }
    50% { transform: translate(-10px, -35px) rotate(-3deg); }
    75% { transform: translate(20px, -15px) rotate(7deg); }
}

@keyframes floatDrift2 {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(-20px, 10px) rotate(-5deg); }
    50% { transform: translate(15px, 25px) rotate(8deg); }
    75% { transform: translate(-10px, 15px) rotate(-4deg); }
}

@keyframes floatDrift3 {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(25px, -10px) rotate(10deg); }
    66% { transform: translate(-15px, 20px) rotate(-6deg); }
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .hud-panel {
        display: none;
    }

    .works-catalog {
        padding-left: 8%;
        padding-right: 8%;
    }

    .work-content {
        max-width: 100%;
    }

    .pattern-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .pattern-library {
        padding: 60px 8% 40px;
    }

    .footer-hud {
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }

    .detail-panel {
        padding: 24px;
    }

    .detail-hud-bottom {
        gap: 16px;
    }
}

@media (max-width: 480px) {
    .work-entry {
        grid-template-columns: 40px 1fr;
        gap: 16px;
    }

    .work-pattern-swatch {
        width: 40px;
        height: 40px;
    }

    .pattern-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
