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

body {
    overflow: hidden;
    background: #0d0a07;
    font-family: serif;
}

/* Dojo Container */
#dojo-container {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    transform-style: preserve-3d;
    perspective: 1000px;
}

/* Static dojo background */
#dojo-bg {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
}

/* Wood burn overlay for warmth */
#wood-overlay {
    position: absolute;
    inset: 0;
    background: url("assets/dojo/wood_texture.png");
    opacity: 0.14;
    mix-blend-mode: multiply;
    pointer-events: none;
}

/* Top bar */
.top-bar {
    position: fixed;
    top: var(--title-top);
    left: 50%;
    transform: translateX(-50%);
    width: auto;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: transparent;
    backdrop-filter: none;
    z-index: 5;
}
.top-bar-inner {
    font-family: 'Rock Salt', cursive;
    font-size: var(--title-size);
    letter-spacing: 0.08em;
    color: #4a3a2a;
    font-weight: 400;
    text-shadow: 
        1px 1px 1px rgba(255,250,240,0.5),
        -0.5px -0.5px 1px rgba(60,40,20,0.3),
        0 0 3px rgba(0,0,0,0.1);
    padding: 12px 24px;
    white-space: nowrap;
    filter: blur(0.4px) contrast(0.92) brightness(0.95);
    opacity: 0.85;
    mix-blend-mode: multiply;
    background: url("assets/dojo/wood_texture.png");
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    background-size: 200px 200px;
    background-position: center;
}

/* Audio toggle button in header */
.audio-toggle {
    appearance: none;
    -webkit-appearance: none;
    border: none;
    background: rgba(255,240,200,0.06);
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 10px;
    cursor: pointer;
    font-size: 18px;
    transition: background 180ms ease, transform 160ms ease;
    box-shadow: 0 4px 10px rgba(0,0,0,0.28);
}
.audio-toggle:hover { transform: translateY(-2px); }
.audio-toggle.on { background: linear-gradient(180deg, rgba(255,230,160,0.18), rgba(255,200,120,0.12)); color: #2b1708; }
.audio-toggle:focus { outline: 2px solid rgba(255,230,180,0.28); }

/* Header sprite: meditating Chilla using a 4-frame horizontal sprite sheet */
/* Removed spinning sprite styles from header */

/* Content overlay sits above the background */
.content-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 30;
    pointer-events: none;
    padding-top: 56px; /* make room for top bar */
}

.hero img#chef-chilla-hero {
    max-width: 90px;
    width: 7vw;
    min-width: 48px;
    height: auto;
    display: block;
    pointer-events: auto;
    margin: 0 auto;
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
}

.pacing-inner {
     will-change: transform;
     transform-origin: center bottom;
     /* Calm, subtle breathing */
     animation: idle-breath 8s ease-in-out infinite;
     position: relative; /* needed for the floor shadow */
 }
/* Pacing animation: left-right pacing and subtle bob */

.pacing-wrap {
    width: 100%;
    max-width: 600px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: visible;
    /* No horizontal pacing */
}

    will-change: transform;
    transform-origin: center bottom;
    /* Calm, subtle breathing */
    animation: idle-breath 8s ease-in-out infinite;
    position: relative; /* needed for the floor shadow */
}

.pacing-img {
    display: block;
    max-width: 100%;
    /* warmer, slightly brighter and more saturated for inviting look */
    filter: drop-shadow(0 12px 26px rgba(0,0,0,0.48)) brightness(1.02) saturate(1.06) sepia(0.04) hue-rotate(-3deg);
    -webkit-filter: drop-shadow(0 12px 26px rgba(0,0,0,0.48)) brightness(1.02) saturate(1.06) sepia(0.04) hue-rotate(-3deg);
    transition: transform 180ms ease, filter 180ms ease;
}

@keyframes idle-breath {
    0% { transform: scale(1); }
    50% { transform: scale(1.015); }
    100% { transform: scale(1); }
}

.pacing-img.flipped {
    transform: scaleX(-1);
}

