/* Lumea website: the gallery wall and phone mockup (home and app pages).
   The backdrop, framed paintings (.hung), the phone and its lock screen
   (.screen, .clock, .hang) and the painted stand-ins shown while images load.
   The phone and lock screen scale from --pw (phone width). */

.canvas {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: var(--surface);
}

.canvas img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 700ms ease;
}

.canvas img.is-loaded {
  opacity: 1;
}

/* The stand-in painting (a quiet landscape in the painting's own colors),
   shown until a real image loads, or if none does. */
.standin {
  position: absolute;
  inset: 0;
}

.standin span {
  position: absolute;
  left: -10%;
  right: -10%;
  border-radius: 50% 50% 0 0 / 30% 30% 0 0;
}

.standin .sky {
  inset: 0;
  left: 0;
  right: 0;
  border-radius: 0;
  background: linear-gradient(var(--p-sky, #4a5868), var(--p-far, #7a8a8f));
}

.standin .sun {
  width: 22%;
  aspect-ratio: 1;
  left: 62%;
  right: auto;
  top: 18%;
  border-radius: 50%;
  background: var(--p-sun, #e8c98a);
  filter: blur(1px);
  opacity: 0.85;
}

.standin .far {
  bottom: 28%;
  height: 34%;
  background: var(--p-far, #6b7a76);
  opacity: 0.9;
}

.standin .near {
  bottom: 0;
  height: 36%;
  background: var(--p-near, #3e4a3a);
}

.standin .deep {
  bottom: -6%;
  height: 18%;
  left: 20%;
  background: var(--p-deep, #20271f);
}

.backdrop {
  position: relative;
  height: clamp(34rem, 72vh, 44rem);
  border-radius: 6px;
  overflow: hidden;
  isolation: isolate;
  /* The phone and its lock screen are sized from the backdrop, so they
     scale together when the backdrop is shorter. */
  container-type: size;
  --pw: min(40.6cqh, 62cqw); /* phone width: 88% of the height, at most 62% of the width */
}

@media (min-width: 48rem) {
  .backdrop {
    height: clamp(17rem, calc(100vh - 22.5rem), 44rem);
    height: clamp(17rem, calc(100svh - 22.5rem), 44rem);
  }
}

/* Paintings: a gallery wall with framed works and a spotlight from above. */
.backdrop-paintings {
  background:
    radial-gradient(70% 55% at 50% 0%, rgba(246, 216, 154, 0.12), transparent 70%),
    linear-gradient(180deg, #1d1a16, #141210 75%);
}

.backdrop-paintings::after {
  /* the gallery floor line */
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 14%;
  background: linear-gradient(180deg, #0f0e0c, #0b0a09);
  border-top: 1px solid #2a2620;
  z-index: -1;
}

/* A framed painting on the gallery wall. Each one is placed by its center
   (--x, --y) and fits a box of --w by --h at its own shape (--r = width / height),
   so nothing is cropped. main.js corrects --r from the real image once it loads. */
.hung {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: min(calc(var(--w) * var(--k, 1)), calc(var(--h) * var(--r)));
  aspect-ratio: var(--r);
  transform: translate(-50%, -50%);
  padding: clamp(0.25rem, 0.9cqh, 0.45rem);
  background: #0e0d0b;
  box-shadow:
    0 0 0 1px rgba(201, 169, 106, 0.35),
    0 18px 36px -14px rgba(0, 0, 0, 0.8);
  opacity: 0.72;
}

@media (max-width: 47.99rem) {
  .backdrop {
    --k: 2.2;
  }

  .hung-small {
    display: none;
  }
}

.hung .canvas {
  aspect-ratio: auto;
  width: 100%;
  height: 100%;
}

/* The phone */
.phone {
  position: absolute;
  left: 50%;
  bottom: 6%;
  transform: translateX(-50%);
  width: var(--pw);
  aspect-ratio: 9 / 19.5;
  padding: calc(var(--pw) * 0.0333);
  border-radius: calc(var(--pw) * 0.158);
  background: #050505;
  box-shadow:
    0 0 0 1px #3a3631,
    0 0 0 3px #141311,
    0 40px 80px -24px rgba(0, 0, 0, 0.9);
  transition: transform 300ms ease;
}

.screen {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: calc(var(--pw) * 0.127);
  overflow: hidden;
  background: var(--screen-wall, #1a1714);
}

.screen .island {
  position: absolute;
  top: 2.2%;
  left: 50%;
  transform: translateX(-50%);
  width: 32%;
  height: 3.8%;
  border-radius: 999px;
  background: #000;
  z-index: 3;
}

/* The lock screen clock, as iOS draws it */
.clock {
  position: absolute;
  top: 9%;
  left: 0;
  right: 0;
  text-align: center;
  color: rgba(255, 255, 255, 0.92);
  font-family: -apple-system, "SF Pro Display", system-ui, sans-serif;
  z-index: 2;
}

.clock .date {
  font-size: calc(var(--pw) * 0.0473);
  font-weight: 600;
  letter-spacing: 0.01em;
}

.clock .time {
  font-size: calc(var(--pw) * 0.218);
  line-height: 1;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-top: 0.1rem;
}

/* The painting on the Museum wall: same proportions as the app
   (up to 90% wide, 52% tall, centered 46% down, never above 26.5%). */
.hang {
  position: absolute;
  left: 50%;
  top: 46%;
  transform: translate(-50%, -50%);
  width: 78%;
  aspect-ratio: 4 / 5;
  padding: 1.6%;
  background: #1c1712;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.1),
    0 14px 26px rgba(0, 0, 0, 0.55);
}

.hang .canvas {
  aspect-ratio: auto;
  width: 100%;
  height: 100%;
}

.screen .bottom {
  position: absolute;
  bottom: 3.5%;
  left: 12%;
  right: 12%;
  display: flex;
  justify-content: space-between;
  z-index: 2;
}

.screen .bottom span {
  width: calc(var(--pw) * 0.127);
  height: calc(var(--pw) * 0.127);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(6px);
}

.screen .home-bar {
  position: absolute;
  bottom: 1.2%;
  left: 50%;
  transform: translateX(-50%);
  width: 34%;
  height: 0.28rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  z-index: 2;
}

/* A real screenshot, when there is one, replaces the drawn lock screen. */
.screen > img.shot {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 4;
}

@media (max-width: 560px) {
  .clock .time { font-size: 3rem; }
}
