/* The collection lookbook, its pages turning as you scroll: the Autumn lookbook of Atelier Oska, a made-up house of
   ceramics and furniture. Warm paper on a warm table, black ink, one terracotta accent (the ribbon and the index).
   The stage stays still in a tall section; the book lies open in the middle and the script turns its leaves with
   the scroll. Every position of a leaf, of a shadow and of the index is written by the script. */
:root {
  --tavolo: #ece5da;       /* the table the book lies on */
  --luce: #f8f3ea;         /* the window light on the table */
  --carta: #fbf8f2;        /* the paper of the pages */
  --carta-ombra: #e9e1d4;  /* the paper near the spine */
  --taglio: #ddd3c3;       /* the edges of the pages under the book */
  --inchiostro: #1b1712;   /* the words */
  --tenue: #8a8173;        /* the small words */
  --sottile: #d9d0c2;      /* the thin rules */
  --accento: #b4532d;      /* terracotta: the ribbon and the index */
  --ombra: 38, 26, 14;     /* the colour of the shadows, as r, g, b */
}

* {
  box-sizing: border-box;
}

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

body {
  background:
    radial-gradient(90% 70% at 18% 0%, var(--luce) 0%, rgba(248, 243, 234, 0) 64%),
    radial-gradient(70% 60% at 100% 100%, rgba(180, 83, 45, 0.05), rgba(180, 83, 45, 0) 70%),
    var(--tavolo);
  background-attachment: fixed;
  color: var(--inchiostro);
  font-family: 'Mona Sans Variable', 'Mona Sans', 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* a fine grain over everything, so the table and the paper are never flat */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  opacity: 0.3;
  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.9' 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.35 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ------------------------------------------------------------ the stage */
.lookbook {
  position: relative;
  height: 420vh;
}

.palco {
  position: sticky;
  top: 0;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  height: 100vh;
  height: 100lvh;
  padding: clamp(10px, 2.6vh, 26px) clamp(14px, 4vw, 52px) clamp(8px, 2.2vh, 22px);
  overflow: hidden;
}

.testata {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.marchio {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: clamp(13px, 1.6vw, 16px);
  font-weight: 650;
  font-variation-settings: 'wdth' 110;
  letter-spacing: -0.015em;
}

.marchio__segno {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  transform: translateY(1px);
}

.stagione {
  margin: 0;
  font-size: clamp(11px, 1.3vw, 13px);
  color: var(--tenue);
  font-variation-settings: 'wdth' 96;
}

.stagione em {
  font-family: 'Fraunces Variable', 'Fraunces', Georgia, serif;
  font-style: italic;
  font-size: 1.12em;
  color: var(--inchiostro);
  font-variation-settings: 'opsz' 14, 'SOFT' 50;
}

.tavolo {
  display: grid;
  place-items: center;
  min-height: 0;
}

.scena {
  position: relative;
  --l: min(960px, 92vw, calc((100vh - 150px) * 1.5));
  width: var(--l);
}

/* ------------------------------------------------------------ the book */
.libro {
  position: relative;
  width: var(--l);
  height: calc(var(--l) / 1.5);
  perspective: calc(var(--l) * 3.2);
  perspective-origin: 50% 42%;
  container-type: inline-size;
  z-index: 1;
}

/* the soft shadow of the book on the table, wider than the book and very faint at its edges */
.appoggio {
  position: absolute;
  left: -2%;
  right: -2%;
  top: 4%;
  bottom: -5%;
  z-index: 0;
  border-radius: 8px;
  background: radial-gradient(60% 55% at 50% 58%, rgba(var(--ombra), 0.26), rgba(var(--ombra), 0) 72%);
  filter: blur(14px);
  pointer-events: none;
}

/* the page edges under the book: a stack that grows on the left and thins on the right as pages are turned */
.pila {
  position: absolute;
  top: 1.2%;
  bottom: -1.2%;
  width: 50%;
  border-radius: 2px;
  background: repeating-linear-gradient(to bottom, var(--carta) 0 1px, var(--taglio) 1px 2px);
  box-shadow: 0 1px 2px rgba(var(--ombra), 0.16), 0 10px 26px rgba(var(--ombra), 0.12);
}

.pila--s {
  right: 50%;
  transform: translateX(calc(var(--spessore, 3px) * -1));
  background: repeating-linear-gradient(to right, var(--carta) 0 1px, var(--taglio) 1px 2px);
}

.pila--d {
  left: 50%;
  transform: translateX(var(--spessore, 3px));
  background: repeating-linear-gradient(to left, var(--carta) 0 1px, var(--taglio) 1px 2px);
}

/* a page: the paper, a little darker towards the spine, with a hairline that catches the light on its top edge */
.faccia {
  position: absolute;
  top: 0;
  width: 50%;
  height: 100%;
  overflow: hidden;
  background-color: var(--carta);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  display: flex;
  flex-direction: column;
}

.faccia--s {
  left: 0;
  padding: 3.3cqw 3.6cqw 2.3cqw;
  border-radius: 3px 1px 1px 3px;
  background-image:
    linear-gradient(to left, rgba(var(--ombra), 0.16) 0%, rgba(var(--ombra), 0.05) 5%, rgba(var(--ombra), 0) 14%),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0) 1.5%);
}

