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

:root {
    --night-deep: #080a0e;
    --paper: #c4bdb4;
    --text: #c4bdb4;
    --muted: #6e6760;
    --line: #242018;
    --accent: #c8874a;
    --font-display: 'Cormorant Garamond', Georgia, serif;
    --font-serif: 'Cormorant Garamond', Georgia, serif;
    --stretch-title: 1.28;
    --stretch-room: 1.22;
    --display-glow: 0 0 1px rgba(212, 205, 196, 0.45), 0 0 18px rgba(196, 189, 180, 0.22), 0 0 52px rgba(196, 189, 180, 0.14);
    --display-glow-room: 0 0 1px rgba(212, 205, 196, 0.38), 0 0 14px rgba(196, 189, 180, 0.18), 0 0 40px rgba(196, 189, 180, 0.11);
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    min-height: 100vh;
    background: var(--night-deep);
    color: var(--text);
    font: 300 0.92rem/1.75 'Noto Sans JP', sans-serif;
    overflow-x: hidden;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

a {
    color: var(--accent);
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    transition: color 0.2s;
}

a:hover {
    color: var(--paper);
}

.atmosphere {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
    opacity: 0;
}

.atmo-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    will-change: transform;
}

.atmo-base {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 65% 50% at 12% 5%, rgba(75, 95, 125, 0.16) 0%, transparent 58%),
        radial-gradient(ellipse 50% 45% at 92% 88%, rgba(50, 65, 90, 0.11) 0%, transparent 55%),
        radial-gradient(ellipse 35% 28% at 4% 92%, rgba(200, 135, 74, 0.09) 0%, transparent 62%),
        linear-gradient(175deg, #06080b 0%, var(--night-deep) 45%, #0c0f14 100%);
    animation: base-shift 90s ease-in-out infinite alternate;
}

@keyframes base-shift {
    from { filter: hue-rotate(0deg) brightness(1); }
    to { filter: hue-rotate(8deg) brightness(1.04); }
}

.atmo-glow {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

.atmo-glow-warm {
    width: 48vmax;
    height: 48vmax;
    left: -10vmax;
    bottom: -14vmax;
    background: radial-gradient(circle, rgba(200, 135, 74, 0.16) 0%, rgba(200, 135, 74, 0.04) 42%, transparent 72%);
    animation: glow-warm 24s ease-in-out infinite;
}

.atmo-glow-cool {
    width: 58vmax;
    height: 42vmax;
    right: -16vmax;
    top: -10vmax;
    background: radial-gradient(circle, rgba(95, 120, 150, 0.14) 0%, rgba(70, 90, 120, 0.04) 40%, transparent 70%);
    animation: glow-cool 31s ease-in-out infinite;
}

@keyframes glow-warm {
    0%, 100% {
        opacity: 0.35;
        transform: translate3d(0, 0, 0) scale(1);
    }
    50% {
        opacity: 0.75;
        transform: translate3d(3vw, -2vh, 0) scale(1.08);
    }
}

@keyframes glow-cool {
    0%, 100% {
        opacity: 0.4;
        transform: translate3d(0, 0, 0) scale(1);
    }
    50% {
        opacity: 0.8;
        transform: translate3d(-2.5vw, 2.5vh, 0) scale(1.06);
    }
}

.atmo-mist {
    position: absolute;
    border-radius: 50%;
}

.atmo-mist-1 {
    width: 130vmax;
    height: 80vmax;
    left: -30vmax;
    top: -20vmax;
    background: radial-gradient(
        closest-side,
        rgba(95, 120, 150, 0.12) 0%,
        rgba(70, 90, 120, 0.04) 45%,
        transparent 72%
    );
    animation: mist-drift-1 52s ease-in-out infinite alternate, mist-breathe-1 18s ease-in-out infinite;
}

.atmo-mist-2 {
    width: 110vmax;
    height: 75vmax;
    right: -35vmax;
    bottom: -25vmax;
    background: radial-gradient(
        closest-side,
        rgba(80, 100, 130, 0.08) 0%,
        rgba(200, 135, 74, 0.05) 28%,
        transparent 68%
    );
    animation: mist-drift-2 60s ease-in-out infinite alternate, mist-breathe-2 22s ease-in-out infinite;
}

@keyframes mist-drift-1 {
    from { transform: translate3d(-1.5vw, -0.5vh, 0) scale(1); }
    to { transform: translate3d(5vw, 4vh, 0) scale(1.05); }
}

@keyframes mist-drift-2 {
    from { transform: translate3d(1vw, 1vh, 0) scale(1.02); }
    to { transform: translate3d(-4vw, -3vh, 0) scale(1); }
}

@keyframes mist-breathe-1 {
    0%, 100% { opacity: 0.65; }
    50% { opacity: 1; }
}

@keyframes mist-breathe-2 {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 0.95; }
}

