/* ==========================================================================
   lunchbox.dev — Styles
   Grainy-textured editorial meditation on the packed lunch
   ========================================================================== */

/* ----- CSS Custom Properties ----- */
:root {
    --color-primary: #5C1A2A;       /* Deep Burgundy / Kuro-beni */
    --color-secondary: #8B6914;     /* Warm Earth / Toasted Sesame */
    --color-background: #F5EDE0;    /* Warm Cream / Unbleached Linen */
    --color-accent: #B8943E;        /* Muted Gold / Aged Brass */
    --color-dark: #1C1A17;          /* Dark Ground / Charcoal Inkstone */
    --color-text: #2A2623;          /* Text Primary / Sumi Black */
    --color-inverse: #FAF7F2;       /* Text Inverse / Warm White */

    --font-heading: 'Cormorant Garamond', 'Georgia', serif;
    --font-body: 'Commissioner', 'Helvetica Neue', sans-serif;

    --ease-slide: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.875rem, 1.2vw, 1.125rem);
    line-height: 1.7;
    letter-spacing: 0.01em;
    color: var(--color-text);
    background-color: var(--color-background);
    overflow-x: hidden;
    position: relative;
}

/* ----- Grain Overlay ----- */
#grain-overlay {
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    pointer-events: none;
    z-index: 1000;
    mix-blend-mode: multiply;
    opacity: 0.04;
    will-change: transform;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23g)' opacity='1'/%3E%3C/svg%3E");
    background-repeat: repeat;
}

/* ----- Skeleton Loading Overlay ----- */
#skeleton-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    background-color: var(--color-background);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2vh;
    padding: 5vh 5vw;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

#skeleton-overlay.hidden {
    opacity: 0;
    visibility: hidden;
}

.skeleton-band {
    width: 90%;
    height: 12vh;
    background-color: var(--color-primary);
    opacity: 0.4;
    animation: skeleton-pulse 1.2s ease-in-out infinite alternate;
}

.skeleton-band-1 {
    transform: skewY(-3deg);
    animation-delay: 0s;
}

.skeleton-band-2 {
    transform: skewY(4deg);
    animation-delay: 0.15s;
    width: 80%;
}

.skeleton-band-3 {
    transform: skewY(-4deg);
    animation-delay: 0.3s;
}

.skeleton-band-4 {
    transform: skewY(3deg);
    animation-delay: 0.45s;
    width: 85%;
}

.skeleton-band-5 {
    transform: skewY(-3deg);
    animation-delay: 0.6s;
    width: 75%;
}

@keyframes skeleton-pulse {
    0% { opacity: 0.4; }
    100% { opacity: 0.6; }
}

/* ----- Scroll Progress Indicator ----- */
#scroll-progress {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 36px;
    height: 36px;
    z-index: 900;
    opacity: 0;
    transition: opacity 0.4s ease;
}

#scroll-progress.visible {
    opacity: 1;
}

.progress-ring {
    width: 100%;
    height: 100%;
}

.progress-ring-fill {
    transition: stroke-dashoffset 0.15s ease;
}

/* ----- Flowing Curves ----- */
#flowing-curves {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.curves-svg {
    width: 100%;
    height: 100%;
}

.flow-curve {
    filter: blur(2px);
    transition: filter 0.8s ease;
}

/* ----- Kanji Strokes (decorative) ----- */
#kanji-strokes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

.kanji-stroke {
    position: absolute;
    width: 60px;
    height: 60px;
}

.kanji-stroke-1 {
    top: 25%;
    left: 8%;
}

.kanji-stroke-2 {
    top: 45%;
    right: 12%;
}

.kanji-stroke-3 {
    top: 65%;
    left: 15%;
}

.kanji-stroke-4 {
    top: 82%;
    right: 8%;
}

/* ----- Typography ----- */
h1, h2, h3 {
    font-family: var(--font-heading);
    font-weight: 300;
    line-height: 0.95;
    letter-spacing: -0.02em;
}

.body-text {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.875rem, 1.2vw, 1.125rem);
    line-height: 1.7;
    letter-spacing: 0.01em;
    margin-bottom: 1.5em;
}

.body-text:last-child {
    margin-bottom: 0;
}

.accent-numeral {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    color: var(--color-accent);
    display: block;
    margin-bottom: 0.5em;
    letter-spacing: 0.05em;
}

.decorative-ampersand {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: clamp(6rem, 15vw, 12rem);
    color: var(--color-accent);
    opacity: 0.2;
    display: block;
    line-height: 0.8;
    text-align: center;
    margin-bottom: -0.2em;
    position: relative;
    z-index: 0;
}

/* ----- Section Base ----- */
.section {
    position: relative;
    z-index: 5;
    overflow: hidden;
}

/* ----- Section 1: The Lid (Hero) ----- */
.section-hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--color-primary);
    position: relative;
}

.hero-content {
    text-align: center;
    padding: 2rem;
}

.hero-title {
    font-family: var(--font-heading);
    font-weight: 300;
    font-size: clamp(3rem, 8vw, 7rem);
    color: var(--color-inverse);
    letter-spacing: -0.02em;
    line-height: 0.95;
    transform: rotate(-2deg);
    display: inline-block;
}

.hero-line {
    width: 120px;
    height: 1px;
    background-color: var(--color-accent);
    margin: 2rem auto 0;
    opacity: 0.6;
}

/* ----- Section 2-3: The First Layer ----- */
.section-first-layer {
    min-height: 100vh;
    padding: 12vh 5vw;
    background-color: var(--color-background);
    position: relative;
}

