/* ppuzzl.dev - Inflated 3D Aesthetic */

:root {
    --purple: #d366ff;
    --red: #ff6b6b;
    --blue: #6ec8ff;
    --light: #f0f2f7;
    --dark: #111118;
    --green: #4dffc3;
    --muted: #8a91a4;
    --deepdark: #0d0d14;
}

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

html {
    scroll-snap-type: y mandatory;
    overflow-y: scroll;
}

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--deepdark);
    color: var(--light);
    overflow-x: hidden;
}

.scroll-container {
    width: 100%;
}

/* Chapters */
.chapter {
    min-height: 100vh;
    scroll-snap-align: start;
    display: flex;
    align-items: center;
    padding: 4rem;
    position: relative;
    overflow: hidden;
}

.split-left {
    width: 40%;
    padding-right: 4rem;
    z-index: 2;
}

.split-right {
    width: 60%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-height: 400px;
}

/* Typography */
.display-heading {
    font-family: 'Libre Baskerville', serif;
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 4.5rem);
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: var(--light);
    margin-bottom: 1.5rem;
}

.display-heading em {
    font-style: normal;
    color: var(--purple);
}

.section-heading {
    font-family: 'Libre Baskerville', serif;
    font-weight: 700;
    font-size: clamp(1.2rem, 2.5vw, 2rem);
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: var(--light);
    margin-bottom: 1.5rem;
}

.body-text {
    font-family: 'DM Sans', sans-serif;
    font-size: clamp(0.95rem, 1.2vw, 1.15rem);
    line-height: 1.7;
    color: var(--muted);
    max-width: 440px;
}

