/* The photo that snaps into the corner: one live view, one shutter, one accent. */
:root {
  --fondo: #f3f1ec;         /* warm white */
  --inchiostro: #1c1b19;    /* the shutter disc */
  --anello: #cfcac0;        /* the thin ring at rest */
  --accento: #e4572e;       /* the one accent: the Photo label and the stroke around the shutter */
  --nota: #8d877d;          /* the Saved line */
  --carta: #ffffff;         /* the white edge of the thumbnail */
  --raggio: 16px;           /* the corners of the live view */
}

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

html, body { height: 100%; }

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

.scena {
  position: relative;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

.palco {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(14px, 3.6vh, 30px);
}

/* the live view: measured on the width and on the height of the box */
.mirino {
  width: min(78vw, 78vh, 600px);
  aspect-ratio: 5 / 4;
  cursor: pointer;
}

/* GSAP moves this one (the little kick of the shutter); the frame above keeps the size */
.mirino-kick {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: var(--raggio);
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(28, 27, 25, 0.04), 0 18px 40px -22px rgba(28, 27, 25, 0.28);
  transform: translateZ(0);
}

.foto {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #3a1d12;
}

/* a fine film grain over the photo: it hides the banding of the sky and stays still while the photo drifts under it */
.foto::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.16;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 1.6 -0.3'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23g)'/%3E%3C/svg%3E");
}

/* the photo is a little bigger than the frame, so the hand can drift it without showing an edge */
.foto img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 60% 50%;
  transform-origin: 60% 50%;
  -webkit-user-drag: none;
}

.lampo {
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
}

/* the mode label: two lines in the same place, one fades into the other */
.modo {
  position: relative;
  height: 1.3em;
  margin-bottom: calc(clamp(14px, 3.6vh, 30px) * -0.45);
  font-size: clamp(10px, 1.6vh, 13px);
  font-weight: 640;
  font-stretch: 112%;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  line-height: 1.3;
  color: var(--accento);
  text-align: center;
  min-width: 8em;
}

.modo-riga {
  position: absolute;
  inset: 0;
  display: block;
}

.modo-salvata { color: var(--nota); opacity: 0; }

/* the shutter */
.scatto {
  position: relative;
  width: clamp(44px, 8.4vh, 60px);
  aspect-ratio: 1;
  border: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.scatto:focus-visible { outline: 2px solid var(--accento); outline-offset: 4px; border-radius: 50%; }

.scatto-anello {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  transform: rotate(-90deg);
}

.anello-fondo { fill: none; stroke: var(--anello); stroke-width: 1.5; }

.anello-giro {
  fill: none;
  stroke: var(--accento);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-dasharray: 179.1 179.1;
  stroke-dashoffset: 179.1;
}

.scatto-disco {
  position: absolute;
  inset: 16%;
  border-radius: 50%;
  background: var(--inchiostro);
}

/* the thumbnail: a copy of the live view, with a white edge */
.miniatura {
  position: absolute;
  left: 0;
  top: 0;
  background: var(--carta);
  border-radius: var(--raggio);
  overflow: hidden;
  pointer-events: none;
  z-index: 3;
  box-shadow: 0 0 0 rgba(28, 27, 25, 0);
  will-change: transform;
}

.miniatura-foto {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.miniatura-foto .foto { border-radius: inherit; }

@media (hover: hover) {
  .scatto:hover .anello-fondo { stroke: #a9a399; }
}
