/* Our morning, from the oven to the window: the morning page of Pâtisserie Odile, a made-up pastry shop. Warm flour
   paper with a soft lamp light and a fine grain, brown-black ink, one caramel accent for the hour that is passing.
   In a tall section a stage stays still while you scroll: the frame of photos on the left, the rolling clock and its
   sentence on the right (under the frame on a phone). The shape of the frame and every moving part are written by
   the script. */
:root {
  --farina: #f3ece1;       /* the paper of the page, warm like flour */
  --lampada: #fdf8ef;      /* the soft lamp light on the paper */
  --inchiostro: #1d1611;   /* the words, the clock and the hours already gone */
  --tenue: #8d8173;        /* the small words */
  --sottile: #dcd1c1;      /* the empty scale and the hours still to come */
  --caramello: #b75a22;    /* the accent: the tip of the scale, the name of each moment */
  --filo: #ffe9c8;         /* the warm light on the edge of the photo coming in */
}

* {
  box-sizing: border-box;
}

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

body {
  background:
    radial-gradient(110% 80% at 85% -10%, var(--lampada) 0%, rgba(253, 248, 239, 0) 60%),
    radial-gradient(80% 60% at 0% 110%, rgba(183, 90, 34, 0.07), rgba(183, 90, 34, 0) 70%),
    var(--farina);
  background-attachment: fixed;
  color: var(--inchiostro);
  font-family: 'Mona Sans Variable', 'Mona Sans', 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* the fine grain over the whole page, so the paper is 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.47 0 0 0 0 0.4 0 0 0 0 0.31 0 0 0 0.35 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

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

/* ------------------------------------------------------------ the bar at the top */
.barra {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: clamp(12px, 3vh, 26px) clamp(16px, 4.4vw, 56px);
}

.marchio {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 15px;
  font-weight: 640;
  font-variation-settings: 'wdth' 104;
  letter-spacing: -0.015em;
  white-space: nowrap;
}

.marchio__segno {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.barra__voci {
  display: flex;
  gap: clamp(12px, 2.4vw, 30px);
  font-size: 13px;
  white-space: nowrap;
}

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

.barra__voci a[aria-current] {
  color: var(--inchiostro);
}

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

/* ------------------------------------------------------------ the opening */
.apertura {
  display: grid;
  align-content: center;
  gap: clamp(12px, 3vh, 22px);
  height: 100vh;
  height: 100lvh;
  padding: 64px clamp(16px, 5vw, 72px) 32px;
}

.piccolo {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 13px;
  font-weight: 500;
}

.piccolo--tenue {
  color: var(--tenue);
}

.giu {
  width: 10px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.titolo {
  margin: 0;
  max-width: 10em;
  font-size: clamp(40px, min(8vw, 12vh), 120px);
  font-weight: 340;
  font-variation-settings: 'wdth' 90;
  line-height: 0.96;
  letter-spacing: -0.035em;
}

.titolo em {
  font-style: normal;
  color: var(--tenue);
}

/* ------------------------------------------------------------ the stage */
.racconto {
  position: relative;
  height: 620vh;
}

.palco {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100lvh;
  overflow: hidden;
  display: grid;
  place-items: center;
  padding: clamp(56px, 11vh, 96px) clamp(16px, 4.4vw, 56px) clamp(16px, 5vh, 48px);
}

/* two columns on a computer: the frame, the clock and its words */
.scena {
  --bh: min(640px, calc(100vh - 190px));
  --bw: min(56vw, calc(var(--bh) * 1.62), 860px);
  display: grid;
  grid-template-columns: var(--bw) minmax(220px, 300px);
  align-items: center;
  gap: clamp(28px, 4.4vw, 72px);
}

/* ------------------------------------------------------------ the frame */
.cornice {
  position: relative;
  margin: 0;
  width: var(--bw);
  height: var(--bh);
}

/* the shadow on the paper and a hairline edge: drop-shadow on the parent follows the clipped shape of the child */
.cornice__ombra {
  position: absolute;
  inset: 0;
  filter:
    drop-shadow(0 0 0.6px rgba(40, 24, 10, 0.35))
    drop-shadow(0 2px 3px rgba(60, 34, 12, 0.12))
    drop-shadow(0 22px 26px rgba(60, 34, 12, 0.16));
}

.cornice__forma {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #2a1d12;
  clip-path: inset(50% 50% 50% 50%);
}

.scatto {
  position: absolute;
  inset: 0;
  overflow: hidden;
  visibility: hidden;
}

.scatto img {
  position: absolute;
  left: 0;
  top: -4%;
  width: 100%;
  height: 108%;
  display: block;
  object-fit: cover;
  will-change: transform;
}

.scatto:nth-child(1) img { object-position: 50% 55%; }
.scatto:nth-child(2) img { object-position: 62% 50%; }
.scatto:nth-child(3) img { object-position: 45% 50%; }
.scatto:nth-child(4) img { object-position: 50% 40%; }

/* a warm lamp glaze over every photo, lighter at the top, so the four read as one morning */
.cornice__forma::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255, 214, 160, 0.10), rgba(255, 214, 160, 0) 40%),
    linear-gradient(0deg, rgba(30, 16, 6, 0.22), rgba(30, 16, 6, 0) 30%);
  mix-blend-mode: soft-light;
}