.mono-label {
    font-family: 'Fira Code', monospace;
    font-size: 0.8rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Scroll Hint */
.scroll-hint {
    margin-top: 3rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.scroll-hint-text {
    font-family: 'Fira Code', monospace;
    font-size: 0.75rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.scroll-hint-arrow {
    width: 20px;
    height: 20px;
    border-right: 2px solid var(--purple);
    border-bottom: 2px solid var(--purple);
    transform: rotate(45deg);
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: rotate(45deg) translateY(0); }
    50% { transform: rotate(45deg) translateY(6px); }
}

/* Inflated Puzzle Pieces */
.puzzle-piece {
    position: relative;
    width: 180px;
    height: 180px;
    border-radius: 32px;
    background: radial-gradient(ellipse at 30% 20%, rgba(211, 102, 255, 0.6), rgba(211, 102, 255, 0.15) 70%);
    box-shadow:
        0 20px 60px rgba(211, 102, 255, 0.3),
        0 8px 24px rgba(0, 0, 0, 0.5),
        inset 0 2px 4px rgba(255, 255, 255, 0.2),
        inset 0 -4px 12px rgba(0, 0, 0, 0.3);
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.piece-inner {
    position: absolute;
    inset: 12px;
    border-radius: 22px;
    background: radial-gradient(ellipse at 40% 30%, rgba(255, 255, 255, 0.15), transparent 60%);
}

.piece-knob {
    position: absolute;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: radial-gradient(ellipse at 30% 20%, rgba(211, 102, 255, 0.7), rgba(211, 102, 255, 0.2));
    box-shadow:
        0 8px 20px rgba(211, 102, 255, 0.3),
        inset 0 2px 4px rgba(255, 255, 255, 0.2);
}

.knob-top {
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
}

.knob-right {
    right: -20px;
    top: 50%;
    transform: translateY(-50%);
}

.piece-hero {
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-15px) rotate(2deg); }
}

/* Floating Orbs */
.floating-orb {
    position: absolute;
    border-radius: 50%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.orb-1 {
    width: 60px;
    height: 60px;
    background: radial-gradient(circle at 30% 30%, var(--blue), rgba(110, 200, 255, 0.3));
    top: 15%;
    right: 10%;
    animation: float 8s ease-in-out infinite;
}

.orb-2 {
    width: 40px;
    height: 40px;
    background: radial-gradient(circle at 30% 30%, var(--green), rgba(77, 255, 195, 0.3));
    bottom: 20%;
    right: 25%;
    animation: float 7s ease-in-out infinite 1s;
}

.orb-3 {
    width: 30px;
    height: 30px;
    background: radial-gradient(circle at 30% 30%, var(--red), rgba(255, 107, 107, 0.3));
    top: 35%;
    left: 5%;
    animation: float 9s ease-in-out infinite 2s;
}

/* Chapter 2 - Assembly */
.puzzle-assembly {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.piece-a {
    width: 140px;
    height: 140px;
    border-radius: 28px;
    background: radial-gradient(ellipse at 30% 20%, rgba(110, 200, 255, 0.6), rgba(110, 200, 255, 0.15) 70%);
    box-shadow:
        0 20px 60px rgba(110, 200, 255, 0.3),
        0 8px 24px rgba(0, 0, 0, 0.5),
        inset 0 2px 4px rgba(255, 255, 255, 0.2),
        inset 0 -4px 12px rgba(0, 0, 0, 0.3);
    transform: translate(20px, 10px);
    transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.piece-b {
    width: 140px;
    height: 140px;
    border-radius: 28px;
    background: radial-gradient(ellipse at 30% 20%, rgba(77, 255, 195, 0.6), rgba(77, 255, 195, 0.15) 70%);
    box-shadow:
        0 20px 60px rgba(77, 255, 195, 0.3),
        0 8px 24px rgba(0, 0, 0, 0.5),
        inset 0 2px 4px rgba(255, 255, 255, 0.2),
        inset 0 -4px 12px rgba(0, 0, 0, 0.3);
    transform: translate(-10px, -20px);
    transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s;
}

.piece-c {
    width: 140px;
    height: 140px;
    border-radius: 28px;
    background: radial-gradient(ellipse at 30% 20%, rgba(255, 107, 107, 0.6), rgba(255, 107, 107, 0.15) 70%);
    box-shadow:
        0 20px 60px rgba(255, 107, 107, 0.3),
        0 8px 24px rgba(0, 0, 0, 0.5),
        inset 0 2px 4px rgba(255, 255, 255, 0.2),
        inset 0 -4px 12px rgba(0, 0, 0, 0.3);
    transform: translate(5px, 15px);
    transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s;
}

.piece-a.assembled { transform: translate(0, 0); }
.piece-b.assembled { transform: translate(0, 0); }
.piece-c.assembled { transform: translate(0, 0); }

/* Chapter 3 - Services */
.service-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    max-width: 400px;
}

.service-block {
    background: radial-gradient(ellipse at 30% 20%, rgba(240, 242, 247, 0.08), rgba(240, 242, 247, 0.02) 70%);
    border-radius: 24px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.4),
        inset 0 1px 2px rgba(255, 255, 255, 0.1),
        inset 0 -2px 8px rgba(0, 0, 0, 0.2);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.4s ease;
}

.service-block:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow:
        0 20px 60px rgba(211, 102, 255, 0.2),
        inset 0 1px 2px rgba(255, 255, 255, 0.15),
        inset 0 -2px 8px rgba(0, 0, 0, 0.2);
}

.block-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    box-shadow:
        0 8px 20px rgba(0, 0, 0, 0.3),
        inset 0 2px 4px rgba(255, 255, 255, 0.3);
}

.block-icon-api {
    background: radial-gradient(circle at 30% 30%, var(--purple), rgba(211, 102, 255, 0.4));
}

.block-icon-ui {
    background: radial-gradient(circle at 30% 30%, var(--blue), rgba(110, 200, 255, 0.4));
}

.block-icon-infra {
    background: radial-gradient(circle at 30% 30%, var(--green), rgba(77, 255, 195, 0.4));
}

.block-icon-dx {
    background: radial-gradient(circle at 30% 30%, var(--red), rgba(255, 107, 107, 0.4));
}

/* Chapter 4 - Code */
.code-block {
    background: rgba(17, 17, 24, 0.9);
    border-radius: 20px;
    overflow: hidden;
    width: 100%;
    max-width: 500px;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.5),
        inset 0 1px 1px rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(138, 145, 164, 0.15);
}

.code-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 18px;
    background: rgba(138, 145, 164, 0.08);
    border-bottom: 1px solid rgba(138, 145, 164, 0.1);
}

