:root {
  --fondo: #f2f2f2;
  --cornice: #16161a;
  --bordo: #2a2a30;
  --inchiostro: #17171c;
  --etichetta: rgba(23, 23, 28, 0.72);
  --vetro: rgba(255, 255, 255, 0.42);
  --muro-1: #eef0f7;
  --muro-2: #f6efe8;
  --muro-a: #c9d4ff;
  --muro-b: #ffd9c7;
  --muro-c: #d8f0e4;
  --accento: #2563eb;
}

* { box-sizing: border-box; margin: 0; }

html, body { height: 100%; }

body {
  background: var(--fondo);
  color: var(--inchiostro);
  font-family: "Mona Sans Variable", "Mona Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
}

.stage {
  position: relative;
  height: 100vh;
  display: grid;
  place-items: center;
  overflow: hidden;
}

/* the phone: sizes are set by the script from the height and the width of the window */
.phone {
  position: relative;
  border-radius: calc(var(--s, 1px) * 46);
  background: var(--cornice);
  padding: calc(var(--s, 1px) * 9);
  box-shadow:
    0 0 0 1px var(--bordo) inset,
    0 calc(var(--s, 1px) * 30) calc(var(--s, 1px) * 60) -20px rgba(20, 20, 30, 0.35),
    0 calc(var(--s, 1px) * 4) calc(var(--s, 1px) * 10) rgba(20, 20, 30, 0.12);
}

.phone::after {
  /* a thin highlight on the frame, like light on polished metal */
  content: "";
  position: absolute; inset: 1px;
  border-radius: inherit;
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.22), transparent 30%, transparent 70%, rgba(255, 255, 255, 0.08));
  pointer-events: none;
}

.phone__screen {
  position: relative;
  width: 100%; height: 100%;
  border-radius: calc(var(--s, 1px) * 38);
  overflow: hidden;
  background: linear-gradient(170deg, var(--muro-1), var(--muro-2));
  touch-action: none;
  cursor: default;
}

.phone__notch {
  position: absolute;
  left: 50%; top: calc(var(--s, 1px) * 17);
  width: calc(var(--s, 1px) * 74); height: calc(var(--s, 1px) * 20);
  transform: translateX(-50%);
  border-radius: 999px;
  background: #0b0b0d;
}

.wall i {
  position: absolute;
  border-radius: 50%;
  filter: blur(calc(var(--s, 1px) * 26));
  opacity: 0.85;
}
.wall__a { width: 70%; height: 40%; left: -18%; top: 8%; background: var(--muro-a); }
.wall__b { width: 66%; height: 38%; right: -20%; top: 38%; background: var(--muro-b); }
.wall__c { width: 70%; height: 34%; left: 6%; bottom: -8%; background: var(--muro-c); }

.status {
  position: absolute; left: 0; right: 0; top: 0;
  height: calc(var(--s, 1px) * 52);
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(var(--s, 1px) * 6) calc(var(--s, 1px) * 26) 0;
  font-size: calc(var(--s, 1px) * 13);
  font-weight: 620;
  letter-spacing: 0.01em;
}
.status__icons { display: flex; gap: calc(var(--s, 1px) * 5); align-items: center; }
.status__icons svg { height: calc(var(--s, 1px) * 10); width: auto; fill: currentColor; }
.status__icons .s { fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; }

