/* Wine list, with the photo changing on scroll: the wine page of Osteria Brina, a made-up restaurant. A warm night
   page, like a room lit by candles, with a fine grain; cream words, one champagne accent for the wine being poured.
   In a tall section a stage stays still while you scroll: five wines on the left, a large real photo on the right
   (on top on a phone). Every position in the stage is written by the script. */
:root {
  --notte: #120e0c;        /* the page, warm near-black */
  --legno: #1d1612;        /* the warmer light around the stage */
  --crema: #f2e8da;        /* the words */
  --tenue: #9b8c7d;        /* the small words */
  --sottile: rgba(242, 232, 218, 0.11); /* the hairlines between the wines */
  --accento: #dcae68;      /* champagne: the mark, the glass price, the label */
  --tinta: #d8b46a;        /* the colour of the wine being poured, for the glow behind the photo */
}

* {
  box-sizing: border-box;
}

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

body {
  background:
    radial-gradient(90% 70% at 85% 10%, rgba(120, 62, 36, 0.22) 0%, rgba(120, 62, 36, 0) 60%),
    radial-gradient(80% 60% at 0% 100%, rgba(60, 34, 22, 0.5) 0%, rgba(60, 34, 22, 0) 70%),
    var(--notte);
  background-attachment: fixed;
  color: var(--crema);
  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 night is never flat */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  opacity: 0.5;
  mix-blend-mode: soft-light;
  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.6 0 0 0 0 0.5 0 0 0 0 0.4 0 0 0 0.4 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ------------------------------------------------------------ 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;
  padding: clamp(10px, 3vh, 24px) clamp(16px, 4.4vw, 56px);
}

.marchio {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-family: 'Fraunces Variable', 'Fraunces', Georgia, serif;
  font-size: 17px;
  font-weight: 460;
  letter-spacing: -0.01em;
}

.marchio__segno {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--accento);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

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

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

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

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

.apertura--fine {
  justify-items: start;
}

.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: 11em;
  font-family: 'Fraunces Variable', 'Fraunces', Georgia, serif;
  font-size: clamp(38px, min(7.4vw, 11vh), 112px);
  font-weight: 340;
  line-height: 0.98;
  letter-spacing: -0.03em;
}

.titolo em {
  font-style: italic;
  font-weight: 300;
  color: var(--accento);
}

.titolo--medio {
  font-size: clamp(32px, min(5.6vw, 8.5vh), 80px);
}

.pulsante {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  border-radius: 999px;
  background: var(--crema);
  color: var(--notte);
  font-size: 14px;
  font-weight: 560;
  font-variation-settings: 'wdth' 100;
  text-decoration: none;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 12px 30px -12px rgba(220, 174, 104, 0.45);
  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: 14px;
  height: 14px;
  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);
}

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

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

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

/* ------------------------------------------------------------ the stage */
.carta {
  position: relative;
  height: 600vh;
}

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

/* two columns on a computer: the list, the photo */
.scena {
  --alto: min(640px, calc(100vh - 150px));
  --foto: min(500px, 40vw, calc(var(--alto) * 0.8));
  display: grid;
  grid-template-columns: minmax(260px, 440px) var(--foto);
  align-items: center;
  gap: clamp(28px, 5vw, 80px);
}

/* ------------------------------------------------------------ the list */
.lista {
  position: relative;
}

.lista__testa {
  display: flex;
  justify-content: space-between;
  align-items: end;
  padding: 0 0 12px 18px;
}

.etichetta {
  display: flex;
  gap: 10px;
  margin: 0;
  font-size: 12px;
  font-weight: 560;
  letter-spacing: 0.02em;
  color: var(--accento);
}

.etichetta span {
  font-weight: 450;
  color: var(--tenue);
}

.lista__colonne {
  display: flex;
  margin: 0;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--tenue);
}

.lista__colonne span,
.vino__prezzi span {
  width: 52px;
  text-align: right;
}

.vini {
  position: relative;
  z-index: 2;
  margin: 0;
  padding: 0;
  list-style: none;
  border-bottom: 1px solid var(--sottile);
}

.vino {
  border-top: 1px solid var(--sottile);
}

.vino__tasto {
  display: grid;
  width: 100%;
  padding: clamp(9px, 1.7vh, 15px) 0 clamp(9px, 1.7vh, 15px) 18px;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  opacity: 0.4;
  transition: opacity 0.5s ease;
  -webkit-tap-highlight-color: transparent;
}

.vino.attivo .vino__tasto {
  opacity: 1;
}

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

