/* ========================================
   p9r.xyz — Styles
   Dark-neon broken-grid deconstructionism
   ======================================== */

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

:root {
    --void: #0a0a0f;
    --surface: #0d0d15;
    --border: #1a1a2e;
    --neon-cyan: #00ffd5;
    --neon-magenta: #ff00aa;
    --text-primary: #e8e8f0;
    --text-secondary: #9a9ab8;
    --text-tertiary: #8a3a6e;
    --acid: #c8ff00;
    --dim-surface: #2a2a3f;
    --panel-bg: rgba(13, 13, 21, 0.6);
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--void);
    color: var(--text-secondary);
    font-family: 'Space Grotesk', sans-serif;
    font-size: 15px;
    line-height: 1.72;
    overflow-x: hidden;
}

/* --- Typography --- */
h1, h2 {
    font-family: 'Libre Baskerville', serif;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.04em;
    text-shadow: 0 0 40px rgba(0, 255, 213, 0.15);
}

h2 {
    font-size: clamp(2rem, 5vw, 4rem);
    line-height: 1.1;
    margin-bottom: 1.2rem;
}

p {
    max-width: 32.5rem;
    color: var(--text-secondary);
}

.panel-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-tertiary);
    display: block;
    margin-bottom: 1rem;
}

/* --- Organic Blobs --- */
.blob {
    position: absolute;
    border-radius: 40% 60% 55% 45% / 50% 35% 65% 50%;
    pointer-events: none;
    z-index: -1;
}

.blob-hero {
    width: 500px;
    height: 500px;
    top: 50%;
    left: 50%;
    transform: translate(-30%, -50%);
    background: radial-gradient(circle, rgba(255, 0, 170, 0.12) 0%, transparent 70%);
    animation: blobMorph1 18s ease-in-out infinite;
}

.blob-frag-1 {
    width: 400px;
    height: 400px;
    top: 10%;
    right: -100px;
    background: radial-gradient(circle, rgba(0, 255, 213, 0.1) 0%, transparent 70%);
    animation: blobMorph2 22s ease-in-out infinite;
}

.blob-frag-2 {
    width: 600px;
    height: 600px;
    bottom: 5%;
    left: -150px;
    background: radial-gradient(circle, rgba(255, 0, 170, 0.08) 0%, transparent 70%);
    animation: blobMorph3 25s ease-in-out infinite;
}

.blob-pulse-1 {
    width: 450px;
    height: 450px;
    top: 20%;
    left: 10%;
    background: radial-gradient(circle, rgba(0, 255, 213, 0.1) 0%, transparent 70%);
    animation: blobMorph1 20s ease-in-out infinite reverse;
}

.blob-pulse-2 {
    width: 350px;
    height: 350px;
    bottom: 10%;
    right: 5%;
    background: radial-gradient(circle, rgba(255, 0, 170, 0.1) 0%, transparent 70%);
    animation: blobMorph2 16s ease-in-out infinite;
}

@keyframes blobMorph1 {
    0%, 100% { border-radius: 40% 60% 55% 45% / 50% 35% 65% 50%; transform: translate(-30%, -50%) translateX(0); }
    33% { border-radius: 55% 45% 40% 60% / 35% 60% 40% 65%; transform: translate(-30%, -50%) translateX(15px); }
    66% { border-radius: 45% 55% 60% 40% / 65% 45% 55% 35%; transform: translate(-30%, -50%) translateX(-20px); }
}

@keyframes blobMorph2 {
    0%, 100% { border-radius: 50% 50% 40% 60% / 60% 40% 55% 45%; transform: translateY(0); }
    50% { border-radius: 35% 65% 55% 45% / 45% 55% 40% 60%; transform: translateY(25px); }
}

@keyframes blobMorph3 {
    0%, 100% { border-radius: 60% 40% 45% 55% / 40% 60% 50% 50%; transform: translateX(0); }
    50% { border-radius: 45% 55% 60% 40% / 55% 45% 40% 60%; transform: translateX(-30px); }
}

