/* ppuzzl.bid - Neubrutalist Midnight Blue Design */

/* ============================================
   CSS Custom Properties
   ============================================ */
:root {
    --bg-primary: #0A1628;
    --bg-secondary: #0F1F3D;
    --bg-tertiary: #162D52;
    --text-primary: #E8E8F0;
    --text-secondary: #B8B8CC;
    --text-tertiary: #7878A0;
    --accent-yellow: #FFE600;
    --accent-magenta: #FF2E63;
    --accent-cyan: #00F5FF;
    --border-black: #000000;
    --surface-purple: #2A1B4E;
    --shadow-offset: 8px;
    --border-width: 4px;
    --spring-ease: cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 400;
    line-height: 1.65;
    overflow-x: hidden;
    position: relative;
}

/* ============================================
   Noise Texture Overlay
   ============================================ */
#noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.04;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}

/* ============================================
   Typography
   ============================================ */
h1, h2, .wave-word {
    font-family: 'Anybody', sans-serif;
    font-weight: 900;
    font-stretch: 150%;
    text-transform: uppercase;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    line-height: 1.05;
}

h1 {
    font-size: clamp(2.5rem, 8vw + 1rem, 8rem);
}

h2 {
    font-size: clamp(2rem, 5vw + 0.5rem, 5rem);
    font-stretch: 125%;
}

h3 {
    font-family: 'Anybody', sans-serif;
    font-weight: 700;
    font-stretch: 75%;
    text-transform: lowercase;
    letter-spacing: -0.02em;
    font-size: clamp(1.2rem, 2.5vw, 2rem);
    color: var(--text-primary);
    margin-bottom: 16px;
}

p {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(1rem, 1.5vw, 1.25rem);
    color: var(--text-secondary);
    line-height: 1.65;
}

.dim-text {
    color: var(--text-tertiary);
    font-size: clamp(0.85rem, 1.2vw, 1rem);
}

.mono-accent {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 500;
    font-size: clamp(0.75rem, 1vw, 0.9rem);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--accent-yellow);
    line-height: 2;
}

/* ============================================
   Navigation
   ============================================ */
#top-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background: var(--bg-primary);
    border-bottom: 6px solid var(--border-black);
    box-shadow: 0 6px 0 var(--accent-yellow);
}

.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 32px;
    max-width: 1440px;
    margin: 0 auto;
}

.nav-logo {
    font-family: 'Anybody', sans-serif;
    font-weight: 900;
    font-stretch: 150%;
    font-size: 1.8rem;
    text-transform: uppercase;
    letter-spacing: -0.03em;
    color: var(--accent-yellow);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-links a {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 500;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-primary);
    text-decoration: none;
    padding: 8px 12px;
    border: 2px solid transparent;
    transition: all 150ms var(--spring-ease);
}

.nav-links a:hover {
    color: var(--accent-yellow);
    border-color: var(--accent-yellow);
    transform: translateY(-2px);
}

.nav-pipe {
    color: var(--accent-magenta);
    font-weight: 700;
    font-size: 1.2rem;
}

/* ============================================
   Hero Section
   ============================================ */
#hero {
    display: flex;
    min-height: 100vh;
    padding-top: 100px;
    position: relative;
}

.hero-left {
    flex: 0 0 60%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 64px 48px 64px 48px;
    position: relative;
    z-index: 2;
}

#hero-headline {
    min-height: 1.2em;
    position: relative;
}

#hero-headline .cursor {
    display: inline-block;
    width: 8px;
    height: 1em;
    background: var(--accent-yellow);
    margin-left: 4px;
    vertical-align: baseline;
    animation: blink 0.8s step-end infinite;
}

#hero-subline {
    font-family: 'Anybody', sans-serif;
    font-weight: 400;
    font-stretch: 100%;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    color: var(--accent-yellow);
    text-transform: lowercase;
    margin-top: 24px;
    min-height: 1.5em;
}

#hero-subline .cursor {
    display: inline-block;
    width: 6px;
    height: 1em;
    background: var(--accent-yellow);
    margin-left: 4px;
    vertical-align: baseline;
    animation: blink 0.8s step-end infinite;
}

.highlight {
    color: var(--accent-yellow);
}

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

.hero-right {
    flex: 0 0 40%;
    position: relative;
    overflow: hidden;
}

