/* The guided breath with the petals that open on scroll. Colours in :root (the Playground palette): one accent, the
   sea green of the petals, the lit ticks and the active chapter; everything else is warm paper and ink.
   The flower is sized on width AND height (--d) so the whole page fits the phone box at every point of the scroll. */
:root {
  --fondo: #f3f1ec;          /* the page */
  --fondo-alto: #fbfaf7;     /* the soft light behind the flower */
  --inchiostro: #17191a;     /* the words */
  --tenue: #7b7d7a;          /* the quiet words */
  --linea: #dcd9d1;          /* hairlines and resting ticks */
  --accento: #2c7a6b;        /* the one accent: petals, lit ticks, the active chapter */
  --seme: #fdfcf9;           /* the pebble in the middle of the flower */
  --pillola: #17191a;        /* the session button */
  --pillola-testo: #f6f4ef;  /* the words on the button */
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--fondo);
  color: var(--inchiostro);
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.viaggio { position: relative; height: 700vh; }
.palco {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: clamp(12px, 3vh, 28px) clamp(16px, 4vw, 48px);
}
@supports (height: 100lvh) { .palco { height: 100lvh; } }

/* a broad soft light behind the flower and a whisper of grain on the paper */
.alone {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(min(70vw, 70vh) min(60vw, 60vh) at 50% 50%, var(--fondo-alto), transparent 72%);
}
.grana {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.32;
  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.43 0 0 0 0 0.4 0 0 0 0.16 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- the header ---------- */
.testa {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.marchio { display: inline-flex; align-items: center; gap: 7px; }
.marchio__segno {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--accento);
  stroke-width: 1.4;
  stroke-linecap: round;
}
.marchio__nome {
  font-size: 15px;
  font-weight: 640;
  font-variation-settings: 'wdth' 112;
  letter-spacing: -0.01em;
}
.testa__metodo {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--tenue);
  padding: 5px 10px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px var(--linea);
  background: rgba(255, 255, 255, 0.4);
}

/* ---------- the scene: on a phone the flower and then the chapters in a row ---------- */
.scena {
  --d: clamp(130px, min(80vw, calc(100vh - 226px)), 600px);
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 1fr auto;
  justify-items: center;
  align-items: center;
  gap: clamp(6px, 2vh, 18px);
  min-height: 0;
}
.fiore { grid-row: 1; position: relative; width: var(--d); height: var(--d); }
.capitoli { grid-row: 2; }
.lato { display: none; }

.fiore__svg { display: block; width: 100%; height: 100%; overflow: visible; }

