:root {
  --fondo: #ffffff;
  --inchiostro: #141416;
  --grigio: #71717a;
  --grigio-chiaro: #a1a1aa;
  --linea: #ececef;
  --campo: #f4f4f5;
  --accento: #f0443a;
}

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

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

p { margin: 0; }

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

/* the picture card: the open popover stays inside it, so the preview frames the open state too */
.pin {
  width: min(320px, 92vw);
  display: grid;
  gap: 12px;
}

.pin__media {
  position: relative;
  height: min(220px, 52vh);
}

.pin__img {
  position: absolute;
  inset: 0;
  border-radius: 20px;
  overflow: hidden;
  background: #fff;
}
/* a warm studio grade over the white sweep of the photo, so the card reads on the white page */
.pin__img::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: radial-gradient(120% 90% at 50% 38%, rgba(255, 252, 247, 0) 40%, rgba(232, 222, 208, 0.55) 100%), linear-gradient(180deg, rgba(250, 245, 238, 0.5), rgba(236, 226, 212, 0.6));
  mix-blend-mode: multiply;
  pointer-events: none;
}
.pin__img::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  z-index: 2;
  box-shadow: inset 0 0 0 1px rgba(20, 20, 22, 0.06);
  pointer-events: none;
}
.art { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: cover; object-position: 50% 50%; }
.pin__shade { z-index: 1; position: absolute; inset: 0; background: #141416; opacity: 0; pointer-events: none; }
.pin__flash {
  position: absolute;
  z-index: 2;
  left: 0;
  top: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.55);
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.9);
  opacity: 0;
  pointer-events: none;
}

/* the Save button: frosted white on the picture, ink once saved */
.save {
  position: absolute;
  top: 12px;
  right: 12px;
  height: 60px;
  padding: 0 22px 0 18px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--inchiostro);
  font: inherit;
  font-size: 16px;
  font-weight: 620;
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  isolation: isolate;
  z-index: 3;
  -webkit-tap-highlight-color: transparent;
}
.save:focus-visible { outline: 2px solid var(--accento); outline-offset: 3px; }

.save__glass, .save__ink {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  z-index: -1;
}
.save__glass {
  background: rgba(255, 255, 255, 0.86);
  -webkit-backdrop-filter: blur(14px) saturate(1.5);
  backdrop-filter: blur(14px) saturate(1.5);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.75), 0 1px 2px rgba(20, 20, 22, 0.1), 0 10px 24px -12px rgba(20, 20, 22, 0.45);
  transition: background-color 0.2s, box-shadow 0.25s;
}
.save.is-hover .save__glass, .save.is-open .save__glass {
  background: rgba(255, 255, 255, 0.98);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.9), 0 1px 2px rgba(20, 20, 22, 0.1), 0 16px 30px -12px rgba(20, 20, 22, 0.5);
}
.save.is-down .save__glass {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.9), 0 1px 1px rgba(20, 20, 22, 0.16), 0 4px 10px -6px rgba(20, 20, 22, 0.45);
}
.save__ink {
  background: var(--inchiostro);
  clip-path: circle(0% at 29px 50%);
}

.save__ico { position: relative; width: 22px; height: 22px; flex: none; }
.save__ico svg { position: absolute; inset: 0; width: 22px; height: 22px; overflow: visible; }
.bm-fill { fill: var(--accento); }
.bm-line {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linejoin: round;
  transition: stroke 0.25s;
}
.save.is-filled .bm-line { stroke: var(--accento); }
.bm-burst path { fill: none; stroke: var(--accento); stroke-width: 1.7; stroke-linecap: round; opacity: 0; }

.labels { position: relative; display: block; height: 22px; overflow: hidden; }
.label {
  position: absolute;
  left: 0;
  top: 0;
  line-height: 22px;
  white-space: nowrap;
  font-stretch: 100%;
  opacity: 0;
}
.label[data-l="save"] { opacity: 1; }
.label b { font-weight: 720; }

/* the popover with the collections */
.pop {
  position: absolute;
  top: 80px;
  right: 12px;
  width: min(236px, calc(100% - 24px));
  padding: 6px;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(20, 20, 22, 0.06), 0 26px 50px -20px rgba(20, 20, 22, 0.42), 0 4px 10px -4px rgba(20, 20, 22, 0.12);
  visibility: hidden;
  z-index: 4;
}

