:root {
  --fondo: #f2f2f3;
  --card: #ffffff;
  --inchiostro: #141416;
  --grigio: #6f6f77;
  --grigio-chiaro: #a9a9b1;
  --bordo: rgba(20, 20, 22, 0.09);
  --accento: #e5484d;
  --accento-chiaro: #fdecec;
}

* { box-sizing: border-box; margin: 0; padding: 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;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 14px;
  overflow: hidden;
  touch-action: none;
}

.album {
  position: relative;
  width: min(330px, 100%, calc(78vh - 20px));
  background: var(--card);
  border: 1px solid var(--bordo);
  border-radius: 22px;
  padding: clamp(12px, 3.4vmin, 18px);
  box-shadow: 0 1px 2px rgba(20, 20, 22, 0.04), 0 26px 56px -28px rgba(20, 20, 22, 0.24);
}

.album__head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: clamp(10px, 2.6vmin, 14px); }
.album__brand { display: flex; align-items: center; gap: 9px; font-size: 13.5px; font-weight: 660; letter-spacing: -0.01em; line-height: 1.15; }
.album__brand small { display: block; font-size: 11px; font-weight: 450; color: var(--grigio); letter-spacing: 0; }
.album__logo { width: 28px; height: 28px; border-radius: 9px; background: var(--inchiostro); display: grid; place-items: center; flex: none; }
.album__logo svg { width: 17px; height: 17px; fill: none; stroke: #fff; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.album__count { font-size: 11.5px; color: var(--grigio); white-space: nowrap; }

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(5px, 1.4vmin, 7px);
  transition: opacity 0.3s;
}

/* a photo: an element for GSAP, the picture inside for the CSS */
.photo { position: relative; aspect-ratio: 1; border-radius: 11px; cursor: pointer; touch-action: none; }
.photo__pic {
  position: absolute; inset: 0; border-radius: inherit; overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05);
}
.photo__pic img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; user-select: none; -webkit-user-drag: none; }
.photo__pic::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.22), transparent 42%);
}
.photo__fav {
  position: absolute; right: 6px; bottom: 6px; width: 20px; height: 20px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.94); display: grid; place-items: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.16);
  opacity: 0; transform: scale(0.4);
}
.photo__fav svg { width: 12px; height: 12px; fill: var(--accento); }

/* the empty place a deleted photo leaves */
.photo__gap {
  position: absolute; inset: 0; border-radius: inherit;
  border: 1.5px dashed rgba(20, 20, 22, 0.16);
  opacity: 0;
}

.hint { margin-top: clamp(9px, 2.4vmin, 13px); text-align: center; font-size: 11.5px; color: var(--grigio); height: 1.3em; }

/* the radial menu: placed where the finger presses */
.radial { position: absolute; left: 0; top: 0; width: 0; height: 0; pointer-events: none; z-index: 10; }
.radial__line { position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: visible; }
.radial__line line { stroke: rgba(20, 20, 22, 0.35); stroke-width: 1.5; stroke-linecap: round; opacity: 0; }
.radial__hold { position: absolute; left: -32px; top: -32px; width: 64px; height: 64px; overflow: visible; transform: rotate(-90deg); }
.radial__hold circle { fill: none; stroke: var(--inchiostro); stroke-width: 2.4; stroke-linecap: butt; opacity: 0; }
.radial__core {
  position: absolute; left: 0; top: 0; width: 34px; height: 34px; margin: -17px 0 0 -17px;
  border-radius: 999px; background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--bordo);
  box-shadow: 0 6px 18px -6px rgba(20, 20, 22, 0.3);
  display: grid; place-items: center; overflow: hidden;
  opacity: 0; transform: scale(0.3);
}
.radial__name { font-size: 11px; font-weight: 640; white-space: nowrap; padding: 0 10px; }

.item {
  position: absolute; left: 0; top: 0; width: 44px; height: 44px; margin: -22px 0 0 -22px;
  pointer-events: none;
}
.item__face {
  position: absolute; inset: 0; border-radius: 50%;
  background: #fff; border: 1px solid var(--bordo);
  box-shadow: 0 1px 2px rgba(20, 20, 22, 0.06), 0 10px 22px -10px rgba(20, 20, 22, 0.35);
  display: grid; place-items: center;
}
.item__face svg { width: 19px; height: 19px; fill: none; stroke: var(--inchiostro); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.item.is-on .item__face { background: var(--inchiostro); border-color: var(--inchiostro); }
.item.is-on .item__face svg { stroke: #fff; }
.item.is-danger.is-on .item__face { background: var(--accento); border-color: var(--accento); }

/* the toast at the bottom of the card */
.toast {
  position: absolute; left: 50%; bottom: clamp(10px, 2.8vmin, 16px);
  display: flex; align-items: center; gap: 8px;
  padding: 7px 8px 7px 11px; border-radius: 999px;
  background: var(--inchiostro); color: #fff; font-size: 12px; font-weight: 560; white-space: nowrap;
  box-shadow: 0 12px 26px -12px rgba(20, 20, 22, 0.55);
  opacity: 0; transform: translate(-50%, 14px); z-index: 12; pointer-events: none;
}
.toast.is-on { pointer-events: auto; }
.toast__icon { width: 16px; height: 16px; display: grid; place-items: center; }
.toast__icon svg { width: 15px; height: 15px; fill: none; stroke: #fff; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.toast__undo {
  font: inherit; font-size: 11.5px; font-weight: 640; color: #fff; background: rgba(255, 255, 255, 0.14);
  border: 0; border-radius: 999px; padding: 4px 9px; cursor: pointer; display: none;
}
.toast.has-undo .toast__undo { display: inline-block; }

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

@media (hover: hover) {
  .toast__undo:hover { background: rgba(255, 255, 255, 0.24); }
}
