/* Pill steps: a garden design studio's method in four steps. The section holds still while you scroll; at every
   step a drawing comes in from the right, two stars spin, and the pill of the step you are on stretches. */
:root {
  --paper: #f1eee4;         /* the page */
  --ink: #1f2a22;           /* text and the active pill */
  --muted: rgba(31, 42, 34, 0.6);
  --stage: #e3ead9;         /* the round behind the drawings */
  --fill: #2f6b4f;          /* the bar that fills inside the pills */
  --edge: clamp(18px, 3.2vw, 48px);
}

* {
  box-sizing: border-box;
}

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

body {
  background: var(--paper);
  color: var(--ink);
  font-family: 'Bricolage Grotesque Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

em {
  font-family: 'DM Serif Display', Georgia, serif;
  font-weight: 400;
}

.bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px var(--edge);
  font-size: 14px;
}

.brand {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.bar__nav {
  display: flex;
  gap: clamp(16px, 2.4vw, 34px);
}

.bar__nav a {
  transition: opacity 0.2s;
}

@media (hover: hover) {
  .bar__nav a:hover {
    opacity: 0.55;
  }
}

.bar a:focus-visible,
.pill:focus-visible,
.outro__link:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.intro,
.outro {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 110px var(--edge);
  text-align: center;
}

.intro__title,
.outro__title {
  max-width: 11em;
  margin: 0;
  font-size: clamp(44px, 7vw, 108px);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.045em;
}

.intro__hint {
  margin: 8px 0 0;
  font-size: 15px;
  color: var(--muted);
}

.outro__link {
  margin-top: 6px;
  padding: 12px 22px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 15px;
  font-weight: 600;
  transition: background-color 0.2s;
}

@media (hover: hover) {
  .outro__link:hover {
    background: #2f6b4f;
  }
}

/* ---------------------------------------------------------------- the steps */
.steps__inner {
  height: 100vh;
  height: 100lvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(24px, 5vw, 80px);
  padding: 90px var(--edge) 60px;
}

.copy {
  display: flex;
  flex-direction: column;
  gap: 22px;
  max-width: 560px;
}

.copy__kicker {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

/* the four texts stand on top of each other; the script shows one */
.copy__texts {
  display: grid;
}

.copy__text {
  grid-area: 1 / 1;
}

.copy__text h2 {
  margin: 0 0 16px;
  font-size: clamp(36px, 4.6vw, 70px);
  font-weight: 700;
  line-height: 0.98;
  letter-spacing: -0.04em;
}

.copy__text p {
  max-width: 30em;
  margin: 0;
  font-size: clamp(16px, 1.3vw, 19px);
  line-height: 1.45;
  color: var(--muted);
}

/* the pills: widths are set by the script (49% and 15%, as on the original) */
.pills {
  display: flex;
  gap: 8px;
  width: 100%;
  max-width: 520px;
}

.pill {
  position: relative;
  width: 15%;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(31, 42, 34, 0.12);
  color: var(--paper);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  cursor: pointer;
}

/* the bar inside the pill: it fills from the left while you scroll through that step, and stays full once you leave it */
.pill__fill {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--fill);
  transform: scaleX(0);
  transform-origin: left center;
}

.pill span {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  white-space: nowrap;
}

.pill.is-on {
  background: var(--ink);
}

/* the drawings stand in a round, on top of each other */
.stage {
  position: relative;
  width: min(100%, 560px);
  aspect-ratio: 1;
  justify-self: center;
}

.stage::before {
  content: '';
  position: absolute;
  inset: 6%;
  border-radius: 50%;
  background: var(--stage);
}

.art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.star {
  position: absolute;
  z-index: 1;
  width: 13%;
  height: 13%;
}

.star--a {
  top: 6%;
  right: 10%;
}

.star--b {
  bottom: 10%;
  left: 4%;
  width: 9%;
  height: 9%;
}

@media (max-width: 760px) {
  .bar__nav {
    display: none;
  }

  .steps__inner {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    align-items: start;
    gap: 14px;
    padding: 76px var(--edge) 28px;
  }

  .stage {
    grid-row: 1;
    width: min(76%, 46svh);
  }

  .copy {
    gap: 16px;
  }

  .copy__text h2 {
    font-size: 34px;
    margin-bottom: 10px;
  }

  .copy__text p {
    font-size: 15px;
  }

  .pill {
    height: 38px;
    font-size: 13px;
  }
}

/* schermi bassi (la casella dell'anteprima sul telefono, 341 per 410): il disegno più piccolo, i testi e le pillole
   più stretti, così il passo si vede tutto insieme */
@media (max-height: 520px) {
  .bar {
    padding-top: 14px;
    padding-bottom: 14px;
  }

  .steps__inner {
    padding-top: 60px;
    padding-bottom: 20px;
  }

  .stage {
    width: min(100%, 560px, calc(100vh - 150px));
  }

  .copy {
    gap: 12px;
  }

  .copy__text h2 {
    font-size: clamp(24px, 7vh, 36px);
    margin-bottom: 8px;
  }

  .copy__text p {
    font-size: 14px;
    line-height: 1.38;
  }
}

@media (max-width: 760px) and (max-height: 520px) {
  .steps__inner {
    gap: 10px;
  }

  .stage {
    width: min(76%, calc(100vh - 260px));
  }

  .copy {
    gap: 10px;
  }

  .copy__kicker {
    font-size: 11px;
  }

  .copy__text h2 {
    font-size: 24px;
    margin-bottom: 6px;
  }

  .copy__text p {
    font-size: 13px;
  }

  .pill {
    height: 30px;
    font-size: 12px;
  }
}
