/* ==============================================
   ppuzzle.org - Glitch-Art Puzzle Archive
   Colors: #F5EDD8, #3C2F1E, #8B6914, #C87941, #A8B596, #FFF8E8
   Fonts: Lora (display), Source Sans 3 (body)
   ============================================== */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 400;
    font-size: 1rem;
    line-height: 1.7;
    background-color: #F5EDD8;
    color: #3C2F1E;
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
}

/* --- Scanlines Overlay --- */
.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 3px,
        rgba(60, 47, 30, 0.03) 3px,
        rgba(60, 47, 30, 0.03) 4px
    );
    animation: scanlineScroll 8s linear infinite;
}

@keyframes scanlineScroll {
    0% { transform: translateY(0); }
    100% { transform: translateY(4px); }
}

/* --- Organic Blob Decorations --- */
.blob {
    position: fixed;
    border-radius: 50%;
    filter: blur(60px);
    pointer-events: none;
    z-index: 0;
    opacity: 0.35;
    animation: blobDrift 20s ease-in-out infinite alternate;
}

.blob-1 {
    width: 400px;
    height: 400px;
    background: #A8B596;
    top: -100px;
    left: -100px;
    animation-delay: 0s;
    border-radius: 60% 40% 70% 30% / 50% 60% 40% 50%;
}

.blob-2 {
    width: 350px;
    height: 350px;
    background: #C87941;
    top: 30%;
    right: -80px;
    animation-delay: -5s;
    border-radius: 40% 60% 30% 70% / 60% 40% 50% 50%;
}

.blob-3 {
    width: 300px;
    height: 300px;
    background: #8B6914;
    bottom: 10%;
    left: 5%;
    animation-delay: -10s;
    border-radius: 50% 50% 40% 60% / 40% 60% 50% 50%;
}

.blob-4 {
    width: 250px;
    height: 250px;
    background: #A8B596;
    top: 60%;
    right: 15%;
    animation-delay: -15s;
    border-radius: 70% 30% 50% 50% / 50% 50% 60% 40%;
}

.blob-5 {
    width: 200px;
    height: 200px;
    background: #C87941;
    top: 10%;
    left: 40%;
    animation-delay: -3s;
    border-radius: 30% 70% 60% 40% / 60% 40% 50% 50%;
}

@keyframes blobDrift {
    0% {
        transform: translate(0, 0) scale(1) rotate(0deg);
    }
    33% {
        transform: translate(30px, -20px) scale(1.05) rotate(5deg);
    }
    66% {
        transform: translate(-20px, 15px) scale(0.95) rotate(-3deg);
    }
    100% {
        transform: translate(15px, 25px) scale(1.02) rotate(2deg);
    }
}

/* --- Glitch Text Effect --- */
.glitch-text {
    position: relative;
}

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

.glitch-text::before {
    color: rgba(200, 121, 65, 0.6);
    text-shadow: -2px 0 #C87941;
    clip-path: inset(0 0 65% 0);
    animation: glitchShift1 4s ease-in-out infinite alternate;
}

.glitch-text::after {
    color: rgba(168, 181, 150, 0.6);
    text-shadow: 2px 0 #A8B596;
    clip-path: inset(65% 0 0 0);
    animation: glitchShift2 3.5s ease-in-out infinite alternate-reverse;
}

@keyframes glitchShift1 {
    0%, 90% { transform: translate(0); }
    92% { transform: translate(-3px, 1px); }
    94% { transform: translate(2px, -1px); }
    96% { transform: translate(-1px, 0); }
    98% { transform: translate(3px, 1px); }
    100% { transform: translate(0); }
}

@keyframes glitchShift2 {
    0%, 88% { transform: translate(0); }
    90% { transform: translate(2px, -1px); }
    93% { transform: translate(-3px, 1px); }
    96% { transform: translate(1px, 0); }
    100% { transform: translate(0); }
}

/* --- Header --- */
.site-header {
    position: relative;
    z-index: 10;
    text-align: center;
    padding: 5rem 2rem 3rem;
}

.header-inner {
    max-width: 800px;
    margin: 0 auto;
}

.site-title {
    font-family: 'Lora', serif;
    font-weight: 700;
    font-size: clamp(2rem, 4.5vw, 4rem);
    color: #3C2F1E;
    letter-spacing: 0.02em;
    margin-bottom: 0.5rem;
}

.site-subtitle {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 600;
    font-size: 1.1rem;
    color: #8B6914;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 0.75rem;
}

.site-tagline {
    font-family: 'Source Sans 3', sans-serif;
    font-size: 0.95rem;
    color: #C87941;
    font-style: italic;
    opacity: 0.8;
}