/* Elliptical floor shadow to ground the character visually */
.floor-shadow {
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: 66%;
    height: 18px;
    pointer-events: none;
    /* warmer shadow tone to blend with wood floor */
    background: radial-gradient(ellipse at center, rgba(18,12,8,0.70) 0%, rgba(28,18,12,0.44) 35%, rgba(28,18,12,0.12) 60%, transparent 75%);
    filter: blur(10px);
    opacity: 0.86;
    mix-blend-mode: multiply;
}

/* Sync shadow with bob: subtle scale + blur variation */
.floor-shadow {
    animation: shadow-pulse 1.8s ease-in-out infinite;
}

@keyframes shadow-pulse {
    0% { transform: translateX(-50%) scaleX(1.00); filter: blur(10px); opacity: 0.86; }
    50% { transform: translateX(-50%) scaleX(1.12); filter: blur(12px); opacity: 0.78; }
    100% { transform: translateX(-50%) scaleX(1.00); filter: blur(10px); opacity: 0.86; }
}

/* Slightly darker floor under Chilla to suggest contact/occlusion */
.pacing-wrap::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 8vh;
    height: 20vh;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.18) 60%, rgba(0,0,0,0.36) 100%);
    z-index: 0;
}

/* Ensure image and shadow render above subtle occlusion */
.pacing-inner, .pacing-img, .floor-shadow { z-index: 2; position: relative; }

/* Lighting overlays to add depth */
.lighting-overlays { position: absolute; inset: 0; pointer-events: none; z-index: 28; }
/* softer vignette with warmer edges */
.lighting-overlays .vignette {
    position: absolute; inset: 0;
    background: radial-gradient(ellipse at center, rgba(0,0,0,0) 46%, rgba(8,4,2,0.14) 68%, rgba(10,6,4,0.42) 100%);
    mix-blend-mode: multiply; opacity: 0.95;
}
.lighting-overlays .spotlight {
    position: absolute; left: 50%; transform: translateX(-50%); bottom: 20vh;
    width: 56vw; max-width: 820px; height: 56vh; pointer-events: none;
    /* warm central light to make scene inviting */
    background: radial-gradient(ellipse at center, rgba(255,238,200,0.26) 0%, rgba(255,220,160,0.08) 36%, rgba(0,0,0,0) 70%);
    filter: blur(34px) saturate(1.06) contrast(1.02);
    mix-blend-mode: screen; opacity: 0.98;
    animation: spotlight-breathe 6.5s ease-in-out infinite;
}

@keyframes spotlight-breathe {
    0% { transform: translateX(-50%) scale(1); opacity: 0.96; }
    50% { transform: translateX(-50%) scale(1.03); opacity: 1; }
    100% { transform: translateX(-50%) scale(1); opacity: 0.96; }
}

/* Rim light behind Chilla to separate him from the background */
.pacing-inner::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 12%;
    transform: translateX(-50%);
    width: 84%;
    height: 140%;
    pointer-events: none;
    background: radial-gradient(ellipse at center, rgba(255,230,180,0.22) 0%, rgba(255,220,150,0.12) 28%, rgba(255,220,150,0.02) 48%, transparent 60%);
    filter: blur(18px);
    mix-blend-mode: screen;
    z-index: 1;
    opacity: 0.95;
}

/* Particles: subtle dust motes */
#particles { position: absolute; inset: 0; z-index: 27; pointer-events: none; overflow: hidden; }
.particle {
    position: absolute; bottom: 10%;
    /* warm dust mote color */
    background: radial-gradient(circle, rgba(255,244,210,0.9) 0%, rgba(255,240,200,0.28) 40%, rgba(255,240,200,0) 70%);
    width: 6px; height: 6px; border-radius: 50%; opacity: 0.06; transform: translateY(0);
    filter: blur(1.2px) saturate(1.06) contrast(0.98);
    animation: particle-rise linear infinite;
}

