/* ============================================
   ppuzzle.dev — Anti-Design Coastal Workshop
   ============================================ */

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    background-color: #F4EDE4;
    color: #3A4850;
    font-family: 'Barlow', sans-serif;
    font-weight: 400;
    font-size: clamp(0.9rem, 1.1vw, 1rem);
    line-height: 1.8;
    overflow-x: hidden;
    position: relative;
}

/* --- Paper-Aged Nautical Texture Overlay --- */
.paper-texture {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    background:
        radial-gradient(ellipse at 20% 30%, rgba(58,72,80,0.04) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 70%, rgba(58,72,80,0.03) 0%, transparent 55%),
        radial-gradient(ellipse at 50% 50%, rgba(136,176,168,0.02) 0%, transparent 70%),
        radial-gradient(ellipse at 10% 90%, rgba(200,120,96,0.02) 0%, transparent 50%),
        radial-gradient(ellipse at 90% 10%, rgba(58,72,80,0.03) 0%, transparent 45%);
    filter: url(#paperGrain);
    opacity: 1;
}

/* --- Geometric Shape Anchors --- */
.geometric-anchors {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.geo-shape {
    position: absolute;
}

.geo-circle-1 {
    width: 80px;
    height: 80px;
    top: 8%;
    left: 5%;
}

.geo-triangle-1 {
    width: 80px;
    height: 80px;
    top: 15%;
    right: 8%;
}

.geo-rect-1 {
    width: 80px;
    height: 80px;
    bottom: 20%;
    left: 10%;
}

.geo-circle-2 {
    width: 60px;
    height: 60px;
    top: 45%;
    right: 4%;
}

.geo-triangle-2 {
    width: 100px;
    height: 100px;
    bottom: 10%;
    right: 15%;
}

.geo-rect-2 {
    width: 50px;
    height: 50px;
    top: 70%;
    left: 3%;
}

.geo-circle-3 {
    width: 120px;
    height: 120px;
    top: 30%;
    left: 40%;
    color: #88B0A8;
}

.geo-triangle-3 {
    width: 70px;
    height: 70px;
    bottom: 35%;
    right: 30%;
}

.geo-diamond-1 {
    width: 60px;
    height: 60px;
    top: 55%;
    left: 25%;
}

.geo-circle-4 {
    width: 40px;
    height: 40px;
    top: 22%;
    left: 60%;
}

/* --- Typography --- */
h1, h2, h3 {
    font-family: 'Barlow Condensed', sans-serif;
    color: #1A2830;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

h2 {
    font-size: clamp(1.8rem, 3.5vw, 2.8rem);
    font-weight: 600;
}

p {
    color: #3A4850;
    font-family: 'Barlow', sans-serif;
    font-weight: 300;
}

/* --- Hero Section --- */
.hero {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 1;
    overflow: hidden;
}

.hero-inner {
    text-align: center;
    position: relative;
    z-index: 2;
}

.hero-title {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 800;
    font-size: clamp(3.5rem, 10vw, 8rem);
    color: #1A2830;
    letter-spacing: 0.06em;
    line-height: 0.95;
    transform: rotate(-0.8deg);
    margin-bottom: 1.2rem;
    opacity: 0;
    animation: heroTitleIn 1s cubic-bezier(0.68, -0.55, 0.27, 1.55) 0.3s forwards;
    cursor: default;
}

.hero-subtitle {
    font-family: 'Barlow', sans-serif;
    font-weight: 300;
    font-size: clamp(1rem, 2vw, 1.4rem);
    color: #5A7888;
    letter-spacing: 0.15em;
    text-transform: lowercase;
    transform: rotate(0.4deg);
    margin-bottom: 1.5rem;
    opacity: 0;
    animation: heroFadeIn 0.8s ease 0.8s forwards;
}

.hero-label {
    font-family: 'Fira Code', monospace;
    font-weight: 400;
    font-size: 0.8rem;
    color: #5A7888;
    opacity: 0;
    animation: heroFadeIn 0.8s ease 1.2s forwards;
}

/* --- Hero Scroll Hint --- */
.hero-scroll-hint {
    position: absolute;
    bottom: 2.5rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    opacity: 0;
    animation: heroFadeIn 0.8s ease 1.8s forwards;
}

.hero-scroll-text {
    font-family: 'Fira Code', monospace;
    font-weight: 400;
    font-size: 0.65rem;
    color: #5A7888;
    letter-spacing: 0.1em;
    text-transform: lowercase;
    opacity: 0.5;
}

.hero-scroll-arrow {
    animation: scrollBounce 2s ease-in-out infinite;
}

@keyframes scrollBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(5px); }
}

@keyframes heroTitleIn {
    0% {
        opacity: 0;
        transform: rotate(-0.8deg) scaleX(0.9) scaleY(1.1);
    }
    60% {
        opacity: 1;
        transform: rotate(-0.8deg) scaleX(1.04) scaleY(0.97);
    }
    100% {
        opacity: 1;
        transform: rotate(-0.8deg) scaleX(1) scaleY(1);
    }
}

@keyframes heroFadeIn {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }
    100% {
        opacity: 0.8;
        transform: translateY(0);
    }
}

