/* lunch.quest — bento-box gamified lunch adventure */

:root {
    --mango: #ff6b35;
    --turmeric: #ffc857;
    --wasabi: #2ec4b6;
    --nori: #1a1a2e;
    --rice: #ffffff;
    --chili: #e71d36;
    --steam: #f0f0f0;
    --eggplant: #6b4d82;

    --gutter: 4px;
    --font-display: 'Fredoka', system-ui, sans-serif;
    --font-body: 'Nunito', system-ui, sans-serif;
    --font-pixel: 'Press Start 2P', monospace;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    font-weight: 400;
    line-height: 1.7;
    color: var(--nori);
    background: var(--nori);
    overflow-x: hidden;
}

/* ==============================
   QUEST PROGRESS BAR
   ============================== */
.quest-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: rgba(26, 26, 46, 0.4);
    z-index: 1000;
}

.quest-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--mango) 0%, var(--turmeric) 50%, var(--wasabi) 100%);
    transition: width 60ms linear;
    box-shadow: 0 0 8px rgba(46, 196, 182, 0.6);
}

/* ==============================
   ACHIEVEMENT BADGES
   ============================== */
.achievement-stack {
    position: fixed;
    top: 24px;
    right: 0;
    z-index: 999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.achievement-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px 8px 8px;
    background: var(--eggplant);
    color: var(--rice);
    border-radius: 28px;
    box-shadow: 0 4px 16px rgba(26, 26, 46, 0.4), inset 0 0 0 2px var(--turmeric);
    transform: translateX(120%);
    animation: badge-bounce-in 600ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    pointer-events: auto;
}

.achievement-badge .badge-circle {
    width: 40px;
    height: 40px;
    background: var(--turmeric);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    line-height: 1;
    flex-shrink: 0;
}

.achievement-badge .badge-text {
    font-family: var(--font-pixel);
    font-size: 0.6rem;
    letter-spacing: 0.5px;
    white-space: nowrap;
    padding-right: 6px;
}

@keyframes badge-bounce-in {
    0% {
        transform: translateX(120%);
    }
    60% {
        transform: translateX(-10px);
    }
    80% {
        transform: translateX(4px);
    }
    100% {
        transform: translateX(0);
    }
}

.achievement-badge.fading {
    animation: badge-fade-out 600ms ease forwards;
}

@keyframes badge-fade-out {
    to {
        opacity: 0;
        transform: translateX(120%);
    }
}

/* ==============================
   MEMPHIS DECORATIVE SHAPES
   ============================== */
.memphis-decor {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.shape {
    position: absolute;
    opacity: 0.85;
}

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

.shape-circle-ring {
    border-radius: 50%;
    background: transparent !important;
}

.shape-triangle {
    width: 0;
    height: 0;
    background: transparent !important;
}

.shape-square {
    transform-origin: center;
}

.shape-squiggle {
    background: transparent !important;
    border-top: 6px solid;
    border-right: 6px solid transparent;
    border-radius: 50% 50% 0 0 / 100% 100% 0 0;
}

.shape-zigzag {
    background: transparent !important;
}

.shape-dots {
    background: transparent !important;
    background-image: radial-gradient(circle, currentColor 25%, transparent 26%);
    background-size: 14px 14px;
}

/* Individual shape positioning */
.shape-1 {
    top: 8%;
    left: 6%;
    width: 70px;
    height: 70px;
    background: var(--mango);
    animation: float-a 10s ease-in-out infinite;
}

.shape-2 {
    top: 18%;
    right: 12%;
    border-left: 36px solid transparent;
    border-right: 36px solid transparent;
    border-bottom: 60px solid var(--wasabi);
    animation: spin-slow 12s linear infinite;
}

.shape-3 {
    top: 38%;
    left: 4%;
    width: 100px;
    height: 50px;
    border-color: var(--chili);
    animation: float-b 11s ease-in-out infinite;
}

.shape-4 {
    top: 30%;
    right: 5%;
    width: 90px;
    height: 90px;
    color: var(--eggplant);
    animation: float-a 9s ease-in-out infinite;
}

.shape-5 {
    top: 55%;
    left: 8%;
    width: 80px;
    height: 80px;
    border: 6px solid var(--turmeric);
    animation: spin-slow 14s linear infinite reverse;
}

.shape-6 {
    top: 62%;
    right: 8%;
    width: 110px;
    height: 30px;
    background: linear-gradient(135deg, var(--mango) 25%, transparent 25%, transparent 50%, var(--mango) 50%, var(--mango) 75%, transparent 75%) !important;
    background-size: 20px 20px !important;
    animation: float-b 10s ease-in-out infinite;
}

.shape-7 {
    top: 75%;
    left: 12%;
    width: 50px;
    height: 50px;
    background: var(--eggplant);
    animation: spin-slow 11s linear infinite;
}

.shape-8 {
    top: 82%;
    right: 14%;
    border-left: 28px solid transparent;
    border-right: 28px solid transparent;
    border-bottom: 48px solid var(--chili);
    animation: spin-slow 13s linear infinite reverse;
}

.shape-9 {
    top: 88%;
    left: 4%;
    width: 60px;
    height: 60px;
    background: var(--wasabi);
    animation: float-a 12s ease-in-out infinite;
}

.shape-10 {
    top: 92%;
    right: 6%;
    width: 80px;
    height: 80px;
    color: var(--turmeric);
    animation: float-b 10s ease-in-out infinite;
}

@keyframes float-a {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg);
    }
    50% {
        transform: translate(12px, -16px) rotate(8deg);
    }
}

