/* The print rack that flips as you scroll: the shop window of Nettlefield Editions, a made-up print shop. A pale
   plaster wall under a raking light, a low rack in pale ash, prints on cotton mats drawn in SVG, ink navy for the
   words and one terracotta accent. The stage stays still in a tall section; every position, tilt and shadow of the
   prints is written by the script. */
:root {
  --parete: #ebe5db;        /* the plaster wall */
  --luce: #fbf7f0;          /* the raking light from the top left */
  --carta: #fbf8f2;         /* the cotton mat of the prints */
  --frassino: #e3d3bb;      /* the pale ash of the rack */
  --frassino-scuro: #c9b391;/* the ash in shadow */
  --inchiostro: #1d2433;    /* the words and the button */
  --tenue: #7f7769;         /* the small words */
  --accento: #c4532f;       /* terracotta: the price and the cart */
  --ombra: 46, 34, 20;      /* the colour of the shadows, as r, g, b */
  --h: min(44vh, 54vw, 420px); /* the height of a print: set on width and height so it fits the phone box */
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  overflow-x: clip;
}

body {
  background: var(--parete);
  color: var(--inchiostro);
  font-family: 'Mona Sans Variable', 'Mona Sans', 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.vetrina {
  position: relative;
  height: 560vh;
}

.palco {
  position: sticky;
  top: 0;
  display: grid;
  grid-template-rows: auto minmax(min-content, 1fr) auto auto minmax(0, 0.5fr);
  height: 100vh;
  height: 100lvh;
  padding: clamp(10px, 2.6vh, 26px) clamp(14px, 4vw, 48px) clamp(8px, 2vh, 20px);
  overflow: hidden;
}

/* an empty row under the card, so the rack and its card sit a little above the middle on tall screens */
.palco::after {
  content: '';
}

/* ------------------------------------------------------------ the wall and its light */
.parete {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0) 62%, rgba(var(--ombra), 0.07) 100%),
    var(--parete);
}

.parete__luce {
  position: absolute;
  left: -30%;
  top: -40%;
  width: 110%;
  height: 120%;
  background: radial-gradient(closest-side, var(--luce) 0%, rgba(251, 247, 240, 0.6) 45%, rgba(251, 247, 240, 0) 100%);
}

/* the raking beam: a soft slanted band of light across the plaster */
.parete__fascio {
  position: absolute;
  inset: -20%;
  background: linear-gradient(118deg, rgba(255, 255, 255, 0) 30%, rgba(255, 252, 245, 0.55) 42%, rgba(255, 255, 255, 0) 56%);
  mix-blend-mode: soft-light;
}

.parete__grana {
  position: absolute;
  inset: 0;
  opacity: 0.34;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.45 0 0 0 0 0.4 0 0 0 0 0.33 0 0 0 0.32 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ------------------------------------------------------------ the header */
.testa {
  position: relative;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.marchio {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: clamp(13px, 1.5vw, 16px);
  font-weight: 600;
  font-stretch: 112%;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.marchio em {
  font-family: 'Fraunces Variable', Georgia, serif;
  font-style: italic;
  font-weight: 400;
}

.marchio__segno {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linejoin: round;
}

.testa__voci {
  display: flex;
  align-items: center;
  gap: clamp(10px, 2.4vw, 28px);
  font-size: clamp(12px, 1.3vw, 14px);
}

.testa__voce {
  color: var(--tenue);
  text-decoration: none;
  transition: color 0.3s;
}

.testa__voce--qui {
  color: var(--inchiostro);
}

.carrello {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--inchiostro);
  text-decoration: none;
}

.carrello svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linejoin: round;
}

.carrello__conto {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  min-width: 1ch;
}

@media (hover: hover) {
  .testa__voce:hover {
    color: var(--inchiostro);
  }
}

/* ------------------------------------------------------------ the rack */
.espositore {
  position: relative;
  z-index: 2;
  display: grid;
  align-content: end;
  min-height: 0;
}

.mazzo {
  position: relative;
  height: calc(var(--h) * 1.3);
  perspective: calc(var(--h) * 4);
  perspective-origin: 50% 30%;
  overflow: hidden;
}

.stampa {
  position: absolute;
  left: 50%;
  bottom: calc(var(--h) * 0.06);
  width: calc(var(--h) * 5 / 7);
  height: var(--h);
  margin-left: calc(var(--h) * -5 / 14);
  transform-origin: 50% 100%;
  transform-style: preserve-3d;
  --lift: 0;
  --scuro: 0;
  will-change: transform;
}

.stampa__corpo {
  position: absolute;
  inset: 0;
  padding: 8% 8% 0;
  border-radius: 2px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0) 30%),
    var(--carta);
  transform-origin: 50% 100%;
  box-shadow:
    inset 0 0 0 1px rgba(var(--ombra), 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 1px 1px rgba(var(--ombra), 0.16),
    0 calc(4px + 18px * var(--lift)) calc(8px + 34px * var(--lift)) calc(-3px - 4px * var(--lift)) rgba(var(--ombra), calc(0.2 + 0.14 * var(--lift))),
    calc(10px * var(--lift)) calc(26px + 30px * var(--lift)) calc(30px + 50px * var(--lift)) calc(-10px) rgba(var(--ombra), calc(0.1 * var(--lift)));
}

