:root {
    --showa-gold: #C4956A;
    --taisho-rose: #C4867A;
    --kuro-plum: #2E2A3B;
    --washi-cream: #F5F0E6;
    --terracotta: #D4896B;
    --blush-mist: #E8D5CE;
    --patina-bronze: #9B7E5E;
    --deep-umber: #8B6F4E;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    background: var(--kuro-plum);
    color: var(--washi-cream);
    font-family: 'Zen Kaku Gothic New', sans-serif;
    font-weight: 400;
    font-size: clamp(0.875rem, 1.2vw, 1rem);
    line-height: 1.8;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Paper grain texture */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1000;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='256' height='256' filter='url(%23g)' opacity='0.25'/%3E%3C/svg%3E");
    background-size: 256px 256px;
    opacity: 0.03;
    mix-blend-mode: overlay;
}

/* Corner brackets */
.corner {
    position: fixed;
    width: 40px;
    height: 40px;
    z-index: 100;
    pointer-events: none;
}

.corner::before, .corner::after {
    content: '';
    position: absolute;
    background: var(--showa-gold);
    opacity: 0.3;
}

.corner-tl { top: 16px; left: 16px; }
.corner-tl::before { width: 20px; height: 1px; top: 0; left: 0; }
.corner-tl::after { width: 1px; height: 20px; top: 0; left: 0; }

.corner-tr { top: 16px; right: 16px; }
.corner-tr::before { width: 20px; height: 1px; top: 0; right: 0; }
.corner-tr::after { width: 1px; height: 20px; top: 0; right: 0; }

.corner-bl { bottom: 16px; left: 16px; }
.corner-bl::before { width: 20px; height: 1px; bottom: 0; left: 0; }
.corner-bl::after { width: 1px; height: 20px; bottom: 0; left: 0; }

.corner-br { bottom: 16px; right: 16px; }
.corner-br::before { width: 20px; height: 1px; bottom: 0; right: 0; }
.corner-br::after { width: 1px; height: 20px; bottom: 0; right: 0; }

/* Scroll progress */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    z-index: 100;
    background: rgba(196, 149, 106, 0.1);
}

.scroll-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--showa-gold), var(--taisho-rose));
    transition: width 100ms linear;
}

/* Room base */
.room {
    min-height: 100vh;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: clamp(3rem, 6vw, 6rem) clamp(1.5rem, 4vw, 4rem);
    overflow: hidden;
}

/* Watercolor washes */
.watercolor-wash {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0.15;
}

.wash-tokonoma {
    background: radial-gradient(ellipse at 30% 40%, var(--taisho-rose), transparent 60%),
                radial-gradient(ellipse at 70% 70%, var(--showa-gold), transparent 50%);
}

.wash-gallery {
    background: radial-gradient(ellipse at 50% 30%, var(--terracotta), transparent 55%),
                radial-gradient(ellipse at 20% 80%, var(--blush-mist), transparent 50%);
}

.wash-study {
    background: radial-gradient(ellipse at 60% 50%, var(--showa-gold), transparent 50%),
                radial-gradient(ellipse at 30% 20%, var(--taisho-rose), transparent 45%);
}

.wash-archive {
    background: radial-gradient(ellipse at 40% 60%, var(--deep-umber), transparent 50%),
                radial-gradient(ellipse at 80% 30%, var(--patina-bronze), transparent 45%);
}

/* Room reveal animation */
.room-reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 800ms ease-out, transform 800ms ease-out;
}

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

/* === Room 1: Tokonoma === */
.tokonoma {
    text-align: center;
    gap: 2rem;
}

.tokonoma-content {
    position: relative;
    z-index: 2;
}

.deco-frame {
    position: absolute;
    width: 80%;
    max-width: 600px;
    height: auto;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0.2;
    z-index: 0;
}

.site-title {
    font-family: 'Megrim', cursive;
    font-size: clamp(4rem, 12vw, 7rem);
    letter-spacing: 0.15em;
    color: var(--showa-gold);
    line-height: 1.2;
    position: relative;
    z-index: 2;
}

.title-char {
    display: inline-block;
    animation: char-float 3s ease-in-out infinite;
    animation-delay: calc(var(--i) * 0.15s);
}

@keyframes char-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.site-subtitle {
    font-family: 'Poiret One', sans-serif;
    font-size: clamp(0.85rem, 1.5vw, 1.1rem);
    color: var(--patina-bronze);
    letter-spacing: 0.2em;
    margin-top: 1rem;
    text-transform: lowercase;
}