.atmo-tints {
    position: absolute;
    inset: 0;
}

.atmo-tint {
    position: absolute;
    inset: 0;
    opacity: 0;
}

.atmo-tint--horizon-line {
    background:
        radial-gradient(ellipse 90% 55% at 50% 0%, rgba(90, 125, 155, 0.13) 0%, transparent 65%),
        radial-gradient(ellipse 70% 45% at 88% 78%, rgba(100, 120, 140, 0.07) 0%, transparent 58%);
}

.atmo-tint--after-hours {
    background:
        radial-gradient(ellipse 65% 50% at 12% 88%, rgba(35, 115, 85, 0.1) 0%, transparent 55%),
        radial-gradient(ellipse 80% 55% at 72% 12%, rgba(55, 65, 115, 0.12) 0%, transparent 60%);
}

.atmo-tint--what-we-burn {
    background:
        radial-gradient(ellipse 75% 55% at 18% 96%, rgba(210, 90, 45, 0.14) 0%, transparent 58%),
        radial-gradient(ellipse 50% 40% at 82% 68%, rgba(175, 70, 35, 0.08) 0%, transparent 55%);
}

.atmo-tint--borrowed-views {
    background:
        radial-gradient(ellipse 70% 50% at 90% 18%, rgba(210, 155, 80, 0.12) 0%, transparent 58%),
        radial-gradient(ellipse 65% 45% at 28% 82%, rgba(155, 105, 65, 0.06) 0%, transparent 55%);
}

.atmo-tint--someone-is-cooking {
    background:
        radial-gradient(ellipse 75% 60% at 50% 55%, rgba(220, 110, 55, 0.11) 0%, transparent 62%),
        radial-gradient(ellipse 55% 45% at 8% 92%, rgba(185, 65, 30, 0.09) 0%, transparent 55%);
}

.atmo-tint--through-glass {
    background:
        radial-gradient(ellipse 85% 60% at 50% 42%, rgba(115, 130, 150, 0.1) 0%, transparent 65%),
        radial-gradient(ellipse 45% 35% at 94% 8%, rgba(175, 185, 195, 0.06) 0%, transparent 50%);
}

.atmo-grain {
    position: absolute;
    inset: -50%;
    width: 200%;
    height: 200%;
    opacity: 0.065;
    mix-blend-mode: overlay;
    background-size: 180px 180px;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.05' numOctaves='3' seed='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
    animation: grain-shift 0.5s steps(2) infinite, grain-breathe 10s ease-in-out infinite alternate;
}

@keyframes grain-breathe {
    from { opacity: 0.055; }
    to { opacity: 0.08; }
}

@keyframes grain-shift {
    0% { transform: translate3d(0, 0, 0); }
    100% { transform: translate3d(-1.5%, -1.5%, 0); }
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background: radial-gradient(ellipse at center, transparent 30%, rgba(6, 7, 10, 0.45) 72%, rgba(4, 5, 7, 0.88) 100%);
}

.shell {
    position: relative;
    z-index: 2;
    max-width: 920px;
    margin: 0 auto;
    padding: 3.5rem 1.35rem 4rem;
}

.intro {
    position: relative;
    padding-left: 1.1rem;
    margin-bottom: 2.75rem;
}

.intro::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 1px;
    height: 100%;
    background: rgba(200, 135, 74, 0.35);
    transform: scaleY(0);
    transform-origin: top center;
}