.vino__nome {
  font-family: 'Fraunces Variable', 'Fraunces', Georgia, serif;
  font-size: clamp(19px, min(2.2vw, 3.4vh), 28px);
  font-weight: 360;
  line-height: 1.1;
  letter-spacing: -0.015em;
  white-space: nowrap;
  transition: font-weight 0.6s cubic-bezier(0.22, 1, 0.36, 1), letter-spacing 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.vino.attivo .vino__nome {
  font-weight: 470;
  letter-spacing: -0.02em;
}

.vino__prezzi {
  display: flex;
  flex: none;
  font-size: 13px;
  font-weight: 500;
}

.vino__prezzi span:first-child {
  transition: color 0.5s ease;
}

.vino.attivo .vino__prezzi span:first-child {
  color: var(--accento);
}

.vino__dove {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 5px;
  font-size: 12px;
  color: var(--tenue);
}

/* a short upright hairline between the cellar, the region and the year */
.vino__dove i {
  width: 1px;
  height: 9px;
  background: currentColor;
  opacity: 0.45;
}

/* the tasting note opens only under the wine being poured */
.vino__piu {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.vino__note {
  min-height: 0;
  overflow: hidden;
  max-width: 34em;
  font-family: 'Fraunces Variable', 'Fraunces', Georgia, serif;
  font-style: italic;
  font-size: clamp(13px, min(1.2vw, 2vh), 15px);
  font-weight: 340;
  line-height: 1.4;
  color: rgba(242, 232, 218, 0.78);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.4s ease, transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.vino.attivo .vino__piu {
  grid-template-rows: 1fr;
}

.vino.attivo .vino__note {
  padding-top: 8px;
  opacity: 1;
  transform: none;
  transition-delay: 0.12s;
}

@media (hover: hover) {
  .vino:not(.attivo) .vino__tasto:hover {
    opacity: 0.72;
  }
}

.vino__tasto:focus-visible {
  outline: 1px solid var(--accento);
  outline-offset: 2px;
  border-radius: 6px;
}

/* the thin mark that follows the wine being poured, on a spring */
.segno {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 3;
  width: 2px;
  height: 40px;
  border-radius: 2px;
  background: var(--accento);
  transform-origin: 50% 0;
  pointer-events: none;
}

/* a short glint that runs down the mark when it arrives */
.segno__luce {
  position: absolute;
  left: -1px;
  top: 0;
  width: 4px;
  height: 30%;
  border-radius: 4px;
  background: linear-gradient(180deg, rgba(255, 246, 228, 0), #fff6e4, rgba(255, 246, 228, 0));
  filter: blur(0.5px);
  opacity: 0;
}

/* a faint plate of light behind the wine being poured */
.piatto {
  position: absolute;
  left: 0;
  right: -10px;
  top: 0;
  z-index: 1;
  height: 40px;
  border-radius: 0 10px 10px 0;
  background: linear-gradient(90deg, rgba(220, 174, 104, 0.1), rgba(220, 174, 104, 0.025) 55%, rgba(220, 174, 104, 0));
  box-shadow: inset 0 1px 0 rgba(255, 240, 215, 0.05);
  pointer-events: none;
}

/* ------------------------------------------------------------ the photo */
.foto {
  position: relative;
  margin: 0;
  width: var(--foto);
}

/* the glow behind the frame, in the colour of the wine */
.foto__alone {
  position: absolute;
  inset: -18% -22%;
  z-index: 0;
  background: radial-gradient(50% 50% at 50% 55%, var(--tinta), rgba(0, 0, 0, 0) 70%);
  opacity: 0.2;
  filter: blur(20px);
  pointer-events: none;
}

.foto__ombra {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: 16px;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.4),
    0 18px 36px -14px rgba(0, 0, 0, 0.65),
    0 60px 90px -40px rgba(0, 0, 0, 0.8);
}

.foto__cornice {
  position: relative;
  z-index: 2;
  width: 100%;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border-radius: 16px;
  background: #1a1410;
}

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

.scatto img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transform-origin: 50% 60%;
}

/* the edge of the rising curtain: a hairline of warm light with a soft spill under it */
.tenda {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 6;
  width: 100%;
  height: 1px;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(90deg, rgba(255, 236, 205, 0.1), #fff3e0 30%, #ffffff 50%, #fff3e0 70%, rgba(255, 236, 205, 0.1));
  box-shadow: 0 0 12px 1px rgba(255, 196, 120, 0.5), 0 0 34px 3px rgba(255, 170, 90, 0.18);
}

.tenda::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 1px;
  height: 70px;
  background: linear-gradient(180deg, rgba(255, 214, 160, 0.16), rgba(255, 214, 160, 0));
}

/* film grain over the photos, tiled from a small canvas the script paints once, moving a little */
.grana {
  position: absolute;
  inset: -40px;
  z-index: 7;
  pointer-events: none;
  background-image: var(--grana, none);
  background-size: 160px 160px;
  mix-blend-mode: overlay;
  opacity: 0.22;
}

/* the hairline of light on the frame, and a soft sheen from the top left */
.foto__riflesso {
  position: absolute;
  inset: 0;
  z-index: 8;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(140deg, rgba(255, 244, 228, 0.08), rgba(255, 244, 228, 0) 38%);
  box-shadow: inset 0 0 0 1px rgba(255, 238, 215, 0.13), inset 0 1px 0 rgba(255, 244, 228, 0.22);
}

/* ------------------------------------------------------------ the glass label on the photo */
.vetro {
  position: absolute;
  left: 14px;
  bottom: 14px;
  z-index: 9;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: calc(100% - 28px);
  padding: 10px 16px 11px;
  border-radius: 12px;
  background: linear-gradient(160deg, rgba(40, 30, 23, 0.62), rgba(18, 13, 10, 0.58));
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  backdrop-filter: blur(14px) saturate(150%);
  border: 1px solid rgba(255, 238, 215, 0.16);
  box-shadow:
    inset 0 1px 0 rgba(255, 246, 232, 0.16),
    0 10px 30px -12px rgba(0, 0, 0, 0.6);
}

.vetro__campo {
  display: grid;
  gap: 3px;
}

.vetro__nome {
  font-size: 9.5px;
  font-weight: 560;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(242, 232, 218, 0.6);
}

/* each value sits in a window one line tall and rolls when the wine changes */
.vetro__valore {
  position: relative;
  display: block;
  height: 1.25em;
  overflow: hidden;
  font-size: 14px;
  font-weight: 560;
  font-variation-settings: 'wdth' 104;
  line-height: 1.25;
  white-space: nowrap;
  color: var(--crema);
}

.vetro__valore span {
  display: block;
}

.vetro__valore span + span {
  position: absolute;
  left: 0;
  top: 0;
}

.vetro__riga {
  align-self: stretch;
  width: 1px;
  background: rgba(255, 238, 215, 0.16);
}

/* ------------------------------------------------------------ middle widths: the list gets narrower */
@media (max-width: 900px) and (min-width: 641px) {
  .scena {
    grid-template-columns: minmax(240px, 1fr) var(--foto);
    gap: 28px;
  }

  .vino__dove {
    font-size: 11px;
  }

  .vetro__campo--largo,
  .vetro__riga--largo {
    display: none;
  }
}

/* ------------------------------------------------------------ a phone: the photo on top, the list under it */
@media (max-width: 640px) {
  .barra {
    padding: 10px 14px;
  }

  .marchio {
    font-size: 15px;
  }

  .barra__voci {
    font-size: 12px;
  }

  .palco {
    padding: 44px 14px 10px;
    align-items: start;
  }

  .scena {
    display: flex;
    flex-direction: column;
    gap: min(12px, 2.4vh);
    width: 100%;
  }

  .foto {
    order: -1;
    width: 100%;
  }

  .foto__cornice {
    aspect-ratio: auto;
    height: min(29vh, 60vw);
    border-radius: 12px;
  }

  .foto__ombra {
    border-radius: 12px;
  }

  .lista {
    width: 100%;
  }

  .lista__testa {
    display: none;
  }

  .vino__tasto {
    padding: min(7px, 1.4vh) 0 min(7px, 1.4vh) 12px;
  }

  .vino__nome {
    font-size: min(17px, 4.6vw);
  }

  .vino__prezzi {
    font-size: 11.5px;
  }

  .lista__colonne span,
  .vino__prezzi span {
    width: 40px;
  }

  /* on a phone the cellar line also opens only under the wine being poured */
  .vino__dove {
    gap: 6px;
    max-height: 16px;
    margin-top: 2px;
    overflow: hidden;
    font-size: 10.5px;
    transition: max-height 0.6s cubic-bezier(0.22, 1, 0.36, 1), margin-top 0.6s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.4s ease;
  }

  .vino:not(.attivo) .vino__dove {
    max-height: 0;
    margin-top: 0;
    opacity: 0;
  }

  .vino__note {
    font-size: 12px;
    line-height: 1.32;
  }

  .vino.attivo .vino__note {
    padding-top: 4px;
  }

  .vetro {
    left: 8px;
    bottom: 8px;
    gap: 10px;
    padding: 6px 10px 7px;
    border-radius: 9px;
  }

  .vetro__nome {
    font-size: 8px;
  }

  .vetro__valore {
    font-size: 12px;
  }

  .vetro__campo--largo,
  .vetro__riga--largo {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .vino__tasto,
  .vino__nome,
  .vino__piu,
  .vino__note {
    transition-duration: 0.01s;
  }

  .vino.attivo .vino__note {
    transition: opacity 0.4s ease;
  }
}