/* the line of warm light riding on the top edge of the photo coming in */
.filo {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 1px;
  z-index: 7;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(90deg, rgba(255, 233, 200, 0), var(--filo) 20%, #ffffff 50%, var(--filo) 80%, rgba(255, 233, 200, 0));
  box-shadow: 0 0 10px 1px rgba(255, 196, 130, 0.6), 0 0 30px 3px rgba(255, 170, 90, 0.25);
}

/* the steam: four soft plumes rising from the trays, only where something is hot */
.vapore {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 18%;
  height: 70%;
  z-index: 5;
  pointer-events: none;
  opacity: 0;
  mix-blend-mode: screen;
}

.vapore i {
  position: absolute;
  bottom: 0;
  width: 17%;
  height: 92%;
  border-radius: 50%;
  background: radial-gradient(50% 50% at 50% 60%, rgba(255, 248, 238, 0.9), rgba(255, 246, 232, 0.4) 42%, rgba(255, 246, 232, 0) 72%);
  filter: blur(9px);
  opacity: 0;
  animation: sale 6.4s cubic-bezier(0.35, 0.1, 0.4, 1) infinite;
}

.vapore i:nth-child(1) { left: 14%; animation-delay: 0s; }
.vapore i:nth-child(2) { left: 36%; animation-delay: -1.6s; animation-duration: 7.2s; }
.vapore i:nth-child(3) { left: 56%; animation-delay: -3.3s; }
.vapore i:nth-child(4) { left: 72%; animation-delay: -4.8s; animation-duration: 5.8s; }

@keyframes sale {
  0% { transform: translate3d(0, 30%, 0) scale(0.6, 0.5); opacity: 0; }
  25% { opacity: 0.9; }
  55% { transform: translate3d(8%, -12%, 0) scale(0.9, 1) rotate(4deg); opacity: 0.7; }
  100% { transform: translate3d(-10%, -58%, 0) scale(1.35, 1.25) rotate(-6deg); opacity: 0; }
}

/* ------------------------------------------------------------ the clock and the words */
.testo {
  display: grid;
  align-content: center;
  gap: 14px;
}

.etichetta {
  margin: 0;
  font-size: 12px;
  font-weight: 560;
  letter-spacing: 0.02em;
  color: var(--caramello);
}

.ora {
  display: flex;
  align-items: baseline;
  margin: 0;
  font-size: clamp(56px, min(7.2vw, 12vh), 112px);
  font-weight: 280;
  font-variation-settings: 'wdth' 82;
  line-height: 1;
}

.rullo {
  display: block;
  width: 0.54em;
  height: 1em;
  overflow: hidden;
  text-align: center;
}

.striscia {
  display: block;
  will-change: transform;
}

.striscia span {
  display: block;
  height: 1em;
  line-height: 1;
}

.ora__punti {
  display: block;
  width: 0.24em;
  text-align: center;
  transform: translateY(-0.06em);
}

.ora__am {
  margin-left: 0.32em;
  font-size: 0.17em;
  font-weight: 520;
  font-variation-settings: 'wdth' 100;
  letter-spacing: 0.04em;
  color: var(--tenue);
}

/* the hours from four to eight on a thin scale, with a caramel tip */
.scala {
  position: relative;
  height: 22px;
  margin-right: 8px;
}

.scala__vuota,
.scala__piena {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 1px;
  transform-origin: 0 50%;
}

.scala__vuota {
  background: var(--sottile);
}

.scala__piena {
  background: var(--inchiostro);
  transform: scaleX(0);
}

.scala__punta {
  position: absolute;
  left: 0;
  top: -5px;
  width: 1.5px;
  height: 11px;
  margin-left: -0.75px;
  background: var(--caramello);
}

.scala span {
  position: absolute;
  top: 9px;
  font-size: 10.5px;
  font-weight: 520;
  color: var(--sottile);
  transform: translateX(-50%);
  transition: color 0.4s ease;
}

.scala span::before {
  content: '';
  position: absolute;
  left: 50%;
  top: -9px;
  width: 1px;
  height: 4px;
  background: currentColor;
}

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

.frasi {
  position: relative;
  min-height: 5.6em;
  font-size: clamp(15px, min(1.5vw, 2.5vh), 20px);
  line-height: 1.32;
  border-top: 1px solid var(--sottile);
  padding-top: 14px;
}

.frase {
  position: absolute;
  left: 0;
  right: 0;
  top: 14px;
  margin: 0;
  letter-spacing: -0.01em;
  visibility: hidden;
}

.frase b {
  font-weight: inherit;
  color: var(--caramello);
}

.parola {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
  padding-bottom: 0.08em;
  margin-bottom: -0.08em;
}

.parola > span {
  display: inline-block;
}

/* the end: open at eight, and the button */
.fine {
  position: absolute;
  left: 0;
  right: 0;
  top: 14px;
  display: grid;
  justify-items: start;
  gap: clamp(10px, 2vh, 18px);
  visibility: hidden;
}

.fine__titolo {
  margin: 0;
  font-size: 1.5em;
  font-weight: 420;
  font-variation-settings: 'wdth' 88;
  letter-spacing: -0.03em;
  line-height: 1;
}

.pulsante {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 20px;
  border-radius: 999px;
  color: var(--farina);
  font-size: 14px;
  font-weight: 560;
  text-decoration: none;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.pulsante__fondo {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, #2e241c, var(--inchiostro));
  box-shadow:
    inset 0 1px 0 rgba(255, 236, 210, 0.18),
    0 1px 2px rgba(29, 22, 17, 0.25),
    0 12px 24px -12px rgba(29, 22, 17, 0.7);
  transition: transform 0.55s cubic-bezier(0.34, 1.7, 0.5, 1);
}

.pulsante__testo {
  position: relative;
  font-variation-settings: 'wdth' 100;
  transition: font-variation-settings 0.55s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

@media (hover: hover) {
  .pulsante:hover .pulsante__fondo {
    transform: scale(1.05, 1.1);
  }

  .pulsante:hover .pulsante__testo {
    font-variation-settings: 'wdth' 116;
  }

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

.pulsante:active .pulsante__fondo {
  transform: scale(0.96);
  transition-duration: 0.12s;
}

/* ------------------------------------------------------------ narrower screens: the frame on top, the words under it */
@media (max-width: 900px) {
  .scena {
    --bw: min(100vw - 40px, 620px);
    --bh: min(calc(100vh - 215px), calc(var(--bw) * 1.1));
    grid-template-columns: var(--bw);
    row-gap: clamp(10px, 2.4vh, 22px);
  }

  .testo {
    grid-template-columns: auto 1fr;
    align-items: start;
    column-gap: clamp(12px, 3vw, 24px);
    row-gap: 6px;
  }

  .etichetta {
    grid-column: 1 / span 2;
  }

  .ora {
    grid-column: 1;
    font-size: clamp(32px, min(10vw, 8.4vh), 72px);
  }

  .scala {
    grid-column: 1;
    grid-row: 3;
    margin-right: 6px;
  }

  .frasi {
    grid-column: 2;
    grid-row: 2 / span 2;
    min-height: 4.6em;
    font-size: clamp(12.5px, min(2.6vw, 3.3vh), 17px);
    border-top: 0;
    border-left: 1px solid var(--sottile);
    padding: 0 0 0 clamp(10px, 2.4vw, 18px);
  }

  .frase,
  .fine {
    top: 0;
    left: clamp(10px, 2.4vw, 18px);
  }

  .fine {
    gap: 8px;
  }

  .fine__titolo {
    font-size: 1.45em;
  }

  .pulsante {
    padding: 10px 14px;
    gap: 7px;
    font-size: 12.5px;
  }
}

@media (max-height: 520px) {
  .etichetta {
    display: none;
  }
}

@media (max-width: 380px) {
  .barra__voci a:not([aria-current]) {
    display: none;
  }
}