body.intro-line .intro::before {
    animation: draw-line 0.36s cubic-bezier(0.22, 1, 0.26, 1) forwards;
}

body.intro-title .atmosphere {
    animation: fade-in 0.85s ease-out forwards;
}

.site-title {
    font-family: var(--font-display);
    font-size: clamp(2.6rem, 9vw, 3.6rem);
    font-weight: 400;
    line-height: 0.92;
    letter-spacing: 0.02em;
    color: var(--paper);
    margin-bottom: 1.35rem;
    transform: scaleX(0.84);
    transform-origin: left center;
    text-shadow: none;
    opacity: 0;
}

body.intro-title .site-title {
    animation: enter-title 0.62s cubic-bezier(0.18, 1, 0.22, 1) forwards;
}

@keyframes enter-title {
    0% {
        opacity: 0;
        transform: scaleX(0.84);
        text-shadow: 0 0 0 rgba(196, 189, 180, 0);
    }
    28% {
        opacity: 1;
        transform: scaleX(var(--stretch-title));
        text-shadow: 0 0 0 rgba(196, 189, 180, 0);
    }
    100% {
        opacity: 1;
        transform: scaleX(var(--stretch-title));
        text-shadow: var(--display-glow);
    }
}

@keyframes draw-line {
    from {
        transform: scaleY(0);
    }
    to {
        transform: scaleY(1);
    }
}

@keyframes enter-nav {
    from {
        opacity: 0;
        clip-path: inset(0 100% 0 0);
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        clip-path: inset(0 0 0 0);
        transform: none;
    }
}

@keyframes enter-gallery {
    from {
        opacity: 0;
        filter: blur(3px);
    }
    to {
        opacity: 1;
        filter: none;
    }
}

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

.nav {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.65rem 1rem;
    padding-top: 0.25rem;
    opacity: 0;
    clip-path: inset(0 100% 0 0);
    transform: translateX(-10px);
}

body.intro-nav .nav {
    animation: enter-nav 0.3s cubic-bezier(0.18, 1, 0.22, 1) forwards;
}

.nav-label {
    font-size: 0.68rem;
    letter-spacing: 0.18em;
    text-transform: lowercase;
    color: var(--muted);
}

.nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.15rem 0.55rem;
}

.nav-link {
    color: var(--muted);
    font-size: 0.82rem;
    letter-spacing: 0.06em;
    text-transform: lowercase;
    text-decoration: underline;
    text-decoration-color: transparent;
    text-underline-offset: 4px;
    transition: color 0.2s, text-decoration-color 0.2s;
}

.nav-link:hover {
    color: var(--text);
    text-decoration-color: rgba(196, 189, 180, 0.35);
}

.gallery {
    width: 100%;
    opacity: 0;
}

body.intro-gallery .gallery {
    animation: enter-gallery 0.5s ease-out forwards;
}

.room {
    padding: 3.5rem 0 4rem;
    border-top: 1px solid var(--line);
    scroll-margin-top: 1.5rem;
}

.room:first-child {
    padding-top: 0.5rem;
    border-top: 0;
}

.room-head {
    max-width: 26rem;
    margin-bottom: clamp(2.5rem, 6vw, 4rem);
}

.room-title {
    font-family: var(--font-display);
    font-size: clamp(1.65rem, 4.5vw, 2.15rem);
    font-weight: 400;
    letter-spacing: 0.03em;
    color: var(--paper);
    line-height: 1;
    transform: scaleX(var(--stretch-room));
    transform-origin: left center;
    text-shadow: var(--display-glow-room);
}

.room-desc {
    margin-top: 0.75rem;
    font-size: 0.86rem;
    line-height: 1.75;
    color: var(--muted);
    font-style: italic;
    font-family: var(--font-serif);
}

.room-wall {
    display: flex;
    flex-direction: column;
    gap: clamp(3.25rem, 9vw, 6.5rem);
}

.piece {
    margin: 0;
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.85s ease, transform 0.85s ease;
}

.piece.is-visible {
    opacity: 1;
    transform: none;
}

