:root {
    color-scheme: light;
    --ink: #34352e;
    --sub: #68685d;
    --paper: #e8e4da;
    --line: #625b3b
}

* {
    box-sizing: border-box
}

html {
    background: var(--paper)
}

body {
    margin: 0;
    color: var(--ink);
    font-family: Arial, Helvetica, sans-serif
}

button {
    font: inherit;
    color: inherit;
    background: none;
    border: 0;
    cursor: pointer;
    font-size: 14px;
    padding: 10px 0
}

button:hover {
    color: #7e6137
}

button:focus-visible {
    outline: 2px solid #695431;
    outline-offset: 5px
}

button:disabled {
    opacity: .4;
    cursor: default
}

.loader {
    min-height: 100svh;
    overflow: hidden;
    isolation: isolate;
    position: relative;
    display: grid;
    grid-template-rows: auto minmax(290px, 1fr) auto auto;
    padding: 28px 4vw 20px;
    background: radial-gradient(ellipse at 55% 27%, #f6f3ec 0%, #e9e5dc 48%, #d7d4c9 100%)
}

header {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: center;
    z-index: 5
}

.signature {
    font-family: Georgia, serif;
    font-size: 19px;
    letter-spacing: -.04em
}

.signature i {
    font-weight: normal
}

.controls {
    display: flex;
    gap: 24px;
    align-items: center
}

.divider {
    width: 1px;
    height: 12px;
    background: #64645045
}

.scene-wrap {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    perspective: 1200px;
    min-height: 280px
}

.scene {
    width: min(70vw, 680px);
    aspect-ratio: 1.5;
    position: relative;
    opacity: 0;
    transition: opacity .6s;
    transform-style: preserve-3d;
    transform: translate(var(--px, 0px), var(--py, 0px));
    will-change: transform
}

.loaded .scene {
    opacity: 1
}

.light {
    position: absolute;
    height: 1px;
    width: 90vw;
    left: 0;
    pointer-events: none;
    opacity: .6;
    background: linear-gradient(90deg, transparent, #fffef4, transparent);
    box-shadow: 0 0 4px 1px #fffdf8;
    transform-origin: center;
    z-index: -1
}

.light-one {
    top: 32%;
    transform: rotate(-27deg);
    animation: light-drift 13s ease-in-out infinite
}

.light-two {
    top: 45%;
    transform: rotate(31deg);
    animation: light-drift 16s ease-in-out infinite reverse
}

.floor-shadow {
    position: absolute;
    left: 13%;
    top: 78%;
    width: 75%;
    height: 12%;
    border-radius: 50%;
    background: #544b3652;
    filter: blur(21px);
    animation: shadow 8s ease-in-out infinite
}

.object {
    position: absolute;
    aspect-ratio: 1;
    transform-origin: center;
    will-change: transform;
    animation: assemble 1.8s cubic-bezier(.15, .7, .25, 1) both;
    animation-play-state: paused
}

.loaded .object {
    animation-play-state: running
}

.float {
    width: 100%;
    height: 100%;
    animation: float 7.7s ease-in-out infinite;
    animation-play-state: paused;
    will-change: transform
}

.loaded .float {
    animation-play-state: running
}

.sprite {
    height: 100%;
    width: 100%;
    background-image: url('../images/couture-atlas.png');
    background-size: 300% 200%;
    background-repeat: no-repeat;
    filter: drop-shadow(0px 12px 11px #4b3e3420)
}

.sprite-machine {
    background-position: 0 0
}

.sprite-mannequin {
    background-position: 50% 0
}

.sprite-scissors {
    background-position: 100% 0
}

.sprite-spool {
    background-position: 0 100%
}

.sprite-tape {
    background-position: 50% 100%
}

.sprite-thimble {
    background-position: 100% 100%
}

.machine {
    width: 62%;
    left: 9%;
    top: 7%;
    --from-x: -80px;
    --from-y: 50px;
    --from-r: -9deg;
    z-index: 2
}

.machine .float {
    --lift: -13px;
    --turn: 3deg;
    animation-delay: -1s
}

.mannequin {
    width: 53%;
    left: 27%;
    top: -9%;
    z-index: 3;
    --from-x: 0px;
    --from-y: -70px;
    --from-r: 8deg;
    animation-delay: .1s
}

.mannequin .float {
    --lift: -17px;
    --turn: -4deg;
    animation-delay: -.7s
}

.scissors {
    width: 48%;
    left: 9%;
    top: 39%;
    z-index: 6;
    --from-x: -110px;
    --from-y: 60px;
    --from-r: -35deg;
    animation-delay: .35s
}

.scissors .float {
    --lift: -23px;
    --turn: 12deg;
    animation-delay: -2s
}

.spool {
    width: 27%;
    left: 72%;
    top: 24%;
    z-index: 4;
    --from-x: 100px;
    --from-y: 10px;
    --from-r: 50deg;
    animation-delay: .45s
}

.spool .float {
    --lift: -31px;
    --turn: 19deg;
    animation-delay: -4s
}

.tape {
    width: 38%;
    left: 57%;
    top: 52%;
    z-index: 7;
    --from-x: 70px;
    --from-y: 65px;
    --from-r: 23deg;
    animation-delay: .2s
}

.tape .float {
    --lift: -14px;
    --turn: -8deg;
    animation-delay: -3s
}

.thimble {
    width: 15%;
    left: 76%;
    top: -4%;
    z-index: 1;
    --from-x: 55px;
    --from-y: -90px;
    --from-r: 80deg;
    animation-delay: .6s
}

.thimble .float {
    --lift: -25px;
    --turn: 24deg;
    animation-delay: -5s
}

.orbit {
    position: absolute;
    left: 3%;
    top: 7%;
    width: 96%;
    height: 81%;
    border: 1px solid #fffc;
    box-shadow: 0 -1px 8px #fff8;
    border-radius: 50%;
    pointer-events: none;
    transform: rotate(-22deg);
    animation: orbit 12s ease-in-out infinite
}

.orbit-back {
    z-index: 1;
    clip-path: inset(0 0 50% 0)
}

.orbit-front {
    z-index: 8;
    clip-path: inset(50% 0 0 0);
    opacity: .7
}

.caption {
    text-align: center;
    position: relative;
    z-index: 3;
    margin: 22px 0 26px
}

.eyebrow {
    font-size: 10px;
    letter-spacing: .2em;
    color: var(--sub);
    margin: 0 0 14px
}

h1 {
    font: normal clamp(28px, 3vw, 44px)/1.13 Georgia, 'Times New Roman', serif;
    letter-spacing: -.035em;
    margin: 0
}

h1 em {
    font-weight: normal;
    color: #73664f
}

footer {
    width: min(420px, 100%);
    margin: 0 auto;
    z-index: 5
}

.progress-label {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    font-size: 14px;
    color: #55574b
}

#count {
    font: 24px Georgia, serif;
    color: var(--ink);
    font-variant-numeric: tabular-nums
}

#count span {
    font: 12px Arial;
    margin-left: 5px
}

.track {
    height: 2px;
    background: #37382826;
    margin: 13px 0 8px
}

#bar {
    height: 100%;
    width: 0;
    background: #756445;
    transition: width .12s linear
}