/* the prints further back are a little in shadow */
.stampa__corpo::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: rgb(var(--ombra));
  opacity: var(--scuro);
  pointer-events: none;
}

.stampa__arte {
  display: block;
  width: 100%;
  height: auto;
  box-shadow: 0 0 0 1px rgba(var(--ombra), 0.08);
}

/* a pencil signature under the artwork */
.stampa__matita {
  position: absolute;
  right: 10%;
  bottom: 5.2%;
  width: 24%;
  height: 4%;
  background:
    linear-gradient(rgba(70, 66, 60, 0.5), rgba(70, 66, 60, 0.5)) 0 60% / 100% 1px no-repeat;
  transform: rotate(-2deg);
}

.stampa__matita::before {
  content: '';
  position: absolute;
  left: -220%;
  bottom: 22%;
  width: 52%;
  height: 1px;
  background: rgba(70, 66, 60, 0.35);
}

/* the light running across the surface as the print turns */
.stampa__lucido {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(105deg, rgba(255, 255, 255, 0) 38%, rgba(255, 255, 255, 0.42) 48%, rgba(255, 255, 255, 0.08) 54%, rgba(255, 255, 255, 0) 62%);
  background-size: 300% 100%;
  background-position: 50% 0;
  mix-blend-mode: soft-light;
}

/* the rack: a back board behind the prints and a front lip in pale ash, the prints standing between them */
.vassoio__fondo,
.vassoio__bordo {
  position: absolute;
  left: 50%;
  width: min(100%, calc(var(--h) * 2.9));
  transform: translateX(-50%);
  pointer-events: none;
}

