/* ===========================================
   ppuzzl.org — MCbling Jewel-Tone Showcase
   =========================================== */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.2vw, 1.1rem);
    line-height: 1.8;
    color: #3A1848;
    background-color: #FDF8FF;
    overflow-x: hidden;
}

/* --- Canvas (max-width container) --- */
.canvas {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 24px;
}

/* --- Diamond Grid Background --- */
.diamond-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    background-image:
        linear-gradient(45deg, rgba(106,32,128,0.05) 1px, transparent 1px),
        linear-gradient(-45deg, rgba(106,32,128,0.05) 1px, transparent 1px);
    background-size: 60px 60px;
    opacity: 0;
    transition: opacity 2s ease;
}

.diamond-grid.visible {
    opacity: 1;
}

/* --- Sparkle Canvas (MCbling sparkle overlay) --- */
.sparkle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

/* --- Hamburger Navigation --- */
.hamburger {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 1000;
    width: 44px;
    height: 44px;
    background: rgba(253, 248, 255, 0.6);
    border: 1px solid rgba(106, 32, 128, 0.08);
    border-radius: 2px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    padding: 0;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: background-color 0.3s ease;
}

.hamburger:hover {
    background: rgba(253, 248, 255, 0.9);
}

.hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background-color: #6A2080;
    transition: all 0.3s ease;
    transform-origin: center;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* --- Navigation Overlay --- */
.nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(253, 248, 255, 0.97);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.nav-overlay.open {
    opacity: 1;
    pointer-events: all;
}

.nav-overlay ul {
    list-style: none;
    text-align: center;
}

.nav-overlay ul li {
    margin: 28px 0;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.nav-overlay.open ul li {
    opacity: 1;
    transform: translateY(0);
}

.nav-overlay.open ul li:nth-child(1) { transition-delay: 0.1s; }
.nav-overlay.open ul li:nth-child(2) { transition-delay: 0.15s; }
.nav-overlay.open ul li:nth-child(3) { transition-delay: 0.2s; }
.nav-overlay.open ul li:nth-child(4) { transition-delay: 0.25s; }

.nav-overlay ul li a {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(2rem, 4vw, 3rem);
    color: #1A0828;
    text-decoration: none;
    position: relative;
    transition: color 0.3s ease;
    letter-spacing: 0.02em;
}

.nav-overlay ul li a:hover {
    color: #6A2080;
}

.nav-overlay ul li a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #C02050, #6A2080);
    transition: width 0.3s ease;
}

.nav-overlay ul li a:hover::after {
    width: 100%;
}

/* --- Hero Section --- */
.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    z-index: 1;
    padding: 40px 24px;
}

.hero-content {
    position: relative;
}

.hero-label {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
    font-size: 0.72rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: #6A2080;
    display: block;
    margin-bottom: 24px;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.8s ease 0.3s forwards;
}

.hero-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(2.2rem, 5vw, 3.8rem);
    color: #1A0828;
    letter-spacing: 0.06em;
    position: relative;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.8s ease 0.5s forwards;
}

.hero-subtitle {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 300;
    font-size: clamp(1rem, 1.5vw, 1.2rem);
    color: #3A1848;
    margin-top: 16px;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.8s ease 0.7s forwards;
}

.hero-diamond-accent {
    margin-top: 40px;
    opacity: 0;
    animation: fadeInUp 0.8s ease 0.9s forwards;
}

.diamond-icon {
    width: 80px;
    height: 80px;
    animation: diamondSpin 10s linear infinite;
}

.hero-facets {
    margin-top: 32px;
    opacity: 0;
    animation: fadeInUp 0.8s ease 1.1s forwards;
}

.facet-line {
    width: 280px;
    height: 40px;
}

/* --- Glitch Effect on Title (channel separation) --- */
.glitch-target {
    position: relative;
}

.glitch-target::before,
.glitch-target::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
}

.glitch-target::before {
    color: #6A2080;
    z-index: -1;
}

.glitch-target::after {
    color: #208068;
    z-index: -1;
}

.glitch-target.glitching::before {
    opacity: 0.7;
    animation: glitchBefore 0.3s step-end;
}

.glitch-target.glitching::after {
    opacity: 0.7;
    animation: glitchAfter 0.3s step-end;
}

