/* The cloche button: a night-blue pill on a black page, with a silver cloche on its plate in the round left end. The
   plate, the breakfast and the cover are drawn by script.js in an SVG, the steam on a canvas over them (their colours
   come from here); the pill, the words and the states are CSS. */
:root {
  --page: #000000;          /* the page */
  --pill: #1f2a3f;          /* the pill, at its top */
  --pill-deep: #111827;     /* the pill, at its foot */
  --ink: #f4e8d0;           /* the words */
  --muted: #9aa6bd;         /* the small words */
  --gold: #d7b46a;          /* the price, and the thread of gold round the pill */
  --silver-light: #ffffff;  /* the cover, where the light falls */
  --silver: #b9c0c9;        /* the cover */
  --silver-dark: #3a4150;   /* the cover, where it mirrors the dark room */
  --china: #f3efe6;         /* the plate under the cover */
  --crust: #c9802f;         /* the croissant's crust */
  --crust-light: #f2c27a;   /* the croissant, where it is baked lightest */
  --warm: #ffc98a;          /* the warmth that slips out under the cover */
  --steam: #ffffff;         /* the steam */
  --focus: #d7b46a;         /* the ring of the keyboard's focus */
}

* {
  box-sizing: border-box;
}

/* a tap is a click at once: no wait for a double tap */
html {
  touch-action: manipulation;
}

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

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--ink);
  font-family: 'Fraunces Variable', 'Fraunces', Georgia, 'Times New Roman', serif;
  -webkit-font-smoothing: antialiased;
}

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

.stage {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 48px 16px;
}

.cloche {
  display: grid;
  justify-items: center;
}

/* the unit holds the pill and, over its left end, the room the lifted cover and the steam rise into */
.cloche__unit {
  position: relative;
  padding-top: 104px;
}

/* ---------------------------------------------------------------- the pill */
.cloche__btn {
  position: relative;
  display: block;
  /* the script sets the width from the widest words; this is the width before it does */
  width: 300px;
  max-width: calc(100vw - 32px);
  height: 60px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  isolation: isolate;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.cloche__btn[aria-disabled='true'] {
  cursor: progress;
}

/* the fill is a layer of its own, so it can swell past the pill with a bounce without moving anything */
.cloche__fill {
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background:
    radial-gradient(70% 120% at 12% 50%, rgba(255, 214, 160, 0.07), transparent 60%),
    linear-gradient(180deg, var(--pill), var(--pill-deep));
  box-shadow:
    inset 0 0 0 1px rgba(215, 180, 106, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 -1px 0 rgba(0, 0, 0, 0.5),
    0 18px 36px -18px rgba(120, 150, 210, 0.28);
  transition:
    inset 0.6s cubic-bezier(0.34, 1.9, 0.45, 1),
    box-shadow 0.4s ease;
}

.cloche__btn:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 5px;
}

html[data-using='pointer'] .cloche__btn:focus-visible {
  outline: none;
}

/* the cloche and the steam stand over the pill; the pointer goes through them */
.cloche__art,
.cloche__steam {
  position: absolute;
  pointer-events: none;
  overflow: visible;
}

.cloche__art {
  z-index: 1;
  left: -16px;
  bottom: -4px;
  width: 96px;
  height: 124px;
}

.cloche__steam {
  z-index: 2;
  left: -50px;
  bottom: 14px;
  width: 160px;
  height: 150px;
}

/* ---------------------------------------------------------------- the words */
/* three faces on top of each other, right of the cloche: at rest, while the order goes, and on its way */
.cloche__faces {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 68px;
  right: 0;
  pointer-events: none;
}

.cloche__face {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  /* as wide as the words, not as the pill is now: the script measures them to size the pill */
  width: max-content;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  white-space: nowrap;
}

.cloche__face--two {
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 4px;
}

[data-face='busy'],
[data-face='done'] {
  opacity: 0;
  visibility: hidden;
}

/* the words at rest grow heavier and softer under the pointer, on the typeface's weight and softness axes */
.cloche__word {
  font-size: 18px;
  font-weight: 520;
  font-variation-settings: 'opsz' 24, 'SOFT' 0, 'WONK' 0;
  letter-spacing: -0.01em;
  line-height: 1;
  padding-bottom: 1px;
  transition:
    font-weight 0.6s cubic-bezier(0.34, 1.9, 0.45, 1),
    font-variation-settings 0.6s cubic-bezier(0.34, 1.9, 0.45, 1),
    letter-spacing 0.6s cubic-bezier(0.34, 1.9, 0.45, 1);
}

.cloche__price {
  font-size: 15px;
  font-weight: 600;
  font-variation-settings: 'opsz' 14;
  font-variant-numeric: lining-nums tabular-nums;
  line-height: 1;
  color: var(--gold);
}

.cloche__small {
  font-size: 11.5px;
  font-weight: 500;
  font-variation-settings: 'opsz' 9;
  letter-spacing: 0.02em;
  line-height: 1;
  color: var(--muted);
  font-variant-numeric: lining-nums;
}

.cloche__big {
  font-size: 17px;
  font-weight: 560;
  font-variation-settings: 'opsz' 24, 'SOFT' 50;
  letter-spacing: -0.01em;
  line-height: 1.05;
  font-variant-numeric: lining-nums;
}

/* ---------------------------------------------------------------- under the pointer */
@media (hover: hover) and (pointer: fine) {
  .cloche__btn:not([aria-disabled='true']):hover .cloche__fill {
    inset: -2px -7px;
    box-shadow:
      inset 0 0 0 1px rgba(215, 180, 106, 0.4),
      inset 0 1px 0 rgba(255, 255, 255, 0.14),
      inset 0 -1px 0 rgba(0, 0, 0, 0.5),
      0 22px 40px -18px rgba(120, 150, 210, 0.36);
  }

  .cloche__btn:not([aria-disabled='true']):hover .cloche__word {
    font-weight: 640;
    font-variation-settings: 'opsz' 24, 'SOFT' 100, 'WONK' 1;
    letter-spacing: 0.004em;
  }
}

/* the keys bring the focus: the words change as under the pointer */
html[data-using='keys'] .cloche__btn:focus-visible:not([aria-disabled='true']) .cloche__word {
  font-weight: 640;
  font-variation-settings: 'opsz' 24, 'SOFT' 100, 'WONK' 1;
  letter-spacing: 0.004em;
}

/* ---------------------------------------------------------------- reduced motion: no swelling, no change of shape */
/* schermo stretto (la casella dell'anteprima sul telefono): la tela del vapore sporgeva 14 px oltre il bordo sinistro,
   vuota (il vapore sale sopra la campana); si accorcia da quel lato e lo script ne legge la misura */
@media (max-width: 380px) {
  .cloche__steam {
    left: -34px;
    width: 144px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cloche__fill,
  .cloche__word {
    transition: box-shadow 0.3s ease, filter 0.3s ease;
  }

  html[data-using='keys'] .cloche__btn:focus-visible:not([aria-disabled='true']) .cloche__word {
    font-weight: 520;
    font-variation-settings: 'opsz' 24, 'SOFT' 0, 'WONK' 0;
    letter-spacing: -0.01em;
  }
}

@media (prefers-reduced-motion: reduce) and (hover: hover) and (pointer: fine) {
  .cloche__btn:not([aria-disabled='true']):hover .cloche__fill {
    inset: 0;
    filter: brightness(1.25);
  }

  .cloche__btn:not([aria-disabled='true']):hover .cloche__word {
    font-weight: 520;
    font-variation-settings: 'opsz' 24, 'SOFT' 0, 'WONK' 0;
    letter-spacing: -0.01em;
  }
}
