/* ============================================
   ppuzzl.com - Styles
   Palette:
     Ocean Mist: #88C0D0
     Sand Warm: #D4A574
     Shell Cream: #E8C5A0
     Sunrise Coral: #FF8A65
     Deep Tide: #2E4057
     Foam White: #F5F0EB
     Kelp Green: #5B8C5A
   Fonts:
     Headlines: Caveat (700/400)
     Body: Source Sans 3 (400/600)
     Accents: Fira Code (400)
   ============================================ */

/* ----- Reset & Base ----- */

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

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

body {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 400;
    font-size: clamp(16px, 1.5vw, 19px);
    line-height: 1.75;
    color: #2E4057;
    background: #F5F0EB;
    overflow-x: hidden;
    position: relative;
}

/* ----- Depth Layers ----- */

.depth-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.layer-0 {
    z-index: 0;
}

.layer-1 {
    z-index: 1;
}

.layer-2 {
    z-index: 2;
    position: relative;
    pointer-events: auto;
}

.layer-3 {
    z-index: 10;
}

/* ----- Layer 0: Sky Gradient ----- */

#sky-layer {
    background: linear-gradient(135deg, #88C0D0 0%, #D4A574 50%, #E8C5A0 100%);
    background-size: 200% 200%;
    animation: sky-cycle 30s ease-in-out infinite alternate;
    filter: hue-rotate(0deg);
}

@keyframes sky-cycle {
    0% {
        background-position: 0% 0%;
        filter: hue-rotate(0deg);
    }
    25% {
        background-position: 50% 50%;
        filter: hue-rotate(8deg);
    }
    50% {
        background-position: 100% 100%;
        filter: hue-rotate(15deg);
    }
    75% {
        background-position: 50% 50%;
        filter: hue-rotate(8deg);
    }
    100% {
        background-position: 0% 0%;
        filter: hue-rotate(0deg);
    }
}

/* ----- Layer 1: Floating Puzzle Pieces ----- */

#puzzle-layer {
    overflow: hidden;
}

.puzzle-piece {
    position: absolute;
    will-change: transform;
}

.piece-1 {
    width: 320px;
    height: 320px;
    top: -5%;
    left: -5%;
    animation: drift-1 28s ease-in-out infinite;
    opacity: 0;
}

.piece-2 {
    width: 260px;
    height: 260px;
    top: 15%;
    right: -8%;
    animation: drift-2 35s ease-in-out infinite;
    opacity: 0;
}

.piece-3 {
    width: 380px;
    height: 380px;
    top: 50%;
    left: 20%;
    animation: drift-3 40s ease-in-out infinite;
    opacity: 0;
}

.piece-4 {
    width: 200px;
    height: 200px;
    top: 70%;
    right: 10%;
    animation: drift-4 24s ease-in-out infinite;
    opacity: 0;
}

.piece-5 {
    width: 300px;
    height: 300px;
    top: 30%;
    left: 60%;
    animation: drift-5 32s ease-in-out infinite;
    opacity: 0;
}

.piece-6 {
    width: 240px;
    height: 240px;
    top: 85%;
    left: 5%;
    animation: drift-6 36s ease-in-out infinite;
    opacity: 0;
}

.piece-7 {
    width: 280px;
    height: 280px;
    top: 5%;
    left: 45%;
    animation: drift-7 30s ease-in-out infinite;
    opacity: 0;
}

.piece-8 {
    width: 220px;
    height: 220px;
    top: 60%;
    right: 35%;
    animation: drift-8 26s ease-in-out infinite;
    opacity: 0;
}

.puzzle-piece.visible {
    opacity: 1;
    transition: opacity 2s ease;
}

@keyframes drift-1 {
    0%   { transform: translate(0, 0) rotate(0deg); }
    25%  { transform: translate(60px, 40px) rotate(8deg); }
    50%  { transform: translate(30px, 80px) rotate(-4deg); }
    75%  { transform: translate(80px, 20px) rotate(12deg); }
    100% { transform: translate(0, 0) rotate(0deg); }
}

@keyframes drift-2 {
    0%   { transform: translate(0, 0) rotate(0deg); }
    33%  { transform: translate(-70px, 50px) rotate(-10deg); }
    66%  { transform: translate(-30px, 90px) rotate(6deg); }
    100% { transform: translate(0, 0) rotate(0deg); }
}

