/* The toaster button: a jam-red pill on a white page, with a mint enamel toaster standing in its round left end. The
   toaster is an inline SVG (its colours come from here); the pill, the words and the timer are CSS. */
:root {
  --page: #ffffff;          /* the page */
  --jam: #d8432f;           /* the jam red of the pill and the dial's hand */
  --jam-deep: #9c2a1c;      /* the red in its shadow */
  --cream: #fff4e0;         /* the words */
  --butter: #f6b73c;        /* the timer that fills the pill while it toasts */
  --mint: #7fcdbb;          /* the enamel of the toaster */
  --mint-light: #b9eadd;    /* the enamel where the light falls */
  --mint-deep: #3f9584;     /* the enamel in its shadow */
  --chrome: #d7dee3;        /* the chrome of the top and the band */
  --chrome-light: #f7fafb;  /* the chrome where the light falls */
  --chrome-dark: #8a979f;   /* the chrome in its shadow */
  --ink: #2a1f1a;           /* the slots, the feet, the knob */
  --slot: #4a2b1c;          /* the bottom of the slots */
  --glow: #f2702a;          /* the heat in the slots */
  --glow-hot: #ffc25a;      /* the hottest part of the coils */
  --bread: #f1dcae;         /* the bread */
  --bread-light: #fff1d2;   /* the bread where the light falls */
  --crust: #d9a565;         /* the crust of the fresh bread */
  --toast: #c47a35;         /* the toast */
  --toast-light: #e2a75e;   /* the toast in the middle */
  --toast-deep: #7f4319;    /* the toasted crust */
  --focus: #2a1f1a;         /* the ring of the keyboard's focus */
}

* {
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

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

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--ink);
  font-family: 'Mona Sans Variable', 'Mona Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

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

/* the whole thing: the toaster stands at the left, its feet on the line of the pill's foot */
.tb {
  position: relative;
  width: 308px;
  max-width: calc(100vw - 32px);
  height: 170px;
}

/* the toaster sits over the left end of the pill; it takes no pointer, the click goes to the button under it */
.tb__art {
  position: absolute;
  left: 0;
  bottom: 0;
  z-index: 3;
  display: block;
  overflow: visible;
  pointer-events: none;
}

.tb__brand {
  font: 760 5.6px/1 'Mona Sans Variable', system-ui, sans-serif;
  font-stretch: 125%;
  letter-spacing: 0.24em;
  fill: var(--mint-deep);
}

/* ---------------------------------------------------------------- the pill */
.tb__btn {
  position: absolute;
  left: 58px;
  right: 0;
  bottom: 0;
  z-index: 2;
  display: block;
  height: 60px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--cream);
  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;
}

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

.tb__fill {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  border-radius: inherit;
  background:
    radial-gradient(70% 150% at 40% 0%, rgba(255, 255, 255, 0.18), transparent 60%),
    linear-gradient(180deg, var(--jam), var(--jam-deep));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.24),
    inset 0 -2px 0 rgba(0, 0, 0, 0.22),
    0 1px 2px rgba(156, 42, 28, 0.25),
    0 14px 28px -14px rgba(156, 42, 28, 0.7);
}

/* the timer: a band of butter that grows from the left while the bread toasts */
.tb__timer {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(246, 183, 60, 0), rgba(246, 183, 60, 0.3) 70%, rgba(255, 220, 140, 0.46));
  border-right: 2px solid rgba(255, 228, 160, 0.7);
  transform: scaleX(0);
  transform-origin: 0 50%;
}

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

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

/* ---------------------------------------------------------------- the words */
.tb__faces {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 76px;
  right: 18px;
  pointer-events: none;
}

.tb__face {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

/* at rest the small words sit under the big ones, so both fit in the pill */
.tb__face[data-face='rest'] {
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 4px;
}

.tb__face--busy,
.tb__face--done {
  opacity: 0;
  visibility: hidden;
}

.tb__word {
  display: inline-block;
  padding-bottom: 1px;
  font-size: 16.5px;
  font-weight: 640;
  font-stretch: 100%;
  letter-spacing: -0.006em;
  line-height: 1;
  transition: font-stretch 0.6s cubic-bezier(0.34, 1.9, 0.45, 1);
}

.tb__note {
  padding-bottom: 1px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1;
  color: var(--butter);
}

@media (hover: hover) {
  .tb__btn:hover .tb__word {
    font-stretch: 112%;
  }
}

.tb__btn:focus-visible .tb__word {
  font-stretch: 112%;
}

/* while it toasts a warm sheen runs through the word */
.tb__shine {
  padding-bottom: 1px;
  font-size: 16.5px;
  font-weight: 640;
  line-height: 1;
  background: linear-gradient(100deg, var(--cream) 30%, var(--butter) 50%, var(--cream) 70%) 0 0 / 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.tb__done {
  padding-bottom: 1px;
  font-size: 16.5px;
  font-weight: 700;
  font-stretch: 108%;
  line-height: 1;
}

.tb__tick {
  flex: none;
  color: var(--butter);
}