.pop__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 34px;
  padding: 0 4px 0 10px;
  font-size: 12.5px;
  font-weight: 540;
  color: var(--grigio);
}
.pop__new {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--campo);
  display: grid;
  place-items: center;
}
.pop__new svg { width: 14px; height: 14px; fill: none; stroke: var(--grigio); stroke-width: 1.7; stroke-linecap: round; }

.row {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  height: 50px;
  padding: 0 10px 0 6px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--inchiostro);
  font: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.16s;
}
.row.is-hot { background: var(--campo); }
.row:focus-visible { outline: 2px solid var(--accento); outline-offset: -2px; }

.cover {
  position: relative;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 9px;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(20, 20, 22, 0.05);
}
.tile {
  position: absolute;
  border-radius: 2.5px;
  overflow: hidden;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}
.tile:nth-child(1) { left: 0; top: 0; width: 18px; height: 38px; }
.tile:nth-child(2) { left: 20px; top: 0; width: 18px; height: 18px; }
.tile:nth-child(3) { left: 20px; top: 20px; width: 18px; height: 18px; }
/* the bottle cut from the photo: the crop 274, 50, 212 x 452 of the 760 x 524 file (CROP in script.js) */
.snip {
  display: block;
  width: 100%;
  height: 100%;
  /* the same warm grade as the card, multiplied over the cut */
  background-color: #fff;
  background-image: linear-gradient(180deg, #faf5ee, #ece2d4), url("contagocce.webp");
  background-repeat: no-repeat;
  background-size: 100% 100%, 358.49% 115.93%;
  background-position: 0 0, 50% 69.44%;
  background-blend-mode: multiply, normal;
}

.t-terra { background: linear-gradient(170deg, #dca37a, #a85f3b); }
.t-sand { background: radial-gradient(circle at 60% 40%, #f6ecdc 0 30%, #e4d3bb 31%); }
.t-olive { background: linear-gradient(160deg, #8f9a76, #5f6b4c); }
.t-box { background: linear-gradient(#e9dfcd 0 38%, #3e4c3d 38% 62%, #2e392d 62%); }
.t-label { background: linear-gradient(#e7b65b 0 50%, #cf8f3a 50%); }
.t-kraft { background: repeating-linear-gradient(90deg, #cdb79a 0 3px, #c3ab8b 3px 4px); }
.t-aa { background: #141416; color: #fff; font-size: 9.5px; font-stretch: 112%; }
.t-g { background: #f1ebe2; color: #141416; font-size: 13px; font-weight: 500; }
.t-r { background: #ffd9c7; color: #8a3b1a; font-size: 11px; font-weight: 800; font-stretch: 80%; }

.row__name { flex: 1; min-width: 0; font-size: 14px; font-weight: 590; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row__count {
  position: relative;
  height: 18px;
  overflow: hidden;
  line-height: 18px;
  font-size: 13px;
  font-weight: 520;
  color: var(--grigio);
  text-align: right;
}
.row__count span { display: block; }
.row__count [data-cb] { position: absolute; right: 0; top: 0; transform: translateY(100%); }
.row__check { width: 16px; height: 16px; flex: none; margin-left: -2px; overflow: visible; }
.row__check path { fill: none; stroke: var(--accento); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 14; stroke-dashoffset: 14; }

/* the caption under the picture */
.pin__cap { display: grid; gap: 3px; padding: 0 4px 8px; }
.pin__title { font-size: 14.5px; font-weight: 620; letter-spacing: -0.01em; }
.pin__meta { font-size: 12.5px; color: var(--grigio); font-weight: 460; display: flex; align-items: baseline; gap: 0.28em; white-space: nowrap; }
.roll { position: relative; display: inline-block; height: 16px; line-height: 16px; overflow: hidden; vertical-align: bottom; }
.roll span { display: block; }
.roll [data-sb] { position: absolute; left: 0; top: 0; transform: translateY(100%); }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* the lifted thumbnail */
.flyer {
  position: fixed;
  left: 0;
  top: 0;
  width: 50px;
  height: 106px;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 0 0 2px #fff, 0 14px 26px -10px rgba(20, 20, 22, 0.45);
  pointer-events: none;
  opacity: 0;
  z-index: 9;
}


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

@media (hover: hover) {
  .row:hover { background: var(--campo); }
}
