:root {
  --bg: #f6f5f1;
  --ink: #1b1b1a;
  --grey: #8b8a85;
  --line: #d9d7d0;
  --paper: #ffffff;
  --door: #e9e7e1;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 15px/1.5 "Helvetica Neue", Helvetica, Arial, sans-serif; -webkit-font-smoothing: antialiased; }
img { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; cursor: pointer; }
.hidden { display: none !important; }
.link { background: none; border: 0; padding: 0; color: var(--grey); text-decoration: underline; text-underline-offset: 3px; }

.top { position: fixed; inset: 0 0 auto 0; z-index: 50; display: flex; justify-content: space-between; align-items: baseline; padding: 18px 32px; mix-blend-mode: multiply; }
.brand { text-decoration: none; font-weight: 600; }
.top nav a { text-decoration: none; margin-left: 22px; color: var(--grey); }
.top nav a.on { color: var(--ink); }

.opening { height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 0 32px; }
.opening p { font-size: clamp(26px, 4vw, 48px); line-height: 1.15; margin: 0; max-width: 820px; }
.opening .scroll-cue { font-size: 13px; color: var(--grey); margin-top: 32px; }

/* every module is a tall track with a sticky, full-screen stage */
.module { position: relative; }
.m1 { height: 260vh; }
.mgen { height: 280vh; }
.sticky { position: sticky; top: 0; height: 100vh; overflow: hidden; display: flex; flex-direction: column; padding: 64px 32px 32px; }
.m-label { font-size: 15px; margin-bottom: 18px; }
.num { color: var(--grey); margin-right: 6px; }
.sub { color: var(--grey); margin-left: 12px; font-size: 13px; }

/* 01 storeroom */
.room { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
/* the room keeps a 3:2 box at any window size */
.room-frame { position: relative; aspect-ratio: 3 / 2; width: min(100%, calc((100vh - 150px) * 1.5)); }
.room-svg, .room-svg svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.room-svg .obj, .room-svg .fx { transition: transform .25s ease, opacity .25s ease; transform-box: fill-box; transform-origin: center bottom; }

/* build-up: each piece drops in, blurred, then settles — one after another (--i is its order) */
.room-svg .fx, .room-svg .obj { opacity: 0; }
.room-svg.built .fx, .room-svg.built .obj { animation: drop-in .7s cubic-bezier(.2,.8,.25,1.15) both; animation-delay: calc(var(--i) * 90ms); }
.room-svg.leaving .fx, .room-svg.leaving .obj { animation: lift-out .45s ease-in both; animation-delay: calc(var(--j) * 40ms); }
@keyframes drop-in {
  0%   { opacity: 0; translate: 0 -40px; filter: blur(8px); }
  60%  { opacity: 1; filter: blur(0); }
  100% { opacity: 1; translate: 0 0; filter: blur(0); }
}
@keyframes lift-out {
  0%   { opacity: 1; translate: 0 0; filter: blur(0); }
  100% { opacity: 0; translate: 0 -24px; filter: blur(8px); }
}
.room-svg .obj.live { cursor: pointer; }
.room-svg .obj.live:hover { transform: translateY(-6px); }
/* dim the other objects through their parts, so the build-up animation on the group is not restarted */
.room-svg .obj > * { transition: opacity .25s ease; }
.room-svg.dim .obj:not(.on) > * { opacity: .3; }
.room-svg .obj.on { transform: translateY(-6px); }

/* the photographed room: a still image with clickable areas; the name shows on hover */
.room-svg.photo .room-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.room-svg.photo .obj { position: absolute; opacity: 1; animation: none !important; cursor: pointer; border-radius: 6px; outline: 1.5px solid transparent; outline-offset: 2px; transition: outline-color .2s ease, background .2s ease; transform: none !important; }
.room-svg.photo .obj:hover, .room-svg.photo .obj:focus-visible, .room-svg.photo .obj.on { outline-color: rgba(255,255,255,.95); background: rgba(255,255,255,.12); box-shadow: 0 0 0 3.5px rgba(27,27,26,.18); }
.room-svg.photo .obj span { position: absolute; left: 0; bottom: calc(100% + 6px); white-space: nowrap; font-size: 11px; background: var(--paper); padding: 2px 6px; opacity: 0; transition: opacity .2s ease; pointer-events: none; }
.room-svg.photo .obj[data-object="clothes hanger"] span { left: auto; right: 0; }
.room-svg.photo .obj:hover span, .room-svg.photo .obj:focus-visible span { opacity: 1; }

/* doors close over the room at the end of module 01 */
.door { position: absolute; top: 0; bottom: 0; width: 50%; background: var(--door); z-index: 5; transition: none; }
.door.left { left: 0; transform: translateX(-100%); border-right: 1px solid var(--line); }
.door.right { right: 0; transform: translateX(100%); }

/* the images of a clicked object: centred over the room, large */
.drawer { position: fixed; left: 50%; top: 50%; z-index: 40; width: max-content; max-width: calc(100vw - 64px); background: var(--paper); padding: 18px 22px 20px; box-shadow: 0 20px 60px rgba(0,0,0,.12);
  transform: translate(-50%, -48%) scale(.97); opacity: 0; pointer-events: none; transition: transform .4s cubic-bezier(.2,.7,.2,1), opacity .3s ease; }
.drawer.open { transform: translate(-50%, -50%); opacity: 1; pointer-events: auto; }
.drawer-head { display: flex; justify-content: space-between; gap: 24px; font-size: 13px; margin-bottom: 14px; }
.drawer-imgs { display: flex; gap: 18px; overflow-x: auto; justify-content: safe center; }
.drawer-imgs figure { margin: 0; flex: 0 0 auto; }
.drawer-imgs img { height: min(68vh, 720px); width: auto; }
.drawer-empty { font-size: 13px; color: var(--grey); padding: 40px 60px; }
.drawer-imgs figcaption { font-size: 11px; color: var(--grey); margin-top: 8px; max-width: 40vh; }

/* 02 / 03 */
.stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; position: relative; }
.uploader { width: min(560px, 100%); }
.drop { display: flex; align-items: center; justify-content: center; height: 220px; border: 1px dashed var(--grey); color: var(--grey); cursor: pointer; }
.drop:hover, .drop.over { border-color: var(--ink); color: var(--ink); }
.drop input { display: none; }
.samples { display: flex; gap: 12px; margin-top: 18px; }
.samples button { border: 0; padding: 0; background: none; text-align: left; color: var(--grey); font-size: 12px; }
.samples img { width: 96px; height: 120px; object-fit: cover; margin-bottom: 6px; }

.frame { position: relative; margin: 0; height: 100%; display: flex; flex-direction: column; align-items: center; }
.frame .mine, .frame .made, .frame .placeholder { height: calc(100% - 40px); width: auto; max-width: 100%; aspect-ratio: 3 / 4; object-fit: cover; }
.frame .made, .frame .placeholder { position: absolute; top: 0; clip-path: inset(100% 0 0 0); }
.frame .made { object-fit: contain; background: var(--bg); }
.frame .placeholder { background: #e4e2db; color: var(--grey); display: flex; align-items: center; justify-content: center; text-align: center; font-size: 13px; padding: 24px; }
.frame figcaption { margin-top: 12px; font-size: 12px; color: var(--grey); display: flex; gap: 16px; }
/* 02 pair: your photo and the generated one stand side by side */
.mgen[data-mode="pair"] { height: auto; }
.mgen[data-mode="pair"] .sticky { position: relative; }
.mgen[data-mode="pair"] .frame { flex-direction: row; flex-wrap: wrap; justify-content: center; align-content: center; gap: 24px; }
.mgen[data-mode="pair"] .frame .mine, .mgen[data-mode="pair"] .frame .made, .mgen[data-mode="pair"] .frame .placeholder { position: static; clip-path: none; height: calc(100% - 48px); }
.mgen[data-mode="pair"] .frame .made { object-fit: cover; animation: fade-in .6s ease both; }
.mgen[data-mode="pair"] .frame figcaption { flex-basis: 100%; justify-content: center; margin-top: 0; }
@keyframes fade-in { from { opacity: 0; } }

.loading { position: absolute; bottom: 0; color: var(--grey); animation: breathe 1.6s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .35; } }

.end { padding: 80px 32px; color: var(--grey); font-size: 13px; }
.end p { margin: 0 0 8px; max-width: 720px; }
.end .rights { font-size: 11px; }
.offline-note { color: var(--grey); font-size: 13px; margin: 0 0 14px; }

@media (max-width: 760px) {
  .top { padding: 14px 16px; }
  .opening, .sticky, .end { padding-left: 16px; padding-right: 16px; }
  .sub { display: block; margin: 4px 0 0; }
  .mgen[data-mode="pair"] .frame { flex-direction: column; flex-wrap: nowrap; }
  .mgen[data-mode="pair"] .frame .mine, .mgen[data-mode="pair"] .frame .made, .mgen[data-mode="pair"] .frame .placeholder { height: calc(50% - 40px); }
  .drawer { max-width: calc(100vw - 24px); padding: 14px; }
  .drawer-imgs img { height: auto; max-height: 60vh; max-width: calc(100vw - 52px); }
}