/* --- Skeleton Shimmer Bars --- */
@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.shimmer-bar,
.skeleton-bar {
    background: linear-gradient(90deg, var(--surface) 25%, rgba(200, 255, 0, 0.06) 50%, var(--surface) 75%);
    background-size: 200% 100%;
    animation: shimmer 2.5s ease-in-out infinite;
}

.shimmer-intro {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60vw;
    height: 3px;
    z-index: 5;
    opacity: 0;
}

.shimmer-intro.active {
    opacity: 1;
}

.shimmer-intro.fade-out {
    opacity: 0;
    transition: opacity 0.4s ease;
}

.skeleton-bar {
    height: 3px;
    border-radius: 1px;
}

.skel-1 {
    grid-column: 2 / 7;
    width: 65%;
    margin: 20px 0;
}

.skel-2 {
    grid-column: 6 / 10;
    width: 40%;
    margin: 10px 0;
    justify-self: end;
}

.skel-3 {
    position: absolute;
    bottom: 60px;
    left: 15%;
    width: 30%;
}

/* --- Decorative Lines --- */
.decorative-line {
    position: absolute;
    background-color: var(--border);
    pointer-events: none;
}

.dl-1 {
    width: 120%;
    height: 1px;
    top: 62%;
    left: -10%;
    opacity: 0.6;
    border-top: 1px dashed var(--border);
    background: none;
}

.dl-2 {
    width: 1px;
    height: 40%;
    top: 30%;
    right: 18%;
    background-color: rgba(0, 255, 213, 0.12);
    transform: rotate(8deg);
}

.dl-3 {
    width: 80%;
    height: 1px;
    bottom: 15%;
    left: -5%;
    background-color: rgba(0, 255, 213, 0.08);
    transform: rotate(-3deg);
}

.dl-4 {
    width: 1px;
    height: 60%;
    top: 10%;
    left: 25%;
    background-color: var(--border);
    opacity: 0.4;
    transform: rotate(5deg);
}

.dl-5 {
    width: 100%;
    height: 1px;
    top: 40%;
    left: 0;
    border-top: 1px dotted rgba(0, 255, 213, 0.15);
    background: none;
    transform: rotate(2deg);
}

/* ============================================
   SIGNAL ZONE (Hero)
   ============================================ */
#signal-zone {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background-color: var(--void);
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: left;
}