#hero-mesh {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.gradient-mesh-panel {
    background:
        radial-gradient(ellipse 60% 50% at 30% 40%, rgba(0, 245, 255, 0.5) 0%, transparent 70%),
        radial-gradient(ellipse 50% 60% at 70% 30%, rgba(255, 46, 99, 0.4) 0%, transparent 65%),
        radial-gradient(ellipse 70% 40% at 50% 70%, rgba(255, 230, 0, 0.35) 0%, transparent 60%),
        radial-gradient(ellipse 40% 80% at 20% 80%, rgba(42, 27, 78, 0.6) 0%, transparent 55%),
        radial-gradient(ellipse 55% 55% at 80% 60%, rgba(0, 245, 255, 0.3) 0%, transparent 50%);
    background-size: 200% 200%;
    animation: meshDrift 25s ease-in-out infinite alternate;
}

@keyframes meshDrift {
    0% { background-position: 0% 0%, 100% 0%, 50% 100%, 0% 50%, 100% 50%; }
    25% { background-position: 30% 20%, 70% 30%, 40% 80%, 20% 60%, 80% 40%; }
    50% { background-position: 50% 50%, 40% 60%, 60% 40%, 30% 70%, 70% 30%; }
    75% { background-position: 70% 30%, 20% 80%, 80% 20%, 50% 50%, 50% 60%; }
    100% { background-position: 100% 100%, 0% 100%, 50% 0%, 100% 50%, 0% 50%; }
}

.manifesto-scroll {
    position: absolute;
    bottom: 80px;
    left: 24px;
    right: 24px;
    max-height: 200px;
    overflow-y: auto;
    padding: 24px;
    background: rgba(15, 31, 61, 0.85);
    border: 4px solid var(--border-black);
    box-shadow: 6px 6px 0 var(--accent-magenta);
    z-index: 2;
}

.manifesto-scroll::-webkit-scrollbar {
    width: 12px;
}

.manifesto-scroll::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

.manifesto-scroll::-webkit-scrollbar-thumb {
    background: var(--accent-yellow);
    border: 2px solid var(--border-black);
}

.manifesto-scroll p {
    font-size: clamp(0.85rem, 1.2vw, 1rem);
    color: var(--text-secondary);
    margin-bottom: 12px;
}

/* Audio Visualizer */
#audio-visualizer {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 80px;
    margin-top: 40px;
}

.viz-bar {
    width: 2px;
    background: var(--accent-cyan);
    animation: vizPulse 2s ease-in-out infinite alternate;
    transform-origin: bottom;
}

.viz-bar:nth-child(3n) { background: var(--accent-yellow); }
.viz-bar:nth-child(5n) { background: var(--accent-magenta); }

@keyframes vizPulse {
    0% { transform: scaleY(0.3); }
    50% { transform: scaleY(1); }
    100% { transform: scaleY(0.5); }
}

/* ============================================
   Wave Dividers
   ============================================ */
.wave-divider {
    width: 100%;
    height: 60px;
    overflow: hidden;
    position: relative;
}

.wave-divider svg {
    width: 200%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

.wave-path.wave-1 {
    animation: waveDrift1 15s linear infinite alternate;
}
.wave-path.wave-2 {
    animation: waveDrift2 12s linear infinite alternate;
}
.wave-path.wave-3 {
    animation: waveDrift3 18s linear infinite alternate;
}

@keyframes waveDrift1 { 0% { transform: translateX(0); } 100% { transform: translateX(-50%); } }
@keyframes waveDrift2 { 0% { transform: translateX(-25%); } 100% { transform: translateX(0); } }
@keyframes waveDrift3 { 0% { transform: translateX(0); } 100% { transform: translateX(-30%); } }

/* ============================================
   Interrupt Strips
   ============================================ */
.interrupt-strip {
    width: 100%;
    background: var(--accent-yellow);
    padding: 20px 32px;
    text-align: center;
    position: relative;
    border-top: 4px solid var(--border-black);
    border-bottom: 4px solid var(--border-black);
}

.interrupt-text {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 500;
    font-size: clamp(0.85rem, 1.5vw, 1.1rem);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--bg-primary);
    line-height: 1.4;
}

.interrupt-wave-top,
.interrupt-wave-bottom {
    position: absolute;
    left: 0;
    width: 100%;
    height: 20px;
    overflow: hidden;
}

.interrupt-wave-top {
    top: -14px;
}

.interrupt-wave-bottom {
    bottom: -14px;
}

.interrupt-wave-top svg,
.interrupt-wave-bottom svg {
    width: 100%;
    height: 100%;
}

.interrupt-inline {
    grid-column: 1 / -1;
    margin: 0 -4px;
}

/* ============================================
   Puzzle Grid Section
   ============================================ */
#puzzle-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    padding: 48px 32px;
    max-width: 1440px;
    margin: 0 auto;
    position: relative;
}