@keyframes float-b {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg);
    }
    50% {
        transform: translate(-14px, 12px) rotate(-10deg);
    }
}

@keyframes spin-slow {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* ==============================
   BENTO SECTIONS
   ============================== */
.bento {
    position: relative;
    z-index: 2;
    width: 100%;
    min-height: 100vh;
    padding: var(--gutter);
    background: var(--nori); /* divider color shows through gaps */
}

.bento-grid {
    display: grid;
    gap: var(--gutter);
    width: 100%;
    height: calc(100vh - 2 * var(--gutter));
    min-height: 600px;
}

/* Universal block styling */
.block {
    position: relative;
    padding: clamp(16px, 2.4vw, 36px);
    overflow: hidden;
    transition: transform 200ms ease, box-shadow 200ms ease;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    color: var(--nori);
}

.block:hover {
    transform: scale(1.02);
    box-shadow: 0 0 0 2px var(--wasabi), 0 0 24px rgba(46, 196, 182, 0.5);
    z-index: 5;
}

.quest-tag {
    font-family: var(--font-pixel);
    font-size: 0.7rem;
    letter-spacing: 1px;
    margin-bottom: 14px;
    color: inherit;
    opacity: 0.85;
}

.block-heading {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(1.6rem, 3.6vw, 3.2rem);
    line-height: 1.05;
    margin-bottom: 16px;
}

.block-body {
    font-size: clamp(0.95rem, 1.1vw, 1.05rem);
    max-width: 38ch;
}

.block-label {
    font-family: var(--font-pixel);
    font-size: 0.7rem;
    letter-spacing: 1px;
}

.big-emoji {
    font-size: clamp(3rem, 7vw, 6rem);
    line-height: 1;
    margin-bottom: 10px;
}

/* ==============================
   LEVEL 1 — HERO
   ============================== */
.grid-hero {
    grid-template-columns: 2fr 1fr 1fr;
    grid-template-rows: 1fr 1fr 1fr;
    grid-template-areas:
        "hero hero a"
        "hero hero b"
        "c d b";
}

.block-hero {
    background: var(--turmeric);
    justify-content: center;
}

.hero-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2.5rem, 9vw, 7rem);
    line-height: 0.92;
    color: var(--nori);
    margin-bottom: 30px;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.05em;
}

.hero-word,
.hero-dot,
.hero-line {
    display: inline-block;
    transform: scale(0);
    opacity: 0;
}