.vassoio__fondo {
  bottom: calc(var(--h) * 0.1);
  height: calc(var(--h) * 0.12);
  z-index: 1;
  border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, var(--frassino-scuro), var(--frassino));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.vassoio__bordo {
  bottom: 0;
  height: calc(var(--h) * 0.17);
  z-index: 95;
  display: grid;
  place-items: center;
  border-radius: 3px;
  background:
    repeating-linear-gradient(92deg, rgba(var(--ombra), 0) 0 14px, rgba(var(--ombra), 0.035) 14px 15px, rgba(var(--ombra), 0) 15px 31px),
    linear-gradient(180deg, #efe3d0 0%, var(--frassino) 46%, #d6c3a5 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.85),
    inset 0 -1px 0 rgba(var(--ombra), 0.12),
    0 10px 18px -8px rgba(var(--ombra), 0.35),
    0 2px 3px rgba(var(--ombra), 0.12);
}

/* a small brass label holder on the front lip */
.vassoio__targa {
  padding: 0.25em 0.9em;
  border-radius: 2px;
  font-size: clamp(8px, calc(var(--h) * 0.038), 11px);
  font-style: normal;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #5b4626;
  background: linear-gradient(180deg, #e9cf98, #c9a35f);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 1px 1px rgba(var(--ombra), 0.25);
}

/* ------------------------------------------------------------ the card under the rack */
.scheda {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: min(100%, calc(var(--h) * 2.9));
  margin: clamp(10px, 2.4vh, 26px) auto 0;
  padding-top: clamp(10px, 2vh, 18px);
  border-top: 1px solid rgba(var(--ombra), 0.14);
}

.scheda__testi {
  min-width: 0;
}

.scheda__nome {
  margin: 0;
  font-family: 'Fraunces Variable', Georgia, serif;
  font-weight: 420;
  font-size: clamp(18px, min(4.2vh, 4.6vw), 34px);
  line-height: 1.1;
  letter-spacing: -0.015em;
  white-space: nowrap;
}

.scheda__dati {
  margin: 4px 0 0;
  font-size: clamp(11px, min(1.7vh, 2.6vw), 13px);
  color: var(--tenue);
  white-space: nowrap;
}

/* a line of text that rolls: the old words leave upwards, the new ones arrive from below */
.riga {
  display: inline-grid;
  overflow: hidden;
  vertical-align: bottom;
  padding-bottom: 0.08em;
}

.riga > span {
  grid-area: 1 / 1;
  display: inline-block;
  white-space: nowrap;
}

/* ------------------------------------------------------------ the button */
.compra {
  position: relative;
  flex: none;
  display: inline-flex;
  align-items: center;
  height: clamp(36px, 6vh, 48px);
  padding: 0 clamp(14px, 1.8vw, 22px);
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--carta);
  font: inherit;
  font-size: clamp(12px, min(1.8vh, 3.6vw), 15px);
  font-weight: 560;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.compra__fondo {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, #2b3448, var(--inchiostro));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    0 1px 2px rgba(var(--ombra), 0.3),
    0 8px 20px -8px rgba(var(--ombra), 0.55);
}

.compra__testo {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.8em;
  font-stretch: 100%;
  transition: font-stretch 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.compra__scritta {
  display: inline-grid;
  overflow: hidden;
  white-space: nowrap;
}

.compra__scritta > span {
  grid-area: 1 / 1;
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
}

.compra__fatto {
  opacity: 0;
}

.compra__fatto svg {
  width: 1.05em;
  height: 1.05em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.compra__prezzo {
  padding-left: 0.8em;
  border-left: 1px solid rgba(251, 248, 242, 0.24);
  color: #f0b79f;
  font-variant-numeric: tabular-nums;
}

@media (hover: hover) {
  .compra:hover .compra__testo {
    font-stretch: 112%;
  }
}

.compra:focus-visible {
  outline: 2px solid var(--accento);
  outline-offset: 3px;
}

/* the small copy that flies to the cart */
.volo {
  position: fixed;
  z-index: 40;
  pointer-events: none;
  padding: 3px 3px 0;
  border-radius: 1px;
  background: var(--carta);
  box-shadow: 0 6px 16px -4px rgba(var(--ombra), 0.4);
}

.volo svg {
  display: block;
  width: 100%;
  height: auto;
}

/* ------------------------------------------------------------ the hint */
.invito {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: clamp(6px, 1.6vh, 16px) 0 0;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--tenue);
}

.invito svg {
  width: 9px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (max-height: 460px) {
  .invito {
    display: none;
  }
}

/* narrow windows: the header keeps the mark and the cart, the details may wrap onto two lines */
@media (max-width: 520px) {
  .testa__voce,
  .carrello__parola {
    display: none;
  }

  .scheda {
    gap: 10px;
  }

  .scheda__dati .riga > span {
    white-space: normal;
  }

  .scheda__dati {
    white-space: normal;
    line-height: 1.3;
  }

  .compra {
    padding: 0 13px;
  }

  .compra__testo {
    gap: 0.6em;
  }

  .compra__prezzo {
    padding-left: 0.6em;
  }
}
