/* ============================================
   lunchbox.dev — Street-style nostalgic design
   Typography reference: Work Sans" (Google Fonts (300 humanist optimized screen readability with a warm body face.
   Animation reference: IntersectionObserver` (threshold: 0.15 reveals marker scribble moments.
   ============================================ */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Work Sans', Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-weight: 400;
    color: #1c1915;
    background: #f2ece3;
    overflow-x: hidden;
}

.svg-filters {
    position: absolute;
    width: 0;
    height: 0;
}

/* ============================================
   Navigation Latch
   ============================================ */
.latch-nav {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 0;
    background: #2b2520;
    border: 2px solid #d4a637;
    border-radius: 24px;
    padding: 8px 12px;
    max-width: 48px;
    overflow: hidden;
    transition: max-width 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    cursor: pointer;
}

.latch-nav:hover {
    max-width: 360px;
}

.latch-nav.latch-open {
    max-width: 360px;
}

.latch-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
}

.latch-links {
    display: flex;
    gap: 16px;
    padding-left: 12px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease 0.1s;
}

.latch-nav:hover .latch-links {
    opacity: 1;
}

.latch-nav.latch-open .latch-links {
    opacity: 1;
}

.latch-links a {
    font-family: 'Caveat', 'Bradley Hand', 'Segoe Print', cursive;
    font-size: clamp(0.9rem, 1.5vw, 1.3rem);
    color: #f7f4ef;
    text-decoration: none;
    transition: color 0.2s;
}

.latch-links a:hover {
    color: #d4a637;
}

/* ============================================
   Sections — Diagonal Clipping
   ============================================ */
.section {
    position: relative;
    width: 100%;
    padding: clamp(1.5rem, 4vw, 4rem);
}