.puzzle-block {
    border: var(--border-width) solid var(--border-black);
    background: var(--bg-secondary);
    padding: 32px;
    position: relative;
    transition: transform 150ms var(--spring-ease), box-shadow 150ms var(--spring-ease);
    overflow: hidden;
}

.puzzle-block[data-shadow="yellow"] {
    box-shadow: var(--shadow-offset) var(--shadow-offset) 0 var(--accent-yellow);
}

.puzzle-block[data-shadow="magenta"] {
    box-shadow: var(--shadow-offset) var(--shadow-offset) 0 var(--accent-magenta);
}

.puzzle-block[data-shadow="cyan"] {
    box-shadow: var(--shadow-offset) var(--shadow-offset) 0 var(--accent-cyan);
}

.puzzle-block:hover {
    transform: translateY(-2px);
}

.puzzle-block[data-shadow="yellow"]:hover {
    box-shadow: 12px 12px 0 var(--accent-yellow);
}

.puzzle-block[data-shadow="magenta"]:hover {
    box-shadow: 12px 12px 0 var(--accent-magenta);
}

.puzzle-block[data-shadow="cyan"]:hover {
    box-shadow: 12px 12px 0 var(--accent-cyan);
}

/* Block sizes */
.block-large {
    grid-column: span 2;
    min-height: 400px;
    padding: 48px;
}

.block-medium {
    min-height: 300px;
}

.block-small {
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.block-tall {
    grid-row: span 2;
    min-height: 500px;
    padding: 48px;
}

.block-wide {
    grid-column: span 2;
    min-height: 250px;
    padding: 0;
}

.block-wide .gradient-mesh-panel {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

/* Mesh panel small */
.mesh-small {
    position: absolute;
    top: 0;
    right: 0;
    width: 40%;
    height: 100%;
    clip-path: polygon(20% 0%, 100% 0%, 100% 100%, 0% 100%);
    z-index: 0;
}

.mesh-wide {
    clip-path: polygon(0% 0%, 100% 0%, 100% 80%, 90% 100%, 10% 100%, 0% 80%);
}

.puzzle-block > h2,
.puzzle-block > h3,
.puzzle-block > p,
.puzzle-block > .mono-accent {
    position: relative;
    z-index: 1;
}

/* Reveal animation */
.reveal-block {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 500ms var(--spring-ease), transform 500ms var(--spring-ease);
}

.reveal-block.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Mini visualizer in small block */
.visualizer-mini {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 60px;
}

/* Frequency bars in tall block */
.frequency-bars {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 50px;
    margin-top: 24px;
}

.freq-bar {
    width: 3px;
    background: var(--accent-cyan);
    animation: vizPulse 2s ease-in-out infinite alternate;
    transform-origin: bottom;
}

.freq-bar:nth-child(2n) { background: var(--accent-magenta); }
.freq-bar:nth-child(3n) { background: var(--accent-yellow); }

/* ============================================
   Full-Bleed Wave Section
   ============================================ */
#wave-section {
    min-height: 100vh;
    background: var(--bg-secondary);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.wave-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.wave-canvas svg {
    width: 100%;
    height: 100%;
}

.wave-text-overlay {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
}

.wave-word {
    font-size: clamp(3rem, 10vw, 10rem);
    font-stretch: 150%;
    font-weight: 900;
    display: block;
    transition: font-stretch 300ms var(--spring-ease), font-weight 300ms var(--spring-ease);
}

.wave-word:nth-child(1) { color: var(--accent-cyan); }
.wave-word:nth-child(2) { color: var(--accent-magenta); }
.wave-word:nth-child(3) { color: var(--accent-yellow); }
.wave-word:nth-child(4) { color: var(--text-primary); }

.wave-word:hover {
    font-stretch: 75%;
    font-weight: 400;
}

/* ============================================
   Final Puzzle Section
   ============================================ */
#final-section {
    padding: 80px 32px;
    max-width: 1440px;
    margin: 0 auto;
}

.final-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    transition: gap 800ms var(--spring-ease);
}

.final-grid.snapped {
    gap: 0;
}

.final-block {
    border: var(--border-width) solid var(--border-black);
    background: var(--bg-secondary);
    padding: 40px;
    transition: box-shadow 800ms var(--spring-ease), transform 800ms var(--spring-ease);
}

.final-block[data-shadow="yellow"] {
    box-shadow: var(--shadow-offset) var(--shadow-offset) 0 var(--accent-yellow);
}
.final-block[data-shadow="magenta"] {
    box-shadow: var(--shadow-offset) var(--shadow-offset) 0 var(--accent-magenta);
}
.final-block[data-shadow="cyan"] {
    box-shadow: var(--shadow-offset) var(--shadow-offset) 0 var(--accent-cyan);
}

