/* ============================================================
   SocialDebug.Org -- Styles
   Isometric debugging environment / ma negative space
   Five-act play rendered in isometric geometry
   ============================================================ */

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

:root {
    /* Palette */
    --void: #0D0221;
    --structure: #1A0A2E;
    --structure-left: #150826;
    --structure-right: #100620;
    --white: #FFFFFF;
    --lavender: #C8B8DB;
    --pink: #FF2D6F;
    --cyan: #00F0FF;
    --green: #39FF14;
    --gold: #FFD700;

    /* Typography */
    --font-display: 'Bebas Neue', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-mono: 'IBM Plex Mono', monospace;

    /* Isometric cube sizes */
    --cube-large: 60px;
    --cube-medium: 48px;
    --cube-small: 36px;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--void);
    color: var(--lavender);
    font-family: var(--font-body);
    font-size: 18px;
    line-height: 1.75;
    overflow-x: hidden;
}

/* --- Panel Base --- */
.panel {
    min-height: 100vh;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
}

/* --- Typography --- */
.panel-title {
    font-family: var(--font-display);
    font-size: clamp(56px, 8vw, 96px);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--white);
    line-height: 1;
    margin-bottom: 20px;
}

.panel-body {
    font-family: var(--font-body);
    font-size: 18px;
    line-height: 1.75;
    font-weight: 400;
    color: var(--lavender);
    max-width: 420px;
}

.panel-body strong,
.panel-body em {
    font-weight: 600;
}

.label {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.15em;
    color: var(--cyan);
    text-transform: uppercase;
    display: block;
    margin-bottom: 16px;
}

/* --- Panel Content Positioning --- */
.panel-content {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 800ms ease, transform 800ms ease;
    z-index: 2;
    position: relative;
}

.panel-content.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Panel 1: left side */
.panel-content--left {
    position: absolute;
    left: 8%;
    top: 50%;
    transform: translateY(calc(-50% + 20px));
    max-width: 500px;
}

.panel-content--left.visible {
    transform: translateY(-50%);
}

/* Panel 2: upper right */
.panel-content--upper-right {
    position: absolute;
    right: 8%;
    top: 20%;
    max-width: 420px;
    text-align: right;
}

/* Panel 3: inside cracked cube */
.panel-content--inside {
    position: relative;
    z-index: 3;
    text-align: center;
    padding: 20px;
}

.panel-body--dark {
    color: var(--void);
    font-weight: 600;
    max-width: 280px;
    margin: 0 auto;
}

.label--dark {
    color: var(--void);
}

/* Panel 4: two columns flanking */
.panel-content--col-left {
    position: absolute;
    left: 6%;
    top: 50%;
    transform: translateY(calc(-50% + 20px));
    max-width: 320px;
}

.panel-content--col-left.visible {
    transform: translateY(-50%);
}

.panel-content--col-right {
    position: absolute;
    right: 6%;
    top: 50%;
    transform: translateY(calc(-50% + 20px));
    max-width: 260px;
}

.panel-content--col-right.visible {
    transform: translateY(-50%);
}

/* Panel 5: upper left */
.panel-content--upper-left {
    position: absolute;
    left: 8%;
    top: 18%;
    max-width: 480px;
}

/* --- Panel Illustrations Positioning --- */
.panel-illustration {
    position: absolute;
    z-index: 1;
}

.panel-illustration--right {
    right: 12%;
    bottom: 15%;
}

.panel-illustration--thread-left {
    left: 8%;
    bottom: 12%;
}

.panel-illustration--center {
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

.panel-illustration--bottom-right {
    right: 10%;
    bottom: 10%;
}

/* ============================================================
   ISOMETRIC ENGINE
   ============================================================ */

/* --- Cube Base --- */
.iso-cube {
    position: relative;
    transform-style: preserve-3d;
    width: var(--cube-large);
    height: var(--cube-large);
}

.iso-cube--large {
    width: var(--cube-large);
    height: var(--cube-large);
}

.iso-cube--medium {
    width: var(--cube-medium);
    height: var(--cube-medium);
}

.iso-cube--small {
    width: var(--cube-small);
    height: var(--cube-small);
}

/* --- Faces --- */
.face {
    position: absolute;
    width: 100%;
    height: 100%;
}

.face-top {
    background: var(--structure);
    transform: rotateX(60deg) rotateZ(45deg);
    transform-origin: center center;
    width: 70.7%;
    height: 70.7%;
    top: -20%;
    left: 14.6%;
}

.face-left {
    background: var(--structure-left);
    transform: skewY(-30deg);
    width: 50%;
    height: 86.6%;
    top: 13.4%;
    left: 0;
}

.face-right {
    background: var(--structure-right);
    transform: skewY(30deg);
    width: 50%;
    height: 86.6%;
    top: 13.4%;
    left: 50%;
}

/* Edge glow for feed tower */
#panel-feed .face-left {
    box-shadow: -2px 0 8px rgba(255, 45, 111, 0.6);
}