.edit-add, .edit-done {
  position: absolute;
  top: calc(var(--s, 1px) * 18);
  border: 0;
  font: inherit;
  color: var(--inchiostro);
  background: rgba(255, 255, 255, 0.62);
  box-shadow: 0 0 0 1px rgba(20, 20, 30, 0.06), 0 2px 8px rgba(20, 20, 30, 0.08);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  opacity: 0;
  visibility: hidden;
  cursor: pointer;
  z-index: 4;
}
.edit-add {
  left: calc(var(--s, 1px) * 20);
  width: calc(var(--s, 1px) * 28); height: calc(var(--s, 1px) * 28);
  border-radius: 50%;
  display: grid; place-items: center;
}
.edit-add svg { width: 60%; height: 60%; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.edit-done {
  right: calc(var(--s, 1px) * 18);
  height: calc(var(--s, 1px) * 28);
  padding: 0 calc(var(--s, 1px) * 14);
  border-radius: 999px;
  font-size: calc(var(--s, 1px) * 12.5);
  font-weight: 650;
  font-stretch: 105%;
}

.widget { position: absolute; left: 0; top: 0; }
.widget__jig { position: relative; width: 100%; height: 100%; }
.widget__card {
  position: relative;
  width: 100%; height: 100%;
  border-radius: calc(var(--s, 1px) * 20);
  background: rgba(255, 255, 255, 0.66);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.7) inset, 0 8px 22px -12px rgba(20, 20, 30, 0.25);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  padding: calc(var(--s, 1px) * 13) calc(var(--s, 1px) * 15);
  overflow: hidden;
}
.widget__app { font-size: calc(var(--s, 1px) * 9.5); font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; color: #d42a2a; }
.widget__day { margin-top: calc(var(--s, 1px) * 2); font-size: calc(var(--s, 1px) * 26); line-height: 1.05; font-weight: 380; letter-spacing: -0.01em; }
.widget__day b { font-weight: 680; }
.widget__next { margin-top: calc(var(--s, 1px) * 8); font-size: calc(var(--s, 1px) * 12); font-weight: 600; }
.widget__time { font-size: calc(var(--s, 1px) * 10.5); color: rgba(23, 23, 28, 0.55); }
.widget__line {
  position: absolute; left: calc(var(--s, 1px) * 15); right: calc(var(--s, 1px) * 15); bottom: calc(var(--s, 1px) * 13);
  height: calc(var(--s, 1px) * 3); border-radius: 2px; background: rgba(23, 23, 28, 0.08); overflow: hidden;
}
.widget__line i { position: absolute; inset: 0; background: linear-gradient(90deg, #f87171, #d42a2a); transform-origin: left; transform: scaleX(0.42); border-radius: inherit; }
.widget__x { width: calc(var(--s, 1px) * 15) !important; height: calc(var(--s, 1px) * 15) !important; left: calc(var(--s, 1px) * -5); top: calc(var(--s, 1px) * -5); }

.grid, .dock { position: absolute; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; }

.dock__glass {
  position: absolute;
  border-radius: calc(var(--s, 1px) * 28);
  background: var(--vetro);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.5) inset, 0 6px 20px -8px rgba(20, 20, 30, 0.18);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  backdrop-filter: blur(14px) saturate(1.3);
}

/* one app: the outer box is moved by GSAP, the lift box grows when it is held, the jig box wobbles */
.app {
  position: absolute; left: 0; top: 0;
  pointer-events: auto;
  touch-action: none;
  cursor: pointer;
}
.app__lift, .app__jig { position: relative; width: 100%; height: 100%; }
.app__tile {
  position: relative;
  border-radius: 23%;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(20, 20, 30, 0.12), 0 4px 10px -4px rgba(20, 20, 30, 0.2);
}
.app__tile::before {
  /* a soft top light on every icon */
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0) 46%);
}
.app__tile::after {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  box-shadow: 0 0 0 0.5px rgba(255, 255, 255, 0.35) inset;
}
.app__tile svg { position: absolute; inset: 22%; width: 56%; height: 56%; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.app__tile svg .f { fill: #fff; stroke: none; }
.app__name {
  position: absolute; left: -20%; right: -20%;
  text-align: center;
  color: var(--etichetta);
  font-weight: 520;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app__x {
  position: absolute;
  left: -9%; top: -9%;
  width: 34%; height: 34%;
  border-radius: 50%;
  background: rgba(236, 236, 240, 0.94);
  box-shadow: 0 0 0 0.5px rgba(20, 20, 30, 0.14), 0 1px 3px rgba(20, 20, 30, 0.18);
  display: grid; place-items: center;
  transform: scale(0);
}
.app__x svg { width: 56%; height: 56%; fill: none; stroke: #45454d; stroke-width: 2.6; stroke-linecap: round; }
.app__shade {
  /* the shadow that grows under the icon while it is carried */
  position: absolute;
  left: 8%; right: 8%; bottom: -6%;
  height: 30%;
  border-radius: 50%;
  background: rgba(20, 20, 30, 0.32);
  filter: blur(6px);
  opacity: 0;
}
.app.is-held { z-index: 3; }
.app.is-dock .app__name { display: none; }

@media (hover: hover) {
  .app__tile { transition: transform 0.32s cubic-bezier(0.2, 0.9, 0.3, 1.4), box-shadow 0.32s ease; }
  .app:hover .app__tile {
    transform: translateY(-1.5px) scale(1.05);
    box-shadow: 0 2px 3px rgba(20, 20, 30, 0.12), 0 9px 16px -6px rgba(20, 20, 30, 0.3);
  }
  .app.is-held .app__tile { transform: none; }
  .edit-done:hover { background: rgba(255, 255, 255, 0.85); }
}

.ghost {
  position: absolute; left: 0; top: 0;
  width: 26px; height: 26px;
  fill: #111; stroke: #fff; stroke-width: 1.4; stroke-linejoin: round;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.25));
  pointer-events: none;
  opacity: 0;
  z-index: 5;
}
