/* Puzzle-piece scroll reveal — demo/escape-room */

:root {
    --puzzle-ease: cubic-bezier(0.16, 1, 0.3, 1);
    --puzzle-duration-char: 0.72s;
    --puzzle-duration-block: 0.85s;
    --puzzle-stagger-char: 0.038s;
    --puzzle-stagger-word: 0.055s;
    --puzzle-travel: 110px;
}

/* ---- Split text pieces ---- */
.puzzle-headline-inner {
    display: inline;
}

.puzzle-char {
    display: inline-block;
    opacity: 0;
    --tx: 0px;
    --ty: 40px;
    --rot: 0;
    transform: translate3d(var(--tx), var(--ty), 0) rotate(calc(var(--rot) * 1deg)) scale(0.86);
    transition:
        opacity var(--puzzle-duration-char) var(--puzzle-ease),
        transform var(--puzzle-duration-char) var(--puzzle-ease),
        filter 0.55s var(--puzzle-ease);
    transition-delay: calc(var(--i) * var(--puzzle-stagger-char));
    will-change: transform, opacity;
}

.puzzle-char--hero {
    filter: blur(5px);
}

.puzzle-headline.is-visible .puzzle-char,
.puzzle-headline.is-visible .puzzle-char--hero {
    opacity: 1;
    transform: translate3d(0, 0, 0) rotate(0deg) scale(1);
    filter: blur(0);
}

.puzzle-words-inner {
    display: inline;
}

.puzzle-word {
    display: inline-block;
    opacity: 0;
    --tx: 0px;
    --ty: 55px;
    --rot: 0;
    transform: translate3d(var(--tx), var(--ty), 0) rotate(calc(var(--rot) * 1deg)) scale(0.92);
    transition:
        opacity 0.78s var(--puzzle-ease),
        transform 0.78s var(--puzzle-ease);
    transition-delay: calc(var(--i) * var(--puzzle-stagger-word));
    margin-right: 0.25em;
}

.puzzle-word:last-child {
    margin-right: 0;
}

.puzzle-words.is-visible .puzzle-word {
    opacity: 1;
    transform: translate3d(0, 0, 0) rotate(0deg) scale(1);
}

/* ---- Block / section pieces ---- */
.puzzle-block {
    opacity: 0;
    --tx: 0px;
    --ty: 48px;
    --rot: 0;
    transform: translate3d(var(--tx), var(--ty), 0) rotate(calc(var(--rot) * 1deg)) scale(0.94);
    transition:
        opacity var(--puzzle-duration-block) var(--puzzle-ease),
        transform var(--puzzle-duration-block) var(--puzzle-ease);
}

.puzzle-block.is-visible {
    opacity: 1;
    transform: translate3d(0, 0, 0) rotate(0deg) scale(1);
}

.puzzle-block.delay-100 {
    transition-delay: 100ms;
}

.puzzle-block.delay-200 {
    transition-delay: 200ms;
}

.puzzle-block.delay-300 {
    transition-delay: 300ms;
}

.puzzle-block.delay-400 {
    transition-delay: 400ms;
}

/* ---- Simple scroll reveal (below-the-fold default) ---- */
.scroll-reveal {
    opacity: 0;
    transform: translate3d(0, 26px, 0);
    transition: opacity 0.72s var(--puzzle-ease), transform 0.78s var(--puzzle-ease);
}

.scroll-reveal.is-visible {
    opacity: 1;
    transform: translate3d(0, 0, 0);
}

.room-cards > .scroll-reveal:nth-child(1) {
    transition-delay: 0.05s;
}

.room-cards > .scroll-reveal:nth-child(2) {
    transition-delay: 0.12s;
}

.room-cards > .scroll-reveal:nth-child(3) {
    transition-delay: 0.19s;
}

.review-cards > .scroll-reveal:nth-child(1) {
    transition-delay: 0.05s;
}

.review-cards > .scroll-reveal:nth-child(2) {
    transition-delay: 0.12s;
}

.review-cards > .scroll-reveal:nth-child(3) {
    transition-delay: 0.19s;
}

.room-card .room-img {
    transition: transform 0.7s ease;
}

.room-card:hover .room-img {
    transform: scale(1.05);
}

@media (prefers-reduced-motion: reduce) {
    .puzzle-char,
    .puzzle-word,
    .puzzle-block,
    .scroll-reveal {
        transition-duration: 0.01ms !important;
        transition-delay: 0ms !important;
        filter: none !important;
    }

    .puzzle-char,
    .puzzle-word,
    .puzzle-block:not(.is-visible),
    .scroll-reveal:not(.is-visible) {
        opacity: 1;
        transform: none;
    }

    .puzzle-headline:not(.is-visible) .puzzle-char,
    .puzzle-words:not(.is-visible) .puzzle-word {
        opacity: 1;
        transform: none;
        filter: none;
    }
}