#panel-feed .face-right {
    box-shadow: 2px 0 8px rgba(0, 240, 255, 0.6);
}

/* --- Tower --- */
.iso-tower {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.iso-tower .iso-cube {
    margin-top: -20px;
}

.iso-tower .iso-cube:first-child {
    margin-top: 0;
}

/* Staggered build animation */
.iso-tower .iso-cube,
.iso-thread .thread-node {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 400ms ease, transform 400ms ease;
}

.panel.active .iso-tower .iso-cube,
.panel.active .iso-thread .thread-node {
    opacity: 1;
    transform: translateY(0);
}

/* Staggered delays for tower cubes */
.panel.active .iso-tower .iso-cube:nth-child(1) { transition-delay: 0ms; }
.panel.active .iso-tower .iso-cube:nth-child(2) { transition-delay: 120ms; }
.panel.active .iso-tower .iso-cube:nth-child(3) { transition-delay: 240ms; }
.panel.active .iso-tower .iso-cube:nth-child(4) { transition-delay: 360ms; }
.panel.active .iso-tower .iso-cube:nth-child(5) { transition-delay: 480ms; }
.panel.active .iso-tower .iso-cube:nth-child(6) { transition-delay: 600ms; }

/* Staggered delays for thread nodes */
.panel.active .iso-thread .thread-node:nth-child(1) { transition-delay: 0ms; }
.panel.active .iso-thread .thread-node:nth-child(2) { transition-delay: 240ms; }
.panel.active .iso-thread .thread-node:nth-child(3) { transition-delay: 480ms; }
.panel.active .iso-thread .thread-node:nth-child(4) { transition-delay: 600ms; }
.panel.active .iso-thread .thread-node:nth-child(5) { transition-delay: 720ms; }

/* Small tower (Panel 5) */
.iso-tower--small {
    transform: scale(0.6);
    transform-origin: bottom right;
}

/* Steady glow on quiet tower -- no glitch, total stillness */
#tower-quiet .face-left {
    box-shadow: -1px 0 12px rgba(0, 240, 255, 0.4);
}

#tower-quiet .face-right {
    box-shadow: 1px 0 12px rgba(0, 240, 255, 0.4);
}