.piece--start {
    align-self: flex-start;
}

.piece--end {
    align-self: flex-end;
}

.piece--center {
    align-self: center;
}

.piece--vertical {
    width: min(54vw, 400px);
}

.piece--landscape {
    width: min(90vw, 760px);
}

.piece--panorama {
    width: min(98vw, 920px);
    align-self: center;
}

.piece-btn {
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    touch-action: manipulation;
}

.piece-btn img {
    display: block;
    width: 100%;
    height: auto;
    border: 1px solid rgba(36, 32, 24, 0.85);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.28);
    transition: opacity 0.35s ease, transform 0.35s ease;
    -webkit-user-drag: none;
}

.piece-btn:hover img {
    opacity: 0.92;
}

.piece-caption {
    margin-top: 0.85rem;
    max-width: 28rem;
    font-size: 0.78rem;
    line-height: 1.65;
    letter-spacing: 0.04em;
    color: var(--muted);
    font-style: italic;
    font-family: 'Cormorant Garamond', Georgia, serif;
}

.piece--end .piece-caption {
    margin-left: auto;
    text-align: right;
}

.piece--center .piece-caption {
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

.empty {
    padding: 3rem 1rem;
    color: var(--muted);
    font-size: 0.8rem;
    letter-spacing: 0.06em;
    text-align: center;
}

.nav-ig {
    margin-left: auto;
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    color: var(--muted);
    text-decoration: none;
}

.nav-ig:hover {
    color: var(--paper);
}

.footer {
    margin-top: 3rem;
    padding-top: 1.75rem;
    border-top: 1px solid var(--line);
    opacity: 0;
}

body.intro-gallery .footer {
    animation: fade-in 0.45s ease 0.1s forwards;
}

.footer-note {
    max-width: 28rem;
    font-size: 0.88rem;
    line-height: 1.75;
    color: var(--muted);
    font-style: italic;
    font-family: 'Cormorant Garamond', Georgia, serif;
}

.footer-note a {
    font-style: normal;
    font-family: 'Noto Sans JP', sans-serif;
    color: var(--accent);
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(5, 6, 9, 0.96);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.modal[hidden] {
    display: none;
}

.modal.open {
    opacity: 1;
}

.modal.closing {
    opacity: 0;
}

.modal-loader {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal.is-loading .modal-loader {
    opacity: 1;
    visibility: visible;
}

.modal-loader-dots {
    display: flex;
    gap: 0.38rem;
}

.modal-loader-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--muted);
    animation: loader-dot 1.05s ease-in-out infinite;
}

.modal-loader-dot:nth-child(2) {
    animation-delay: 0.16s;
}

.modal-loader-dot:nth-child(3) {
    animation-delay: 0.32s;
}

@keyframes loader-dot {
    0%, 70%, 100% {
        transform: translateY(0);
        opacity: 0.3;
    }
    35% {
        transform: translateY(-3px);
        opacity: 0.85;
    }
}

.modal-img {
    display: block;
    position: relative;
    z-index: 2;
    width: auto;
    height: auto;
    max-width: min(96vw, 100%);
    max-height: min(92vh, 100%);
    object-fit: contain;
    border: 1px solid var(--line);
    box-shadow: 0 12px 60px rgba(0, 0, 0, 0.45);
    opacity: 0;
    transition: opacity 0.35s ease;
    -webkit-user-drag: none;
}

.modal-img.is-ready {
    opacity: 1;
}

.modal-close {
    position: fixed;
    top: 18px;
    right: 22px;
    z-index: 2001;
    border: 0;
    background: none;
    color: var(--muted);
    font-size: 1.75rem;
    font-weight: 300;
    line-height: 1;
    cursor: pointer;
    touch-action: manipulation;
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--accent);
}

.modal-nav {
    position: fixed;
    top: 50%;
    z-index: 2001;
    transform: translateY(-50%);
    width: 2.25rem;
    height: 2.75rem;
    padding: 0;
    border: 0;
    background: none;
    color: var(--muted);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    touch-action: manipulation;
    opacity: 0.45;
    transition: opacity 0.2s, color 0.2s;
}