/* --- Archive Main --- */
.archive-main {
    position: relative;
    z-index: 5;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* --- Archive Grid --- */
.archive-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-bottom: 4rem;
}

/* Featured entries span 2 columns */
.archive-entry.featured {
    grid-column: span 2;
}

/* --- Archive Entry --- */
.archive-entry {
    position: relative;
    background: #FFF8E8;
    border: 1px solid rgba(139, 105, 20, 0.15);
    border-radius: 4px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.archive-entry:hover {
    transform: translateY(-2px);
    box-shadow:
        0 8px 30px rgba(60, 47, 30, 0.1),
        0 2px 8px rgba(139, 105, 20, 0.08);
}

/* Glitch overlay on entries */
.entry-glitch-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
    opacity: 0;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 2px,
        rgba(139, 105, 20, 0.04) 2px,
        rgba(139, 105, 20, 0.04) 3px
    );
    transition: opacity 0.3s ease;
}

.archive-entry:hover .entry-glitch-overlay {
    opacity: 1;
}

.archive-entry.featured .entry-glitch-overlay {
    opacity: 0.5;
    animation: entryGlitch 6s ease-in-out infinite;
}

@keyframes entryGlitch {
    0%, 85% { opacity: 0.5; }
    87% { opacity: 0.8; }
    89% { opacity: 0.3; }
    91% { opacity: 0.7; }
    93% { opacity: 0.5; }
    100% { opacity: 0.5; }
}

.entry-inner {
    position: relative;
    z-index: 1;
    padding: 2rem;
}

.entry-number {
    font-family: 'Source Sans 3', sans-serif;
    font-size: 0.75rem;
    color: #A8B596;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.entry-title {
    font-family: 'Lora', serif;
    font-weight: 700;
    font-size: 1.4rem;
    color: #3C2F1E;
    margin-bottom: 0.75rem;
    line-height: 1.3;
}

.archive-entry.featured .entry-title {
    font-size: 1.8rem;
}

.entry-desc {
    font-family: 'Source Sans 3', sans-serif;
    font-size: 0.95rem;
    line-height: 1.7;
    color: #3C2F1E;
    opacity: 0.85;
    margin-bottom: 1rem;
}

/* --- Meta Tags --- */
.entry-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.meta-tag {
    font-family: 'Source Sans 3', sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.2rem 0.6rem;
    background: rgba(139, 105, 20, 0.08);
    color: #8B6914;
    border: 1px solid rgba(139, 105, 20, 0.15);
    border-radius: 2px;
}

/* --- Zoom-Focus Detail --- */
.entry-detail {
    margin-top: 0.5rem;
    border-radius: 3px;
    overflow: hidden;
    background: rgba(60, 47, 30, 0.03);
    padding: 1rem;
    transition: transform 0.4s ease, filter 0.4s ease;
    transform-origin: center center;
    cursor: crosshair;
}

.entry-detail:hover {
    transform: scale(1.08);
    filter: contrast(1.1) brightness(1.02);
}

.puzzle-svg {
    width: 100%;
    height: auto;
    display: block;
    max-height: 120px;
}

.archive-entry.featured .puzzle-svg {
    max-height: 140px;
}

/* --- Footer --- */
.archive-footer {
    position: relative;
    z-index: 10;
    border-top: 1px solid rgba(139, 105, 20, 0.15);
    padding: 2.5rem 2rem;
    text-align: center;
    margin-top: 2rem;
}

.footer-inner {
    max-width: 700px;
    margin: 0 auto;
}

.footer-text {
    font-family: 'Lora', serif;
    font-weight: 700;
    font-size: 1rem;
    color: #3C2F1E;
    margin-bottom: 0.5rem;
}

.footer-status {
    font-family: 'Source Sans 3', sans-serif;
    font-size: 0.8rem;
    color: #C87941;
    opacity: 0.7;
}

.status-value {
    color: #8B6914;
    font-weight: 600;
}

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

    .archive-entry.featured {
        grid-column: span 1;
    }

    .site-header {
        padding: 3rem 1.5rem 2rem;
    }

    .archive-main {
        padding: 1rem;
    }

    .entry-inner {
        padding: 1.5rem;
    }

    .site-title {
        font-size: clamp(1.8rem, 6vw, 2.5rem);
    }
}

@media (max-width: 500px) {
    .entry-title {
        font-size: 1.2rem;
    }

    .archive-entry.featured .entry-title {
        font-size: 1.4rem;
    }

    .entry-desc {
        font-size: 0.9rem;
    }
}