/* --- Scroll Indicator --- */
.scroll-indicator {
    position: absolute;
    bottom: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    opacity: 0;
    animation: fadeInUp 0.8s ease 1.4s forwards;
    transition: opacity 0.4s ease;
}

.scroll-label {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
    font-size: 0.62rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: #6A2080;
}

.scroll-line {
    width: 1px;
    height: 40px;
    background: linear-gradient(to bottom, #6A2080, transparent);
    animation: scrollPulse 2s ease infinite;
}

/* --- Section Shared Styles --- */
.section-label {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
    font-size: 0.68rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: #6A2080;
    display: block;
    margin-bottom: 16px;
}

.section-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(2.2rem, 5vw, 3.8rem);
    color: #1A0828;
    margin-bottom: 16px;
    letter-spacing: 0.02em;
}

.section-description {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 300;
    font-size: clamp(0.95rem, 1.2vw, 1.1rem);
    color: #3A1848;
    line-height: 1.8;
    margin-bottom: 48px;
}

/* --- Showcase Section --- */
.showcase {
    position: relative;
    z-index: 1;
    padding: 120px 0;
}

.puzzle-grid {
    display: flex;
    flex-direction: column;
    gap: 56px;
}

.puzzle-card {
    background: #F8F0FA;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.puzzle-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 48px rgba(106, 32, 128, 0.1), 0 4px 12px rgba(106, 32, 128, 0.06);
}

.puzzle-image {
    width: 100%;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    position: relative;
    background: linear-gradient(135deg, #F8F0FA, #FDF8FF);
    display: flex;
    align-items: center;
    justify-content: center;
}

.puzzle-image::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(106,32,128,0.04), rgba(32,128,104,0.04));
    pointer-events: none;
}

.puzzle-jewel-border {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.puzzle-card:hover .puzzle-jewel-border {
    opacity: 1;
}

.puzzle-jewel-border::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #6A2080, #208068, transparent);
}

.puzzle-placeholder {
    width: 60%;
    max-width: 200px;
    filter: saturate(1.3) contrast(1.1);
    transition: transform 0.6s ease;
}

.puzzle-card:hover .puzzle-placeholder {
    transform: scale(1.05);
}

.puzzle-placeholder svg {
    width: 100%;
    height: auto;
}

.puzzle-info {
    padding: 24px;
}

.puzzle-label {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
    font-size: 0.68rem;
    letter-spacing: 0.18em;
    color: #6A2080;
    display: block;
    margin-bottom: 8px;
}

.puzzle-name {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 1.4rem;
    color: #1A0828;
    margin-bottom: 8px;
    letter-spacing: 0.01em;
}

.puzzle-desc {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 300;
    font-size: 0.9rem;
    color: #3A1848;
    line-height: 1.7;
}

/* --- Glitch Hover Effect (cards & items) --- */
.glitch-hover {
    position: relative;
}

.glitch-hover::before,
.glitch-hover::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.1s;
    z-index: 2;
}

.glitch-hover::before {
    background: rgba(106, 32, 128, 0.03);
    transform: translateX(0);
}

.glitch-hover::after {
    background: rgba(32, 128, 104, 0.03);
    transform: translateX(0);
}

.glitch-hover.glitch-active::before {
    opacity: 1;
    animation: glitchShiftLeft 0.3s step-end;
}

.glitch-hover.glitch-active::after {
    opacity: 1;
    animation: glitchShiftRight 0.3s step-end;
}

/* --- Collection / Archive Section --- */
.collection {
    position: relative;
    z-index: 1;
    padding: 120px 0;
}

.archive-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.archive-item {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 28px 0;
    border-bottom: 1px solid rgba(106, 32, 128, 0.1);
    transition: background-color 0.3s ease, padding-left 0.3s ease;
    cursor: default;
}

.archive-item:first-child {
    border-top: 1px solid rgba(106, 32, 128, 0.1);
}

.archive-item:hover {
    background-color: rgba(248, 240, 250, 0.6);
    padding-left: 12px;
}

.archive-number {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
    font-size: 0.72rem;
    color: #6A2080;
    flex-shrink: 0;
    width: 32px;
}

.archive-content {
    flex: 1;
}