.final-grid.snapped .final-block {
    box-shadow: 0 0 0 transparent;
}

.final-typewriter {
    margin-top: 64px;
    text-align: center;
}

#final-headline {
    font-family: 'Anybody', sans-serif;
    font-weight: 700;
    font-stretch: 125%;
    font-size: clamp(2rem, 5vw, 4rem);
    color: var(--accent-yellow);
    text-transform: lowercase;
    min-height: 1.5em;
}

#final-headline .cursor {
    display: inline-block;
    width: 8px;
    height: 1em;
    background: var(--accent-yellow);
    margin-left: 4px;
    vertical-align: baseline;
    animation: blink 0.8s step-end infinite;
}

/* ============================================
   Footer
   ============================================ */
#footer {
    border-top: 6px solid var(--border-black);
    background: var(--bg-primary);
    padding: 64px 32px;
    position: relative;
}

.footer-inner {
    display: grid;
    grid-template-columns: 1fr 1fr 200px;
    gap: 32px;
    max-width: 1440px;
    margin: 0 auto;
    align-items: start;
}

.footer-col {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.footer-link {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 500;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-tertiary);
    line-height: 1.8;
}

.footer-puzzle-piece {
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
}

.puzzle-footer-svg {
    width: 160px;
    height: 160px;
    animation: puzzleSpin 30s linear infinite;
}

@keyframes puzzleSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Rotate the gradient for conic effect */
#puzzle-gradient {
    animation: gradientRotate 30s linear infinite;
}

/* ============================================
   Responsive - Tablet
   ============================================ */
@media (max-width: 768px) {
    #hero {
        flex-direction: column;
    }

    .hero-left {
        flex: none;
        padding: 32px 24px;
    }

    .hero-right {
        flex: none;
        height: 50vh;
    }

    .manifesto-scroll {
        position: relative;
        bottom: auto;
        left: auto;
        right: auto;
        margin: 24px;
    }

    #puzzle-grid {
        grid-template-columns: 1fr;
        padding: 24px 16px;
    }

    .block-large,
    .block-wide {
        grid-column: span 1;
    }

    .block-tall {
        grid-row: span 1;
        min-height: 350px;
    }

    .final-grid {
        grid-template-columns: 1fr;
    }

    .footer-inner {
        grid-template-columns: 1fr;
    }

    .footer-puzzle-piece {
        justify-content: center;
    }

    .nav-links a {
        font-size: 0.7rem;
        padding: 6px 8px;
    }

    .wave-word {
        font-size: clamp(2rem, 8vw, 5rem);
    }
}

/* ============================================
   Responsive - Mobile
   ============================================ */
@media (max-width: 480px) {
    :root {
        --shadow-offset: 4px;
        --border-width: 3px;
    }

    .nav-logo {
        font-size: 1.2rem;
    }

    .nav-pipe {
        display: none;
    }

    .nav-links {
        gap: 2px;
    }

    .nav-links a {
        font-size: 0.6rem;
        padding: 4px 6px;
    }

    .hero-left {
        padding: 24px 16px;
    }

    .puzzle-block {
        padding: 24px;
    }

    .block-large {
        padding: 32px;
    }

    .final-block {
        padding: 24px;
    }

    #footer {
        padding: 32px 16px;
    }
}

/* ============================================
   Puzzle piece clip-path notches
   ============================================ */
.puzzle-block::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: var(--bg-primary);
    bottom: -2px;
    right: -2px;
    clip-path: polygon(100% 0%, 100% 100%, 0% 100%);
}

.puzzle-block:nth-child(even)::after {
    top: -2px;
    bottom: auto;
    left: -2px;
    right: auto;
    clip-path: polygon(0% 0%, 100% 0%, 0% 100%);
}

/* ============================================
   Hover wave distortion for headlines
   ============================================ */
.puzzle-block h2:hover,
.puzzle-block h3:hover {
    filter: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='wave'%3E%3CfeTurbulence type='turbulence' baseFrequency='0.015' numOctaves='2' result='turbulence'/%3E%3CfeDisplacementMap in='SourceGraphic' in2='turbulence' scale='3' xChannelSelector='R' yChannelSelector='G'/%3E%3C/filter%3E%3C/svg%3E#wave");
}

/* ============================================
   Scrollbar Styling
   ============================================ */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--accent-yellow);
    border: 2px solid var(--border-black);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-magenta);
}

/* ============================================
   Interactive element cursor
   ============================================ */
a, button, .puzzle-block, .wave-word, .final-block {
    cursor: pointer;
}

/* ============================================
   Selection styles
   ============================================ */
::selection {
    background: var(--accent-yellow);
    color: var(--bg-primary);
}
