/* ===== CSS VARIABLES ===== */
:root {
    --cream: #f5f0e1;
    --ink: #1a1a1a;
    --coral: #ff6b6b;
    --teal: #4ecdc4;
    --yellow: #ffe66d;
    --violet: #6c5ce7;
    --pink: #ff9ff3;
    --mint: #00b894;

    --font-display: 'Bungee', sans-serif;
    --font-body: 'Work Sans', sans-serif;
    --font-accent: 'Archivo Narrow', sans-serif;
}

/* ===== RESET & BASE ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--cream);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 0.95rem;
    line-height: 1.7;
    overflow-x: hidden;
}

/* ===== CONFETTI ===== */
#confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    overflow: hidden;
}

.confetti-piece {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: confetti-burst 1.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    animation-delay: var(--delay, 0s);
    opacity: 0;
}

@keyframes confetti-burst {
    0% {
        transform: translate(-50%, -50%) rotate(0deg) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(calc(-50% + var(--dx, 0px)), calc(-50% + var(--dy, 0px))) rotate(var(--spin, 360deg)) scale(0.3);
        opacity: 0;
    }
}

/* ===== GEOMETRIC SHAPES ===== */
.shape {
    position: absolute;
    display: block;
}

.shape.circle {
    border-radius: 50%;
}

.shape.triangle {
    background: transparent !important;
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
    background-color: var(--c) !important;
}

.shape.square {
    border-radius: 0;
}

/* ===== TAGS ===== */
.tag {
    display: inline-block;
    background: var(--tag-bg, #1a1a1a);
    color: var(--ink);
    font-family: var(--font-accent);
    font-size: 0.8rem;
    font-weight: 500;
    line-height: 1.3;
    padding: 0.25rem 0.6rem;
    border: 2px solid var(--ink);
    border-radius: 0;
    letter-spacing: 0.03em;
}

/* ===== SECTION HEADINGS ===== */
.section-heading {
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 4vw, 3.5rem);
    line-height: 1.1;
    color: var(--ink);
    margin-bottom: 1.5rem;
}

.section-heading.centered {
    text-align: center;
}

/* ===== ZIGZAG DIVIDERS ===== */
.zigzag-divider {
    width: 100%;
    height: 24px;
    background: var(--ink);
    clip-path: polygon(
        0% 0%, 2.5% 100%, 5% 0%, 7.5% 100%, 10% 0%, 12.5% 100%, 15% 0%, 17.5% 100%,
        20% 0%, 22.5% 100%, 25% 0%, 27.5% 100%, 30% 0%, 32.5% 100%, 35% 0%, 37.5% 100%,
        40% 0%, 42.5% 100%, 45% 0%, 47.5% 100%, 50% 0%, 52.5% 100%, 55% 0%, 57.5% 100%,
        60% 0%, 62.5% 100%, 65% 0%, 67.5% 100%, 70% 0%, 72.5% 100%, 75% 0%, 77.5% 100%,
        80% 0%, 82.5% 100%, 85% 0%, 87.5% 100%, 90% 0%, 92.5% 100%, 95% 0%, 97.5% 100%,
        100% 0%
    );
    margin: 0;
    position: relative;
    z-index: 2;
}

.zigzag-teal {
    background: var(--teal);
}

.zigzag-violet {
    background: var(--violet);
}

/* ===== HERO SECTION ===== */
#hero {
    position: relative;
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 2rem;
    background: var(--cream);
}

.hero-shapes {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 800px;
}

.hero-tagline {
    font-family: var(--font-accent);
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--ink);
    background: var(--yellow);
    display: inline-block;
    padding: 0.3rem 0.8rem;
    border: 2px solid var(--ink);
    margin-bottom: 1.5rem;
}

.hero-title {
    font-family: var(--font-display);
    font-size: clamp(3.5rem, 10vw, 9rem);
    line-height: 1;
    color: var(--ink);
    letter-spacing: -0.02em;
    margin-bottom: 1rem;
    -webkit-text-stroke: 0px;
}

.hero-title .dot {
    color: var(--coral);
}

.hero-sub {
    font-family: var(--font-body);
    font-size: clamp(1rem, 2vw, 1.25rem);
    font-weight: 400;
    color: var(--ink);
    max-width: 520px;
    margin: 0 auto 2rem;
    line-height: 1.6;
}

.hero-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

.scroll-hint {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-accent);
    font-size: 0.8rem;
    letter-spacing: 0.1em;
    color: var(--ink);
    animation: scroll-bounce 2s ease-in-out infinite;
    z-index: 1;
}

@keyframes scroll-bounce {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(8px); }
}

/* ===== ABOUT SECTION ===== */
#about {
    padding: 5rem 2rem;
    position: relative;
    background: var(--cream);
    overflow: hidden;
}

.about-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: center;
}

.about-text p {
    margin-bottom: 1.2rem;
    font-size: 1rem;
}

.about-shapes {
    position: relative;
    height: 280px;
    border: 3px solid var(--ink);
    background: var(--yellow);
}

/* ===== PROJECTS SECTION ===== */
#projects {
    padding: 5rem 2rem;
    background: var(--cream);
}

#projects .section-heading {
    margin-bottom: 3rem;
}

.project-grid {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1.5rem;
    padding: 0;
}

/* Distribute grid-column and grid-row via data attrs */
.project-block[data-col="1"] { grid-column: span 1; }
.project-block[data-col="2"] { grid-column: span 2; }
.project-block[data-col="3"] { grid-column: span 3; }
.project-block[data-row="1"] { grid-row: span 1; }
.project-block[data-row="2"] { grid-row: span 2; }