.hero-word.bounce-in,
.hero-dot.bounce-in,
.hero-line.bounce-in {
    animation: bounce-enter 400ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.hero-word-accent {
    color: var(--mango);
}

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

@keyframes bounce-enter {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    60% {
        transform: scale(1.05);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.hero-tagline {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: clamp(1.4rem, 3vw, 2.4rem);
    line-height: 1.05;
    color: var(--nori);
    display: flex;
    flex-direction: column;
}

.hero-line-accent {
    color: var(--eggplant);
}

.block-noodle {
    background: var(--mango);
    color: var(--rice);
    align-items: flex-start;
    justify-content: space-between;
}

.block-stat {
    background: var(--wasabi);
    color: var(--nori);
    justify-content: center;
    align-items: center;
    text-align: center;
}

.stat-num {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(3rem, 7vw, 6rem);
    line-height: 1;
    color: var(--nori);
}

.stat-label {
    font-family: var(--font-pixel);
    font-size: 0.7rem;
    letter-spacing: 1px;
    margin-top: 8px;
}

.block-taco {
    background: var(--chili);
    color: var(--rice);
    align-items: flex-start;
    justify-content: space-between;
}

.block-scroll {
    background: var(--nori);
    color: var(--turmeric);
    justify-content: center;
    align-items: center;
    text-align: center;
}

.scroll-text {
    font-family: var(--font-pixel);
    font-size: 0.8rem;
    letter-spacing: 2px;
}

.scroll-arrow {
    display: block;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 2.4rem;
    margin-top: 8px;
    animation: bob 1.6s ease-in-out infinite;
}

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

/* ==============================
   LEVEL 2 — POWER UPS
   ============================== */
.grid-powerups {
    grid-template-columns: 2fr 1fr 1fr 1fr;
    grid-template-rows: 1fr 1fr 1fr;
    grid-template-areas:
        "feature p1 p2 p3"
        "feature p1 p2 p3"
        "feature p4 p5 p5";
}

.block-feature {
    background: var(--mango);
    color: var(--rice);
    justify-content: center;
}

.block-feature .quest-tag {
    color: var(--nori);
}

.block-feature .block-heading {
    color: var(--rice);
}

.block-sushi {
    background: var(--rice);
    color: var(--nori);
    justify-content: space-between;
}

.block-curry {
    background: var(--turmeric);
    color: var(--nori);
    justify-content: space-between;
}

.block-sandwich {
    background: var(--wasabi);
    color: var(--nori);
    justify-content: space-between;
}

.block-dumpling {
    background: var(--steam);
    color: var(--nori);
    justify-content: space-between;
}

.block-pizza {
    background: var(--chili);
    color: var(--rice);
    justify-content: space-between;
}

/* ==============================
   LEVEL 3 — WORLD MAP
   ============================== */
.grid-worldmap {
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 1fr 1fr 1fr;
    grid-template-areas:
        "asia asia euro"
        "asia asia euro"
        "amer afri counter";
}

.block-region {
    justify-content: flex-end;
}

.block-asia {
    background: var(--chili);
    color: var(--rice);
}

.block-europe {
    background: var(--turmeric);
    color: var(--nori);
}

.block-americas {
    background: var(--wasabi);
    color: var(--nori);
}

.block-africa {
    background: var(--eggplant);
    color: var(--rice);
}

.region-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.8rem, 4vw, 3.4rem);
    line-height: 1;
    margin-bottom: 12px;
}

.region-body {
    font-size: 0.95rem;
    margin-bottom: 14px;
    max-width: 30ch;
}

.region-emojis {
    font-size: clamp(1.4rem, 2.4vw, 2rem);
    letter-spacing: 6px;
}

.block-counter {
    background: var(--mango);
    color: var(--rice);
    justify-content: center;
    align-items: center;
    text-align: center;
}

.counter-num {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2.4rem, 5vw, 4rem);
    line-height: 1;
}

.counter-label {
    font-family: var(--font-pixel);
    font-size: 0.7rem;
    letter-spacing: 1px;
    margin-top: 10px;
}

/* ==============================
   LEVEL 4 — QUEST LOG
   ============================== */
.grid-questlog {
    grid-template-columns: 1.4fr 1fr 1fr;
    grid-template-rows: 1fr 1fr 1fr 1fr;
    grid-template-areas:
        "main q1 q2"
        "main q1 q2"
        "main q3 q4"
        "main q3 q4";
}

.block-log-main {
    background: var(--nori);
    color: var(--turmeric);
    justify-content: center;
}

.block-log-main .block-heading {
    color: var(--rice);
}

.block-log-main .quest-tag {
    color: var(--turmeric);
}

.block-quest {
    justify-content: space-between;
}

.block-quest-1 {
    background: var(--mango);
    color: var(--rice);
}

.block-quest-2 {
    background: var(--turmeric);
    color: var(--nori);
}

.block-quest-3 {
    background: var(--wasabi);
    color: var(--nori);
}

.block-quest-4 {
    background: var(--eggplant);
    color: var(--rice);
}

.quest-num {
    font-family: var(--font-pixel);
    font-size: 0.65rem;
    letter-spacing: 1px;
    opacity: 0.85;
    margin-bottom: 10px;
}

.quest-name {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(1.1rem, 1.8vw, 1.6rem);
    line-height: 1.1;
    margin-bottom: 10px;
}

.quest-desc {
    font-size: 0.92rem;
    line-height: 1.5;
    margin-bottom: 14px;
    flex: 1;
}

.quest-reward {
    font-family: var(--font-pixel);
    font-size: 0.7rem;
    letter-spacing: 1px;
    align-self: flex-start;
    padding: 6px 10px;
    background: rgba(26, 26, 46, 0.18);
    border: 2px solid currentColor;
}

.block-quest-1 .quest-reward,
.block-quest-4 .quest-reward {
    background: rgba(255, 255, 255, 0.15);
}

/* ==============================
   LEVEL 5 — TRADITIONS
   ============================== */