.bottom-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px
}

.bottom-row>span {
    font-size: 9px;
    letter-spacing: .15em;
    color: #646559
}

#replay {
    font-size: 12px
}

.paused .float,
.paused .light,
.paused .floor-shadow,
.paused .orbit,
.paused .object {
    animation-play-state: paused !important
}

.complete .orbit {
    opacity: .25;
    transition: opacity 1s
}

.complete #replay {
    color: #694e26
}

.noscript {
    position: fixed;
    bottom: 0;
    left: 0;
    background: var(--paper);
    padding: 12px;
    font-size: 14px
}

body.reduced .float,
body.reduced .object,
body.reduced .orbit,
body.reduced .floor-shadow,
body.reduced .light {
    animation: none !important
}

.asset-error .scene {
    display: none
}

.asset-error .scene-wrap {
    min-height: 100px
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0) rotate(0)
    }

    50% {
        transform: translateY(var(--lift, -20px)) rotate(var(--turn, 5deg))
    }
}

@keyframes assemble {
    from {
        opacity: 0;
        transform: translate(var(--from-x), var(--from-y)) rotate(var(--from-r)) scale(.75)
    }

    to {
        opacity: 1;
        transform: translate(0, 0) rotate(0) scale(1)
    }
}

@keyframes shadow {
    50% {
        opacity: .6;
        transform: scale(.92)
    }
}