/* --- Blocks Section --- */
.blocks-section {
    position: relative;
    z-index: 1;
    padding: 2rem 2rem 4rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* --- Blocks Grid (Modular Puzzle) --- */
.blocks-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2px;
}

/* --- Individual Block --- */
.block {
    position: relative;
    background-color: #FAF6F0;
    padding: 2rem 1.8rem;
    overflow: hidden;
    transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55),
                box-shadow 0.4s ease;
    cursor: pointer;
    opacity: 0;
    transform: translateY(20px);
}

.block:hover {
    z-index: 5;
    box-shadow: 0 2px 20px rgba(26,40,48,0.06);
}

/* Block size variations */
.block-wide {
    grid-column: span 2;
}

.block-tall {
    grid-row: span 2;
}

.block-full {
    grid-column: span 3;
}

/* --- Block Label (Fira Code) --- */
.block-label {
    display: block;
    font-family: 'Fira Code', monospace;
    font-weight: 400;
    font-size: 0.7rem;
    color: #5A7888;
    text-transform: lowercase;
    margin-bottom: 1rem;
    opacity: 0.7;
}

/* --- Block Heading --- */
.block-heading {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 600;
    font-size: clamp(1.2rem, 2.2vw, 1.8rem);
    color: #1A2830;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    margin-bottom: 0.8rem;
    line-height: 1.15;
}

/* --- Block Body --- */
.block-body {
    font-family: 'Barlow', sans-serif;
    font-weight: 300;
    font-size: clamp(0.9rem, 1.1vw, 1rem);
    color: #3A4850;
    line-height: 1.8;
    margin-bottom: 0.6rem;
}

.block-body:last-of-type {
    margin-bottom: 0;
}

/* --- Block Geometric Anchors --- */
.block-anchor {
    position: absolute;
    bottom: 0.8rem;
    right: 0.8rem;
    width: 40px;
    height: 40px;
    pointer-events: none;
}

.block-anchor-tl {
    bottom: auto;
    right: auto;
    top: 0.8rem;
    left: 0.8rem;
}

.block-anchor-br {
    bottom: 0.8rem;
    right: 0.8rem;
}

/* --- Block Visible State --- */
.block.visible {
    opacity: 1;
}

/* --- Coral Accent Blocks (block 07, 11) --- */
.block-accent::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: #C87860;
    opacity: 0.4;
}

/* --- Footer --- */
.site-footer {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 3rem 2rem;
    border-top: 1px solid rgba(90,120,136,0.12);
}

.footer-label {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    color: #1A2830;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.footer-divider {
    font-family: 'Fira Code', monospace;
    font-size: 0.8rem;
    color: #5A7888;
    opacity: 0.5;
}

.footer-text {
    font-family: 'Barlow', sans-serif;
    font-weight: 300;
    font-size: 0.85rem;
    color: #5A7888;
    letter-spacing: 0.08em;
}

/* --- Responsive --- */
@media (max-width: 900px) {
    .blocks-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .block-wide {
        grid-column: span 2;
    }

    .block-full {
        grid-column: span 2;
    }

    .block-tall {
        grid-row: span 2;
    }

    .hero-title {
        font-size: clamp(2.5rem, 8vw, 5rem);
    }
}

@media (max-width: 520px) {
    .blocks-grid {
        grid-template-columns: 1fr;
    }

    .block-wide,
    .block-full,
    .block-tall {
        grid-column: span 1;
        grid-row: span 1;
    }

    .blocks-section {
        padding: 1rem 1rem 3rem;
    }

    .hero-title {
        font-size: clamp(2rem, 12vw, 3.5rem);
    }
}