/* --- Thread System (Panel 2) --- */
.iso-thread {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.thread-node {
    position: relative;
}

.thread-node--2 {
    margin-left: 30px;
}

.thread-node--3 {
    margin-left: 60px;
}

.thread-node--4 {
    margin-left: 90px;
}

.thread-node--5 {
    margin-left: 40px;
}

/* Conduits -- connecting lines at isometric angles */
.conduit {
    width: 40px;
    height: 4px;
    background: var(--cyan);
    transform: skewY(-30deg);
    margin-left: 20px;
    opacity: 0;
    transition: opacity 600ms ease;
    animation: conduitPulse 4s ease-in-out infinite;
    animation-play-state: paused;
}

.panel.active .conduit {
    opacity: 0.7;
    animation-play-state: running;
}

.conduit--2 {
    margin-left: 50px;
    transform: skewY(15deg);
    width: 35px;
}

.conduit--branch {
    margin-left: 80px;
    transform: skewY(-45deg);
    width: 30px;
    background: var(--pink);
}

.conduit--3 {
    margin-left: 60px;
    transform: skewY(20deg);
    width: 45px;
}

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

/* ============================================================
   PANEL 3: THE BREAK
   ============================================================ */

.panel--break {
    justify-content: center;
    align-items: center;
}

/* Background glow -- radial gradient from acid green */
.break-glow {
    position: absolute;
    width: 600px;
    height: 600px;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(57, 255, 20, 0.35) 0%, rgba(57, 255, 20, 0.08) 40%, transparent 70%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 1200ms ease;
}

.panel--break.active .break-glow {
    opacity: 1;
}

/* Cracked Cube Container */
.iso-cube-cracked {
    position: relative;
    width: 200px;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Crack light behind -- green bleeding through */
.crack-light {
    position: absolute;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, var(--green) 0%, rgba(57, 255, 20, 0.4) 50%, transparent 80%);
    opacity: 0;
    transition: opacity 800ms ease;
}

.panel--break.active .crack-light {
    opacity: 0.8;
}

/* Cube shell halves -- split cube */
.cube-shell {
    position: absolute;
    width: 80px;
    height: 100px;
    transition: transform 800ms ease;
}

.cube-shell .face {
    position: absolute;
    width: 100%;
    height: 100%;
}

.cube-shell .face-top {
    background: var(--structure);
    transform: rotateX(60deg) rotateZ(45deg);
    width: 70%;
    height: 70%;
    top: -15%;
    left: 15%;
}

.cube-shell .face-left {
    background: var(--structure-left);
    transform: skewY(-30deg);
    width: 100%;
    height: 80%;
    top: 20%;
    left: 0;
}

.cube-shell .face-right {
    background: var(--structure-right);
    transform: skewY(30deg);
    width: 100%;
    height: 80%;
    top: 20%;
    left: 0;
}

.cube-shell--left {
    left: 10px;
    top: 30px;
    clip-path: polygon(0 0, 100% 10%, 95% 55%, 60% 100%, 0 100%);
}

.cube-shell--right {
    right: 10px;
    top: 30px;
    clip-path: polygon(5% 0, 100% 0, 100% 100%, 40% 100%, 0% 50%);
}

/* Crack flicker -- jagged clip-path alternation */
.panel--break.active.glitch-active .cube-shell--left {
    animation: crackFlickerLeft 300ms steps(1) infinite;
}

.panel--break.active.glitch-active .cube-shell--right {
    animation: crackFlickerRight 300ms steps(1) infinite;
}

@keyframes crackFlickerLeft {
    0% { clip-path: polygon(0 0, 100% 10%, 95% 55%, 60% 100%, 0 100%); }
    50% { clip-path: polygon(0 0, 100% 8%, 92% 58%, 55% 100%, 0 100%); }
    100% { clip-path: polygon(0 0, 100% 10%, 95% 55%, 60% 100%, 0 100%); }
}

@keyframes crackFlickerRight {
    0% { clip-path: polygon(5% 0, 100% 0, 100% 100%, 40% 100%, 0% 50%); }
    50% { clip-path: polygon(8% 0, 100% 0, 100% 100%, 45% 100%, 3% 48%); }
    100% { clip-path: polygon(5% 0, 100% 0, 100% 100%, 40% 100%, 0% 50%); }
}

/* ============================================================
   PANEL 4: THE REPAIR (Kintsugi)
   ============================================================ */

.iso-cube-repaired {
    position: relative;
    width: 120px;
    height: 120px;
}

.iso-cube-repaired > .face-top {
    background: var(--structure);
    transform: rotateX(60deg) rotateZ(45deg);
    width: 70.7%;
    height: 70.7%;
    top: -20%;
    left: 14.6%;
    position: absolute;
}

.iso-cube-repaired > .face-left {
    background: var(--structure-left);
    transform: skewY(-30deg);
    width: 50%;
    height: 86.6%;
    top: 13.4%;
    left: 0;
    position: absolute;
}

.iso-cube-repaired > .face-right {
    background: var(--structure-right);
    transform: skewY(30deg);
    width: 50%;
    height: 86.6%;
    top: 13.4%;
    left: 50%;
    position: absolute;
}

/* Kintsugi lines -- gold repair traces */
.kintsugi-line {
    position: absolute;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
    box-shadow: 0 0 8px var(--gold), 0 0 16px rgba(255, 215, 0, 0.3);
    z-index: 2;
    opacity: 0;
    transition: opacity 600ms ease;
}

.panel.active .kintsugi-line {
    opacity: 1;
}

.kintsugi-line--1 {
    width: 80%;
    top: 35%;
    left: 10%;
    transform: rotate(-15deg);
    transition-delay: 200ms;
}

.kintsugi-line--2 {
    width: 60%;
    top: 55%;
    left: 20%;
    transform: rotate(25deg);
    transition-delay: 400ms;
}

.kintsugi-line--3 {
    width: 50%;
    top: 75%;
    left: 15%;
    transform: rotate(-8deg);
    transition-delay: 600ms;
}

/* ============================================================
   ORGANIC BLOBS
   ============================================================ */

.blob {
    position: absolute;
    border-radius: 30% 70% 60% 40% / 60% 30% 70% 40%;
    filter: blur(40px);
    pointer-events: none;
    opacity: 0;
    transition: opacity 1000ms ease;
    will-change: filter, transform;
    animation: blobBreathe 6s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
    animation-play-state: paused;
}

.panel.active .blob {
    opacity: 1;
    animation-play-state: running;
}

.blob--pink {
    background: rgba(255, 45, 111, 0.15);
}

.blob--cyan {
    background: rgba(0, 240, 255, 0.12);
}

/* Panel 1 blobs */
.blob--1 {
    width: 200px;
    height: 200px;
    right: -60px;
    top: -40px;
}

.blob--2 {
    width: 160px;
    height: 160px;
    left: -30px;
    bottom: -20px;
}

/* Panel 2 blob */
.blob--3 {
    width: 220px;
    height: 180px;
    left: 40px;
    top: -60px;
}

/* Panel 4 healing blobs */
.blob--heal-1 {
    width: 180px;
    height: 180px;
    top: -50px;
    left: -60px;
}

.blob--heal-2 {
    width: 140px;
    height: 140px;
    bottom: -40px;
    right: -40px;
}

.blob--heal-3 {
    width: 160px;
    height: 120px;
    top: 20px;
    right: -80px;
}

@keyframes blobBreathe {
    0%, 100% { transform: scale(0.95); }
    50% { transform: scale(1.05); }
}

/* ============================================================
   GLITCH EFFECTS
   ============================================================ */

/* Panel 1: micro-glitch on tower -- barely perceptible twitch */
#panel-feed.active.glitch-active #tower-feed {
    animation: microglitch 8s infinite;
}