@keyframes orbit {
    50% {
        transform: rotate(-10deg) scaleY(.85)
    }
}

@keyframes light-drift {
    50% {
        opacity: .25;
        translate: 0 25px
    }
}

@media(min-width:1000px) and (min-height:850px) {
    .scene {
        width: min(75vw, 880px)
    }

    .caption {
        margin-top: 40px;
        margin-bottom: 35px
    }
}

@media(max-width:650px) {
    .loader {
        padding: 22px 22px 16px;
        grid-template-rows: auto minmax(310px, 1fr) auto auto
    }

    .signature {
        font-size: 18px
    }

    .controls {
        gap: 15px
    }

    .controls button {
        font-size: 12px
    }

    .scene {
        width: 112%;
        flex-shrink: 0;
        margin-top: -20px;
        aspect-ratio: 1.05
    }

    .machine {
        top: 13%;
        left: 2%;
        width: 72%
    }

    .mannequin {
        top: 3%;
        left: 25%;
        width: 58%
    }

    .scissors {
        top: 44%;
        left: 1%;
        width: 55%
    }

    .tape {
        top: 56%;
        left: 52%;
        width: 42%
    }

    .spool {
        top: 27%;
        left: 71%;
        width: 29%
    }

    .thimble {
        top: 6%;
        left: 78%;
        width: 15%
    }

    .floor-shadow {
        top: 80%
    }

    .orbit {
        top: 13%;
        height: 68%;
        left: 4%;
        width: 93%
    }

    .caption {
        margin: 0 0 28px
    }

    h1 {
        font-size: 34px
    }

    .eyebrow {
        font-size: 9px;
        letter-spacing: .16em
    }

    .light-one {
        width: 150vw;
        left: -25vw
    }

    .light-two {
        width: 150vw;
        left: -25vw
    }
}

@media(max-height:690px) {
    .loader {
        padding-top: 14px;
        grid-template-rows: auto minmax(235px, 1fr) auto auto
    }

    .scene {
        width: min(58vw, 490px)
    }

    .caption {
        margin: 5px 0 18px
    }

    h1 {
        font-size: 28px
    }

    .eyebrow {
        margin-bottom: 8px
    }
}

@media(max-height:690px) and (max-width:650px) {
    .scene {
        width: min(103%, 380px);
        margin-top: 0
    }
}

@media(prefers-reduced-motion:reduce) {

    *,
    *:before,
    *:after {
        animation: none !important;
        transition: none !important
    }

    .scene {
        transform: none !important
    }
}

/* Individual transparent atlas regions keep every silhouette complete. */
.sprite-machine {
    background-size: 283.39483% 236.48961%;
    background-position: 1.81087% 9.81387%;
}

.machine {
    aspect-ratio: 542/433;
}

.sprite-mannequin {
    background-size: 830.27027% 192.48120%;
    background-position: 50.11103% 0.00000%;
}

.mannequin {
    aspect-ratio: 185/532;
}

.sprite-scissors {
    background-size: 301.76817% 233.25740%;
    background-position: 98.73418% 9.57265%;
}

.scissors {
    aspect-ratio: 509/439;
}

.sprite-spool {
    background-size: 359.71897% 230.11236%;
    background-position: 4.23805% 91.53713%;
}

.spool {
    aspect-ratio: 427/445;
}

.sprite-tape {
    background-size: 314.75410% 271.61804%;
    background-position: 52.48092% 89.48995%;
}

.tape {
    aspect-ratio: 488/377;
}

.sprite-thimble {
    background-size: 517.17172% 302.95858%;
    background-position: 92.33253% 86.29738%;
}

.thimble {
    aspect-ratio: 297/338;
}

.machine {
    width: 61%;
    left: 10%;
    top: 22%
}

.mannequin {
    width: 19%;
    left: 43%;
    top: -3%
}

.scissors {
    width: 48%;
    left: 8%;
    top: 42%
}

.spool {
    width: 21%;
    left: 75%;
    top: 25%
}

.tape {
    width: 31%;
    left: 59%;
    top: 64%
}