.archive-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: 1.15rem;
    color: #1A0828;
    margin-bottom: 4px;
}

.archive-text {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 300;
    font-size: 0.85rem;
    color: #3A1848;
    line-height: 1.7;
}

.archive-gem {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
}

.archive-gem svg {
    width: 100%;
    height: 100%;
    transition: transform 0.5s ease;
}

.archive-item:hover .archive-gem svg {
    transform: rotate(45deg) scale(1.1);
}

/* --- About Section --- */
.about {
    position: relative;
    z-index: 1;
    padding: 120px 0;
}

.about-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
    margin-bottom: 64px;
}

.stat-item {
    text-align: center;
    position: relative;
}

.stat-item::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 2px;
    background: linear-gradient(90deg, #6A2080, #208068);
    opacity: 0.3;
}

.stat-number {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(2rem, 4vw, 3rem);
    color: #6A2080;
    display: block;
    line-height: 1.2;
}

.stat-label {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
    font-size: 0.62rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #3A1848;
    display: block;
    margin-top: 8px;
}

.about-manifesto {
    background: #F8F0FA;
    padding: 40px;
    border-radius: 4px;
    border-left: 3px solid #6A2080;
    position: relative;
}

.about-manifesto::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, transparent 50%, rgba(106, 32, 128, 0.03) 50%);
    pointer-events: none;
}

.manifesto-text {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.2vw, 1.1rem);
    color: #3A1848;
    line-height: 1.9;
}

.manifesto-signature {
    margin-top: 28px;
}

.signature-diamond {
    width: 160px;
    height: 40px;
    opacity: 0.6;
}

/* --- Footer --- */
.footer {
    position: relative;
    z-index: 1;
    padding: 60px 0;
    text-align: center;
}

.footer .canvas {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
}

.footer-diamond {
    opacity: 0.5;
}

.footer-mark {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: 0.85rem;
    color: #6A2080;
    letter-spacing: 0.04em;
}

.footer-year {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
    font-size: 0.68rem;
    color: #3A1848;
    opacity: 0.4;
}

/* --- Animations --- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes diamondSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes scrollPulse {
    0%, 100% { opacity: 1; transform: scaleY(1); }
    50% { opacity: 0.3; transform: scaleY(0.7); }
}

@keyframes glitchBefore {
    0% { transform: translate(-2px, 0); }
    20% { transform: translate(2px, 0); }
    40% { transform: translate(-1px, 0); }
    60% { transform: translate(2px, 0); }
    80% { transform: translate(-2px, 0); }
    100% { transform: translate(0, 0); }
}

@keyframes glitchAfter {
    0% { transform: translate(2px, 0); }
    20% { transform: translate(-2px, 0); }
    40% { transform: translate(1px, 0); }
    60% { transform: translate(-2px, 0); }
    80% { transform: translate(2px, 0); }
    100% { transform: translate(0, 0); }
}

@keyframes glitchShiftLeft {
    0% { transform: translateX(-2px); }
    25% { transform: translateX(2px); }
    50% { transform: translateX(-1px); }
    75% { transform: translateX(1px); }
    100% { transform: translateX(0); }
}

@keyframes glitchShiftRight {
    0% { transform: translateX(2px); }
    25% { transform: translateX(-2px); }
    50% { transform: translateX(1px); }
    75% { transform: translateX(-1px); }
    100% { transform: translateX(0); }
}

/* --- Scroll reveal --- */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Sparkle particle --- */
.sparkle-particle {
    position: fixed;
    pointer-events: none;
    z-index: 9;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    animation: sparkleFloat 0.8s ease-out forwards;
}

@keyframes sparkleFloat {
    0% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
    100% {
        opacity: 0;
        transform: scale(0) translateY(-20px);
    }
}

/* --- Responsive --- */
@media (max-width: 600px) {
    .about-stats {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .archive-item {
        gap: 16px;
    }

    .archive-gem {
        display: none;
    }

    .about-manifesto {
        padding: 24px;
    }

    .hamburger {
        top: 16px;
        right: 16px;
    }

    .facet-line {
        width: 200px;
    }

    .hero-facets {
        display: none;
    }

    .puzzle-grid {
        gap: 40px;
    }
}
