/* Czech Closet — the gallery in space: 1 FINAL (Breeze) on a deep-space background.
   A long page you can scroll through. The squares are solid bodies on springs (Matter.js, run by
   breeze.js) that lag and wobble as you scroll and swing in a breeze; grab one, move it about and
   throw it. Behind everything a fixed canvas (space.js) paints the stars. */

:root {
  --bg: #000;
  --text: #f5f5f4;
  --muted: #8a8a88;
  --stroke: rgba(255, 255, 255, .09);
  --red: #b80f0f;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}

/* ---------- the sky: a fixed canvas under everything, painted by space.js ---------- */
.space {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 0;
  width: 100%;
  height: 100vh;
  height: 100lvh; /* tall enough for phones with their toolbars hidden */
  background: #030409; /* black with the faintest blue, the colour of the night sky */
  pointer-events: none;
  animation: fade 2s ease backwards;
}

/* ---------- pinned logo: the squares fly over it ---------- */
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; translate: 0 24px; filter: blur(12px); } }

.hero {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  padding: 0 24px;
  pointer-events: none;
}
.hero::before { /* the edges of the screen fall away into darker space */
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(ellipse at center, transparent 45%, rgba(0, 0, 0, .55) 100%);
}
.logo { width: clamp(260px, 46vw, 640px); max-width: calc(100vw - 48px); margin: 0; line-height: 0; }
.logo svg { display: block; width: 100%; height: auto; overflow: visible; fill: #fff; animation: rise 1.4s cubic-bezier(.2, .8, .2, 1) backwards; }
.logo__tagline { animation: fade .9s .7s ease backwards; }

.hint {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 1;
  translate: -50% 0;
  display: grid;
  justify-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .3em;
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
  transition: opacity .4s ease;
  animation: fade 1s 1.2s ease backwards;
}
.hint::after {
  content: "";
  width: 1px;
  height: 36px;
  background: linear-gradient(var(--red), transparent);
}
.is-used .hint { opacity: 0; }

/* ---------- the world: as big as the page, the squares live inside it ---------- */
.world {
  position: relative;
  z-index: 2;
  overflow: clip;
  --tile: 240px;   /* physics.js sets the size for the screen */
  --radius: 17px;
}
.tile {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--tile);
  margin: 0;
  cursor: grab;
  touch-action: none; /* dragging a square moves it; drag the background to scroll */
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  will-change: transform;
}
.tile[hidden] { display: none; }
.tile .cc-gallery {
  --cc-radius: var(--radius);
  background: #141414;
  border-radius: var(--radius);
  box-shadow: 0 0 0 1px var(--stroke), 0 30px 60px -20px rgba(0, 0, 0, .8);
  transition: transform .25s cubic-bezier(.2, .8, .2, 1), box-shadow .25s ease;
}
.tile .cc-gallery > img { color: transparent; } /* no alt text flashing up while a photo loads */
.tile .cc-gallery[data-variant="fade"] > img { transition-duration: .45s; }
.tile.is-held { z-index: 5; }
.tile.is-held .cc-gallery {
  transform: scale(1.04); /* lifted off the page */
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .28), 0 50px 90px -20px rgba(0, 0, 0, .95);
}
.is-dragging, .is-dragging * { cursor: grabbing !important; }

footer {
  position: relative;
  z-index: 2;
  padding: 40px 24px;
  color: #555;
  font-size: 12px;
  letter-spacing: .2em;
  text-align: center;
  text-transform: uppercase;
}

/* ---------- name label under the cursor (or above a tapped square) ---------- */
.cursor {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 200;
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--red);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .45), 0 10px 30px -10px rgba(0, 0, 0, .7);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  translate: -50% 0;
  opacity: 0;
  scale: .5;
  pointer-events: none;
  transition: opacity .18s ease, scale .25s cubic-bezier(.2, .8, .2, 1);
  will-change: transform;
}
.cursor.is-on { opacity: 1; scale: 1; }
.cursor__colorway {
  color: rgba(255, 255, 255, .78);
  font-family: "Instrument Serif", Georgia, serif;
  font-size: 17px;
  font-weight: 400;
}

@media (prefers-reduced-motion: reduce) {
  .space, .logo svg, .logo__tagline, .hint { animation: none; }
}
