/* The moka pot loader: a stovetop moka pot on a small gas ring, alone on a white page, drawn like a technical drawing:
   brushed aluminium outside, hatched where it is cut; under it one line of words and the pills. The pot, the flame,
   the liquids and the steam are drawn by script.js with these colours. */
:root {
  --page: #ffffff;          /* the page */
  --ink: #2a211b;           /* outlines and words */
  --muted: #8a7b6d;         /* the quiet words */
  --ok: #2d7a4c;            /* report ready */
  --cut: #e6e9ec;           /* the aluminium where it is cut */
  --hatch: #9ba3ac;         /* its hatching */
  --bakelite: #221e1c;      /* the handle and the knob */
  --brass: #d2b06a;         /* the safety valve */
  --burner: #24201e;        /* the burner cap and the pan support, cast iron */
  --water: #8cc4e8;         /* the water in the boiler */
  --coffee: #3a1d0e;        /* the coffee */
  --crema: #c08447;         /* the crema on top of it */
  --foam: #ecd5ae;          /* the foam of the last spurts */
  --grounds: #8d5c38;       /* the dry grounds in the funnel */
  --flame: #3c6dff;         /* the gas flame */
  --steam: #b3bcc7;         /* the steam (a little blue grey, so it shows on a white page) */
  --button: #3b2417;        /* the main pill, espresso */
  --button-ink: #fff6ea;    /* its words */
  --line: #e2d6c6;          /* the ring round the quiet pill */
  --focus: #c9731f;         /* the keyboard's focus ring */
}

* {
  box-sizing: border-box;
}

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

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

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--ink);
  font-family: 'Bricolage Grotesque Variable', system-ui, sans-serif;
  font-optical-sizing: auto;
  -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: 72px 16px 40px;
}

/* ---------------------------------------------------------------- the pot */
.moka {
  display: grid;
  justify-items: center;
  width: min(360px, 100%);
}

/* the pot's place: from the knob to the shadow under the hob, 200 by 252 units of the drawing */
.moka__scene {
  position: relative;
  width: min(240px, 100%);
  aspect-ratio: 200 / 252;
}

/* the layers reach past it, 25 units to each side and 38 above, for the steam that rises out of the spout */
.moka__layers {
  position: absolute;
  top: -15.0794%;
  left: -12.5%;
  width: 125%;
  height: 115.0794%;
  pointer-events: none;
}

.moka__art {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* ---------------------------------------------------------------- the line of words */
.moka__status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 22px;
  margin: 14px 0 0;
  max-width: 100%;
  font-size: 15.5px;
  font-weight: 620;
  font-stretch: 94%;
  line-height: 22px;
  letter-spacing: -0.006em;
  white-space: nowrap;
}

.moka__swap {
  display: inline-block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.moka[data-mode='idle'] .moka__swap,
.moka[data-mode='reset'] .moka__swap {
  color: var(--muted);
}

.moka[data-mode='done'] .moka__swap {
  color: var(--ok);
}

/* the percentage keeps its width while the figures change */
.moka__pct {
  display: none;
  min-width: 3.1em;
  font-weight: 720;
  font-stretch: 86%;
  text-align: left;
  font-variant-numeric: tabular-nums;
}

.moka[data-mode='brew'] .moka__pct,
.moka[data-mode='sputter'] .moka__pct {
  display: inline-block;
}

/* the tick of Report ready, drawn in by script.js */
.moka__tick {
  display: none;
  flex: none;
  width: 19px;
  height: 19px;
  fill: none;
  stroke: var(--ok);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}

.moka[data-mode='done'] .moka__tick {
  display: block;
}

/* ---------------------------------------------------------------- the pills */
.moka__buttons {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
}

/* the fill is a layer of its own that swells past the edge with a bounce, and the words widen on the width axis of
   the font; pressed, a pill squashes a little */
.pill {
  position: relative;
  display: inline-grid;
  place-items: center;
  height: 44px;
  min-width: 44px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--button-ink);
  font: inherit;
  font-size: 14.5px;
  font-weight: 640;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  isolation: isolate;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
  transition: color 0.25s ease, opacity 0.25s ease;
}

.pill[hidden] {
  display: none;
}

.pill::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: var(--button);
  transition: inset 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.25s ease, box-shadow 0.25s ease;
}

.pill__label {
  display: inline-block;
  font-stretch: 88%;
  transition: font-stretch 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.pill.is-quiet {
  color: var(--ink);
}

.pill.is-quiet::before {
  background: transparent;
  box-shadow: inset 0 0 0 1.5px var(--line);
}

/* downloaded: the main pill turns green */
.pill.is-saved::before {
  background: var(--ok);
}

/* while the pot is working there is nothing to press: the main pill steps back like the quiet one */
.pill[aria-disabled='true'] {
  color: var(--muted);
  cursor: default;
}

.pill[aria-disabled='true']::before {
  background: transparent;
  box-shadow: inset 0 0 0 1.5px var(--line);
}

@media (hover: hover) and (pointer: fine) {
  .pill:not([aria-disabled='true']):hover::before {
    inset: -2px -5px;
  }

  .pill:not([aria-disabled='true']):hover .pill__label {
    font-stretch: 100%;
  }

  .pill.is-quiet:not([aria-disabled='true']):hover::before {
    background: color-mix(in srgb, var(--line) 35%, transparent);
  }
}

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

@media (prefers-reduced-motion: reduce) {
  .pill::before,
  .pill__label {
    transition: none;
  }
}

/* ---------------------------------------------------------------- the drawing */
.part {
  stroke: var(--ink);
  stroke-width: 0.85;
  stroke-linejoin: round;
}

.outline {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.1;
  stroke-linejoin: round;
}

.thin {
  fill: none;
  stroke: var(--ink);
  stroke-width: 0.55;
  stroke-linecap: round;
}

.sheet {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.1;
  stroke-linejoin: round;
}

.plate {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.2;
  stroke-dasharray: 2.2 0.9;
}

.centre {
  fill: none;
  stroke: var(--ink);
  stroke-width: 0.45;
  stroke-dasharray: 8 2 1.2 2;
  opacity: 0.28;
}
