/* ppuzzl.com - Blobitecture Puzzle Dreamscape */
/* Palette: #1a1a1a Void | #2e2e2e Obsidian Fog | #3a3a3a Graphite Whisper | #6a6a6a Phantom Gray | #9a9a9a Silver Veil | #d0d0d0 Mist | #d4d4d4 Cloud Membrane | #e8e8e8 Haze | #ececec Frost Plane | #f8f8f8 Dream Field */
/* Fonts: Cormorant Garamond, Libre Baskerville, IBM Plex Mono */
/* Features: IntersectionObserver threshold 0.15, skeleton-loading reveal, respond to hover with subtle translateZ shifts, Content text appears in two columns within the HUD frame */
/* Mono" font reference: IBM Plex Mono | (Google Fonts loaded) | `translateZ` used for depth planes */

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: 'Libre Baskerville', serif;
    background: #f8f8f8;
    color: #3a3a3a;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ============================================
   HUD OVERLAY FRAME
   ============================================ */

#hud-frame {
    position: fixed;
    top: 24px;
    left: 24px;
    right: 24px;
    bottom: 24px;
    border: 1px solid #4a4a4a;
    z-index: 1000;
    pointer-events: none;
}

.hud-corner {
    position: absolute;
    pointer-events: none;
}

.hud-corner-tl {
    top: 8px;
    left: 12px;
}

.hud-corner-tr {
    top: 8px;
    right: 12px;
}

.hud-corner-bl {
    bottom: 8px;
    left: 12px;
}

.hud-corner-br {
    bottom: 8px;
    right: 12px;
}

.hud-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(0.65rem, 0.8vw, 0.75rem);
    font-weight: 400;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #6a6a6a;
    transition: color 0.4s ease;
}

/* HUD Navigation */
.hud-nav {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 32px;
    pointer-events: auto;
}

.hud-nav-link {
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(0.65rem, 0.8vw, 0.75rem);
    font-weight: 400;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #6a6a6a;
    text-decoration: none;
    transition: color 0.3s ease;
    cursor: pointer;
}

.hud-nav-link:hover {
    color: #3a3a3a;
}

/* HUD Progress Bar */
.hud-progress {
    position: absolute;
    top: 0;
    right: 0;
    width: 1px;
    height: 100%;
    background: transparent;
}

.hud-progress-bar {
    width: 2px;
    height: 0%;
    background: #f8f8f8;
    transition: height 0.1s linear;
    position: absolute;
    right: -1px;
    top: 0;
}

/* HUD Puzzle Node Markers */
.hud-node {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #6a6a6a;
    opacity: 0.4;
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.hud-node::before,
.hud-node::after {
    content: '';
    position: absolute;
    background: #6a6a6a;
    opacity: 0.3;
}

.hud-node::before {
    width: 20px;
    height: 1px;
    top: 50%;
    left: 100%;
    transform: translateY(-50%);
}

.hud-node::after {
    width: 1px;
    height: 20px;
    left: 50%;
    top: 100%;
    transform: translateX(-50%);
}

.hud-node-tl { top: -4px; left: -4px; }
.hud-node-tr { top: -4px; right: -4px; }
.hud-node-tr::before { left: auto; right: 100%; }
.hud-node-bl { bottom: -4px; left: -4px; }
.hud-node-bl::after { top: auto; bottom: 100%; }
.hud-node-br { bottom: -4px; right: -4px; }
.hud-node-br::before { left: auto; right: 100%; }
.hud-node-br::after { top: auto; bottom: 100%; }

/* ============================================
   PERSPECTIVE CONTAINER & DEPTH PLANES
   ============================================ */

#perspective-container {
    perspective: 1200px;
    transform-style: preserve-3d;
    position: relative;
}

.depth-plane-0 {
    transform: translateZ(-200px) scale(1.17);
}

.depth-plane-2 {
    transform: translateZ(80px) scale(0.93);
}

/* ============================================
   FLOATING PARTICLES LAYER
   ============================================ */

#particles-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 500;
    pointer-events: none;
    overflow: hidden;
}

.particle {
    position: absolute;
    border-radius: 50%;
    background: #6a6a6a;
    opacity: 0;
    animation: particleFloat linear infinite;
}

