/* ============================================
   lunch.quest - Styles
   Japanese-minimal kissaten aesthetic
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --rice-paper: #F5EDE0;
    --lacquerware: #2A2A2A;
    --miso-glaze: #C4813D;
    --moss-sage: #7A8B6F;
    --soft-gold: #D4B896;
    --warm-black: #1A1714;

    --font-heading: 'Cormorant Garamond', Georgia, serif;
    --font-body: 'Source Serif 4', 'Source Serif Pro', Georgia, serif;
    --font-accent: 'Zen Kaku Gothic New', 'Helvetica Neue', sans-serif;

    --ease-gentle: cubic-bezier(0.25, 0.1, 0.25, 1.0);
    --split-left-width: 35%;
    --split-right-width: 65%;
}

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
    background-color: var(--warm-black);
}

body {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(1rem, 1.15vw, 1.15rem);
    line-height: 1.85;
    color: var(--rice-paper);
    background-color: var(--warm-black);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Film Grain Overlay --- */
#grain-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    opacity: 0.04;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}

/* --- Steam Container --- */
#steam-container {
    position: fixed;
    top: 20px;
    right: 40px;
    z-index: 100;
    pointer-events: none;
    display: flex;
    gap: 8px;
}

.steam-wisp {
    width: 30px;
    height: 60px;
    opacity: 0.06;
    animation: steam-rise 4s ease-in-out infinite;
}

.steam-wisp-2 {
    animation-duration: 5s;
    animation-delay: -1.5s;
}

.steam-wisp-3 {
    animation-duration: 6s;
    animation-delay: -3s;
}

@keyframes steam-rise {
    0%, 100% { transform: translateY(0px); opacity: 0.06; }
    50% { transform: translateY(-15px); opacity: 0.03; }
}

/* --- Ripple Container --- */
#ripple-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
}

.ripple-ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid var(--miso-glaze);
    opacity: 0;
    pointer-events: none;
    animation: ripple-expand 800ms var(--ease-gentle) forwards;
}

@keyframes ripple-expand {
    0% {
        width: 0px;
        height: 0px;
        opacity: 0.2;
        filter: blur(0px);
    }
    100% {
        width: 200px;
        height: 200px;
        opacity: 0;
        filter: blur(3px);
    }
}

/* --- Scene / Section Base --- */
.scene {
    position: relative;
    min-height: 100vh;
    display: flex;
    overflow: hidden;
}

/* --- Split Layout --- */
.split-left {
    position: relative;
    width: var(--split-left-width);
    min-height: 100vh;
    background-color: var(--rice-paper);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 2;
}

/* Rice paper texture on left panel */
.split-left::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='paper'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.04' numOctaves='5' result='noise'/%3E%3CfeDiffuseLighting in='noise' lighting-color='%23F5EDE0' surfaceScale='1.5'%3E%3CfeDistantLight azimuth='45' elevation='55'/%3E%3C/feDiffuseLighting%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23paper)'/%3E%3C/svg%3E");
    opacity: 0.15;
    pointer-events: none;
}

/* Gradient dissolve between panels */
.split-left::after {
    content: '';
    position: absolute;
    top: 0;
    right: -12px;
    width: 24px;
    height: 100%;
    background: linear-gradient(to right, var(--rice-paper), transparent);
    z-index: 3;
    pointer-events: none;
}

.split-right {
    position: relative;
    width: var(--split-right-width);
    min-height: 100vh;
    background-color: var(--lacquerware);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px;
    z-index: 1;
}

/* --- Opening Section --- */
#opening {
    height: 100vh;
    opacity: 0;
    animation: scene-fade-in 1.5s var(--ease-gentle) 0.3s forwards;
}

@keyframes scene-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

#opening .split-left {
    background-color: var(--rice-paper);
}

.site-title {
    font-family: var(--font-heading);
    font-weight: 300;
    font-size: clamp(3rem, 8vw, 6rem);
    color: var(--lacquerware);
    letter-spacing: -0.02em;
    line-height: 1;
    text-align: center;
}

.site-subtitle {
    display: block;
    font-family: var(--font-accent);
    font-weight: 300;
    font-size: clamp(0.75rem, 1vw, 0.9rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--moss-sage);
    text-align: center;
    margin-top: 12px;
}

/* Table scene SVG */
.table-scene {
    width: 100%;
    max-width: 600px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.table-svg {
    width: 100%;
    height: auto;
    filter: blur(0.3px);
}

/* Vignette overlay */
.vignette {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, transparent 40%, rgba(26, 23, 20, 0.15) 100%);
    pointer-events: none;
    z-index: 2;
}