.hero-glyph {
    font-size: clamp(6rem, 15vw, 12rem);
    color: var(--text-primary);
    line-height: 1;
    letter-spacing: -0.04em;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.hero-glyph.visible {
    opacity: 1;
    transform: translateY(0);
}

.hero-suffix {
    display: block;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3em;
    color: var(--neon-cyan);
    margin-top: 0.5rem;
    margin-left: 0.5rem;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.hero-suffix.visible {
    opacity: 1;
}

.signal-line {
    position: absolute;
    top: 62%;
    left: 0;
    width: 100%;
    height: 1px;
    border-top: 1px dashed var(--dim-surface);
    z-index: 1;
}

/* ============================================
   FRAGMENT ZONE (Content)
   ============================================ */
#fragment-zone {
    position: relative;
    padding: 120px 5vw 160px;
    min-height: 100vh;
}

.fragment-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.fragment-panel {
    padding: 2.5rem 2rem;
    position: relative;
    opacity: 0;
    transition: opacity 0.7s ease, transform 0.7s ease;
}

.fragment-panel.in-view {
    opacity: 1;
    transform: translate(0, 0) rotate(var(--rot, 0deg));
}

.fp-1 {
    grid-column: 1 / 7;
    border-left: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    background: var(--panel-bg);
    transform: translateX(-40px) rotate(-2deg);
    --rot: -2deg;
}

.fp-2 {
    grid-column: 6 / 12;
    border-right: 1px solid var(--border);
    border-top: 1px solid var(--border);
    margin-top: -40px;
    transform: translateX(40px) rotate(3deg);
    --rot: 3deg;
}

.fp-3 {
    grid-column: 2 / 8;
    border-left: 1px solid var(--border);
    background: var(--panel-bg);
    margin-top: -20px;
    transform: translateX(-40px) rotate(-1deg);
    --rot: -1deg;
}

.fp-4 {
    grid-column: 7 / 13;
    border-bottom: 1px solid var(--border);
    border-right: 1px solid var(--border);
    margin-top: -50px;
    transform: translateX(40px) rotate(4deg);
    --rot: 4deg;
}

/* ============================================
   PULSE ZONE (Icons)
   ============================================ */
#pulse-zone {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

.pulse-field {
    position: relative;
    width: 100%;
    height: 100%;
}

.pulse-icon {
    position: absolute;
    left: var(--x);
    top: var(--y);
    color: var(--neon-cyan);
    animation: iconPulse 4s ease-in-out infinite;
    animation-delay: var(--delay);
    transition: color 0.4s cubic-bezier(0.16, 1, 0.3, 1), transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: default;
}

.pulse-icon:hover {
    color: var(--neon-magenta);
}

.pulse-icon svg {
    display: block;
}

@keyframes iconPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

/* ============================================
   RESIDUE ZONE (Footer)
   ============================================ */
#residue-zone {
    position: relative;
    height: 40vh;
    overflow: hidden;
    display: flex;
    align-items: center;
}

.residue-watermark {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding-left: 3vw;
}

.residue-watermark span {
    font-family: 'Libre Baskerville', serif;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.4em;
    color: var(--text-primary);
    opacity: 0.2;
    writing-mode: horizontal-tb;
}

.residue-line {
    position: absolute;
    bottom: 30%;
    left: 15%;
    width: 50%;
    height: 2px;
    background-color: var(--neon-cyan);
    opacity: 0;
    transition: opacity 1s ease;
}

.residue-line.pulse-once {
    animation: residuePulse 2s ease forwards;
}

@keyframes residuePulse {
    0% { opacity: 0; }
    30% { opacity: 1; }
    100% { opacity: 0; }
}

/* ============================================
   REVEAL ANIMATION BASE
   ============================================ */
.reveal {
    opacity: 0;
}

.reveal[data-direction="left"] {
    transform: translateX(-40px) rotate(var(--rot, 0deg));
}

.reveal[data-direction="right"] {
    transform: translateX(40px) rotate(var(--rot, 0deg));
}

.reveal.in-view {
    opacity: 1;
    transform: translateX(0) rotate(var(--rot, 0deg));
}

/* ============================================
   RESPONSIVE (< 768px)
   ============================================ */
@media (max-width: 768px) {
    .fragment-grid {
        display: flex;
        flex-direction: column;
        gap: 2rem;
    }

    .fragment-panel {
        margin-top: 0;
    }

    .fp-1 { transform: translateX(-10px) rotate(-1deg); }
    .fp-2 { transform: translateX(10px) rotate(1.5deg); }
    .fp-3 { transform: translateX(-10px) rotate(-0.5deg); }
    .fp-4 { transform: translateX(10px) rotate(2deg); }

    .fp-1.in-view { transform: translateX(0) rotate(-1deg); }
    .fp-2.in-view { transform: translateX(0) rotate(1.5deg); }
    .fp-3.in-view { transform: translateX(0) rotate(-0.5deg); }
    .fp-4.in-view { transform: translateX(0) rotate(2deg); }

    .skeleton-bar {
        width: 50% !important;
    }

    .skel-1, .skel-2 {
        justify-self: start;
    }

    .pulse-icon svg {
        width: 36px;
        height: 36px;
    }

    .hero-glyph {
        font-size: clamp(4rem, 15vw, 8rem);
    }

    .blob {
        transform: scale(0.6);
    }
}
