/* The update card with the mercury progress bar: the software update card of an operating system on a near black
   page. The progress bar is a dark groove; over it a WebGL canvas, a little larger than the groove, draws the liquid
   metal, its shadow and the light it throws on the groove. Without WebGL a chrome strip drawn by the CSS fills it. */
:root {
  --page: #0a0a0c;          /* the page */
  --card: #141418;          /* the body of the card, at the top */
  --card-low: #101013;      /* the body of the card, at the bottom */
  --groove: #060607;        /* the groove of the bar */
  --ink: #eeeff2;           /* the words */
  --muted: #84858f;         /* the small words */
  --accent: #a9c1ff;        /* the one colour: the chip when it is installed, the cold light in the metal */
  --button: #f3f4f6;        /* the button */
  --button-ink: #0b0b0d;    /* the words on the button */
  --light: #ffffff;         /* the brightest lights the metal reflects */
  --sky: #aeb6c4;           /* the wall behind you, in the top of the metal */
  --floor: #30343c;         /* the floor, in the bottom of the metal */
  --deep: #060708;          /* the darkest corner of the room */
}

* {
  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: 'Geist Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

/* a cold light far behind the card, and a fine grain over everything */
.stage {
  position: relative;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 16px;
  overflow: hidden;
  background:
    radial-gradient(ellipse min(70vw, 520px) min(46vh, 320px) at 50% 44%, rgba(150, 170, 220, 0.09), transparent 70%),
    var(--page);
}

.stage::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.07;
  mix-blend-mode: overlay;
  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%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.upd {
  position: relative;
  z-index: 1;
  width: min(88vw, 392px);
  opacity: 0;
}

.upd__card {
  --mx: 50%;
  --my: 0%;
  position: relative;
  border-radius: 22px;
  padding: clamp(14px, 4.4vh, 22px) clamp(16px, 5.4vw, 22px) clamp(14px, 4vh, 20px);
  background: linear-gradient(180deg, var(--card), var(--card-low));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    inset 0 0 0 1px rgba(255, 255, 255, 0.055),
    0 1px 2px rgba(0, 0, 0, 0.6),
    0 18px 40px -18px rgba(0, 0, 0, 0.95),
    0 44px 90px -40px rgba(60, 76, 120, 0.45);
}

/* the 1px edge catches the light where the light is (--mx, --my, moved by the script) */
.upd__rim {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  pointer-events: none;
  background: radial-gradient(160px circle at var(--mx) var(--my), rgba(214, 226, 255, 0.5), rgba(214, 226, 255, 0.06) 60%, transparent 80%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
}

.upd__head {
  display: flex;
  align-items: center;
  gap: clamp(8px, 3vw, 12px);
}

/* the app icon: a small square of brushed metal with a dark ring cut into it */
.upd__icon {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.55), transparent 55%),
    conic-gradient(from 210deg, #d9dde5, #7d838f, #f2f4f8, #5f6571, #c9ced8, #8a909c, #d9dde5);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    inset 0 -1px 0 rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(0, 0, 0, 0.5),
    0 6px 14px -6px rgba(0, 0, 0, 0.9);
}

.upd__icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke-linecap: round;
}

.upd__icon-ring {
  stroke: #1a1c21;
  stroke-width: 2.6;
}

.upd__icon-cut {
  stroke: rgba(255, 255, 255, 0.85);
  stroke-width: 1.1;
}

.upd__title {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 2px;
}

.upd__name {
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.upd__meta {
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.upd__chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
  transition: color 0.4s, box-shadow 0.4s, background-color 0.4s;
}

.upd__chip.is-done {
  color: var(--accent);
  background-color: color-mix(in srgb, var(--accent) 9%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 34%, transparent);
}

.upd__chip-check {
  width: 0;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  overflow: visible;
}

.upd__chip-words {
  display: inline-block;
  white-space: nowrap;
}

.upd__line {
  margin: clamp(10px, 3vh, 16px) 0 0;
  font-size: 13px;
  line-height: 1.45;
  color: #a7a8b1;
}

/* the bar: a dark groove, the metal is drawn over it */
.upd__bar {
  position: relative;
  height: 22px;
  margin-top: clamp(14px, 4vh, 22px);
}

.upd__groove {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #030304, var(--groove) 60%, #0b0b0d);
  box-shadow:
    inset 0 1px 2px rgba(0, 0, 0, 0.9),
    inset 0 0 0 1px rgba(0, 0, 0, 0.6),
    0 1px 0 rgba(255, 255, 255, 0.07),
    0 -1px 0 rgba(0, 0, 0, 0.4);
}

.upd__metal {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
}

/* the metal without WebGL: a chrome strip, its width set by the script */
.upd__flat {
  position: absolute;
  left: 2.5px;
  top: 2.5px;
  bottom: 2.5px;
  width: 13px;
  border-radius: 999px;
  display: none;
  background: linear-gradient(180deg, #ffffff, #b9c1cc 38%, #30343c 62%, #8d95a3 86%, #e8ebf0);
}

.no-gl .upd__flat {
  display: block;
}

.upd__nums {
  margin: 10px 0 0;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.upd__got [data-got] {
  color: var(--ink);
}

.upd__btn {
  position: relative;
  display: block;
  width: 100%;
  height: clamp(40px, 11vh, 44px);
  margin-top: clamp(14px, 4vh, 20px);
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--button-ink);
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

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

/* the face moves with GSAP; the button stays put */
.upd__btn-face {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: inherit;
  background: linear-gradient(180deg, #ffffff, var(--button));
  box-shadow:
    inset 0 -1px 0 rgba(0, 0, 0, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 1px 1px rgba(0, 0, 0, 0.4),
    0 8px 20px -10px rgba(200, 214, 255, 0.35);
  font-size: 14px;
  font-weight: 560;
  letter-spacing: -0.005em;
}

@media (hover: hover) {
  .upd__btn:hover .upd__btn-face {
    background: linear-gradient(180deg, #ffffff, #e9ebf0);
  }
}

.upd__btn-icons {
  position: relative;
  width: 16px;
  height: 16px;
}

.upd__ico {
  position: absolute;
  inset: 0;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
}

.upd__ico[data-ico='idle'] {
  opacity: 1;
}

.upd__fill {
  fill: currentColor;
  stroke-width: 1.2;
}

.upd__btn-words {
  display: inline-block;
  white-space: nowrap;
}