.grid-traditions {
    grid-template-columns: 1fr 1fr 1fr 1fr;
    grid-template-rows: 1fr 1fr 1fr;
    grid-template-areas:
        "tfeat tfeat t1 t2"
        "tfeat tfeat t1 t2"
        "tfeat tfeat t3 t4";
}

.block-trad-feature {
    background: var(--wasabi);
    color: var(--nori);
    justify-content: center;
}

.block-trad {
    justify-content: flex-end;
}

.block-trad-1 {
    background: var(--chili);
    color: var(--rice);
}

.block-trad-2 {
    background: var(--steam);
    color: var(--nori);
}

.block-trad-3 {
    background: var(--turmeric);
    color: var(--nori);
}

.block-trad-4 {
    background: var(--eggplant);
    color: var(--rice);
}

.trad-name {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.4rem, 2.6vw, 2.2rem);
    line-height: 1;
    margin-bottom: 6px;
}

.trad-origin {
    font-family: var(--font-pixel);
    font-size: 0.65rem;
    letter-spacing: 1px;
    margin-bottom: 12px;
    opacity: 0.85;
}

.trad-desc {
    font-size: 0.92rem;
    line-height: 1.45;
}

/* ==============================
   LEVEL 6 — FINAL
   ============================== */
.grid-final {
    grid-template-columns: 1fr 1fr 1fr 1fr;
    grid-template-rows: 1fr 1fr 1fr;
    grid-template-areas:
        "end end b1 b2"
        "end end b3 b4"
        "foot foot foot foot";
}

.block-final-main {
    background: var(--mango);
    color: var(--rice);
    justify-content: center;
    position: relative;
}

.final-heading {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 4.4rem);
    line-height: 0.95;
    margin-bottom: 16px;
}

.final-body {
    font-size: 1.05rem;
    max-width: 32ch;
    margin-bottom: 24px;
}

.final-stamp {
    font-size: clamp(3rem, 6vw, 5rem);
    line-height: 1;
}

.block-badge {
    justify-content: center;
    align-items: center;
    text-align: center;
    gap: 10px;
}

.block-badge-1 {
    background: var(--turmeric);
    color: var(--nori);
}

.block-badge-2 {
    background: var(--wasabi);
    color: var(--nori);
}

.block-badge-3 {
    background: var(--chili);
    color: var(--rice);
}

.block-badge-4 {
    background: var(--eggplant);
    color: var(--rice);
}

.badge-icon {
    font-size: clamp(2.4rem, 5vw, 4rem);
    line-height: 1;
}

.badge-name {
    font-family: var(--font-pixel);
    font-size: 0.7rem;
    letter-spacing: 1.5px;
}

.block-foot {
    background: var(--nori);
    color: var(--rice);
    justify-content: center;
    align-items: center;
    flex-direction: row;
    gap: 30px;
    text-align: center;
}

.foot-domain {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.2rem, 2vw, 1.8rem);
    color: var(--turmeric);
}

.foot-tag {
    font-family: var(--font-pixel);
    font-size: 0.7rem;
    letter-spacing: 2px;
    color: var(--rice);
}

/* ==============================
   IN-VIEW BLOCK ANIMATION
   ============================== */
.block {
    opacity: 0;
    transform: translateY(20px) scale(0.96);
    transition: opacity 500ms ease, transform 500ms cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 200ms ease;
}

.block.in-view {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.block.in-view:hover {
    transform: scale(1.02);
}

/* Hero blocks visible immediately */
.bento-hero .block {
    opacity: 1;
    transform: none;
}

/* ==============================
   RESPONSIVE
   ============================== */
@media (max-width: 900px) {
    .bento-grid {
        height: auto;
        min-height: 100vh;
    }

    .grid-hero {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto auto auto;
        grid-template-areas:
            "hero hero"
            "a b"
            "c b"
            "d d";
    }

    .grid-powerups {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto auto auto;
        grid-template-areas:
            "feature feature"
            "p1 p2"
            "p3 p4"
            "p5 p5";
    }

    .grid-worldmap {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto auto;
        grid-template-areas:
            "asia asia"
            "euro amer"
            "afri counter";
    }

    .grid-questlog {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto auto;
        grid-template-areas:
            "main main"
            "q1 q2"
            "q3 q4";
    }

    .grid-traditions {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto auto;
        grid-template-areas:
            "tfeat tfeat"
            "t1 t2"
            "t3 t4";
    }

    .grid-final {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto auto;
        grid-template-areas:
            "end end"
            "b1 b2"
            "b3 b4"
            "foot foot";
    }

    .block {
        min-height: 180px;
    }

    .block-hero {
        min-height: 60vh;
    }
}

@media (max-width: 540px) {
    .achievement-badge .badge-text {
        font-size: 0.5rem;
    }

    .shape {
        opacity: 0.55;
    }
}