@keyframes particle-rise {
    0% { transform: translateY(0) scale(0.9); opacity: 0.02; }
    40% { opacity: 0.08; }
    100% { transform: translateY(-30vh) scale(1.3); opacity: 0; }
}

/* Parallax-friendly background */
#dojo-bg { will-change: transform; transition: transform 160ms linear; }

/* Parallax for character */
.pacing-wrap { will-change: transform; transition: transform 120ms linear; }

/* Respect user's motion preferences */
@media (prefers-reduced-motion: reduce) {
    .pacing { animation: none; }
}

/* Contact box */
.contact-box {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: 18px;
    z-index: 50;
    width: calc(100% - 36px);
    max-width: 760px;
    display: none !important;
    gap: 10px;
    align-items: center;
    background: rgba(8,6,4,0.72);
    padding: 10px;
    border-radius: 10px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.45);
    pointer-events: auto;
}
.contact-box textarea {
    flex: 1 1 auto;
    resize: vertical;
    border: none;
    background: rgba(255,255,255,0.03);
    color: #fff;
    padding: 8px 10px;
    border-radius: 6px;
    min-height: 44px;
}
.email-button {
    background: #f6b042;
    border: none;
    color: #111;
    padding: 10px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
}

.visually-hidden { position: absolute !important; height: 1px; width: 1px; overflow: hidden; clip: rect(1px, 1px, 1px, 1px); white-space: nowrap; }

/* Tatami mat under Chef Chilla */
.mat {
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: 110px;
    height: 22px;
    background: linear-gradient(180deg, #c2a178 0%, #bfa76a 100%);
    border-radius: 50% 50% 44% 44% / 60% 60% 100% 100%;
    box-shadow: 0 2px 12px 0 rgba(60,40,20,0.18), 0 1px 4px 0 rgba(60,40,20,0.12);
    border: 1px solid #a88a4a;
    opacity: 0.93;
    z-index: 1;
    pointer-events: none;
}

/* Adjust floor shadow for mat */
.floor-shadow {
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: 90px;
    height: 10px;
    pointer-events: none;
    background: radial-gradient(ellipse at center, rgba(18,12,8,0.70) 0%, rgba(28,18,12,0.44) 35%, rgba(28,18,12,0.12) 60%, transparent 75%);
    filter: blur(10px);
    opacity: 0.86;
    mix-blend-mode: multiply;
}

/* Soft floor reflection for realism */
.pacing-inner::before {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: 90px;
    height: 18px;
    background: radial-gradient(ellipse at center, rgba(255,255,255,0.06) 0%, rgba(255,255,255,0.01) 60%, transparent 100%);
    filter: blur(6px);
    opacity: 0.5;
    z-index: 0;
    pointer-events: none;
}

/* Subtle film grain and color grade for realism */
body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 100;
    opacity: 0.13;
    background: url('https://www.transparenttextures.com/patterns/45-degree-fabric-light.png'), linear-gradient(180deg, rgba(255,230,180,0.04) 0%, rgba(180,140,80,0.08) 100%);
    mix-blend-mode: soft-light;
}

/* CSS variables to make Chef Chilla easy to tweak */
:root {
    --chef-offset-x: 0px;     /* horizontal tweak, added to translateX center */
    --chef-translate-y: 100px; /* negative moves forward (up the screen) */
    --chef-scale: 2.3;       /* scale to simulate closeness */
    --title-top: 157px;        /* distance from top */
    --title-size: 1.1rem;     /* font size */
    --breath-duration: 4.5s;    /* breathing animation duration */
    --inhale-opacity: 2;      /* intensity of inhale (opacity of top layer) */
}