@keyframes drift-3 {
    0%   { transform: translate(0, 0) rotate(0deg); }
    25%  { transform: translate(-40px, -30px) rotate(5deg); }
    50%  { transform: translate(50px, -60px) rotate(-8deg); }
    75%  { transform: translate(20px, -20px) rotate(3deg); }
    100% { transform: translate(0, 0) rotate(0deg); }
}

@keyframes drift-4 {
    0%   { transform: translate(0, 0) rotate(0deg); }
    50%  { transform: translate(-50px, -40px) rotate(15deg); }
    100% { transform: translate(0, 0) rotate(0deg); }
}

@keyframes drift-5 {
    0%   { transform: translate(0, 0) rotate(0deg); }
    33%  { transform: translate(40px, -50px) rotate(-7deg); }
    66%  { transform: translate(-30px, 30px) rotate(9deg); }
    100% { transform: translate(0, 0) rotate(0deg); }
}

@keyframes drift-6 {
    0%   { transform: translate(0, 0) rotate(0deg); }
    25%  { transform: translate(50px, -20px) rotate(6deg); }
    50%  { transform: translate(80px, -50px) rotate(-4deg); }
    75%  { transform: translate(30px, -30px) rotate(10deg); }
    100% { transform: translate(0, 0) rotate(0deg); }
}

@keyframes drift-7 {
    0%   { transform: translate(0, 0) rotate(0deg); }
    50%  { transform: translate(-60px, 60px) rotate(-12deg); }
    100% { transform: translate(0, 0) rotate(0deg); }
}

@keyframes drift-8 {
    0%   { transform: translate(0, 0) rotate(0deg); }
    33%  { transform: translate(30px, 40px) rotate(8deg); }
    66%  { transform: translate(-40px, 20px) rotate(-6deg); }
    100% { transform: translate(0, 0) rotate(0deg); }
}

/* ----- Hero Section ----- */

#hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 2;
}

.hero-content {
    text-align: center;
    padding: 2rem;
    position: relative;
    z-index: 5;
}

.hero-title {
    font-family: 'Caveat', cursive;
    font-weight: 700;
    font-size: clamp(48px, 8vw, 120px);
    color: #2E4057;
    letter-spacing: 0.05em;
    margin-bottom: 0.25em;
    text-shadow: 2px 4px 12px rgba(136, 192, 208, 0.3);
    opacity: 0;
    transform: translateY(30px);
    animation: hero-title-in 1.2s cubic-bezier(0.34, 1.56, 0.64, 1) 0.3s forwards;
}

.hero-tagline {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 400;
    font-size: clamp(18px, 2.5vw, 28px);
    color: #2E4057;
    opacity: 0;
    transform: translateY(20px);
    animation: hero-title-in 1s cubic-bezier(0.34, 1.56, 0.64, 1) 0.7s forwards;
}

@keyframes hero-title-in {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ----- Mountain Divider ----- */

#mountain-divider {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 4;
    line-height: 0;
}

#mountain-svg {
    width: 100%;
    height: auto;
    display: block;
}

#mountain-left,
#mountain-right {
    stroke: #2E4057;
    stroke-width: 0;
    fill: #2E4057;
}

#mountain-left {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    animation: mountain-draw 1.5s ease-out 1s forwards;
}

#mountain-right {
    stroke-dasharray: 2000;
    stroke-dashoffset: -2000;
    animation: mountain-draw-right 1.5s ease-out 1s forwards;
}

