:root {
  --fondo: #f1ede6;
  --tavolo: #ebe5dc;
  --inchiostro: #1b1a18;
  --secondario: #7a756d;
  --linea: #dcd5ca;
  --accento: #c4693a;
  --ombra: 38, 30, 22;
  --matita: #5f5b55;
}

* { box-sizing: border-box; }

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

/* the light of a window over the table, soft and from the upper left */
body {
  background:
    radial-gradient(120% 90% at 18% 0%, #fbf8f3 0%, rgba(251, 248, 243, 0) 60%),
    linear-gradient(180deg, var(--fondo), var(--tavolo));
}

.stage {
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  justify-items: center;
  align-items: center;
  gap: clamp(6px, 2vh, 18px);
  padding: clamp(10px, 4vh, 36px) 16px clamp(10px, 4vh, 32px);
  overflow: hidden;
  position: relative;
}

.bottega {
  margin: 0;
  font-size: clamp(10px, 1.6vh, 12px);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--secondario);
  font-stretch: 112%;
}
.bottega span { color: var(--inchiostro); font-weight: 600; }

/* the print: 4:3 plus the border, sized on both the width and the height of the window */
.tavolo {
  --w: min(70vw, 66vh, 560px);
  --h: calc(var(--w) * .8);
  position: relative;
  width: var(--w);
  height: var(--h);
  perspective: 1100px;
  perspective-origin: 50% 30%;
}

.stampa {
  position: absolute;
  inset: 0;
  cursor: pointer;
  outline: none;
  transform-style: preserve-3d;
}
.stampa:focus-visible::after {
  content: "";
  position: absolute;
  inset: -8px;
  border: 1.5px solid var(--accento);
  border-radius: 4px;
}

.carta {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  will-change: transform;
}

.fronte {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
}

/* each strip of the photo: one element for the transform, the image and the light inside it */
.striscia {
  position: absolute;
  top: 0;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
  background: #fbfaf6;
  will-change: transform;
}
/* the photo inside each strip: the same image for all of them, moved so that together they make one print */
.striscia__foto {
  position: absolute;
  background:
    radial-gradient(95% 95% at 50% 48%, rgba(0, 0, 0, 0) 55%, rgba(0, 0, 0, .2) 100%),
    url("bassa-marea.webp") center / cover no-repeat;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08);
}
.striscia__luce {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.retro {
  position: absolute;
  inset: 0;
  transform: rotateY(180deg);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
}
.retro__carta { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.retro__carta text { font-family: "Mona Sans Variable", "Mona Sans", system-ui, sans-serif; }
.retro__luce { position: absolute; inset: 0; pointer-events: none; }

/* the pencil note, written by hand on the back */
.nota {
  position: absolute;
  left: 9%;
  top: 46%;
  width: 70%;
  font-family: "Caveat Variable", "Caveat", cursive;
  color: var(--matita);
  transform: rotate(-2.5deg);
  transform-origin: 0 0;
}
.nota__riga, .nota__firma {
  margin: 0;
  font-size: calc(var(--w) * .056);
  line-height: 1.25;
  white-space: nowrap;
  opacity: .9;
}
.nota__firma { margin-top: .35em; padding-left: 52%; font-size: calc(var(--w) * .05); }

/* two shadows: the tight one where the paper touches the table, the soft one when it lifts */
.ombra {
  position: absolute;
  inset: 0;
  pointer-events: none;
  will-change: transform, opacity, filter;
}
.ombra--contatto {
  background: rgba(var(--ombra), .32);
  filter: blur(1.5px);
  transform: translate(1px, 1.5px);
}
.ombra--morbida {
  background: rgba(var(--ombra), .26);
  border-radius: 3px;
  filter: blur(6px);
  opacity: .5;
}

.didascalia { text-align: center; display: grid; gap: 4px; }
.didascalia p { margin: 0; }
.didascalia__titolo {
  font-size: clamp(14px, 2.6vh, 20px);
  font-weight: 560;
  font-stretch: 92%;
  letter-spacing: -.01em;
}
.didascalia__dati { font-size: clamp(11px, 1.7vh, 13px); color: var(--secondario); }
.prezzo { color: var(--inchiostro); font-weight: 600; }
.didascalia__aiuto {
  font-size: clamp(10px, 1.5vh, 11px);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--secondario);
  opacity: .7;
  margin-top: 4px !important;
}

/* the drawn pointer of the self-running loop */
.puntatore {
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  pointer-events: none;
  opacity: 0;
  filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, .25));
  z-index: 5;
}

@media (hover: none) {
  .didascalia__aiuto { display: none; }
}

/* the real photo the print is made from: loaded with the page so the print is ready when it starts, never shown on its own */
.sorgente { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