.modal-prev {
    left: 14px;
}

.modal-next {
    right: 14px;
}

.modal-nav:hover {
    opacity: 1;
    color: var(--paper);
}

.back-top {
    position: fixed;
    right: max(1.1rem, env(safe-area-inset-right, 0px));
    bottom: max(1.1rem, env(safe-area-inset-bottom, 0px));
    z-index: 100;
    padding: 0.35rem;
    border: 0;
    background: none;
    color: var(--muted);
    cursor: pointer;
    touch-action: manipulation;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(6px);
    transition: opacity 0.5s ease, visibility 0.5s ease, transform 0.5s ease, color 0.2s;
}

.back-top-mark {
    display: block;
    width: 0.85rem;
    height: auto;
}

.back-top.is-visible {
    opacity: 0.4;
    visibility: visible;
    pointer-events: auto;
    transform: none;
}

.back-top.is-visible:hover {
    opacity: 0.85;
    color: var(--paper);
}

.back-top:focus-visible {
    outline: 1px solid var(--accent);
    outline-offset: 2px;
}

@media (max-width: 768px) {
    .shell {
        padding: 2.5rem 1rem 3rem;
    }

    .intro {
        padding-left: 0.85rem;
        margin-bottom: 2rem;
    }

    .nav {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .nav-ig {
        margin-left: 0;
    }

    .piece--vertical {
        width: min(72vw, 340px);
    }

    .piece--landscape {
        width: min(94vw, 680px);
    }

    .room-wall {
        gap: clamp(2.75rem, 10vw, 5rem);
    }

    .modal-prev {
        left: 6px;
    }

    .modal-next {
        right: 6px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .atmo-grain {
        animation: none;
        inset: 0;
        width: 100%;
        height: 100%;
    }

    .atmo-layer {
        transform: none !important;
    }

    .piece {
        opacity: 1;
        transform: none;
    }

    .back-top {
        transition: none;
    }

    .modal-loader-dot {
        animation: none;
        opacity: 0.7;
    }

    body.intro-title .site-title,
    body.intro-line .intro::before,
    body.intro-nav .nav,
    body.intro-gallery .gallery,
    body.intro-gallery .footer,
    body.intro-title .atmosphere,
    body.intro-gallery .atmosphere {
        animation: none;
        opacity: 1;
        transform: none;
        clip-path: none;
        filter: none;
    }

    .intro::before {
        transform: scaleY(1);
    }

    .site-title {
        transform: scaleX(var(--stretch-title));
        text-shadow: var(--display-glow);
    }
}

.shell--not-found {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.not-found {
    max-width: 26rem;
    padding: 0 0 4rem 1.1rem;
    border-left: 1px solid rgba(200, 135, 74, 0.35);
}

.not-found-code {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: clamp(4rem, 16vw, 6.5rem);
    line-height: 1;
    letter-spacing: 0.08em;
    color: rgba(110, 103, 96, 0.32);
    margin-bottom: 1.25rem;
}

.not-found-title {
    font-family: var(--font-display);
    font-size: clamp(1.65rem, 4.5vw, 2.15rem);
    font-weight: 400;
    letter-spacing: 0.03em;
    color: var(--paper);
    line-height: 1;
    margin-bottom: 0.85rem;
    transform: scaleX(var(--stretch-room));
    transform-origin: left center;
    text-shadow: var(--display-glow-room);
}

.not-found-note {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 0.86rem;
    line-height: 1.75;
    color: var(--muted);
    font-style: italic;
    margin-bottom: 1.75rem;
}

.not-found-back a {
    font-size: 0.82rem;
    letter-spacing: 0.06em;
    text-transform: lowercase;
    color: var(--muted);
    text-decoration: underline;
    text-decoration-color: transparent;
    text-underline-offset: 4px;
    transition: color 0.2s, text-decoration-color 0.2s;
}

.not-found-back a:hover {
    color: var(--text);
    text-decoration-color: rgba(196, 189, 180, 0.35);
}

@media (max-width: 768px) {
    .not-found {
        padding-left: 0.85rem;
    }
}