.code-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.dot-red { background: var(--red); }
.dot-yellow { background: #ffcc4d; }
.dot-green { background: var(--green); }

.code-filename {
    font-family: 'Fira Code', monospace;
    font-size: 0.75rem;
    color: var(--muted);
    margin-left: auto;
}

.code-content {
    padding: 1.5rem;
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
    line-height: 1.8;
    color: var(--light);
    overflow-x: auto;
}

.code-keyword { color: var(--purple); }
.code-type { color: var(--blue); }
.code-prop { color: var(--light); }
.code-method { color: var(--green); }

/* Chapter 5 - CTA */
.cta-button {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-top: 2rem;
    padding: 1rem 2rem;
    border-radius: 16px;
    background: radial-gradient(ellipse at 30% 20%, rgba(211, 102, 255, 0.5), rgba(211, 102, 255, 0.2) 70%);
    box-shadow:
        0 12px 40px rgba(211, 102, 255, 0.3),
        inset 0 2px 4px rgba(255, 255, 255, 0.2),
        inset 0 -3px 8px rgba(0, 0, 0, 0.2);
    text-decoration: none;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.4s ease;
}

.cta-button:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow:
        0 18px 50px rgba(211, 102, 255, 0.4),
        inset 0 2px 4px rgba(255, 255, 255, 0.3),
        inset 0 -3px 8px rgba(0, 0, 0, 0.2);
}

.cta-text {
    font-family: 'DM Sans', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    color: var(--light);
}

.cta-piece {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    background: var(--purple);
    box-shadow: 0 4px 12px rgba(211, 102, 255, 0.5);
}

/* Final Assembly */
.final-assembly {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.piece-final {
    width: 120px;
    height: 120px;
    border-radius: 26px;
    opacity: 0;
    transform: scale(0.7) rotate(10deg);
    transition: opacity 0.6s ease, transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.piece-final.visible {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

.piece-f1 {
    background: radial-gradient(ellipse at 30% 20%, rgba(211, 102, 255, 0.6), rgba(211, 102, 255, 0.15) 70%);
    box-shadow: 0 16px 48px rgba(211, 102, 255, 0.3), inset 0 2px 4px rgba(255, 255, 255, 0.2);
    transition-delay: 0s;
}

.piece-f2 {
    background: radial-gradient(ellipse at 30% 20%, rgba(110, 200, 255, 0.6), rgba(110, 200, 255, 0.15) 70%);
    box-shadow: 0 16px 48px rgba(110, 200, 255, 0.3), inset 0 2px 4px rgba(255, 255, 255, 0.2);
    transition-delay: 0.15s;
}

.piece-f3 {
    background: radial-gradient(ellipse at 30% 20%, rgba(77, 255, 195, 0.6), rgba(77, 255, 195, 0.15) 70%);
    box-shadow: 0 16px 48px rgba(77, 255, 195, 0.3), inset 0 2px 4px rgba(255, 255, 255, 0.2);
    transition-delay: 0.3s;
}

.piece-f4 {
    background: radial-gradient(ellipse at 30% 20%, rgba(255, 107, 107, 0.6), rgba(255, 107, 107, 0.15) 70%);
    box-shadow: 0 16px 48px rgba(255, 107, 107, 0.3), inset 0 2px 4px rgba(255, 255, 255, 0.2);
    transition-delay: 0.45s;
}

/* Mobile */
@media (max-width: 768px) {
    .chapter {
        flex-direction: column;
        padding: 3rem 1.5rem;
        justify-content: center;
        gap: 3rem;
    }

    .split-left,
    .split-right {
        width: 100%;
        padding-right: 0;
    }

    .split-right {
        min-height: 250px;
    }

    .puzzle-piece {
        width: 120px;
        height: 120px;
    }

    .piece-a, .piece-b, .piece-c {
        width: 100px;
        height: 100px;
    }

    .service-grid {
        max-width: 100%;
    }

    .code-block {
        max-width: 100%;
    }

    .final-assembly {
        gap: 8px;
    }

    .piece-final {
        width: 90px;
        height: 90px;
    }
}