@keyframes particleFloat {
    0% {
        transform: translateY(0) translateX(0);
        opacity: 0;
    }
    10% {
        opacity: var(--particle-opacity, 0.12);
    }
    90% {
        opacity: var(--particle-opacity, 0.12);
    }
    100% {
        transform: translateY(calc(-100vh - 20px)) translateX(var(--particle-drift, 20px));
        opacity: 0;
    }
}

/* ============================================
   CHAMBERS / SECTIONS
   ============================================ */

.chamber {
    min-height: 100vh;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transform-style: preserve-3d;
}

#opening {
    background: radial-gradient(ellipse at 30% 40%, #ececec 0%, #d4d4d4 60%, #c0c0c0 100%);
}

#chamber-observe {
    background: radial-gradient(ellipse at 60% 50%, #f8f8f8 0%, #ececec 50%, #d4d4d4 100%);
}

#chamber-layers {
    background: radial-gradient(ellipse at 40% 60%, #ececec 0%, #d4d4d4 50%, #c0c0c0 100%);
}

#chamber-solve {
    background: radial-gradient(ellipse at 50% 30%, #f8f8f8 0%, #ececec 60%, #d4d4d4 100%);
}

#chamber-drift {
    background: radial-gradient(ellipse at 50% 50%, #f8f8f8 0%, #ececec 40%, #d4d4d4 80%, #c0c0c0 100%);
}

/* Section transitions - gradient overlays between sections */
.chamber::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 120px;
    background: linear-gradient(to bottom, transparent, #d4d4d4);
    pointer-events: none;
    z-index: 1;
}

#chamber-drift::after {
    display: none;
}

/* ============================================
   BLOB BACKGROUNDS (Plane 0)
   ============================================ */

.blob-bg {
    position: absolute;
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    opacity: 0.22;
    will-change: border-radius;
    pointer-events: none;
    z-index: 0;
}

.blob-bg-1 {
    width: 70vw;
    height: 70vw;
    max-width: 800px;
    max-height: 800px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) translateZ(-200px) scale(1.17);
    background: radial-gradient(ellipse at center, #d4d4d4 0%, #d0d0d0 40%, #9a9a9a 100%);
    animation: blobMorph1 25s ease-in-out infinite;
}