/* --- Pause Section --- */
#pause {
    min-height: 100vh;
}

#pause .split-left {
    background-color: var(--rice-paper);
}

.haiku {
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: center;
}

.haiku-line {
    display: block;
    font-family: var(--font-accent);
    font-weight: 300;
    font-size: clamp(0.75rem, 1vw, 0.9rem);
    letter-spacing: 0.12em;
    text-transform: lowercase;
    color: var(--moss-sage);
    line-height: 1.6;
}

#pause .split-right {
    padding: 80px 60px;
    justify-content: center;
    gap: 40px;
}

.content-narrow {
    max-width: 480px;
    width: 100%;
}

.body-text {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(1rem, 1.15vw, 1.15rem);
    line-height: 1.85;
    color: var(--rice-paper);
    margin-bottom: 1.5em;
}

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

/* Drifting leaf */
.drift-leaf {
    position: absolute;
    top: -60px;
    right: 80px;
    width: 40px;
    height: 40px;
    opacity: 0;
    pointer-events: none;
    z-index: 5;
}

.drift-leaf.active {
    animation: leaf-drift 3s var(--ease-gentle) forwards;
}

@keyframes leaf-drift {
    0% {
        opacity: 0;
        transform: translate(0, 0) rotate(0deg);
    }
    20% {
        opacity: 0.6;
    }
    100% {
        opacity: 0;
        transform: translate(-200px, 500px) rotate(120deg);
    }
}

/* --- Shoji Screen Transition --- */
.shoji-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--rice-paper);
    opacity: 0;
    transform: translateX(-100%);
    pointer-events: none;
    z-index: 500;
    transition: none;
}

.shoji-screen.active {
    animation: shoji-slide 600ms cubic-bezier(0.42, 0, 0.58, 1) forwards;
}

@keyframes shoji-slide {
    0% {
        transform: translateX(-100%);
        opacity: 0.7;
    }
    50% {
        transform: translateX(0%);
        opacity: 0.5;
    }
    100% {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* --- Offering Section --- */
#offering {
    flex-direction: column;
    min-height: auto;
}

.offering-pair {
    position: relative;
    display: flex;
    min-height: 60vh;
    overflow: hidden;
}

.offering-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    opacity: 0;
    background: linear-gradient(135deg,
        rgba(196, 129, 61, 0.06) 0%,
        rgba(42, 42, 42, 0.02) 50%,
        rgba(122, 139, 111, 0.04) 100%
    );
    transition: opacity 0.8s var(--ease-gentle);
}

.offering-pair:hover .offering-bg {
    opacity: 1;
}

.offering-bg-2 {
    background: linear-gradient(225deg,
        rgba(212, 184, 150, 0.06) 0%,
        rgba(42, 42, 42, 0.02) 50%,
        rgba(196, 129, 61, 0.04) 100%
    );
}

.offering-bg-3 {
    background: linear-gradient(315deg,
        rgba(122, 139, 111, 0.06) 0%,
        rgba(26, 23, 20, 0.03) 50%,
        rgba(212, 184, 150, 0.04) 100%
    );
}

.offering-pair .split-left {
    min-height: 60vh;
}

.offering-pair .split-right {
    min-height: 60vh;
    padding: 60px;
    justify-content: center;
    align-items: flex-start;
}

.offering-content {
    max-width: 520px;
}

/* Leaf divider */
.leaf-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 32px;
    width: 100%;
    max-width: 300px;
}

.divider-line {
    flex: 1;
    height: 1px;
    background-color: var(--miso-glaze);
    opacity: 0.4;
}

.divider-leaf {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.section-heading {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: clamp(2rem, 5vw, 3.8rem);
    color: var(--rice-paper);
    letter-spacing: -0.02em;
    line-height: 1.15;
    margin-bottom: 24px;
}

.margin-text {
    font-family: var(--font-accent);
    font-weight: 300;
    font-size: clamp(0.75rem, 1vw, 0.9rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--moss-sage);
    text-align: center;
}

.margin-text-sm {
    font-family: var(--font-accent);
    font-weight: 300;
    font-size: clamp(0.65rem, 0.8vw, 0.8rem);
    letter-spacing: 0.08em;
    color: var(--miso-glaze);
    text-align: center;
    margin-top: 8px;
    opacity: 0.7;
}

/* --- Reflection Section --- */
#reflection {
    min-height: 100vh;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: var(--warm-black);
    padding: 60px 24px;
}