/* ===== PROJECT BLOCK ===== */
.project-block {
    position: relative;
    background: var(--block-bg, #f5f0e1);
    border: 3px solid var(--ink);
    padding: 1.5rem;
    overflow: hidden;
    cursor: pointer;
    transform: scale(0.8) rotate(calc(var(--r, 0) * 3deg));
    opacity: 0;
    transition: box-shadow 0.2s ease;
}

.project-block.visible {
    animation: block-enter 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    animation-delay: var(--delay, 0s);
}

@keyframes block-enter {
    from {
        transform: scale(0.8) rotate(calc(var(--r, 0) * 3deg));
        opacity: 0;
    }
    to {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.project-block:hover {
    box-shadow: 6px 6px 0 var(--ink);
}

.project-block:hover .block-shapes .shape {
    animation: bounce-shape 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes bounce-shape {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Pattern Overlays */
.block-pattern {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0.12;
}

.block-pattern.polka-dots {
    background-image: radial-gradient(circle, var(--dot-color, #1a1a1a) 3px, transparent 3px);
    background-size: 16px 16px;
}

.block-pattern.diagonal-stripes {
    background-image: repeating-linear-gradient(
        45deg,
        var(--ink) 0px,
        var(--ink) 2px,
        transparent 2px,
        transparent 12px
    );
}

.block-pattern.crosshatch {
    background-image:
        repeating-linear-gradient(0deg, var(--ink) 0px, var(--ink) 1px, transparent 1px, transparent 12px),
        repeating-linear-gradient(90deg, var(--ink) 0px, var(--ink) 1px, transparent 1px, transparent 12px);
}

.block-inner {
    position: relative;
    z-index: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.block-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.block-title {
    font-family: var(--font-display);
    font-size: clamp(1.1rem, 2.5vw, 1.7rem);
    line-height: 1.1;
    color: inherit;
}

.block-desc {
    font-size: 0.9rem;
    line-height: 1.6;
    color: inherit;
}

.block-shapes {
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
    position: relative;
}

.block-shapes .shape {
    position: relative;
    flex-shrink: 0;
}

/* ===== PROCESS SECTION ===== */
#process {
    padding: 5rem 2rem;
    background: var(--cream);
}

#process .section-heading {
    margin-bottom: 3rem;
}

.process-grid {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

.process-step {
    background: var(--step-bg, var(--cream));
    border: 3px solid var(--ink);
    padding: 2rem 1.5rem;
    transform: scale(0.85) rotate(calc(var(--r, 0) * 2deg));
    opacity: 0;
    transition: box-shadow 0.2s ease;
}

.process-step.visible {
    animation: block-enter 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    animation-delay: var(--delay, 0s);
}

.process-step:hover {
    box-shadow: 4px 4px 0 var(--ink);
}

.step-number {
    font-family: var(--font-display);
    font-size: 2.5rem;
    line-height: 1;
    color: var(--ink);
    opacity: 0.25;
    margin-bottom: 0.5rem;
}

.step-title {
    font-family: var(--font-display);
    font-size: 1.4rem;
    color: inherit;
    margin-bottom: 0.6rem;
}

/* ===== CONTACT SECTION ===== */
#contact {
    padding: 6rem 2rem;
    background: var(--ink);
    color: var(--cream);
    position: relative;
    overflow: hidden;
    text-align: center;
}

#contact .section-heading {
    color: var(--cream);
    font-size: clamp(2.5rem, 6vw, 5rem);
    margin-bottom: 1rem;
}

.contact-shapes {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.contact-inner {
    position: relative;
    z-index: 1;
    max-width: 700px;
    margin: 0 auto;
}

.contact-lead {
    font-size: 1.1rem;
    color: var(--cream);
    opacity: 0.8;
    margin-bottom: 2rem;
}

.contact-links {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
}

.contact-btn {
    display: inline-block;
    background: var(--btn-bg, var(--coral));
    color: var(--ink);
    font-family: var(--font-display);
    font-size: 1rem;
    padding: 0.8rem 1.6rem;
    border: 3px solid var(--cream);
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.contact-btn:hover {
    transform: translate(-3px, -3px);
    box-shadow: 6px 6px 0 var(--cream);
}

.site-footer {
    margin-top: 4rem;
    display: flex;
    justify-content: center;
    gap: 2rem;
    font-family: var(--font-accent);
    font-size: 0.8rem;
    color: var(--cream);
    opacity: 0.5;
    position: relative;
    z-index: 1;
    flex-wrap: wrap;
}

/* ===== HERO SCATTERED SHAPES (placed by JS) ===== */
.hero-shape {
    position: absolute;
    pointer-events: none;
    animation: hero-float var(--float-dur, 4s) ease-in-out var(--float-delay, 0s) infinite alternate;
}

@keyframes hero-float {
    0% { transform: translateY(0) rotate(var(--rot-from, 0deg)); }
    100% { transform: translateY(var(--float-y, -12px)) rotate(var(--rot-to, 8deg)); }
}

/* ===== CONTACT SHAPES (placed by JS) ===== */
.contact-shape {
    position: absolute;
    pointer-events: none;
    animation: hero-float var(--float-dur, 5s) ease-in-out var(--float-delay, 0s) infinite alternate;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
    .project-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .project-block[data-col="3"] { grid-column: span 3; }
    .project-block[data-col="2"] { grid-column: span 2; }
    .project-block[data-col="1"] { grid-column: span 1; }

    .process-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .about-inner {
        grid-template-columns: 1fr;
    }

    .about-shapes {
        height: 200px;
    }
}

@media (max-width: 600px) {
    .project-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .project-block[data-col="3"] { grid-column: span 2; }
    .project-block[data-col="2"] { grid-column: span 2; }
    .project-block[data-col="1"] { grid-column: span 1; }

    .process-grid {
        grid-template-columns: 1fr;
    }

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