.blob-bg-2 {
    width: 40vw;
    height: 40vw;
    max-width: 500px;
    max-height: 500px;
    top: 20%;
    right: 10%;
    transform: translateZ(-200px) scale(1.17);
    background: radial-gradient(ellipse at center, #ececec 0%, #e8e8e8 40%, #c0c0c0 100%);
    opacity: 0.15;
    animation: blobMorph2 30s ease-in-out infinite;
}

.blob-bg-3 {
    width: 55vw;
    height: 55vw;
    max-width: 700px;
    max-height: 700px;
    top: 40%;
    left: 60%;
    transform: translate(-50%, -50%) translateZ(-200px) scale(1.17);
    background: radial-gradient(ellipse at center, #d4d4d4 0%, #9a9a9a 100%);
    animation: blobMorph3 28s ease-in-out infinite;
}

.blob-bg-4 {
    width: 60vw;
    height: 60vw;
    max-width: 750px;
    max-height: 750px;
    top: 30%;
    left: 20%;
    transform: translateZ(-200px) scale(1.17);
    background: radial-gradient(ellipse at center, #ececec 0%, #c0c0c0 100%);
    animation: blobMorph1 22s ease-in-out infinite reverse;
}

.blob-bg-5 {
    width: 35vw;
    height: 35vw;
    max-width: 450px;
    max-height: 450px;
    bottom: 10%;
    right: 5%;
    transform: translateZ(-200px) scale(1.17);
    background: radial-gradient(ellipse at center, #d4d4d4 0%, #9a9a9a 100%);
    opacity: 0.18;
    animation: blobMorph2 26s ease-in-out infinite;
}

.blob-bg-6 {
    width: 50vw;
    height: 50vw;
    max-width: 650px;
    max-height: 650px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) translateZ(-200px) scale(1.17);
    background: radial-gradient(ellipse at center, #d4d4d4 0%, #9a9a9a 100%);
    animation: blobMorph3 24s ease-in-out infinite;
}

.blob-bg-7 {
    width: 80vw;
    height: 80vw;
    max-width: 1000px;
    max-height: 1000px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) translateZ(-200px) scale(1.17);
    background: radial-gradient(ellipse at center, #ececec 0%, #d4d4d4 70%, #c0c0c0 100%);
    opacity: 0.25;
    animation: blobMorph1 30s ease-in-out infinite;
}

.blob-bg-8 {
    width: 45vw;
    height: 45vw;
    max-width: 550px;
    max-height: 550px;
    top: 60%;
    left: 30%;
    transform: translateZ(-200px) scale(1.17);
    background: radial-gradient(ellipse at center, #d4d4d4 0%, #9a9a9a 100%);
    opacity: 0.15;
    animation: blobMorph2 27s ease-in-out infinite reverse;
}

/* Blob morph animations */
@keyframes blobMorph1 {
    0% {
        border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    }
    33% {
        border-radius: 58% 42% 36% 64% / 48% 62% 38% 52%;
    }
    66% {
        border-radius: 42% 58% 62% 38% / 62% 38% 62% 38%;
    }
    100% {
        border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    }
}

@keyframes blobMorph2 {
    0% {
        border-radius: 40% 60% 50% 50% / 50% 40% 60% 50%;
    }
    33% {
        border-radius: 60% 40% 40% 60% / 40% 60% 40% 60%;
    }
    66% {
        border-radius: 50% 50% 60% 40% / 60% 40% 50% 50%;
    }
    100% {
        border-radius: 40% 60% 50% 50% / 50% 40% 60% 50%;
    }
}

@keyframes blobMorph3 {
    0% {
        border-radius: 45% 55% 65% 35% / 35% 55% 45% 65%;
    }
    33% {
        border-radius: 35% 65% 45% 55% / 55% 35% 65% 45%;
    }
    66% {
        border-radius: 55% 45% 35% 65% / 45% 65% 55% 35%;
    }
    100% {
        border-radius: 45% 55% 65% 35% / 35% 55% 45% 65%;
    }
}

/* ============================================
   CHAMBER CONTENT LAYOUTS
   ============================================ */

.chamber-content {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 1200px;
    padding: 48px 80px;
}

.chamber-content-asymmetric {
    display: flex;
    gap: 60px;
    align-items: center;
}

.content-left {
    flex: 2;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.content-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chamber-content-columns {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.columns-wrapper {
    display: flex;
    gap: 48px;
}

.column {
    flex: 1;
}

.chamber-content-centered {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 32px;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */

.title-massive {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: clamp(4rem, 10vw, 8rem);
    letter-spacing: 0.08em;
    line-height: 1.15;
    color: #2e2e2e;
    text-align: center;
}

.subtitle-ethereal {
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(0.75rem, 1vw, 0.9rem);
    font-weight: 400;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #6a6a6a;
    text-align: center;
    margin-top: 16px;
}

.heading-secondary {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: clamp(1.8rem, 3.5vw, 2.8rem);
    letter-spacing: 0.08em;
    line-height: 1.15;
    color: #2e2e2e;
}

.heading-drift {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: clamp(2.8rem, 6vw, 5.2rem);
    letter-spacing: 0.08em;
    line-height: 1.15;
    color: #2e2e2e;
    opacity: 0.6;
}

.body-text {
    font-family: 'Libre Baskerville', serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.1vw, 1.15rem);
    line-height: 1.75;
    letter-spacing: 0.01em;
    color: #3a3a3a;
}

.body-text-fade {
    opacity: 0.6;
    max-width: 540px;
}

.closing-whisper {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: clamp(1.2rem, 2vw, 1.6rem);
    letter-spacing: 0.08em;
    color: #9a9a9a;
    opacity: 0.5;
}

/* ============================================
   SKELETON LOADING / REVEAL PATTERN
   ============================================ */

.skeleton-wrapper {
    position: relative;
    overflow: hidden;
}

.skeleton-wrapper-full {
    width: 100%;
}

.skeleton-lines {
    display: flex;
    flex-direction: column;
    gap: 10px;
    opacity: 1;
    transition: opacity 0.6s ease;
}

.skeleton-line {
    height: 16px;
    border-radius: 8px;
    background: #d4d4d4;
    position: relative;
    overflow: hidden;
}

.skeleton-line::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(248, 248, 248, 0.5), transparent);
    animation: skeletonShimmer 1.8s ease-in-out infinite;
}

.skeleton-line-xl { width: 60%; margin: 0 auto; height: 32px; border-radius: 16px; }
.skeleton-line-lg { width: 75%; }
.skeleton-line-md { width: 55%; }
.skeleton-line-sm { width: 35%; margin: 0 auto; }
.skeleton-line-full { width: 100%; }

.skeleton-block {
    width: 180px;
    height: 180px;
    border-radius: 16px;
    background: #d4d4d4;
    position: relative;
    overflow: hidden;
    margin: 0 auto;
}

.skeleton-block::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(248, 248, 248, 0.5), transparent);
    animation: skeletonShimmer 1.8s ease-in-out infinite;
}

@keyframes skeletonShimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.reveal-content {
    opacity: 0;
    transition: opacity 0.8s ease 0.2s;
}

/* Revealed state */
.skeleton-wrapper.revealed .skeleton-lines {
    opacity: 0;
    pointer-events: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
}

.skeleton-wrapper.revealed .reveal-content {
    opacity: 1;
}

/* ============================================
   ISOMETRIC ICONS
   ============================================ */

.isometric-cluster {
    position: relative;
    width: 200px;
    height: 200px;
}

.iso-cube {
    position: absolute;
    transform-style: preserve-3d;
    transform: rotateX(55deg) rotateZ(-45deg);
}

.iso-cube-1 {
    width: 80px;
    height: 80px;
    top: 20px;
    left: 60px;
}

.iso-cube-2 {
    width: 60px;
    height: 60px;
    top: 80px;
    left: 20px;
}

.iso-cube-3 {
    width: 50px;
    height: 50px;
    top: 90px;
    left: 110px;
}

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

.iso-top {
    background: #d4d4d4;
    border-radius: 4px;
    transform: translateZ(1px);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.05);
}

.iso-left {
    background: #9a9a9a;
    border-radius: 4px;
    width: 100%;
    height: 30px;
    bottom: 0;
    top: auto;
    transform: rotateX(-90deg) translateZ(15px);
    transform-origin: bottom;
}

.iso-right {
    background: #6a6a6a;
    border-radius: 4px;
    width: 30px;
    height: 100%;
    right: 0;
    left: auto;
    transform: rotateY(90deg) translateZ(15px);
    transform-origin: right;
}

/* Interactive puzzle pieces in Solve section */
.interactive-pieces {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-top: 40px;
    flex-wrap: wrap;
}

.iso-puzzle-piece {
    width: 80px;
    height: 80px;
    transform-style: preserve-3d;
    transform: rotateX(55deg) rotateZ(-45deg);
    transition: transform 0.5s cubic-bezier(0.23, 1, 0.32, 1);
    cursor: pointer;
    position: relative;
}

.iso-puzzle-piece:hover {
    transform: rotateX(55deg) rotateZ(-45deg) translateZ(20px);
}

.iso-piece-1 { border-radius: 40%; }
.iso-piece-2 { border-radius: 50%; }
.iso-piece-3 { border-radius: 30% 70% 70% 30%; }
.iso-piece-4 { border-radius: 60% 40% 60% 40%; }
.iso-piece-5 { border-radius: 45% 55% 45% 55%; }

.iso-piece-1 .iso-top { border-radius: 40%; }
.iso-piece-2 .iso-top { border-radius: 50%; }
.iso-piece-3 .iso-top { border-radius: 30% 70% 70% 30%; }
.iso-piece-4 .iso-top { border-radius: 60% 40% 60% 40%; }
.iso-piece-5 .iso-top { border-radius: 45% 55% 45% 55%; }

.iso-puzzle-piece .iso-top {
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.08);
}

/* ============================================
   DEPTH DIAGRAM (Layers section)
   ============================================ */

.depth-diagram {
    position: relative;
    width: 200px;
    height: 220px;
    perspective: 600px;
}

.depth-plane-visual {
    position: absolute;
    width: 160px;
    height: 100px;
    border: 1px solid #9a9a9a;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    left: 50%;
    transform: translateX(-50%) rotateX(40deg);
    transform-style: preserve-3d;
    backdrop-filter: blur(2px);
}

.depth-plane-visual-0 {
    bottom: 0;
    background: rgba(212, 212, 212, 0.4);
    border-color: #c0c0c0;
}

.depth-plane-visual-1 {
    bottom: 60px;
    background: rgba(236, 236, 236, 0.5);
    border-color: #9a9a9a;
}

.depth-plane-visual-2 {
    bottom: 120px;
    background: rgba(248, 248, 248, 0.3);
    border-color: #d4d4d4;
}

.depth-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.6rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #6a6a6a;
}

