/* ================================================
   lungi.dev — Glassmorphic Textile Workshop
   ================================================ */

/* CSS Custom Properties */
:root {
    --slate-dusk: #1e1e2e;
    --lungi-lavender: #c4b5e0;
    --monsoon-rose: #e8a5b7;
    --river-mint: #a8d8c8;
    --dhaka-gold: #e8d5a0;
    --cotton-white: #eae6f0;
    --woven-gray: #8b87a0;
    --loom-red: #e07070;
    --glass-surface: rgba(255, 255, 255, 0.10);
    --glass-border: rgba(255, 255, 255, 0.15);
    --glass-gradient: linear-gradient(135deg, rgba(196, 181, 224, 0.06), rgba(232, 165, 183, 0.04));
    --blur-transition: cubic-bezier(0.16, 1, 0.3, 1);
    --gutter: 1.5rem;
}

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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: var(--slate-dusk);
    color: var(--cotton-white);
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.72;
    overflow-x: hidden;
    position: relative;
}

/* ================================================
   Grain Canvas Overlay
   ================================================ */
#grain-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 1000;
    opacity: 0.04;
    mix-blend-mode: overlay;
}

/* ================================================
   Diamond Grid Background
   ================================================ */
#diamond-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    background:
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 28px,
            rgba(196, 181, 224, 0.04) 28px,
            rgba(196, 181, 224, 0.04) 29px
        ),
        repeating-linear-gradient(
            -45deg,
            transparent,
            transparent 28px,
            rgba(196, 181, 224, 0.04) 28px,
            rgba(196, 181, 224, 0.04) 29px
        );
}

/* ================================================
   Floating Geometric Shapes
   ================================================ */
#floating-shapes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

.float-shape {
    position: absolute;
    opacity: 0.15;
}

.shape-diamond {
    top: 12%;
    left: 8%;
    animation: floatDrift1 120s linear infinite;
}

.shape-circle {
    top: 45%;
    right: 12%;
    animation: floatDrift2 100s linear infinite;
}

.shape-hexagon {
    top: 70%;
    left: 20%;
    animation: floatDrift3 140s linear infinite;
}

.shape-diamond-2 {
    top: 25%;
    right: 25%;
    animation: floatDrift4 110s linear infinite;
}

.shape-circle-2 {
    top: 80%;
    right: 8%;
    animation: floatDrift1 130s linear infinite reverse;
}

.shape-hexagon-2 {
    top: 5%;
    left: 55%;
    animation: floatDrift2 115s linear infinite reverse;
}

.shape-diamond-3 {
    top: 55%;
    left: 45%;
    animation: floatDrift3 125s linear infinite;
}

.shape-circle-3 {
    top: 35%;
    left: 75%;
    animation: floatDrift4 105s linear infinite reverse;
}

@keyframes floatDrift1 {
    0% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(60px, -40px) rotate(90deg); }
    50% { transform: translate(20px, -80px) rotate(180deg); }
    75% { transform: translate(-40px, -30px) rotate(270deg); }
    100% { transform: translate(0, 0) rotate(360deg); }
}

@keyframes floatDrift2 {
    0% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(-50px, 30px) rotate(90deg); }
    50% { transform: translate(-20px, 70px) rotate(180deg); }
    75% { transform: translate(30px, 40px) rotate(270deg); }
    100% { transform: translate(0, 0) rotate(360deg); }
}

@keyframes floatDrift3 {
    0% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(40px, 50px) rotate(90deg); }
    50% { transform: translate(-30px, 20px) rotate(180deg); }
    75% { transform: translate(-60px, -20px) rotate(270deg); }
    100% { transform: translate(0, 0) rotate(360deg); }
}

@keyframes floatDrift4 {
    0% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(-30px, -50px) rotate(90deg); }
    50% { transform: translate(50px, -30px) rotate(180deg); }
    75% { transform: translate(20px, 40px) rotate(270deg); }
    100% { transform: translate(0, 0) rotate(360deg); }
}

/* ================================================
   Navigation Diamond
   ================================================ */
#nav-diamond {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 900;
    background: var(--glass-surface);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transform: rotate(0deg);
    transition: transform 0.6s var(--blur-transition), border-color 0.4s ease;
}

#nav-diamond:hover {
    transform: rotate(45deg);
    border-color: rgba(196, 181, 224, 0.4);
}