.fan-divider {
    width: 100px;
    height: auto;
    opacity: 0.5;
    position: relative;
    z-index: 2;
}

.scroll-chevron {
    position: relative;
    z-index: 2;
    animation: chevron-bob 2s ease-in-out infinite;
}

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

/* === Room 2: Gallery === */
.gallery {
    padding-top: 4rem;
    padding-bottom: 4rem;
}

.triptych {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: clamp(1rem, 2vw, 2rem);
    max-width: 1100px;
    width: 100%;
    position: relative;
    z-index: 2;
}

.shoji-panel {
    background: rgba(245, 240, 230, 0.04);
    border: 1px solid rgba(196, 149, 106, 0.15);
    padding: clamp(1.5rem, 3vw, 3rem);
    position: relative;
    overflow: hidden;
    transition: border-color 400ms ease;
}

.shoji-panel:hover {
    border-color: rgba(196, 149, 106, 0.4);
}

/* Shoji grid lines */
.shoji-grid {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.shoji-grid::before, .shoji-grid::after {
    content: '';
    position: absolute;
    background: rgba(196, 149, 106, 0.06);
}

.shoji-grid::before {
    width: 1px;
    height: 100%;
    left: 50%;
}

.shoji-grid::after {
    width: 100%;
    height: 1px;
    top: 50%;
}

.panel-content {
    position: relative;
    z-index: 1;
}

.panel-heading {
    font-family: 'Poiret One', sans-serif;
    font-size: clamp(0.75rem, 1vw, 0.9rem);
    letter-spacing: 0.2em;
    color: var(--showa-gold);
    margin-bottom: 1rem;
}

.panel-body {
    font-size: 0.9rem;
    color: var(--blush-mist);
    line-height: 1.8;
}

/* Staggered panel entry */
.panel-left.room-reveal {
    transform: translateX(-30px);
    transition-delay: 0ms;
}

.panel-center.room-reveal {
    transform: translateY(30px);
    transition-delay: 200ms;
}

.panel-right.room-reveal {
    transform: translateX(30px);
    transition-delay: 400ms;
}

.panel-left.room-reveal.visible { transform: translateX(0); }
.panel-center.room-reveal.visible { transform: translateY(0); }
.panel-right.room-reveal.visible { transform: translateX(0); }

/* === Deco band === */
.deco-band {
    width: 100%;
    height: 40px;
    background: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 20px,
        rgba(196, 149, 106, 0.08) 20px,
        rgba(196, 149, 106, 0.08) 21px
    );
    position: relative;
}

.deco-band::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 10%;
    right: 10%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--showa-gold), transparent);
    opacity: 0.2;
}

/* === Room 3: Study === */
.study {
    padding-top: 6rem;
    padding-bottom: 6rem;
}

.kiku-margin {
    position: absolute;
    left: clamp(1rem, 3vw, 3rem);
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 2rem;
    z-index: 1;
}

.kiku {
    width: 24px;
    height: 24px;
    opacity: 0.5;
}

.study-column {
    max-width: 600px;
    position: relative;
    z-index: 2;
}

.study-heading {
    font-family: 'Poiret One', sans-serif;
    font-size: clamp(0.85rem, 1.2vw, 1rem);
    letter-spacing: 0.25em;
    color: var(--showa-gold);
    margin-bottom: 1rem;
    text-align: center;
}

.gold-bar {
    width: 60px;
    height: 1px;
    background: var(--showa-gold);
    margin: 0 auto 2rem;
    opacity: 0.5;
}

.study-body {
    font-size: 0.95rem;
    color: var(--blush-mist);
    line-height: 1.9;
    margin-bottom: 1.5rem;
    text-indent: 1.5em;
}

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

/* === Room 4: Archive === */
.archive {
    padding-top: 4rem;
    padding-bottom: 4rem;
}

.archive-heading {
    font-family: 'Poiret One', sans-serif;
    font-size: clamp(0.85rem, 1.2vw, 1rem);
    letter-spacing: 0.25em;
    color: var(--showa-gold);
    margin-bottom: 2rem;
    position: relative;
    z-index: 2;
}

.tatami-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: clamp(0.75rem, 1.5vw, 1.5rem);
    max-width: 700px;
    width: 100%;
    position: relative;
    z-index: 2;
}

.tatami-cell {
    aspect-ratio: 1;
    border: 1px solid rgba(196, 149, 106, 0.15);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: transform 300ms ease, border-color 300ms ease;
}