/* ============================================
   WIREFRAME GRID
   ============================================ */

.wireframe-grid {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 200px;
    background-image:
        linear-gradient(to right, #d4d4d4 1px, transparent 1px),
        linear-gradient(to bottom, #d4d4d4 1px, transparent 1px);
    background-size: 40px 40px;
    opacity: 0.2;
    transform: perspective(600px) rotateX(60deg);
    transform-origin: bottom;
    pointer-events: none;
    z-index: 0;
    mask-image: linear-gradient(to top, rgba(0,0,0,0.3), transparent);
    -webkit-mask-image: linear-gradient(to top, rgba(0,0,0,0.3), transparent);
}

/* ============================================
   SCROLL CHEVRON
   ============================================ */

.scroll-chevron {
    margin-top: 48px;
    display: flex;
    justify-content: center;
    animation: chevronPulse 2.5s ease-in-out infinite;
}

@keyframes chevronPulse {
    0%, 100% { opacity: 0.3; transform: translateY(0); }
    50% { opacity: 0.8; transform: translateY(6px); }
}

/* ============================================
   ORBITAL SVG DECORATIONS
   ============================================ */

.orbital-decoration {
    position: fixed;
    pointer-events: none;
    z-index: 400;
    opacity: 0;
    transition: opacity 1s ease;
}

.orbital-1 {
    width: 200px;
    height: 200px;
    top: 15%;
    right: 8%;
    animation: orbitalSpin 60s linear infinite;
}

.orbital-2 {
    width: 150px;
    height: 150px;
    bottom: 20%;
    left: 5%;
    animation: orbitalSpin 45s linear infinite reverse;
}

.orbital-decoration.visible {
    opacity: 1;
}

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

/* ============================================
   HUD FRAME FADE-IN
   ============================================ */

#hud-frame {
    opacity: 0;
    animation: hudFadeIn 2s ease-out 0.5s forwards;
}

@keyframes hudFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@media (max-width: 768px) {
    #hud-frame {
        top: 12px;
        left: 12px;
        right: 12px;
        bottom: 12px;
    }

    .hud-corner {
        display: none;
    }

    .hud-nav {
        gap: 16px;
    }

    .hud-nav-link {
        font-size: 0.6rem;
    }

    .chamber-content {
        padding: 32px 40px;
    }

    .chamber-content-asymmetric {
        flex-direction: column;
        gap: 32px;
    }

    .columns-wrapper {
        flex-direction: column;
        gap: 24px;
    }

    .content-right {
        order: -1;
    }

    .isometric-cluster {
        width: 150px;
        height: 150px;
    }

    .iso-cube-1 { width: 60px; height: 60px; }
    .iso-cube-2 { width: 45px; height: 45px; }
    .iso-cube-3 { width: 38px; height: 38px; }

    .interactive-pieces {
        gap: 24px;
    }

    .iso-puzzle-piece {
        width: 60px;
        height: 60px;
    }

    .depth-diagram {
        width: 150px;
        height: 180px;
    }

    .depth-plane-visual {
        width: 120px;
        height: 80px;
    }
}

@media (max-width: 480px) {
    .hud-nav {
        gap: 10px;
    }

    .hud-nav-link {
        font-size: 0.55rem;
        letter-spacing: 0.08em;
    }

    .chamber-content {
        padding: 24px 24px;
    }

    .blob-bg {
        opacity: 0.12;
    }

    .iso-cube {
        transform: rotateX(55deg) rotateZ(-45deg) scale(0.6);
    }

    .iso-puzzle-piece {
        width: 48px;
        height: 48px;
    }

    .interactive-pieces {
        gap: 16px;
    }

    .depth-plane-visual {
        width: 100px;
        height: 60px;
    }

    .depth-plane-visual-1 { bottom: 40px; }
    .depth-plane-visual-2 { bottom: 80px; }

    .wireframe-grid {
        height: 100px;
        background-size: 30px 30px;
    }
}