.faccia--d {
  left: 50%;
  padding: 4.4cqw 4.8cqw 2.3cqw;
  border-radius: 1px 3px 3px 1px;
  background-image:
    linear-gradient(to right, rgba(var(--ombra), 0.16) 0%, rgba(var(--ombra), 0.05) 5%, rgba(var(--ombra), 0) 14%),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0) 1.5%);
}

/* a leaf: the right page on its front, the next left page on its back, turning on the spine */
.foglio {
  position: absolute;
  top: 0;
  left: 50%;
  width: 50%;
  height: 100%;
  transform-origin: 0 50%;
  transform-style: preserve-3d;
}

.foglio > .faccia {
  left: 0;
  width: 100%;
}

.foglio > .faccia--s {
  transform: rotateY(180deg);
}

/* the light and the shadows written by the script: on every page, the shade of the leaf passing over it */
.getto,
.lucido {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
}

.lucido {
  mix-blend-mode: soft-light;
}

/* ------------------------------------------------------------ what is printed on the pages */
.foto {
  position: relative;
  flex: 1;
  margin: 0;
  min-height: 0;
  overflow: hidden;
  border-radius: 1px;
  background: var(--carta-ombra);
}

.foto img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform-origin: 50% 60%;
}

/* the photo is printed on the paper: a breath of grain and a thin inner line */
.foto::after {
  content: '';
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 0 1px rgba(var(--ombra), 0.08);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.1' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
  opacity: 0.35;
}

.piede {
  display: flex;
  gap: 0.5em;
  margin: 0;
  padding-top: 2.1cqw;
  font-size: max(7px, 0.86cqw);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-variation-settings: 'wdth' 112;
  color: var(--inchiostro);
}

.piede span {
  color: var(--tenue);
}

.piede--d {
  justify-content: flex-end;
}

.sezione {
  margin: 0 0 0.9em;
  font-size: max(7.5px, 0.95cqw);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accento);
  font-weight: 560;
  font-variation-settings: 'wdth' 118;
}

.pezzo {
  margin: 0 0 0.32em;
  font-family: 'Fraunces Variable', 'Fraunces', Georgia, serif;
  font-weight: 340;
  font-size: max(16px, 3.9cqw);
  line-height: 1;
  letter-spacing: -0.02em;
  font-variation-settings: 'opsz' 96, 'SOFT' 60, 'WONK' 0;
}

.frase {
  margin: 0;
  max-width: 22em;
  font-size: max(8.5px, 1.3cqw);
  line-height: 1.45;
  color: var(--tenue);
  font-variation-settings: 'wdth' 96;
}

.dati {
  margin: auto 0 0;
  padding-top: 0.6em;
  font-size: max(8px, 1.05cqw);
}

.dati div {
  display: flex;
  justify-content: space-between;
  gap: 1em;
  padding: 0.55em 0;
  border-top: 1px solid var(--sottile);
}

.dati dt {
  color: var(--tenue);
  font-variation-settings: 'wdth' 100;
}

.dati dd {
  margin: 0;
  text-align: right;
  font-weight: 520;
  font-variation-settings: 'wdth' 104;
}

.dati div:last-child dd {
  font-weight: 640;
}

.vedi {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  margin-top: 1.1em;
  align-self: flex-start;
  font-size: max(8px, 1.02cqw);
  font-weight: 600;
  color: var(--inchiostro);
  text-decoration: none;
  font-variation-settings: 'wdth' 100;
  transition: font-variation-settings 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.3s ease;
}

