/* lunch.quest - Cinematic Lunch Reel */
/* Palette: Earth Tones */
/* #f5f0e8 Linen White | #ebe3d5 Warm Parchment | #e8ddd0 Steamed Milk */
/* #3d2e22 Roasted Umber | #5c4a3d Leather Brown | #8a7a6a Weathered Stone */
/* #b5956b Bread Crust | #7c6853 Walnut Shell | #c4b5a3 Dried Clay */
/* #d4c8b5 Bone China | #d4b896 (accent) | #6b5a47 (dark leather) */

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

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

body {
    background: #f5f0e8;
    color: #3d2e22;
    overflow: hidden;
}

/* Scroll Container with Snap */
.scroll-container {
    height: 100vh;
    overflow-y: auto;
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
}

/* Frame Base */
.frame {
    min-height: 100vh;
    height: 100vh;
    position: relative;
    overflow: hidden;
    scroll-snap-align: start;
}

.frame-1 { background: #f5f0e8; }
.frame-2 { background: #ebe3d5; }
.frame-3 { background: #f5f0e8; }
.frame-4 { background: #e8ddd0; }
.frame-5 { background: #f5f0e8; }
.frame-6 { background: #ebe3d5; }

/* Frame Grid - Asymmetric 3x3 */
.frame-grid {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    grid-template-rows: 1fr 2fr 1fr;
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 2;
}

/* Leather Binding Strip */
.leather-binding {
    position: absolute;
    top: 0;
    left: 0;
    width: 12px;
    height: 100%;
    z-index: 3;
    background:
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 2px,
            rgba(92, 74, 61, 0.08) 2px,
            rgba(92, 74, 61, 0.08) 4px
        ),
        linear-gradient(
            to bottom,
            #7c6853,
            #6b5a47,
            #7c6853
        );
    border-right: 1px dashed #b5956b;
}

.leather-binding-dark {
    background:
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 2px,
            rgba(92, 74, 61, 0.12) 2px,
            rgba(92, 74, 61, 0.12) 4px
        ),
        linear-gradient(
            to bottom,
            #6b5a47,
            #5c4a3d,
            #6b5a47
        );
}

/* Border Animate */
.border-animate {
    position: absolute;
    top: 16px;
    left: 24px;
    right: 16px;
    bottom: 16px;
    z-index: 1;
    pointer-events: none;
}

.border-animate .border-top,
.border-animate .border-right,
.border-animate .border-bottom,
.border-animate .border-left {
    position: absolute;
    background: #c4b5a3;
}

.border-animate .border-top {
    top: 0;
    left: 0;
    height: 2px;
    width: 0;
}

.border-animate .border-right {
    top: 0;
    right: 0;
    width: 2px;
    height: 0;
}

.border-animate .border-bottom {
    bottom: 0;
    right: 0;
    height: 2px;
    width: 0;
}

.border-animate .border-left {
    bottom: 0;
    left: 0;
    width: 2px;
    height: 0;
}

/* Warm border variant for Frame 4 */
.border-animate-warm .border-top,
.border-animate-warm .border-right,
.border-animate-warm .border-bottom,
.border-animate-warm .border-left {
    background: #b5956b;
}

/* Border animation active states */
.frame.in-view .border-top {
    animation: drawTopBorder 0.4s ease-out forwards;
}
.frame.in-view .border-right {
    animation: drawRightBorder 0.4s ease-out 0.3s forwards;
}
.frame.in-view .border-bottom {
    animation: drawBottomBorder 0.4s ease-out 0.6s forwards;
}
.frame.in-view .border-left {
    animation: drawLeftBorder 0.4s ease-out 0.9s forwards;
}

@keyframes drawTopBorder {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes drawRightBorder {
    from { height: 0; }
    to { height: 100%; }
}

@keyframes drawBottomBorder {
    from { width: 0; right: auto; left: auto; }
    to { width: 100%; }
}

@keyframes drawLeftBorder {
    from { height: 0; bottom: auto; top: auto; }
    to { height: 100%; }
}

/* Bubbles */
.bubbles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

.bubble {
    position: absolute;
    bottom: -50px;
    border-radius: 50%;
    opacity: 0;
}

.bubble-inner {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    position: relative;
}

.frame.in-view .bubble {
    animation: rise var(--duration) ease-in infinite;
    animation-delay: var(--delay);
}

@keyframes rise {
    0% {
        transform: translateY(0);
        opacity: 0;
    }
    10% {
        opacity: 0.7;
    }
    80% {
        opacity: 0.5;
    }
    100% {
        transform: translateY(calc(-100vh - 60px));
        opacity: 0;
    }
}

/* Typography */

/* Title - Frame 1 */
.title-card {
    grid-column: 2 / 3;
    grid-row: 2 / 3;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    padding-right: 10%;
}

.title {
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    font-size: clamp(4rem, 12vw, 9rem);
    letter-spacing: 0.2em;
    color: #3d2e22;
    line-height: 1;
    text-transform: uppercase;
}

.subtitle {
    font-family: 'Cutive Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.75rem, 1vw, 0.9rem);
    color: #8a7a6a;
    letter-spacing: 0.03em;
    margin-top: 1.5rem;
    border-bottom: 1px dashed #c4b5a3;
    padding-bottom: 2px;
}

/* Question - Frame 2 */
.question {
    grid-column: 1 / 2;
    grid-row: 2 / 3;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-left: 20%;
}

.question-text {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.4vw, 1.15rem);
    line-height: 2.0;
    letter-spacing: 0.03em;
    color: #5c4a3d;
    max-width: 38ch;
}

/* Catalogue - Frame 3 */
.catalogue {
    grid-column: 2 / 3;
    grid-row: 2 / 3;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 15%;
}

.word-list {
    list-style: none;
    text-align: right;
}

.word-item {
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    font-size: clamp(1.4rem, 3vw, 2.4rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #3d2e22;
    line-height: 3.0;
    opacity: 0;
    transform: translateY(10px);
}

.frame-3.in-view .word-item {
    animation: fadeInWord 0.6s ease-out forwards;
}

.frame-3.in-view .word-item:nth-child(1) { animation-delay: 0.1s; }
.frame-3.in-view .word-item:nth-child(2) { animation-delay: 0.4s; }
.frame-3.in-view .word-item:nth-child(3) { animation-delay: 0.7s; }
.frame-3.in-view .word-item:nth-child(4) { animation-delay: 1.0s; }
.frame-3.in-view .word-item:nth-child(5) { animation-delay: 1.3s; }

@keyframes fadeInWord {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Moment - Frame 4 */
.moment {
    grid-column: 2 / 3;
    grid-row: 2 / 3;
    display: flex;
    align-items: center;
    justify-content: center;
}

.meal-symbol {
    font-size: 4rem;
    color: #7c6853;
    line-height: 1;
}

/* Quiet After - Frame 5 */
.quiet-after {
    grid-column: 1 / 2;
    grid-row: 3 / 4;
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    padding: 0 0 15% 20%;
}

.quiet-text {
    font-family: 'Cutive Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.75rem, 1vw, 0.9rem);
    color: #8a7a6a;
    border-bottom: 1px dashed #c4b5a3;
    padding-bottom: 2px;
}

/* Return - Frame 6 */
.return {
    grid-column: 2 / 3;
    grid-row: 2 / 3;
    display: flex;
    align-items: center;
    justify-content: center;
}

.again-link {
    font-family: 'Space Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.4vw, 1.15rem);
    color: #5c4a3d;
    letter-spacing: 0.03em;
    cursor: pointer;
    text-transform: lowercase;
    transition: color 0.3s ease;
    position: relative;
}

.again-link:hover {
    color: #3d2e22;
}

.again-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1px;
    background: #b5956b;
    transition: width 0.4s ease;
}

.again-link:hover::after {
    width: 100%;
}

/* Decorative separators */
.frame-1::after {
    content: '· · ·';
    position: absolute;
    bottom: 8%;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.9rem;
    color: #c4b5a3;
    letter-spacing: 0.5em;
    z-index: 2;
}

/* Responsive */
@media (max-width: 400px) {
    .leather-binding {
        display: none;
    }

    .border-animate {
        left: 16px;
    }
}

@media (max-width: 768px) {
    .title-card {
        align-items: center;
        padding-right: 0;
    }

    .question {
        padding-left: 10%;
        grid-column: 1 / 4;
    }

    .catalogue {
        justify-content: center;
        padding-right: 0;
    }

    .quiet-after {
        padding-left: 10%;
        grid-column: 1 / 4;
    }
}