.reflection-content {
    max-width: 680px;
    text-align: center;
    z-index: 2;
}

.reflection-text {
    font-family: var(--font-heading);
    font-weight: 300;
    font-size: clamp(1.6rem, 4vw, 3rem);
    color: var(--rice-paper);
    letter-spacing: -0.01em;
    line-height: 1.5;
}

/* Falling leaves container */
#falling-leaves {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.falling-leaf {
    position: absolute;
    top: -50px;
    opacity: 0;
    pointer-events: none;
}

.falling-leaf svg {
    width: 100%;
    height: 100%;
}

.falling-leaf.active {
    animation: leaf-fall var(--fall-duration, 6s) var(--ease-gentle) var(--fall-delay, 0s) forwards;
}

@keyframes leaf-fall {
    0% {
        opacity: 0;
        transform: translateY(0) rotate(0deg);
    }
    15% {
        opacity: 0.5;
    }
    85% {
        opacity: 0.3;
    }
    100% {
        opacity: 0;
        transform: translateY(calc(60vh)) rotate(var(--fall-rotation, 180deg));
    }
}

/* --- Condensation Overlay --- */
#condensation-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--split-left-width);
    height: 100%;
    pointer-events: none;
    z-index: 50;
    opacity: 0;
    transition: opacity 1s var(--ease-gentle);
}

#condensation-overlay.visible {
    opacity: 1;
}

.condensation-dot {
    position: absolute;
    width: 2px;
    height: 2px;
    border-radius: 50%;
    background-color: var(--rice-paper);
    opacity: 0.05;
    animation: condensation-drip 8s linear infinite;
}

@keyframes condensation-drip {
    0% {
        transform: translateY(0);
        opacity: 0;
    }
    10% {
        opacity: 0.05;
    }
    90% {
        opacity: 0.03;
    }
    100% {
        transform: translateY(100px);
        opacity: 0;
    }
}

/* --- Ambient Leaves (left panel decorations) --- */
#ambient-leaves {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--split-left-width);
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

.ambient-leaf {
    position: absolute;
    opacity: 0.08;
}

.ambient-leaf-1 {
    top: 15%;
    left: 10%;
    width: 30px;
    animation: ambient-rotate 120s linear infinite;
}

.ambient-leaf-2 {
    top: 55%;
    left: 65%;
    width: 25px;
    animation: ambient-rotate 120s linear infinite reverse;
    animation-delay: -40s;
}

.ambient-leaf-3 {
    top: 80%;
    left: 30%;
    width: 22px;
    animation: ambient-rotate 120s linear infinite;
    animation-delay: -80s;
}

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

/* --- Reveal Animation --- */
.reveal-element {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 800ms var(--ease-gentle), transform 800ms var(--ease-gentle);
}

.reveal-element.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Hover Leaf Drift on Content Blocks --- */
.offering-content {
    position: relative;
    overflow: hidden;
}

.offering-content::after {
    content: '';
    position: absolute;
    top: -30px;
    right: 20px;
    width: 20px;
    height: 20px;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 2 Q18 7 16 14 Q14 20 12 22 Q10 20 8 14 Q6 7 12 2Z' fill='none' stroke='%237A8B6F' stroke-width='1'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    opacity: 0;
    pointer-events: none;
    transition: none;
}

.offering-content:hover::after {
    animation: hover-leaf-fall 2s ease-out forwards;
}

@keyframes hover-leaf-fall {
    0% {
        opacity: 0;
        transform: translateY(0) rotate(0deg);
    }
    20% {
        opacity: 0.5;
    }
    100% {
        opacity: 0;
        transform: translateY(300px) rotate(90deg);
    }
}

/* --- Responsive --- */
@media (max-width: 768px) {
    :root {
        --split-left-width: 100%;
        --split-right-width: 100%;
    }

    .scene {
        flex-direction: column;
    }

    .split-left {
        width: 100%;
        min-height: 30vh;
        padding: 32px 24px;
    }

    .split-right {
        width: 100%;
        min-height: 70vh;
        padding: 40px 24px;
    }

    .split-left::after {
        display: none;
    }

    .offering-pair {
        flex-direction: column;
    }

    .offering-pair .split-left {
        min-height: 20vh;
    }

    .offering-pair .split-right {
        min-height: 50vh;
        padding: 40px 24px;
    }

    #ambient-leaves {
        display: none;
    }

    #condensation-overlay {
        display: none;
    }

    #steam-container {
        right: 20px;
    }

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