.tatami-cell.hover-lift:hover {
    transform: translateY(-4px);
    border-color: rgba(196, 149, 106, 0.4);
}

.tatami-cell::after {
    content: attr(data-name);
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Poiret One', sans-serif;
    font-size: 0.65rem;
    letter-spacing: 0.15em;
    color: var(--showa-gold);
    opacity: 0;
    transition: opacity 300ms ease;
    white-space: nowrap;
}

.tatami-cell:hover::after {
    opacity: 0.8;
}

.pattern-fill {
    position: absolute;
    inset: 0;
    opacity: 0.15;
    transition: opacity 300ms ease;
}

.tatami-cell:hover .pattern-fill {
    opacity: 0.3;
}

/* Asanoha - hemp leaf */
.pattern-asanoha .pattern-fill {
    background-image: repeating-conic-gradient(
        var(--showa-gold) 0deg 60deg,
        transparent 60deg 120deg
    );
    background-size: 30px 30px;
    opacity: 0.08;
}

.tatami-cell.pattern-asanoha:hover .pattern-fill { opacity: 0.18; }

/* Seigaiha - blue wave */
.pattern-seigaiha .pattern-fill {
    background: repeating-radial-gradient(
        circle at 50% 100%,
        transparent 0px,
        transparent 8px,
        rgba(196, 149, 106, 0.15) 8px,
        rgba(196, 149, 106, 0.15) 9px,
        transparent 9px,
        transparent 20px
    );
    background-size: 40px 20px;
}

/* Yagasuri - arrow feather */
.pattern-yagasuri .pattern-fill {
    background: linear-gradient(135deg, transparent 25%, rgba(196, 149, 106, 0.12) 25%, rgba(196, 149, 106, 0.12) 50%, transparent 50%, transparent 75%, rgba(196, 149, 106, 0.12) 75%);
    background-size: 20px 20px;
}

/* Shippo - seven treasures */
.pattern-shippo .pattern-fill {
    background: radial-gradient(circle at 0% 50%, transparent 45%, rgba(196, 149, 106, 0.12) 45%, rgba(196, 149, 106, 0.12) 55%, transparent 55%),
                radial-gradient(circle at 100% 50%, transparent 45%, rgba(196, 149, 106, 0.12) 45%, rgba(196, 149, 106, 0.12) 55%, transparent 55%);
    background-size: 30px 30px;
}

/* Uroko - scales */
.pattern-uroko .pattern-fill {
    background: linear-gradient(60deg, transparent 40%, rgba(196, 149, 106, 0.12) 40%, rgba(196, 149, 106, 0.12) 50%, transparent 50%),
                linear-gradient(-60deg, transparent 40%, rgba(196, 149, 106, 0.12) 40%, rgba(196, 149, 106, 0.12) 50%, transparent 50%);
    background-size: 24px 24px;
}

/* Ichimatsu - checkerboard */
.pattern-ichimatsu .pattern-fill {
    background: repeating-conic-gradient(rgba(196, 149, 106, 0.12) 0% 25%, transparent 0% 50%);
    background-size: 24px 24px;
}

/* Tatami cell staggered entry */
.tatami-cell.room-reveal {
    transition-delay: calc(var(--cell-delay) * 120ms);
}

/* === Room 5: Exit === */
.exit-room {
    min-height: 60vh;
    text-align: center;
}

.exit-content {
    position: relative;
    z-index: 2;
}

.exit-title {
    font-family: 'Megrim', cursive;
    font-size: clamp(2rem, 5vw, 3rem);
    color: var(--showa-gold);
    letter-spacing: 0.12em;
}

.exit-rule {
    width: 40px;
    height: 1px;
    background: var(--showa-gold);
    margin: 1rem auto;
    opacity: 0.4;
}

.exit-text {
    font-family: 'Poiret One', sans-serif;
    font-size: 0.8rem;
    color: var(--patina-bronze);
    letter-spacing: 0.15em;
}

/* Responsive */
@media (max-width: 768px) {
    .triptych {
        grid-template-columns: 1fr;
    }

    .panel-left.room-reveal,
    .panel-right.room-reveal {
        transform: translateY(20px);
    }

    .tatami-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .kiku-margin {
        display: none;
    }

    .deco-frame {
        width: 95%;
    }

    .corner { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .title-char {
        animation: none;
    }

    .scroll-chevron {
        animation: none;
    }

    .room-reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .tatami-cell {
        transition: none;
    }

    .pattern-fill {
        transition: none;
    }
}