.vedi svg {
  width: 1.1em;
  height: 1.1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.vedi:active svg {
  transform: translateX(1px) scale(0.92);
}

@media (hover: hover) {
  .vedi:hover {
    color: var(--accento);
    font-variation-settings: 'wdth' 116;
  }

  .vedi:hover svg {
    transform: translateX(3px);
  }
}

/* on a small book the sentence and the link step aside, so the name, the material and the price stay large enough */
@container (max-width: 520px) {
  .frase,
  .vedi {
    display: none;
  }

  .sezione {
    margin-bottom: 0.7em;
  }
}

/* ------------------------------------------------------------ the ribbon, hanging from the spine */
.nastro {
  position: absolute;
  left: 50%;
  top: calc(100% - 3px);
  z-index: 5;
  width: max(5px, 1.1cqw);
  height: max(16px, 4.4cqw);
  margin-left: max(-2.5px, -0.55cqw);
  transform-origin: 50% 0;
  pointer-events: none;
}

.nastro i {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  background: linear-gradient(to right, #9a4425, var(--accento) 45%, #c86a43 60%, #9a4425);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 78%, 0 100%);
  filter: drop-shadow(0 1px 1px rgba(var(--ombra), 0.25));
}

/* ------------------------------------------------------------ the index of the sections */
.indice {
  position: relative;
  z-index: 3;
  justify-self: center;
  display: flex;
  gap: 2px;
  margin-top: clamp(8px, 2.4vh, 22px);
  padding: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.4);
  box-shadow: inset 0 0 0 1px rgba(var(--ombra), 0.08), 0 1px 0 rgba(255, 255, 255, 0.7);
}

.indice button {
  position: relative;
  z-index: 1;
  padding: clamp(5px, 1vh, 8px) clamp(9px, 1.6vw, 16px);
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--tenue);
  font: inherit;
  font-size: clamp(11px, 1.3vw, 13px);
  font-variation-settings: 'wdth' 100;
  cursor: pointer;
  transition: color 0.35s ease, font-variation-settings 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.indice button.ora {
  color: var(--inchiostro);
  font-variation-settings: 'wdth' 112;
}

.indice button:focus-visible {
  outline: 1.5px solid var(--accento);
  outline-offset: 1px;
}

.indice button:active {
  transform: scale(0.96);
}

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

/* the soft pill that follows the turning pages on a spring, with a thin terracotta line at its foot */
.indice__molla {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 0;
  width: 60px;
  border-radius: 999px;
  background: linear-gradient(to bottom, #fffdf9, #f6f0e6);
  box-shadow:
    0 0 0 1px rgba(var(--ombra), 0.08),
    0 1px 2px rgba(var(--ombra), 0.1),
    0 6px 16px -6px rgba(var(--ombra), 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.indice__molla::after {
  content: '';
  position: absolute;
  left: 32%;
  right: 32%;
  bottom: 3px;
  height: 1.5px;
  border-radius: 2px;
  background: var(--accento);
}

.suggerimento {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin: clamp(6px, 1.4vh, 12px) 0 0;
  font-size: 11px;
  color: var(--tenue);
}

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

.doppie {
  display: none;
}

/* ------------------------------------------------------------ the end of the page */
.fine {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: clamp(10px, 2.4vh, 20px);
  height: 70vh;
  padding: 0 20px;
  text-align: center;
}

.fine__piccolo {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--tenue);
  font-variation-settings: 'wdth' 112;
}

.fine__titolo {
  margin: 0;
  font-family: 'Fraunces Variable', 'Fraunces', Georgia, serif;
  font-weight: 340;
  font-size: clamp(26px, min(6vw, 8vh), 64px);
  line-height: 1.02;
  letter-spacing: -0.025em;
  font-variation-settings: 'opsz' 120, 'SOFT' 60;
}

.fine__titolo em {
  display: block;
  font-style: italic;
  color: var(--accento);
}

.pulsante {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 22px;
  border-radius: 999px;
  background: var(--inchiostro);
  color: var(--carta);
  font-size: 14px;
  font-weight: 560;
  text-decoration: none;
  font-variation-settings: 'wdth' 100;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.2) inset, 0 8px 22px -10px rgba(var(--ombra), 0.6);
  transition: font-variation-settings 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.pulsante svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.pulsante:active {
  transform: scale(0.97);
}

@media (hover: hover) {
  .pulsante:hover {
    font-variation-settings: 'wdth' 118;
    transform: scale(1.03);
  }

  .pulsante:hover svg {
    transform: translateX(3px);
  }
}