.thimble {
    width: 10%;
    left: 80%;
    top: 5%
}

.floor-shadow {
    top: 91%;
    height: 10%
}

.orbit {
    top: 14%;
    height: 81%
}

@media(max-width:650px) {
    .machine {
        width: 65%;
        left: 4%;
        top: 24%
    }

    .mannequin {
        width: 21%;
        left: 40%;
        top: 8%
    }

    .scissors {
        width: 45%;
        left: 5%;
        top: 52%
    }

    .tape {
        width: 32%;
        left: 58%;
        top: 66%
    }

    .spool {
        width: 23%;
        left: 75%;
        top: 30%
    }

    .thimble {
        width: 11%;
        left: 78%;
        top: 10%
    }

    .floor-shadow {
        top: 85%
    }

    .orbit {
        top: 17%;
        height: 71%
    }
}

/* Continuous choreography: sewing-machine drive, scissor steps and rolling tools. */
html,
body {
    background: #fff
}

.loader {
    transition: opacity .55s ease;
    min-height: 100svh
}

.loader.exiting {
    opacity: 0;
    pointer-events: none
}

.bottom-row {
    justify-content: center
}

header {
    justify-content: center
}

.float {
    position: relative
}

.loaded .scene {
    animation: camera-move 7.7s ease-in-out both;
    transform-origin: 50% 55%
}

.loaded .machine {
    animation: machine-travel 7.7s ease-in-out both
}

.loaded .machine .float {
    animation: machine-running .32s ease-in-out infinite
}

.loaded .mannequin {
    animation: mannequin-travel 7.7s ease-in-out both
}

.loaded .mannequin .float {
    animation: mannequin-sway 1.8s ease-in-out infinite
}

.loaded .scissors {
    animation: scissor-travel 7.7s linear both
}

.loaded .scissors .float {
    animation: scissor-run .48s ease-in-out infinite;
    transform-origin: 62% 77%
}

.loaded .spool {
    animation: spool-travel 7.7s ease-in-out both
}

.loaded .spool .float {
    animation: spool-turn 1.4s linear infinite
}

.loaded .tape {
    animation: tape-travel 7.7s ease-in-out both
}

.loaded .tape .float {
    animation: tape-roll .8s ease-in-out infinite
}

.loaded .thimble {
    animation: thimble-travel 7.7s ease-in-out both
}

.loaded .thimble .float {
    animation: thimble-tumble 1.6s linear infinite
}

.loaded .orbit {
    animation: orbit-run 3s linear infinite
}