/* Navigation Overlay */
#nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 950;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(30, 30, 46, 0.6);
    -webkit-backdrop-filter: blur(24px);
    backdrop-filter: blur(24px);
    opacity: 1;
    transition: opacity 0.5s var(--blur-transition);
}

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

#nav-panel {
    background: var(--glass-surface);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 4px;
    padding: 3rem 4rem;
    position: relative;
    background-image: var(--glass-gradient);
}

#nav-close {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    background: none;
    border: none;
    color: var(--woven-gray);
    font-size: 2rem;
    cursor: pointer;
    transition: color 0.3s ease;
    line-height: 1;
}

#nav-close:hover {
    color: var(--cotton-white);
}

.nav-link {
    display: block;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    color: var(--cotton-white);
    text-decoration: none;
    padding: 0.75rem 0;
    letter-spacing: 0.01em;
    transition: color 0.3s ease, filter 0.4s var(--blur-transition);
    filter: blur(0px);
}

.nav-link:hover {
    color: var(--lungi-lavender);
}

/* ================================================
   Sections — General
   ================================================ */
.section {
    position: relative;
    z-index: 2;
}

/* ================================================
   Blur-Focus Transition
   ================================================ */
.blur-target {
    filter: blur(40px);
    opacity: 0;
    transition: filter 1.2s var(--blur-transition), opacity 1s var(--blur-transition);
    will-change: filter, opacity;
}

.blur-target.in-view {
    filter: blur(0px);
    opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
    .blur-target {
        filter: none;
        transition: opacity 0.4s ease;
    }
    .blur-target.in-view {
        filter: none;
    }
    .float-shape {
        animation: none !important;
    }
}

/* ================================================
   Section 1: The First Fold
   ================================================ */
.section-first-fold {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--gutter);
}

.hero-block {
    background: var(--glass-surface);
    background-image: var(--glass-gradient);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 4px;
    padding: 4rem 5rem;
    text-align: center;
    max-width: 800px;
}

.hero-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: clamp(2.8rem, 6vw, 5.5rem);
    letter-spacing: -0.03em;
    color: var(--lungi-lavender);
    line-height: 1.1;
    margin-bottom: 1.5rem;
}

.hero-subtitle {
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.5vw, 1.2rem);
    color: var(--cotton-white);
    max-width: 38ch;
    margin: 0 auto;
    line-height: 1.72;
}

/* ================================================
   Glass Block System
   ================================================ */
.warp-block {
    background: var(--glass-surface);
    background-image: var(--glass-gradient);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 4px;
    padding: 2.5rem 3rem;
}

.weft-block {
    background: rgba(255, 255, 255, 0.08);
    background-image: var(--glass-gradient);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 4px;
    padding: 2rem 2.5rem;
}

.selvedge-block {
    border: 1px solid var(--glass-border);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.selvedge-pattern {
    width: 100%;
    height: 100%;
    background:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 8px,
            rgba(196, 181, 224, 0.1) 8px,
            rgba(196, 181, 224, 0.1) 9px
        ),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 8px,
            rgba(232, 165, 183, 0.08) 8px,
            rgba(232, 165, 183, 0.08) 9px
        );
    animation: selvedgePulse 30s ease-in-out infinite;
}

@keyframes selvedgePulse {
    0%, 100% {
        background:
            repeating-linear-gradient(0deg, transparent, transparent 8px, rgba(196, 181, 224, 0.1) 8px, rgba(196, 181, 224, 0.1) 9px),
            repeating-linear-gradient(90deg, transparent, transparent 8px, rgba(232, 165, 183, 0.08) 8px, rgba(232, 165, 183, 0.08) 9px);
    }
    25% {
        background:
            repeating-linear-gradient(0deg, transparent, transparent 8px, rgba(168, 216, 200, 0.1) 8px, rgba(168, 216, 200, 0.1) 9px),
            repeating-linear-gradient(90deg, transparent, transparent 8px, rgba(232, 213, 160, 0.08) 8px, rgba(232, 213, 160, 0.08) 9px);
    }
    50% {
        background:
            repeating-linear-gradient(0deg, transparent, transparent 8px, rgba(232, 165, 183, 0.1) 8px, rgba(232, 165, 183, 0.1) 9px),
            repeating-linear-gradient(90deg, transparent, transparent 8px, rgba(196, 181, 224, 0.08) 8px, rgba(196, 181, 224, 0.08) 9px);
    }
    75% {
        background:
            repeating-linear-gradient(0deg, transparent, transparent 8px, rgba(232, 213, 160, 0.1) 8px, rgba(232, 213, 160, 0.1) 9px),
            repeating-linear-gradient(90deg, transparent, transparent 8px, rgba(168, 216, 200, 0.08) 8px, rgba(168, 216, 200, 0.08) 9px);
    }
}