/* the dial of hairline ticks: one every quarter of a second of the 19 */
.tacca { stroke: var(--linea); stroke-width: 1; stroke-linecap: round; vector-effect: non-scaling-stroke; transition: stroke 0.35s ease; }
.tacca--capo { stroke: #c4c0b6; }
.tacca.accesa { stroke: var(--accento); }
.tacca.ultima { stroke-width: 2.2; }
.guida { fill: none; stroke: var(--linea); stroke-width: 1; stroke-dasharray: 1.5 5; vector-effect: non-scaling-stroke; }
.guida--dentro { opacity: 0.8; }

.petalo {
  fill: url(#velo);
  stroke: var(--accento);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  stroke-linejoin: round;
}
.strato--0 .petalo { stroke-opacity: 0.62; }
.strato--1 .petalo { stroke-opacity: 0.44; }
.strato--2 .petalo { stroke-opacity: 0.3; }
.anello { fill: none; stroke: var(--accento); stroke-opacity: 0.22; stroke-width: 1; vector-effect: non-scaling-stroke; }
.onda { fill: none; stroke: var(--accento); stroke-width: 1; vector-effect: non-scaling-stroke; }

.seme__ombra { fill: rgba(40, 36, 28, 0.08); filter: blur(5px); }
.seme { fill: var(--seme); stroke: rgba(23, 25, 26, 0.08); stroke-width: 1; vector-effect: non-scaling-stroke; }

/* the word in the middle of the flower */
.parola {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}
.parola__fessura { display: block; overflow: hidden; padding: 0.2em 0.3em; }
.parola__testo {
  display: block;
  font-size: clamp(12px, calc(var(--d) * 0.06), 26px);
  font-weight: 560;
  font-variation-settings: 'wdth' 100;
  letter-spacing: 0.01em;
  color: var(--inchiostro);
  will-change: transform;
}

/* ---------- the three chapters ---------- */
.capitoli {
  list-style: none;
  margin: 0;
  padding: 0;
  width: min(100%, 520px);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(10px, 3vw, 22px);
}
.capitolo {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  column-gap: 6px;
  padding-bottom: 9px;
  color: var(--tenue);
  transition: color 0.4s ease;
}
.capitolo__nome { grid-column: 1 / -1; font-size: 11.5px; font-weight: 560; letter-spacing: 0.01em; }
.capitolo__conto { grid-column: 1 / -1; display: flex; align-items: baseline; gap: 2px; margin-top: 2px; }
.capitolo__fessura { display: inline-block; overflow: hidden; height: 1.08em; line-height: 1.08; font-size: clamp(22px, min(7vw, 6vh), 34px); }
.capitolo__cifra {
  display: inline-block;
  font-weight: 600;
  font-variation-settings: 'wdth' 92;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  color: #b9b6ad;
  transition: color 0.4s ease;
}
.capitolo__unita { font-size: 12px; font-weight: 500; }
.capitolo__riga { display: none; grid-column: 1 / -1; font-size: 12.5px; line-height: 1.4; margin-top: 4px; max-width: 22ch; }
.capitolo__filo {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--linea);
  overflow: hidden;
}
.capitolo__filo i { position: absolute; inset: 0; background: var(--accento); transform-origin: 0 50%; transform: scaleX(0); }
.capitolo.attivo { color: var(--inchiostro); }
.capitolo.attivo .capitolo__cifra { color: var(--accento); }
.capitolo.fatto .capitolo__cifra { color: var(--inchiostro); }

/* ---------- the foot: the hint first, then the session button ---------- */
.piede {
  position: relative;
  z-index: 3;
  display: grid;
  place-items: center;
  min-height: 48px;
  padding-top: clamp(4px, 1.4vh, 12px);
}
.invito, .pillola { grid-area: 1 / 1; }
.invito { margin: 0; font-size: 12px; color: var(--tenue); letter-spacing: 0.01em; }

.pillola {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 20px 0 22px;
  border-radius: 999px;
  color: var(--pillola-testo);
  text-decoration: none;
  opacity: 0;
  visibility: hidden;
  -webkit-tap-highlight-color: transparent;
  isolation: isolate;
}
.pillola__fondo {
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: var(--pillola);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.14) inset, 0 1px 2px rgba(20, 18, 14, 0.18), 0 8px 22px -8px rgba(20, 18, 14, 0.4);
  transition: transform 0.6s cubic-bezier(0.34, 1.7, 0.5, 1);
}
.pillola__parole {
  font-size: 14px;
  font-weight: 580;
  font-variation-settings: 'wdth' 100;
  transition: font-variation-settings 0.55s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.pillola__freccia {
  width: 15px;
  height: 15px;
  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);
}
.pillola:active .pillola__fondo { transform: scale(0.96); transition-duration: 0.12s; }
.pillola:focus-visible { outline: 2px solid var(--accento); outline-offset: 3px; }
@media (hover: hover) {
  .pillola:hover .pillola__parole { font-variation-settings: 'wdth' 114; }
  .pillola:hover .pillola__fondo { transform: scale(1.05, 1.1); }
  .pillola:hover .pillola__freccia { transform: translateX(2px); }
  .pillola:active .pillola__fondo { transform: scale(0.97); }
}

/* ---------- wide screens: the chapters on the left, the words on the right ---------- */
@media (min-width: 760px) and (min-aspect-ratio: 1 / 1) {
  .scena {
    --d: clamp(260px, min(44vw, calc(100vh - 170px)), 640px);
    grid-template-columns: minmax(0, 1fr) var(--d) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    gap: clamp(20px, 4vw, 64px);
  }
  .fiore { grid-row: 1; grid-column: 2; }
  .capitoli {
    grid-row: 1;
    grid-column: 1;
    justify-self: end;
    width: min(100%, 240px);
    grid-template-columns: minmax(0, 1fr);
    gap: clamp(14px, 3.6vh, 30px);
  }
  .capitolo { padding-bottom: 12px; }
  .capitolo__riga { display: block; }
  .lato { display: block; grid-row: 1; grid-column: 3; justify-self: start; max-width: 260px; }
  .lato__titolo {
    margin: 0;
    font-size: clamp(22px, min(2.6vw, 4.4vh), 38px);
    line-height: 1.04;
    font-weight: 620;
    font-variation-settings: 'wdth' 106;
    letter-spacing: -0.025em;
  }
  .lato__testo { margin: 14px 0 0; font-size: 13.5px; line-height: 1.5; color: var(--tenue); }
  .lato__dato { margin: 16px 0 0; padding-top: 12px; border-top: 1px solid var(--linea); font-size: 12px; color: var(--tenue); }
  .lato__dato b { color: var(--inchiostro); font-weight: 600; font-variant-numeric: tabular-nums; }
}