.rip-edge {
    position: relative;
    z-index: 6;
    height: 14px;
    margin-top: -10px;
    background: linear-gradient(90deg, #d4a637, #e8714a, #c44569, #6c5b7b);
    filter: url(#torn-edge);
    opacity: 0.78;
    transform-origin: center;
    pointer-events: none;
}

.rip-edge--one { transform: rotate(-1.2deg); }
.rip-edge--two { transform: rotate(1deg); }
.rip-edge--three { transform: rotate(-0.8deg); }
.rip-edge--four { transform: rotate(0.7deg); }

.section--hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #2b2520;
    clip-path: polygon(0 0, 100% 0, 100% 92%, 0 100%);
    overflow: hidden;
}

.section--about {
    background: #f2ece3;
    clip-path: polygon(0 8%, 100% 0, 100% 100%, 0 92%);
    padding-top: clamp(6rem, 10vw, 10rem);
    padding-bottom: clamp(6rem, 10vw, 10rem);
    margin-top: -6vw;
}

.section--projects {
    background: #2b2520;
    color: #f7f4ef;
    clip-path: polygon(0 0, 100% 8%, 100% 92%, 0 100%);
    padding-top: clamp(6rem, 10vw, 10rem);
    padding-bottom: clamp(6rem, 10vw, 10rem);
    margin-top: -6vw;
}

.section--philosophy {
    background: #f2ece3;
    clip-path: polygon(0 8%, 100% 0, 100% 100%, 0 92%);
    padding-top: clamp(6rem, 10vw, 10rem);
    padding-bottom: clamp(6rem, 10vw, 10rem);
    margin-top: -6vw;
}

.section--closing {
    background: #2b2520;
    color: #f7f4ef;
    clip-path: polygon(0 0, 100% 8%, 100% 100%, 0 100%);
    padding-top: clamp(8rem, 12vw, 14rem);
    padding-bottom: clamp(4rem, 8vw, 8rem);
    margin-top: -6vw;
    min-height: 60vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
}

/* ============================================
   Hero
   ============================================ */
.hero-gradient-wash {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #e8714a 0%, #c44569 45%, #6c5b7b 100%);
    mix-blend-mode: multiply;
    opacity: 0.7;
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 3;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hero-title {
    font-family: 'Archivo Black', 'Arial Black', Impact, sans-serif;
    font-size: clamp(4rem, 12vw, 9rem);
    letter-spacing: -0.03em;
    text-transform: uppercase;
    color: #f7f4ef;
    line-height: 0.95;
    margin-top: 1rem;
}

.hero-tagline {
    font-family: 'Caveat', 'Bradley Hand', 'Segoe Print', cursive;
    font-size: clamp(1.2rem, 2.5vw, 2rem);
    color: #d4a637;
    margin-top: 1rem;
}

/* Mountains */
.mountains {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 2;
    pointer-events: none;
}

.mountains--closing {
    top: 0;
    bottom: auto;
}

.mountain-layer {
    display: block;
    width: 100%;
    position: absolute;
    bottom: 0;
}

.mountain-layer--back { height: 220px; }
.mountain-layer--mid { height: 180px; }
.mountain-layer--front { height: 140px; }

.mountain-layer--inverted {
    bottom: auto;
    top: 0;
}

/* ============================================
   3D Lunchbox
   ============================================ */
.lunchbox-3d {
    perspective: 800px;
    width: 200px;
    height: 150px;
    margin-bottom: 1.5rem;
    filter: drop-shadow(14px 20px 0 rgba(28, 25, 21, 0.28));
}

.lunchbox-scene {
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
}

.lunchbox-box {
    width: 200px;
    height: 120px;
    position: relative;
    transform-style: preserve-3d;
    animation: gentleSpin 30s linear infinite;
    transform: rotateX(-10deg);
}

.lunchbox-box--pointer {
    animation: none;
    transform: rotateX(var(--pointer-tilt-x, -10deg)) rotateY(var(--pointer-tilt-y, 0deg));
}

@keyframes gentleSpin {
    from { transform: rotateX(-10deg) rotateY(0deg); }
    to { transform: rotateX(-10deg) rotateY(360deg); }
}

.lunchbox-face {
    position: absolute;
    border: 2px solid rgba(212,166,55,0.4);
}

.lunchbox-front {
    width: 200px;
    height: 120px;
    background: linear-gradient(135deg, #e8714a 0%, #c44569 100%);
    transform: translateZ(50px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.lunchbox-front span {
    font-family: 'Archivo Black', 'Arial Black', Impact, sans-serif;
    font-size: 1.4rem;
    color: #f7f4ef;
    text-align: center;
    line-height: 1.1;
    letter-spacing: 0.05em;
}

.lunchbox-back {
    width: 200px;
    height: 120px;
    background: linear-gradient(135deg, #6c5b7b 0%, #c44569 100%);
    transform: translateZ(-50px) rotateY(180deg);
}

.lunchbox-left {
    width: 100px;
    height: 120px;
    background: linear-gradient(to bottom, #e8714a, #6c5b7b);
    transform: rotateY(-90deg) translateZ(0px);
    left: -50px;
}

.lunchbox-right {
    width: 100px;
    height: 120px;
    background: linear-gradient(to bottom, #c44569, #6c5b7b);
    transform: rotateY(90deg) translateZ(100px);
    left: 50px;
}

.lunchbox-top {
    width: 200px;
    height: 100px;
    background: linear-gradient(135deg, #d4a637 0%, #e8714a 100%);
    transform: rotateX(90deg) translateZ(-10px) rotateX(-15deg);
    top: -50px;
    transform-origin: bottom center;
    box-shadow: inset 0 -18px 0 rgba(247, 244, 239, 0.13);
}

.lunchbox-bottom {
    width: 200px;
    height: 100px;
    background: #2b2520;
    transform: rotateX(-90deg) translateZ(70px);
    top: 70px;
}

/* ============================================
   Content Grid (offset blocks)
   ============================================ */
.section-grid {
    display: grid;
    grid-template-columns: 1fr 2fr 2fr 1fr;
    gap: clamp(1.5rem, 3vw, 3rem);
    max-width: 1100px;
    margin: 0 auto;
    align-items: start;
}

.content-block--left {
    grid-column: 2 / 3;
}

.content-block--right {
    grid-column: 3 / 4;
}

.content-block {
    position: relative;
    transform: rotate(calc(var(--item-tilt, 0) * 1deg));
    padding: clamp(1rem, 2vw, 1.6rem);
    background-image: radial-gradient(circle at 10% 20%, rgba(212,166,55,0.14) 0 2px, transparent 3px), linear-gradient(135deg, rgba(247,244,239,0.22), rgba(247,244,239,0));
    box-shadow: 8px 10px 0 rgba(28,25,21,0.08);
}

.section--projects .content-block,
.section--closing .content-block {
    box-shadow: 8px 10px 0 rgba(0,0,0,0.16);
}

/* ============================================
   Typography
   ============================================ */
.section-label {
    font-family: 'Caveat', 'Bradley Hand', 'Segoe Print', cursive;
    font-size: clamp(0.9rem, 1.5vw, 1.3rem);
    color: #d4a637;
    margin-bottom: 0.25rem;
}

.section-heading {
    font-family: 'Archivo Black', 'Arial Black', Impact, sans-serif;
    font-size: clamp(2rem, 5vw, 3.5rem);
    text-transform: uppercase;
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin-bottom: 0.5rem;
}

.marker-underline {
    height: 4px;
    width: 0;
    background: linear-gradient(90deg, #e8714a, #c44569, #6c5b7b);
    border-radius: 2px;
    margin-bottom: 1.5rem;
    transition: width 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.visible .marker-underline {
    width: 80%;
}

.body-text {
    font-family: 'Work Sans', Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.72;
    margin-bottom: 1rem;
}

.aside-note {
    font-family: 'Caveat', 'Bradley Hand', 'Segoe Print', cursive;
    font-size: clamp(1.1rem, 2vw, 1.6rem);
    color: #6c5b7b;
    transform: rotate(calc(var(--item-tilt, 0) * 1deg));
    padding-top: 2rem;
}

.section--projects .aside-note {
    color: #d4a637;
}

.section--projects .body-text,
.section--projects .section-heading {
    color: #f7f4ef;
}

.section--projects .section-label {
    color: #d4a637;
}

/* ============================================
   Project Items
   ============================================ */
.project-item {
    position: relative;
    background: rgba(247, 244, 239, 0.06);
    border-left: 3px solid #e8714a;
    padding: 1rem 1.2rem;
    margin-bottom: 1.2rem;
    transform: rotate(calc(var(--item-tilt, 0) * 1deg));
}

.project-title {
    font-family: 'Archivo Black', 'Arial Black', Impact, sans-serif;
    font-size: 1.2rem;
    text-transform: uppercase;
    color: #e8714a;
    margin-bottom: 0.3rem;
}

/* ============================================
   Stickers
   ============================================ */
.sticker {
    position: absolute;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 2px solid #d4a637;
    box-shadow: 2px 3px 0 rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    z-index: 5;
    transform: rotate(var(--sticker-rot, 0deg));
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    background: rgba(42, 37, 32, 0.8);
    cursor: default;
    user-select: none;
}

.sticker::after {
    content: '';
    position: absolute;
    right: -2px;
    bottom: -2px;
    width: 18px;
    height: 18px;
    border-radius: 60% 0 50% 0;
    background: rgba(247,244,239,0.22);
    transform: rotate(8deg);
    animation: stickerPeel 2s ease-in-out infinite;
}

@keyframes stickerPeel {
    0%, 100% { transform: rotate(8deg) scale(0.8); opacity: 0.45; }
    50% { transform: rotate(18deg) scale(1.05); opacity: 0.85; }
}

.sticker:hover {
    transform: scale(1.15) rotate(calc(var(--sticker-rot, 0deg) + 10deg));
}

/* ============================================
   Tape Strips
   ============================================ */
.tape-strip {
    position: absolute;
    width: 60px;
    height: 20px;
    background: rgba(212, 166, 55, 0.3);
    z-index: 4;
    pointer-events: none;
}

/* ============================================
   Animate-in (scroll reveal)
   ============================================ */
.animate-in {
    opacity: 0;
    transform: translateY(20px) rotate(calc(var(--item-tilt, 0) * 1deg));
    transition: opacity 600ms cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 600ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.animate-in.visible {
    opacity: 1;
    transform: translateY(0) rotate(calc(var(--item-tilt, 0) * 1deg));
}

/* ============================================
   Closing Section
   ============================================ */
.closing-content {
    position: relative;
    z-index: 3;
    text-align: center;
    padding-top: 4rem;
}

.closing-tagline {
    font-family: 'Caveat', 'Bradley Hand', 'Segoe Print', cursive;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    color: #d4a637;
    margin-bottom: 1rem;
}

.closing-domain {
    font-family: 'Archivo Black', 'Arial Black', Impact, sans-serif;
    font-size: clamp(1.2rem, 2vw, 1.8rem);
    text-transform: uppercase;
    color: #f7f4ef;
    letter-spacing: 0.05em;
    margin-bottom: 1.5rem;
}

.closing-links {
    display: flex;
    gap: 2rem;
    justify-content: center;
}

.closing-link {
    font-family: 'Caveat', 'Bradley Hand', 'Segoe Print', cursive;
    font-size: clamp(1rem, 1.5vw, 1.3rem);
    color: #e8714a;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s, color 0.3s;
}

.closing-link:hover {
    color: #d4a637;
    border-bottom-color: #d4a637;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    .section-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .content-block--left,
    .content-block--right {
        grid-column: 1;
    }

    .lunchbox-3d {
        width: 150px;
        height: 110px;
    }

    .lunchbox-box {
        width: 150px;
        height: 90px;
    }

    .lunchbox-front,
    .lunchbox-back {
        width: 150px;
        height: 90px;
    }

    .lunchbox-left,
    .lunchbox-right {
        width: 75px;
        height: 90px;
    }

    .lunchbox-top,
    .lunchbox-bottom {
        width: 150px;
        height: 75px;
    }

    .sticker {
        width: 44px;
        height: 44px;
        font-size: 1.2rem;
    }
}