.block-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    letter-spacing: 0.01em;
    color: var(--monsoon-rose);
    margin-bottom: 1rem;
}

.block-body {
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.72;
    color: var(--cotton-white);
    max-width: 38ch;
}

/* ================================================
   Section 2: The Weave — Loom Grid
   ================================================ */
.section-weave {
    padding: 6rem var(--gutter);
    min-height: 180vh;
}

.loom-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: var(--gutter);
    max-width: 1400px;
    margin: 0 auto;
}

.selvedge-left {
    grid-column: 1 / 3;
    grid-row: 1 / 4;
    min-height: 60vh;
}

.warp-philosophy {
    grid-column: 3 / 8;
    grid-row: 1 / 2;
    min-height: 40vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.weft-craft {
    grid-column: 5 / 13;
    grid-row: 2 / 3;
}

.warp-approach {
    grid-column: 3 / 7;
    grid-row: 3 / 4;
    min-height: 35vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.weft-skills {
    grid-column: 7 / 13;
    grid-row: 3 / 4;
}

.selvedge-right {
    grid-column: 12 / 13;
    grid-row: 1 / 4;
    min-height: 60vh;
}

.weft-tools {
    grid-column: 2 / 10;
    grid-row: 4 / 5;
}

/* Skill Tags */
.skill-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.tag {
    font-family: 'DM Sans', sans-serif;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--river-mint);
    background: rgba(168, 216, 200, 0.1);
    border: 1px solid rgba(168, 216, 200, 0.2);
    border-radius: 3px;
    padding: 0.4rem 0.9rem;
    transition: background 0.3s ease, border-color 0.3s ease;
}

.tag:hover {
    background: rgba(168, 216, 200, 0.18);
    border-color: rgba(168, 216, 200, 0.35);
}

/* Tool List */
.tool-list {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.tool-item code {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 400;
    font-size: 0.85em;
    letter-spacing: -0.02em;
    color: var(--dhaka-gold);
    background: rgba(232, 213, 160, 0.08);
    padding: 0.3rem 0.7rem;
    border-radius: 3px;
    border: 1px solid rgba(232, 213, 160, 0.15);
}

/* ================================================
   Section 3: Pattern Library
   ================================================ */
.section-patterns {
    padding: 6rem var(--gutter);
    min-height: 140vh;
}

.pattern-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--gutter);
    max-width: 1200px;
    margin: 0 auto;
}

.project-panel {
    background: var(--glass-surface);
    background-image: var(--glass-gradient);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 4px;
    padding: 2.5rem;
    position: relative;
    overflow: hidden;
    transition: border-color 0.4s ease, backdrop-filter 0.4s ease;
    cursor: default;
}

.project-panel:hover {
    border-color: rgba(255, 255, 255, 0.40);
}

.project-motif {
    width: 100%;
    height: 80px;
    margin-bottom: 1.5rem;
    border-radius: 3px;
    opacity: 0.5;
    transition: opacity 0.4s ease;
}

.project-panel:hover .project-motif {
    opacity: 0.8;
}

/* Unique motifs per project */
[data-project="threadweave"] .project-motif {
    background:
        repeating-linear-gradient(45deg, transparent, transparent 6px, rgba(196, 181, 224, 0.15) 6px, rgba(196, 181, 224, 0.15) 7px),
        repeating-linear-gradient(-45deg, transparent, transparent 6px, rgba(232, 165, 183, 0.1) 6px, rgba(232, 165, 183, 0.1) 7px);
}

[data-project="loomscript"] .project-motif {
    background:
        repeating-linear-gradient(0deg, transparent, transparent 10px, rgba(168, 216, 200, 0.12) 10px, rgba(168, 216, 200, 0.12) 11px),
        repeating-linear-gradient(90deg, transparent, transparent 10px, rgba(232, 213, 160, 0.1) 10px, rgba(232, 213, 160, 0.1) 11px);
}