.flywheel {
    position: absolute;
    left: 84.5%;
    top: 13.5%;
    width: 12%;
    height: 47%;
    border-radius: 50%;
    overflow: hidden;
    transform: rotate(-4deg);
    filter: drop-shadow(1px 2px 2px #0003)
}

.wheel-image {
    width: 100%;
    height: 100%;
    background-image: url('../images/couture-atlas.png');
    background-size: 2363.08% 512%;
    background-position: 32.36% 14.08%;
    border-radius: 50%;
    animation: wheel-spin .44s linear infinite;
    animation-play-state: paused
}

.loaded .wheel-image {
    animation-play-state: running
}

.sprite-scissors {
    transform: scaleX(-1)
}

@keyframes camera-move {
    0% {
        transform: scale(.88) rotate(-3deg)
    }

    18% {
        transform: scale(1) rotate(0)
    }

    50% {
        transform: scale(1.02) rotate(2deg)
    }

    68% {
        transform: translate(-3%, -3%) scale(1.16) rotate(-2deg)
    }

    87% {
        transform: scale(.9) rotate(4deg)
    }

    100% {
        transform: scale(.97) rotate(0)
    }
}

@keyframes machine-running {

    0%,
    100% {
        transform: translateY(0) rotate(-.4deg)
    }

    50% {
        transform: translateY(-2px) rotate(.4deg)
    }
}

@keyframes machine-travel {
    0% {
        opacity: 0;
        transform: translate(-30px, 25px) scale(.9)
    }

    12%,
    35% {
        opacity: 1;
        transform: translate(0, 0)
    }

    65% {
        transform: translate(-14px, -12px) rotate(-4deg)
    }

    85% {
        transform: translate(22px, -20px) rotate(5deg) scale(.93)
    }

    100% {
        opacity: 1;
        transform: translate(0, 0)
    }
}

@keyframes mannequin-travel {
    0% {
        opacity: 0;
        transform: translate(0, -35px)
    }

    14%,
    35% {
        opacity: 1;
        transform: translate(0, 0)
    }

    65% {
        transform: translate(18px, -15px) rotate(5deg)
    }

    85% {
        transform: translate(-15px, -5px) rotate(-8deg)
    }

    100% {
        opacity: 1;
        transform: translate(0, 0)
    }
}

@keyframes mannequin-sway {

    0%,
    100% {
        transform: rotate(-3deg) translateY(0)
    }

    50% {
        transform: rotate(4deg) translateY(-8px)
    }
}

@keyframes scissor-travel {
    0% {
        opacity: 0;
        transform: translate(-45px, 20px) rotate(-12deg)
    }

    12% {
        opacity: 1;
        transform: translate(-20px, 0)
    }

    38% {
        transform: translate(30px, -3px) rotate(4deg)
    }

    58% {
        transform: translate(58px, 4px) rotate(-3deg)
    }

    78% {
        transform: translate(20px, -5px) rotate(2deg)
    }

    100% {
        opacity: 1;
        transform: translate(-15px, 0)
    }
}

@keyframes scissor-run {

    0%,
    100% {
        transform: translateY(0) rotate(-7deg)
    }

    25% {
        transform: translateY(-14px) rotate(1deg)
    }

    50% {
        transform: translateY(0) rotate(8deg)
    }

    75% {
        transform: translateY(-11px) rotate(0)
    }
}

@keyframes spool-travel {
    0% {
        opacity: 0;
        transform: translate(30px, 30px) scale(.8)
    }

    14%,
    30% {
        opacity: 1;
        transform: translate(0, 0)
    }

    48% {
        transform: translate(10px, -35px)
    }

    68% {
        transform: translate(-38px, 14px) scale(1.35)
    }

    86% {
        transform: translate(20px, -30px) scale(.8)
    }

    100% {
        opacity: 1;
        transform: translate(0, 0)
    }
}

@keyframes spool-turn {
    0% {
        transform: rotate(-15deg)
    }

    50% {
        transform: rotate(165deg)
    }

    100% {
        transform: rotate(345deg)
    }
}

@keyframes tape-travel {
    0% {
        opacity: 0;
        transform: translate(40px, 15px) rotate(10deg)
    }

    14%,
    30% {
        opacity: 1;
        transform: translate(0, 0)
    }

    50% {
        transform: translate(-8px, -8px) rotate(-10deg)
    }

    68% {
        transform: translate(-65px, -15px) scale(1.6) rotate(-16deg)
    }

    85% {
        transform: translate(5px, -8px) scale(.85) rotate(12deg)
    }

    100% {
        opacity: 1;
        transform: translate(0, 0)
    }
}

@keyframes tape-roll {

    0%,
    100% {
        transform: translateY(0) rotate(-5deg)
    }

    50% {
        transform: translateY(-9px) rotate(6deg)
    }
}

@keyframes thimble-travel {
    0% {
        opacity: 0;
        transform: translate(0, -25px)
    }

    18% {
        opacity: 1;
        transform: translate(0, 0)
    }

    45% {
        transform: translate(-20px, 20px)
    }

    70% {
        transform: translate(10px, -10px)
    }

    100% {
        opacity: 1;
        transform: translate(0, 0)
    }
}

@keyframes thimble-tumble {
    to {
        transform: rotate(360deg)
    }
}

@keyframes wheel-spin {
    to {
        transform: rotate(360deg)
    }
}

@keyframes orbit-run {
    0% {
        transform: rotate(-22deg) scaleY(.8);
        opacity: .4
    }

    50% {
        transform: rotate(-7deg) scaleY(.95);
        opacity: .8
    }

    100% {
        transform: rotate(-22deg) scaleY(.8);
        opacity: .4
    }
}

@media(prefers-reduced-motion:reduce) {

    .loaded .scene,
    .loaded .object,
    .loaded .float,
    .wheel-image {
        animation: none !important;
        transform: none !important
    }

    .loader {
        transition: none !important
    }
}