@keyframes microglitch {
    0%, 95% { transform: translate(0); filter: none; }
    96% { transform: translate(-3px, 0); filter: drop-shadow(-2px 0 #FF2D6F) drop-shadow(2px 0 #00F0FF); }
    97% { transform: translate(3px, 1px); filter: drop-shadow(2px 0 #FF2D6F) drop-shadow(-2px 0 #00F0FF); }
    98% { transform: translate(-1px, -1px); filter: none; }
    100% { transform: translate(0); filter: none; }
}

/* ============================================================
   RESPONSIVE ADJUSTMENTS
   ============================================================ */

@media (max-width: 768px) {
    .panel-content--left,
    .panel-content--upper-right,
    .panel-content--col-left,
    .panel-content--col-right,
    .panel-content--upper-left {
        position: relative;
        left: auto;
        right: auto;
        top: auto;
        transform: none;
        padding: 40px 24px;
        max-width: 100%;
    }

    .panel-content--left.visible,
    .panel-content--col-left.visible,
    .panel-content--col-right.visible {
        transform: none;
    }

    .panel {
        flex-direction: column;
        justify-content: center;
        padding: 40px 20px;
    }

    .panel-illustration {
        position: relative;
        left: auto;
        right: auto;
        bottom: auto;
        top: auto;
        transform: none;
        margin: 20px auto;
    }

    .panel-illustration--center {
        transform: none;
    }

    .panel-title {
        font-size: clamp(40px, 10vw, 72px);
    }

    .panel-body {
        font-size: 16px;
        max-width: 100%;
    }

    .iso-tower {
        transform: scale(0.8);
    }

    .iso-tower--small {
        transform: scale(0.5);
    }

    .iso-cube-cracked {
        width: 160px;
        height: 160px;
    }

    .break-glow {
        width: 400px;
        height: 400px;
    }
}

@media (max-width: 480px) {
    .panel-title {
        font-size: clamp(32px, 12vw, 56px);
    }

    .panel-body {
        font-size: 15px;
    }

    .label {
        font-size: 11px;
    }

    .iso-tower {
        transform: scale(0.65);
    }

    .iso-cube-cracked {
        width: 130px;
        height: 130px;
    }
}

/* ============================================================
   SCROLLBAR
   ============================================================ */

::-webkit-scrollbar {
    width: 4px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--structure);
    border-radius: 2px;
}

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