/* The archive frost: a card of cold blue steel on a black page, with a pane of dark glass in the middle that frosts
   over as the files move to cold storage. The frost is painted by script.js on the canvas with the colours below;
   everything else is plain CSS. */
:root {
  --page: #000000;          /* the page */
  --card: #0d1722;          /* the card */
  --card-lit: #172636;      /* where the light falls on the card, at the top */
  --glass: #050b12;         /* the pane of glass, still clear */
  --glass-lit: #10202f;     /* the cold light behind the glass */
  --rim: rgba(186, 222, 255, 0.16);    /* the edge of the pane */
  --ink: #eef6ff;           /* the words */
  --muted: #8ca2b8;         /* the quieter words */
  --error: #ff9c8a;         /* the words that say what went wrong */
  --halo: rgba(3, 12, 22, 0.8);        /* the dark halo that keeps the words on the clear glass readable */
  --ink-frozen: #0b2135;    /* the words on the pane once it has frozen over */
  --frost: #e9f6ff;         /* the crystals */
  --frost-tip: #9ddcff;     /* the tips of the crystals while they grow, and the glints */
  --haze: #c9e2f5;          /* the haze of frost between the crystals */
  --button: #e6f3ff;        /* the main button */
  --button-ink: #0b1724;    /* its words */
  --ring: rgba(214, 234, 255, 0.28);   /* the ring round the quiet button */
  --focus: #9ddcff;         /* 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: 'Instrument Sans Variable', system-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: 32px 16px;
}

/* ---------------------------------------------------------------- the card */
.vault {
  --pad: 20px;
  position: relative;
  width: min(380px, 100%);
  padding: 18px 0 16px;
  border-radius: 26px;
  background:
    radial-gradient(130% 60% at 30% 0%, var(--card-lit), transparent 70%),
    var(--card);
  box-shadow:
    inset 0 1px 0 rgba(214, 236, 255, 0.12),
    inset 0 0 0 1px rgba(186, 222, 255, 0.06),
    0 30px 60px -30px rgba(70, 150, 220, 0.25);
}

.vault p,
.vault h2 {
  margin: 0;
}

.vault__head,
.vault__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 var(--pad);
}

.vault__words {
  min-width: 0;
}

.vault__title {
  height: 21px;
  overflow: hidden;
  font-size: 16px;
  font-weight: 620;
  font-stretch: 96%;
  line-height: 21px;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.vault__title .is-error {
  color: var(--error);
}

.vault__meta {
  height: 18px;
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  font-weight: 450;
  line-height: 18px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* the words that change slide in by themselves; a long one ends in an ellipsis */
.vault__swap {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: top;
  white-space: nowrap;
}

/* the snowflake: it turns slowly while the files move */
.vault__flake {
  flex: none;
  width: 28px;
  height: 28px;
  fill: none;
  stroke: var(--frost-tip);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.85;
}

/* ---------------------------------------------------------------- the pane of glass */
.vault__pane {
  position: relative;
  height: 172px;
  margin: 16px 12px 0;
  overflow: hidden;
  border-radius: 16px;
  background:
    linear-gradient(118deg, transparent 30%, rgba(190, 225, 255, 0.05) 42%, transparent 43%, transparent 52%, rgba(190, 225, 255, 0.035) 58%, transparent 66%),
    radial-gradient(90% 120% at 50% 110%, var(--glass-lit), transparent 70%),
    var(--glass);
  box-shadow:
    inset 0 0 0 1px var(--rim),
    inset 0 10px 24px -14px rgba(0, 0, 0, 0.9),
    inset 0 -1px 0 rgba(214, 236, 255, 0.08),
    0 1px 0 rgba(214, 236, 255, 0.06);
  isolation: isolate;
}

.vault__pane.is-shake {
  will-change: transform;
}

.vault__frost {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transition: opacity 0.5s ease, filter 0.5s ease;
}

/* stopped by an error, the frost goes grey and dull */
.vault.is-failed .vault__frost {
  opacity: 0.62;
  filter: saturate(0.2);
}

/* the reading in the middle of the pane, always on top of the frost, with a dark halo round the letters */
.vault__read {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 2px;
  pointer-events: none;
  text-align: center;
}

.vault__big {
  position: relative;
  height: 50px;
  font-size: 44px;
  font-weight: 640;
  font-stretch: 84%;
  line-height: 50px;
  letter-spacing: -0.03em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 3px var(--halo), 0 0 14px var(--halo);
  transition: color 0.6s ease, text-shadow 0.6s ease;
}

.vault__big.is-quiet {
  color: color-mix(in srgb, var(--ink) 70%, var(--glass));
}

.vault__big small {
  margin-left: 2px;
  font-size: 0.48em;
  font-weight: 600;
  font-stretch: 100%;
  letter-spacing: 0;
  vertical-align: 0.8em;
}

.vault__tick {
  position: absolute;
  top: 50%;
  left: -34px;
  width: 30px;
  height: 30px;
  margin-top: -15px;
  fill: none;
  stroke: var(--ink);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  visibility: hidden;
  filter: drop-shadow(0 0 4px var(--halo)) drop-shadow(0 0 10px var(--halo));
}

.vault__under {
  height: 18px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 520;
  line-height: 18px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 3px var(--halo), 0 0 10px var(--halo);
  opacity: 0.86;
  transition: color 0.6s ease, text-shadow 0.6s ease;
}

/* the words in the pane keep their halo; it must not be cut by the box of the words that swap */
.vault__read .vault__swap {
  overflow: visible;
}

/* frozen over, the pane is pale frosted glass and its words turn dark */
.vault.is-frozen .vault__big,
.vault.is-frozen .vault__under {
  color: var(--ink-frozen);
  text-shadow: 0 0 6px rgba(225, 242, 255, 0.7), 0 0 16px rgba(225, 242, 255, 0.55);
}

.vault.is-frozen .vault__under {
  opacity: 1;
}

.vault.is-frozen .vault__tick {
  stroke: var(--ink-frozen);
  filter: drop-shadow(0 0 5px rgba(225, 242, 255, 0.7));
}

/* ---------------------------------------------------------------- the foot */
.vault__foot {
  margin-top: 16px;
}

.vault__file {
  min-width: 0;
  height: 18px;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  font-weight: 450;
  line-height: 18px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.vault__file b {
  color: var(--ink);
  font-weight: 560;
}

/* the pill: 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, it squashes a little */
.pill {
  position: relative;
  display: inline-grid;
  flex: none;
  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: 14px;
  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::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);
}

/* while the files move the button only cancels */
.pill.is-quiet {
  color: var(--ink);
}

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

/* while the frost melts there is nothing to press */
.pill[aria-disabled='true'] {
  cursor: default;
  opacity: 0.45;
}

@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: rgba(214, 234, 255, 0.08);
  }
}

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

@media (max-width: 380px) {
  .vault {
    --pad: 18px;
  }

  .vault__big {
    font-size: 40px;
  }
}

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