/* The card that turns like a page
   A minimal component on white: the card of an evening concert printed like a programme page, with a soft
   dog-ear in the bottom right corner. The front, the flap and the inside are three layers of the same size: the
   script clips the front along the fold, reflects the flap across it and lays the shading along the fold line. */

:root {
  --fondo: #ffffff;
  --carta: #fbfaf7;           /* the front of the page */
  --retro: #f3f1ec;           /* the back of the paper, seen on the flap */
  --dentro: #f7f6f2;          /* the inside, under the page */
  --inchiostro: #1b1a18;
  --grigio: #8a8680;
  --filo: #e4e1da;
  --accento: #d4472b;         /* the only colour: the date and the button */
  --serif: 'Fraunces Variable', Georgia, serif;
  --sans: 'Instrument Sans Variable', system-ui, sans-serif;
}

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

html, body { height: 100%; }

body {
  background: var(--fondo);
  color: var(--inchiostro);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.stage {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 20px;
  overflow: hidden;
}

.card {
  position: relative;
  width: min(300px, 82vw);
  height: min(370px, 84vh, 124vw);
  /* the card itself has no paint: its three layers do */
}

/* ---------------------------------------------------------------- the three layers */
.inside,
.front,
.flap {
  position: absolute;
  inset: 0;
  border-radius: 3px;
}

.inside {
  background: var(--dentro);
  box-shadow: inset 0 0 0 1px var(--filo);
  padding: clamp(18px, 7%, 26px);
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 3.4vh, 16px);
  overflow: hidden;
}

.front {
  appearance: none;
  border: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  background: var(--carta);
  box-shadow: inset 0 0 0 1px var(--filo);
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

.front:focus-visible {
  box-shadow: inset 0 0 0 1px var(--filo), 0 0 0 2px var(--fondo), 0 0 0 3px var(--inchiostro);
}

/* the shadow of the page on the card it rests on, painted only where the card is still flat */
.card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 3px;
  box-shadow: 0 1px 1px rgba(27, 26, 24, 0.05), 0 12px 30px -14px rgba(27, 26, 24, 0.22);
  pointer-events: none;
}

.front__body {
  position: absolute;
  inset: 0;
  padding: clamp(18px, 7%, 26px);
  display: flex;
  flex-direction: column;
}

.label {
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--grigio);
  font-variation-settings: 'wdth' 104;
}

.sep { color: var(--filo); padding: 0 0.3em; }

.title {
  display: block;
  margin-top: auto;
  font-family: var(--serif);
  font-size: clamp(38px, min(15vw, 12vh), 56px);
  line-height: 0.94;
  letter-spacing: -0.02em;
  font-variation-settings: 'wght' 380, 'SOFT' 100, 'opsz' 72;
  will-change: font-variation-settings;
}

.rule {
  display: block;
  height: 1px;
  background: var(--inchiostro);
  margin: clamp(14px, 4vh, 20px) 0 12px;
  transform-origin: left center;
}

.meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 13px;
}

.date { color: var(--accento); font-variation-settings: 'wght' 560; }
.place { color: var(--grigio); }

.hint {
  margin-top: clamp(14px, 5vh, 26px);
  font-size: 11px;
  color: var(--grigio);
  letter-spacing: 0.02em;
}

/* shadows along the fold, positioned by the script */
.front__shade,
.inside__shade,
.flap__shade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
}

/* ---------------------------------------------------------------- the flap */
.flapwrap {
  position: absolute;
  inset: 0;
  pointer-events: none;
  /* the folded paper casts its shadow on the page under it */
  filter: drop-shadow(-2px 3px 4px rgba(27, 26, 24, 0.14)) drop-shadow(-6px 10px 14px rgba(27, 26, 24, 0.10));
}

.flap {
  background: var(--retro);
  transform-origin: 0 0;
  overflow: hidden;
}

/* the front print seen through the thin paper, mirrored by the fold */
.flap__ghost {
  position: absolute;
  inset: 0;
  padding: clamp(18px, 7%, 26px);
  display: flex;
  flex-direction: column;
  opacity: 0.07;
}

.flap__ghost .title { margin-top: auto; margin-bottom: 30%; }

/* ---------------------------------------------------------------- the inside */
.programme {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 2px;
}

.programme li {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--filo);
}

.who {
  font-family: var(--serif);
  font-size: clamp(19px, 3.4vh, 22px);
  font-variation-settings: 'wght' 420, 'SOFT' 60, 'opsz' 36;
}

.what { font-size: 12.5px; color: var(--grigio); }

.note { font-size: 12px; line-height: 1.45; color: var(--grigio); max-width: 26ch; }

.actions {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* the site's elastic pill: the background swells with a bounce and the word widens on its wdth axis */
.pill {
  position: relative;
  display: inline-grid;
  place-items: center;
  height: 40px;
  padding: 0 20px;
  color: #fff;
  text-decoration: none;
  font-size: 13.5px;
  -webkit-tap-highlight-color: transparent;
}

.pill__fondo {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--accento);
  transition: transform 0.5s cubic-bezier(0.34, 1.7, 0.5, 1);
}

.pill__testo {
  position: relative;
  font-variation-settings: 'wdth' 100, 'wght' 520;
  transition: font-variation-settings 0.45s cubic-bezier(0.34, 1.6, 0.5, 1);
}

.pill:active .pill__fondo { transform: scale(0.96); }

.back {
  appearance: none;
  border: 0;
  background: none;
  font: inherit;
  font-size: 12.5px;
  color: var(--grigio);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 2px;
  cursor: pointer;
}

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

.back:focus-visible, .pill:focus-visible { outline: 1px solid var(--inchiostro); outline-offset: 3px; border-radius: 999px; }

@media (hover: hover) {
  .pill:hover .pill__fondo { transform: scale(1.06, 1.12); }
  .pill:hover .pill__testo { font-variation-settings: 'wdth' 116, 'wght' 560; }
  .back:hover { color: var(--inchiostro); }
  .back:hover svg { transform: translateX(-3px); }
}