@keyframes mountain-draw {
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes mountain-draw-right {
    to {
        stroke-dashoffset: 0;
    }
}

/* ----- Layer 3: Annotations ----- */

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

.annotation {
    position: absolute;
    opacity: 0;
    transform: scale(0);
    transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.annotation.visible {
    opacity: 1;
    transform: scale(1);
}

.annotation-arrow-1 {
    width: 80px;
    height: 40px;
    top: 22%;
    left: 8%;
}

.annotation-text-1 {
    font-family: 'Caveat', cursive;
    font-weight: 400;
    font-size: 18px;
    color: #FF8A65;
    top: 28%;
    left: 6%;
    display: inline-block;
    filter: drop-shadow(1px 2px 3px rgba(0,0,0,0.1));
}

.annotation-circle-1 {
    width: 60px;
    height: 60px;
    top: 18%;
    right: 12%;
}

.annotation-arrow-2 {
    width: 60px;
    height: 80px;
    top: 55%;
    right: 8%;
}

.annotation-text-2 {
    font-family: 'Caveat', cursive;
    font-weight: 400;
    font-size: 16px;
    color: #D4A574;
    top: 65%;
    right: 6%;
    display: inline-block;
    filter: drop-shadow(1px 2px 3px rgba(0,0,0,0.1));
}

.annotation-squiggle {
    width: 120px;
    height: 20px;
    bottom: 15%;
    left: 50%;
    transform-origin: center center;
}

/* ----- Main Content ----- */

#main-content {
    position: relative;
    z-index: 3;
    background: linear-gradient(180deg, #2E4057 0px, #F5F0EB 120px);
    padding: 80px 0 60px;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 60px 30px;
    max-width: 1200px;
    margin: 0 auto;
}

/* ----- Content Clusters ----- */

.content-cluster {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    padding: 2.5rem;
    position: relative;
}

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

/* Asymmetric grid placement */
.cluster-1 {
    grid-column: 1 / 4;
}

.cluster-2 {
    grid-column: 3 / 7;
}

.cluster-3 {
    grid-column: 1 / 5;
}

.cluster-4 {
    grid-column: 2 / 6;
}

.cluster-5 {
    grid-column: 3 / 7;
}

.cluster-inner {
    background: rgba(245, 240, 235, 0.85);
    border-radius: 16px;
    padding: 2.5rem 3rem;
    backdrop-filter: blur(6px);
    box-shadow: 0 8px 32px rgba(46, 64, 87, 0.08);
    position: relative;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
}

.cluster-inner:hover {
    transform: scale(1.02);
    box-shadow: 0 12px 40px rgba(46, 64, 87, 0.14);
}

.cluster-heading {
    font-family: 'Caveat', cursive;
    font-weight: 700;
    font-size: clamp(32px, 5.5vw, 72px);
    color: #2E4057;
    margin-bottom: 0.5em;
    line-height: 1.15;
}

.cluster-body {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 400;
    color: #2E4057;
    line-height: 1.75;
    max-width: 580px;
}

.cluster-annotation {
    display: inline-block;
    font-family: 'Caveat', cursive;
    font-weight: 400;
    font-size: 16px;
    color: #FF8A65;
    margin-top: 1.2em;
    opacity: 0;
    transform: scale(0);
    transition: opacity 0.5s ease 0.4s, transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.4s;
}

.content-cluster.visible .cluster-annotation {
    opacity: 1;
    transform: scale(1);
}

/* Alternate annotation colors */
.cluster-2 .cluster-annotation { color: #5B8C5A; }
.cluster-3 .cluster-annotation { color: #88C0D0; }
.cluster-4 .cluster-annotation { color: #D4A574; }
.cluster-5 .cluster-annotation { color: #5B8C5A; }

/* ----- Footer ----- */

#site-footer {
    position: relative;
    z-index: 3;
    background: #2E4057;
    padding: 3rem 2rem;
    text-align: center;
}

.footer-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.footer-logo {
    font-family: 'Caveat', cursive;
    font-weight: 700;
    font-size: 36px;
    color: #F5F0EB;
    letter-spacing: 0.04em;
}

.footer-tagline {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 400;
    font-size: 16px;
    color: #E8C5A0;
}

.footer-label {
    font-family: 'Fira Code', monospace;
    font-weight: 400;
    font-size: 13px;
    letter-spacing: 0.03em;
    color: #88C0D0;
    margin-top: 0.5rem;
}

/* ----- Spring Physics: Interactive Elements ----- */

.spring-hover {
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.spring-hover:hover {
    transform: scale(1.08);
}

.spring-hover:active {
    transform: scale(0.96);
    transition-duration: 0.15s;
}

/* ----- Responsive ----- */

@media (max-width: 900px) {
    #main-content {
        grid-template-columns: 1fr;
        gap: 40px 0;
        padding: 60px 20px 40px;
    }

    .cluster-1,
    .cluster-2,
    .cluster-3,
    .cluster-4,
    .cluster-5 {
        grid-column: 1 / -1;
    }

    .cluster-inner {
        padding: 2rem 1.5rem;
    }

    .annotation {
        display: none;
    }

    .puzzle-piece {
        transform: scale(0.6);
    }
}

@media (max-width: 600px) {
    .hero-title {
        font-size: clamp(36px, 12vw, 72px);
    }

    .cluster-heading {
        font-size: clamp(28px, 7vw, 48px);
    }

    .cluster-inner {
        padding: 1.5rem 1.2rem;
    }
}