.tweak-panel {
    position: fixed;
    right: 14px;
    bottom: 14px;
    width: 240px;
    background: rgba(12,10,8,0.72);
    color: #fff;
    border-radius: 10px;
    padding: 10px 12px;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
    z-index: 120;
    box-shadow: 0 8px 30px rgba(0,0,0,0.5);
    backdrop-filter: blur(6px) saturate(1.06);
}
.tweak-panel label { display:block; font-size:12px; color:#f3e6c9; margin-top:8px; }
.tweak-panel input[type=range] { width:100%; margin-top:6px; }
.tweak-panel .row { display:flex; align-items:center; gap:8px; }
.tweak-panel .value { min-width:44px; text-align:right; font-size:13px; color:#ffd; }

.hero-stage {
    position: relative;
    width: 100vw;
    height: 100vh;
    background: url('assets/dojo-bg.png') center center no-repeat;
    background-size: cover;
    overflow: hidden;
    z-index: 10;
    transform-style: preserve-3d;
}

.hero-stage::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    width: 40vw;
    height: 100vh;
    background: url('assets/dojo/dojo_left.png') left bottom no-repeat;
    background-size: contain;
    z-index: 2;
    pointer-events: none;
}

.hero-stage::after {
    content: "";
    position: absolute;
    right: 0;
    top: 0;
    width: 40vw;
    height: 100vh;
    background: url('assets/dojo/dojo_right.png') right bottom no-repeat;
    background-size: contain;
    z-index: 2;
    pointer-events: none;
}

.chef-spinner {
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: 90px;
    height: auto;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.chef-spinner img {
    width: 90px;
    height: auto;
    display: block;
    filter: drop-shadow(0 8px 18px rgba(60,40,20,0.22)) brightness(1.03) saturate(1.08);
    border-radius: 8px;
}

.mat {
    width: 80px;
    height: 18px;
    margin-top: -8px;
    background: linear-gradient(180deg, #c2a178 0%, #bfa76a 100%);
    border-radius: 50% 50% 44% 44% / 60% 60% 100% 100%;
    box-shadow: 0 2px 12px 0 rgba(60,40,20,0.18), 0 1px 4px 0 rgba(60,40,20,0.12);
    border: 1px solid #a88a4a;
    opacity: 0.93;
    z-index: 1;
    pointer-events: none;
}

.floor-shadow {
    width: 60px;
    height: 8px;
    margin-top: -4px;
    background: radial-gradient(ellipse at center, rgba(18,12,8,0.45) 0%, rgba(28,18,12,0.22) 35%, rgba(28,18,12,0.08) 60%, transparent 75%);
    filter: blur(6px);
    opacity: 0.7;
    mix-blend-mode: multiply;
    z-index: 0;
    pointer-events: none;
    position: relative;
}

.chef-actor {
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    height: 80%;
    width: auto;
    z-index: 20;
    animation: breathe 7s ease-in-out infinite;
}

@keyframes breathe {
    0%   { transform: translateX(-50%) scale(1); }
    50%  { transform: translateX(-50%) scale(1.05); }
    100% { transform: translateX(-50%) scale(1); }
}

.chef-breathing-stack {
    position: absolute;
    left: 50%;
    bottom: 0;
    /* Use CSS variables so the position/scale can be tuned live */
    transform: translateX(calc(-50% + var(--chef-offset-x))) translateY(var(--chef-translate-y)) scale(var(--chef-scale));
    height: 60vh;
    width: auto;
    min-width: 120px;
    display: block;
    z-index: 20;
}

.chef-base-layer,
.chef-top-layer {
    position: absolute;
    left: 0;
    bottom: 0;
    width: auto;
    height: 100%;
    max-width: 100%;
    object-fit: contain;
    display: block;
    pointer-events: none;
}

.chef-top-layer {
    opacity: 0;
    animation: breathe-deep var(--breath-duration) ease-in-out infinite alternate;
}

@keyframes breathe-deep {
    0%   { opacity: 0; }
    100% { opacity: var(--inhale-opacity); }
}

/* Soft water drip branding in top left */
.water-drip-brand {
    display: none;
}

.stage-orchid {
    position: absolute;
    left: 16%;
    bottom: 22%;
    height: 18vh;
    width: auto;
    z-index: 2;
    pointer-events: none;
    filter: blur(0.5px) brightness(0.93) saturate(0.98) drop-shadow(0 2px 6px rgba(60,40,20,0.10));
    opacity: 0.92;
}