.first-layer-inner {
    display: grid;
    grid-template-columns: 35% 10% 55%;
    max-width: 1200px;
    margin: 0 auto;
    min-height: 70vh;
    align-items: center;
}

.text-column {
    padding-right: 2rem;
}

.gutter-illustration {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.chopsticks-svg {
    height: 250px;
    width: auto;
}

.visual-column {
    display: flex;
    justify-content: center;
    align-items: center;
    padding-left: 2rem;
}

.bento-top-svg {
    width: 100%;
    max-width: 400px;
    height: auto;
}

/* ----- Diagonal Sections (Compartments) ----- */
.section-diagonal {
    position: relative;
    padding: 14vh 8vw;
    min-height: 80vh;
    display: flex;
    align-items: center;
}

.diagonal-lr {
    clip-path: polygon(0 4%, 100% 0, 100% 96%, 0 100%);
    margin-top: -4vh;
    margin-bottom: -4vh;
}

.diagonal-rl {
    clip-path: polygon(0 0, 100% 4%, 100% 100%, 0 96%);
    margin-top: -4vh;
    margin-bottom: -4vh;
}

.diagonal-dark {
    background-color: var(--color-dark);
    color: var(--color-inverse);
}

.diagonal-dark .body-text {
    color: var(--color-inverse);
    opacity: 0.85;
}

.diagonal-dark .section-heading {
    color: var(--color-inverse);
}

.diagonal-light {
    background-color: var(--color-background);
    color: var(--color-text);
}

.diagonal-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    max-width: 1100px;
    margin: 0 auto;
    align-items: center;
    width: 100%;
}

.section-heading {
    font-family: var(--font-heading);
    font-weight: 300;
    font-size: clamp(2rem, 5vw, 4rem);
    line-height: 0.95;
    letter-spacing: -0.02em;
    margin-bottom: 1em;
}

.diagonal-illustration {
    display: flex;
    justify-content: center;
    align-items: center;
}

.diagonal-illustration .illustration {
    width: 100%;
    max-width: 200px;
    height: auto;
}

/* ----- Section 8: The Bottom ----- */
.section-bottom {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--color-background);
    text-align: center;
    padding: 10vh 5vw;
}

.bottom-content {
    max-width: 700px;
    margin: 0 auto;
}

.bottom-illustration {
    margin-bottom: 3rem;
}

.bottom-illustration .illustration {
    width: 120px;
    height: auto;
    margin: 0 auto;
    display: block;
}

.closing-heading {
    font-family: var(--font-heading);
    font-weight: 300;
    font-size: clamp(2rem, 5vw, 4rem);
    color: var(--color-text);
    line-height: 0.95;
    letter-spacing: -0.02em;
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 1;
}

.closing-text {
    font-family: var(--font-body);
    font-weight: 500;
    font-size: clamp(0.75rem, 1vw, 0.875rem);
    color: var(--color-accent);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-top: 2rem;
}

.bottom-line {
    width: 60px;
    height: 1px;
    background-color: var(--color-accent);
    margin: 3rem auto 0;
    opacity: 0.4;
}

/* ----- Reveal Animations ----- */
.reveal-element {
    opacity: 0;
    transform: translate(30px, 30px);
    transition: opacity 0.8s var(--ease-slide), transform 0.8s var(--ease-slide);
}

.reveal-element.revealed {
    opacity: 1;
    transform: translate(0, 0);
}

/* Diagonal-specific reveal directions */
.diagonal-lr .reveal-element {
    transform: translate(40px, -20px);
}

.diagonal-lr .reveal-element.revealed {
    transform: translate(0, 0);
}

.diagonal-rl .reveal-element {
    transform: translate(-40px, -20px);
}

.diagonal-rl .reveal-element.revealed {
    transform: translate(0, 0);
}

/* ----- Bounce Enter Animation ----- */
.bounce-enter {
    opacity: 0;
    transform: rotate(-2deg) translateY(-30px);
    transition: opacity 0.6s var(--ease-bounce), transform 0.6s var(--ease-bounce);
}

.bounce-enter.revealed {
    opacity: 1;
    transform: rotate(-2deg) translateY(0);
}

/* ----- Blur-Focus Depth Effect ----- */
.blur-element {
    filter: blur(2px);
    transition: filter 0.8s ease;
}

.blur-element.focused {
    filter: blur(0px);
}

/* ----- Illustrations ----- */
.illustration {
    display: block;
}

/* ----- Responsive ----- */
@media (max-width: 768px) {
    .first-layer-inner {
        grid-template-columns: 1fr;
        gap: 3rem;
    }

    .text-column {
        padding-right: 0;
        order: 1;
    }

    .gutter-illustration {
        order: 3;
        padding: 2rem 0;
    }

    .chopsticks-svg {
        height: 120px;
        transform: rotate(90deg);
    }

    .visual-column {
        padding-left: 0;
        order: 2;
    }

    .diagonal-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .section-diagonal {
        padding: 16vh 6vw;
        min-height: 60vh;
    }

    .diagonal-illustration .illustration {
        max-width: 140px;
    }

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

    #scroll-progress {
        bottom: 16px;
        right: 16px;
        width: 28px;
        height: 28px;
    }

    .kanji-stroke {
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 480px) {
    .section-diagonal {
        padding: 18vh 5vw;
    }

    .decorative-ampersand {
        font-size: clamp(4rem, 20vw, 8rem);
    }
}
