:root {
  --fondo: #ffffff;
  --inchiostro: #121214;
  --grigio: #7a7a80;
  --linea: #ececf0;
  --accento: #e5484d;
  --foto: min(232px, 56vh);
  --riga: min(42px, 9.4vh);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--fondo);
  color: var(--inchiostro);
  font-family: "Mona Sans Variable", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.stage {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px 16px;
  overflow: hidden;
}

/* the card is always visible and already holds the open list, so poster and video frame it whole */
.card {
  position: relative;
  width: min(296px, 88vw);
  padding: 8px;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(18, 18, 20, 0.06), 0 1px 2px rgba(18, 18, 20, 0.05), 0 18px 40px -22px rgba(18, 18, 20, 0.35);
}

.photo {
  position: relative;
  height: var(--foto);
  border-radius: 15px;
  overflow: hidden;
  isolation: isolate;
}
.art { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: cover; object-position: 50% 50%; }

/* a fine grain over the photo, so it reads as a print on the board */
.grain {
  position: absolute;
  inset: 0;
  opacity: 0.16;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .4  0 0 0 0 .33  0 0 0 0 .25  0 0 0 .9 0'/></filter><rect width='120' height='120' filter='url(%23n)'/></svg>");
  pointer-events: none;
}

/* the Save pill */
.save {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  height: 36px;
  padding: 0 14px 0 11px;
  display: flex;
  align-items: center;
  gap: 6px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 640;
  letter-spacing: -0.005em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.save:focus-visible { outline: 2px solid var(--inchiostro); outline-offset: 3px; }
.save__bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: var(--accento);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 1px 2px rgba(18, 18, 20, 0.18), 0 6px 14px -6px rgba(18, 18, 20, 0.45);
}
.save__ico { position: relative; width: 17px; height: 17px; flex: none; }
.save__ico svg { width: 100%; height: 100%; display: block; overflow: visible; }
.pin { fill: none; stroke: #fff; stroke-width: 2; stroke-linejoin: round; }
.tick { fill: none; stroke: #fff; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

.labels { position: relative; height: 18px; display: block; }
.lab {
  position: absolute;
  left: 0;
  top: 0;
  line-height: 18px;
  white-space: nowrap;
}

/* where the pin was saved: a small glass chip, bottom left of the photo */
.where {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 2;
  height: 30px;
  padding: 0 11px 0 4px;
  display: flex;
  align-items: center;
  gap: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  -webkit-backdrop-filter: blur(10px) saturate(1.2);
  backdrop-filter: blur(10px) saturate(1.2);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.5) inset, 0 4px 12px -6px rgba(18, 18, 20, 0.3);
  font-size: 12px;
  font-weight: 600;
  opacity: 0;
  visibility: hidden;
}
.where__thumb {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: url("vaso.webp") 50% 62% / 210% auto;
  box-shadow: 0 0 0 1px rgba(18, 18, 20, 0.08);
}

.meta {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 6px 4px;
}
.meta__title { margin: 0; font-size: 14.5px; font-weight: 650; letter-spacing: -0.01em; }
.meta__by { margin: 2px 0 0; font-size: 12px; color: var(--grigio); font-weight: 460; }
.meta__saves { margin: 0; font-size: 12px; color: var(--grigio); font-weight: 520; white-space: nowrap; }

/* rolling numbers: the old value slides out, the new one comes in, inside a soft mask */
.roll {
  position: relative;
  display: inline-block;
  vertical-align: bottom;
  overflow: hidden;
  height: 1.25em;
  line-height: 1.25em;
  -webkit-mask-image: linear-gradient(transparent, #000 22%, #000 78%, transparent);
  mask-image: linear-gradient(transparent, #000 22%, #000 78%, transparent);
}
.roll > span { display: block; }
.roll > span + span { position: absolute; left: 0; top: 0; }

/* the list of collections, grown out of the pill */
.panel {
  position: absolute;
  top: 54px;
  right: 18px;
  z-index: 4;
  width: min(206px, 64vw);
  padding: 6px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(18, 18, 20, 0.07), 0 2px 4px rgba(18, 18, 20, 0.06), 0 22px 40px -16px rgba(18, 18, 20, 0.42);
  transform-origin: 88% 0;
  visibility: hidden;
  opacity: 0;
}
.panel__head {
  margin: 4px 8px 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--grigio);
  letter-spacing: 0.01em;
}
.row {
  position: relative;
  width: 100%;
  height: var(--riga);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 0 5px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 13px;
  font-weight: 560;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.row::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: #f3f3f5;
  opacity: 0;
  transition: opacity 0.18s;
}
.row.is-on::before { opacity: 1; }
@media (hover: hover) {
  .row:hover::before { opacity: 1; }
}
.row:focus-visible { outline: 2px solid var(--inchiostro); outline-offset: -2px; }
.row > * { position: relative; }
.row__name { flex: 1; }
.row__n { font-size: 12px; color: var(--grigio); font-weight: 500; }

/* each collection: four little tiles of what is already inside */
.thumb {
  width: calc(var(--riga) - 10px);
  height: calc(var(--riga) - 10px);
  flex: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(18, 18, 20, 0.06);
}
.thumb i { display: block; }
.thumb--a i:nth-child(1) { background: #c9cfc0; }
.thumb--a i:nth-child(2) { background: #e7ddd0; }
.thumb--a i:nth-child(3) { background: #a7b2a4; }
.thumb--a i:nth-child(4) { background: #d9c6b0; }
.thumb--b i:nth-child(1) { background: #d8c9b6; }
.thumb--b i:nth-child(2) { background: #8f7a64; }
.thumb--b i:nth-child(3) { background: #ebe3d8; }
.thumb--b i:nth-child(4) { background: #b9a48b; }
.thumb--c i:nth-child(1) { background: #e6c9c3; }
.thumb--c i:nth-child(2) { background: #f1e6d6; }
.thumb--c i:nth-child(3) { background: #cfb1a6; }
.thumb--c i:nth-child(4) { background: #e9dcd6; }

/* the copy of the photo that flies into the collection */
.flyer {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 6;
  overflow: hidden;
  transform-origin: 0 0;
  pointer-events: none;
  box-shadow: 0 14px 30px -12px rgba(18, 18, 20, 0.45);
}
.flyer img { width: 100%; height: 100%; display: block; object-fit: cover; }

.ghost {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 8;
  width: 22px;
  height: 22px;
  margin: -3px 0 0 -4px;
  opacity: 0;
  pointer-events: none;
  filter: drop-shadow(0 2px 3px rgba(18, 18, 20, 0.28));
}
.ghost path { fill: var(--inchiostro); stroke: #fff; stroke-width: 1.4; stroke-linejoin: round; }

@media (max-width: 400px) {
  .save { height: 34px; font-size: 13.5px; }
}