[data-project="warpfield"] .project-motif {
    background: repeating-conic-gradient(
        from 0deg at 50% 50%,
        rgba(196, 181, 224, 0.08) 0deg 30deg,
        transparent 30deg 60deg
    );
}

[data-project="selvedge-ui"] .project-motif {
    background:
        repeating-linear-gradient(60deg, transparent, transparent 4px, rgba(232, 165, 183, 0.12) 4px, rgba(232, 165, 183, 0.12) 5px),
        repeating-linear-gradient(-60deg, transparent, transparent 4px, rgba(168, 216, 200, 0.1) 4px, rgba(168, 216, 200, 0.1) 5px);
}

[data-project="jamdani"] .project-motif {
    background:
        repeating-linear-gradient(30deg, transparent, transparent 12px, rgba(232, 213, 160, 0.12) 12px, rgba(232, 213, 160, 0.12) 13px),
        repeating-linear-gradient(150deg, transparent, transparent 12px, rgba(196, 181, 224, 0.1) 12px, rgba(196, 181, 224, 0.1) 13px);
}

[data-project="monsoon"] .project-motif {
    background:
        radial-gradient(circle at 20% 50%, rgba(168, 216, 200, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 30%, rgba(232, 165, 183, 0.12) 0%, transparent 40%),
        radial-gradient(circle at 50% 80%, rgba(196, 181, 224, 0.1) 0%, transparent 45%);
}

.project-name {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: clamp(1.2rem, 2vw, 1.5rem);
    letter-spacing: -0.02em;
    color: var(--cotton-white);
    margin-bottom: 0.5rem;
}

.project-desc {
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    font-size: 0.95rem;
    color: var(--woven-gray);
    line-height: 1.6;
}

/* ================================================
   Section 4: The Selvedge (Closing)
   ================================================ */
.section-selvedge {
    padding: 8rem var(--gutter);
    min-height: 80vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.closing-block {
    text-align: center;
    max-width: 600px;
}

.closing-block .block-body {
    max-width: 42ch;
    margin: 0 auto 2rem;
}

.contact-links {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.contact-link {
    text-decoration: none;
    transition: filter 0.4s var(--blur-transition);
}

.contact-link code {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 400;
    font-size: 0.85em;
    letter-spacing: -0.02em;
    color: var(--lungi-lavender);
    background: rgba(196, 181, 224, 0.08);
    padding: 0.4rem 1rem;
    border-radius: 3px;
    border: 1px solid rgba(196, 181, 224, 0.15);
    display: inline-block;
    transition: border-color 0.3s ease, color 0.3s ease, background 0.3s ease;
}

.contact-link:hover code {
    color: var(--cotton-white);
    border-color: rgba(196, 181, 224, 0.4);
    background: rgba(196, 181, 224, 0.15);
}

.closing-field {
    min-height: 20vh;
}

/* ================================================
   Responsive
   ================================================ */
@media (max-width: 1024px) {
    .loom-grid {
        grid-template-columns: repeat(6, 1fr);
    }
    .selvedge-left {
        grid-column: 1 / 2;
        grid-row: 1 / 3;
    }
    .warp-philosophy {
        grid-column: 2 / 7;
        grid-row: 1 / 2;
    }
    .weft-craft {
        grid-column: 1 / 7;
        grid-row: 2 / 3;
    }
    .warp-approach {
        grid-column: 1 / 5;
        grid-row: 3 / 4;
    }
    .weft-skills {
        grid-column: 1 / 7;
        grid-row: 4 / 5;
    }
    .selvedge-right {
        grid-column: 6 / 7;
        grid-row: 1 / 3;
    }
    .weft-tools {
        grid-column: 1 / 7;
        grid-row: 5 / 6;
    }
    .pattern-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .loom-grid {
        grid-template-columns: 1fr;
    }
    .selvedge-left,
    .selvedge-right {
        display: none;
    }
    .warp-philosophy,
    .weft-craft,
    .warp-approach,
    .weft-skills,
    .weft-tools {
        grid-column: 1 / -1;
        grid-row: auto;
        min-height: auto;
    }
    .pattern-grid {
        grid-template-columns: 1fr;
    }
    .hero-block {
        padding: 3rem 2rem;
    }
    #nav-panel {
        padding: 2.5rem 2rem;
    }
}
