/* The initials avatar with the gradient to choose: the profile picture panel of a notes app, Fernway, alone on a
   white page. Every size is a multiple of --u, which is one pixel on a computer and shrinks with the width and the
   height of the window, so the whole panel always fits (the phone box is 341 by 410). */
:root {
  --page: #ffffff;          /* the page */
  --panel: #fbfaf8;         /* the panel */
  --edge: rgba(20, 18, 30, 0.08); /* the panel's edge */
  --ink: #17161c;           /* the words */
  --muted: #7a7783;         /* the small words */
  --line: #ebe8e4;          /* the thin lines */
  --field: #ffffff;         /* the initials field */
  --on-dark: #ffffff;       /* the initials on a deep gradient */
  --on-light: #1d1a22;      /* the initials on a pale gradient */
  --g1a: #ffb38a;           /* Dusk, the light */
  --g1b: #f2557a;           /* Dusk, the deep */
  --g2a: #7ce8de;           /* Lagoon, the light */
  --g2b: #4a6cf7;           /* Lagoon, the deep */
  --g3a: #dff59a;           /* Meadow, the light */
  --g3b: #4fc28f;           /* Meadow, the deep */
  --g4a: #ffe08a;           /* Amber, the light */
  --g4b: #ff8a3d;           /* Amber, the deep */
  --g5a: #d2b8ff;           /* Iris, the light */
  --g5b: #6c4cf0;           /* Iris, the deep */
  --g6a: #8d93a3;           /* Graphite, the light */
  --g6b: #23252d;           /* Graphite, the deep */
  --save: #17161c;          /* the Save button */
  --save-ink: #ffffff;      /* the words on Save */
  --done: #2f9e6b;          /* the check once saved */
}

/* the six gradients, built from the colours above: a light that sits up and to the left, the deep colour low and to
   the right, a soft third tone between them */
html {
  --grad-0: radial-gradient(120% 120% at 24% 18%, var(--g1a) 0%, transparent 58%), radial-gradient(110% 110% at 82% 86%, var(--g1b) 0%, transparent 62%), linear-gradient(140deg, var(--g1a), color-mix(in oklab, var(--g1a), var(--g1b) 55%) 50%, var(--g1b));
  --grad-1: radial-gradient(120% 120% at 24% 18%, var(--g2a) 0%, transparent 58%), radial-gradient(110% 110% at 82% 86%, var(--g2b) 0%, transparent 62%), linear-gradient(140deg, var(--g2a), color-mix(in oklab, var(--g2a), var(--g2b) 55%) 50%, var(--g2b));
  --grad-2: radial-gradient(120% 120% at 24% 18%, var(--g3a) 0%, transparent 58%), radial-gradient(110% 110% at 82% 86%, var(--g3b) 0%, transparent 62%), linear-gradient(140deg, var(--g3a), color-mix(in oklab, var(--g3a), var(--g3b) 55%) 50%, var(--g3b));
  --grad-3: radial-gradient(120% 120% at 24% 18%, var(--g4a) 0%, transparent 58%), radial-gradient(110% 110% at 82% 86%, var(--g4b) 0%, transparent 62%), linear-gradient(140deg, var(--g4a), color-mix(in oklab, var(--g4a), var(--g4b) 55%) 50%, var(--g4b));
  --grad-4: radial-gradient(120% 120% at 24% 18%, var(--g5a) 0%, transparent 58%), radial-gradient(110% 110% at 82% 86%, var(--g5b) 0%, transparent 62%), linear-gradient(140deg, var(--g5a), color-mix(in oklab, var(--g5a), var(--g5b) 55%) 50%, var(--g5b));
  --grad-5: radial-gradient(120% 120% at 24% 18%, var(--g6a) 0%, transparent 58%), radial-gradient(110% 110% at 82% 86%, var(--g6b) 0%, transparent 62%), linear-gradient(140deg, var(--g6a), color-mix(in oklab, var(--g6a), var(--g6b) 55%) 50%, var(--g6b));
  --grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  --u: min(1.15px, calc(100vh / 530), calc(100vw / 372));
  touch-action: manipulation;
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
  font-family: 'Mona Sans 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;
}

.stage {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: calc(var(--u) * 14);
  overflow: hidden;
}

/* ------------------------------------------------------------------ the panel */
.panel {
  position: relative;
  width: calc(var(--u) * 344);
  border-radius: calc(var(--u) * 26);
  background: var(--panel);
  box-shadow:
    inset 0 0 0 1px var(--edge),
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 1px 2px rgba(20, 18, 30, 0.05),
    0 calc(var(--u) * 10) calc(var(--u) * 24) calc(var(--u) * -8) rgba(20, 18, 30, 0.1),
    0 calc(var(--u) * 34) calc(var(--u) * 60) calc(var(--u) * -24) rgba(20, 18, 30, 0.18);
  opacity: 0;
}

.panel__bar {
  display: flex;
  align-items: center;
  gap: calc(var(--u) * 8);
  height: calc(var(--u) * 54);
  padding: 0 calc(var(--u) * 14) 0 calc(var(--u) * 18);
  border-bottom: 1px solid var(--line);
}

.panel__brand {
  display: inline-flex;
  align-items: center;
  gap: calc(var(--u) * 6);
}

.panel__mark {
  width: calc(var(--u) * 17);
  height: calc(var(--u) * 17);
  fill: var(--ink);
}

.panel__mark-vein {
  fill: none;
  stroke: var(--panel);
  stroke-width: 1.3;
  stroke-linecap: round;
}

.panel__name {
  font-size: calc(var(--u) * 14);
  font-weight: 650;
  font-stretch: 108%;
  letter-spacing: -0.01em;
}

.panel__crumb {
  margin-left: calc(var(--u) * 4);
  padding-left: calc(var(--u) * 10);
  border-left: 1px solid var(--line);
  font-size: calc(var(--u) * 12.5);
  color: var(--muted);
  font-weight: 480;
}

/* the small avatar in the header */
.mini {
  position: relative;
  margin-left: auto;
  width: calc(var(--u) * 30);
  height: calc(var(--u) * 30);
  border-radius: 50%;
  overflow: hidden;
  isolation: isolate;
  box-shadow: 0 0 0 calc(var(--u) * 2) var(--panel), 0 0 0 calc(var(--u) * 3) var(--edge);
}

.mini__base,
.mini__drop,
.mini__grain {
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.mini__base {
  background: var(--grad-0);
}

.mini__drop {
  clip-path: circle(0% at 50% 50%);
}

.mini__grain {
  background: var(--grain);
  background-size: calc(var(--u) * 90);
  mix-blend-mode: soft-light;
  opacity: 0.55;
}

.mini__letters {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: calc(var(--u) * 11);
  font-weight: 680;
  letter-spacing: 0.02em;
  color: var(--on-dark);
}

.panel__body {
  display: grid;
  justify-items: center;
  padding: calc(var(--u) * 22) calc(var(--u) * 22) 0;
}

/* ------------------------------------------------------------------ the large avatar */
.av {
  position: relative;
  width: calc(var(--u) * 132);
  height: calc(var(--u) * 132);
}

.av__glow {
  position: absolute;
  inset: 12% 10% -4%;
  border-radius: 50%;
  background: var(--grad-0);
  filter: blur(calc(var(--u) * 18));
  opacity: 0.5;
  transform: translateY(calc(var(--u) * 10)) scale(0.9);
}

.av__glow + .av__glow {
  opacity: 0;
}

.av__disc {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  overflow: hidden;
  isolation: isolate;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.22),
    inset 0 calc(var(--u) * -10) calc(var(--u) * 24) rgba(0, 0, 0, 0.1),
    0 1px 2px rgba(20, 18, 30, 0.12);
}

.av__base,
.av__drop,
.av__grain,
.av__sheen {
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.av__base {
  background: var(--grad-0);
}

.av__drop {
  clip-path: circle(0% at 50% 50%);
}

/* the rim of light that runs ahead of the new gradient, like the edge of a drop spreading */
.av__wave {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.55), 0 0 10px 2px rgba(255, 255, 255, 0.28);
  opacity: 0;
}

.av__grain {
  background: var(--grain);
  background-size: calc(var(--u) * 150);
  mix-blend-mode: soft-light;
  opacity: 0.6;
  z-index: 2;
}

.av__sheen {
  background: radial-gradient(60% 50% at 34% 22%, rgba(255, 255, 255, 0.42), transparent 70%);
  mix-blend-mode: soft-light;
  z-index: 3;
}

.av__letters {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: calc(var(--u) * 46);
  line-height: 1;
  letter-spacing: -0.01em;
  color: var(--on-dark);
  font-variation-settings: 'wght' var(--w, 640), 'wdth' var(--wd, 100);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.06);
}

/* each letter sits in a slot of its own, so it can roll out and the new one roll in */
.av__slot {
  position: relative;
  display: inline-block;
  height: 1.16em;
  overflow: hidden;
}

.av__ch {
  display: block;
  line-height: 1.16em;
  white-space: pre;
}

.av__ch--out {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
}

/* ------------------------------------------------------------------ titles */
.panel__titles {
  margin-top: calc(var(--u) * 20);
  text-align: center;
}

.panel__title {
  margin: 0;
  font-size: calc(var(--u) * 16);
  font-weight: 640;
  letter-spacing: -0.012em;
}

.panel__sub {
  margin: calc(var(--u) * 5) 0 0;
  font-size: calc(var(--u) * 12.5);
  color: var(--muted);
  font-weight: 450;
}

/* ------------------------------------------------------------------ the swatches */
.swatches {
  position: relative;
  display: flex;
  gap: calc(var(--u) * 13);
  margin-top: calc(var(--u) * 18);
  padding: calc(var(--u) * 6);
}

.swatches__ring {
  position: absolute;
  left: 0;
  top: 50%;
  width: calc(var(--u) * 42);
  height: calc(var(--u) * 42);
  margin-top: calc(var(--u) * -21);
  border-radius: 50%;
  box-shadow: inset 0 0 0 calc(var(--u) * 1.5) var(--ink);
  pointer-events: none;
}

.swatch {
  position: relative;
  width: calc(var(--u) * 32);
  height: calc(var(--u) * 32);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.swatch__face {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3), 0 1px 2px rgba(20, 18, 30, 0.16), 0 calc(var(--u) * 4) calc(var(--u) * 10) calc(var(--u) * -4) rgba(20, 18, 30, 0.3);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.swatch__face::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--grain);
  background-size: calc(var(--u) * 60);
  mix-blend-mode: soft-light;
  opacity: var(--grain-o, 0.6);
}

.swatch[data-swatch='0'] .swatch__face { background: var(--grad-0); }
.swatch[data-swatch='1'] .swatch__face { background: var(--grad-1); }
.swatch[data-swatch='2'] .swatch__face { background: var(--grad-2); }
.swatch[data-swatch='3'] .swatch__face { background: var(--grad-3); }
.swatch[data-swatch='4'] .swatch__face { background: var(--grad-4); }
.swatch[data-swatch='5'] .swatch__face { background: var(--grad-5); }

@media (hover: hover) {
  .swatch:hover .swatch__face {
    transform: scale(1.09);
  }
}

.swatch:active .swatch__face {
  transform: scale(0.92);
  transition-duration: 0.12s;
}

.swatch:focus-visible {
  outline: none;
}

.swatch:focus-visible .swatch__face {
  box-shadow: 0 0 0 calc(var(--u) * 2) var(--panel), 0 0 0 calc(var(--u) * 4) var(--g2b);
}

/* ------------------------------------------------------------------ the initials field */
.field {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  column-gap: calc(var(--u) * 12);
  align-items: center;
  width: 100%;
  margin-top: calc(var(--u) * 18);
  padding-top: calc(var(--u) * 16);
  border-top: 1px solid var(--line);
  cursor: text;
}

.field__label {
  font-size: calc(var(--u) * 13);
  font-weight: 600;
}

.field__hint {
  grid-row: 2;
  font-size: calc(var(--u) * 11.5);
  color: var(--muted);
}

.field__input {
  grid-row: 1 / span 2;
  grid-column: 2;
  width: calc(var(--u) * 76);
  height: calc(var(--u) * 38);
  padding: 0;
  border: 0;
  border-radius: calc(var(--u) * 11);
  background: var(--field);
  box-shadow: inset 0 0 0 1px var(--line), 0 1px 2px rgba(20, 18, 30, 0.05);
  color: var(--ink);
  font: inherit;
  font-size: calc(var(--u) * 16);
  font-weight: 620;
  letter-spacing: 0.22em;
  text-indent: 0.22em;
  text-align: center;
  text-transform: uppercase;
  caret-color: var(--g2b);
  transition: box-shadow 0.25s ease;
}

.field__input:focus {
  outline: none;
  box-shadow: inset 0 0 0 1px var(--ink), 0 0 0 calc(var(--u) * 4) rgba(23, 22, 28, 0.07);
}

.field__input.is-typing {
  box-shadow: inset 0 0 0 1px var(--ink), 0 0 0 calc(var(--u) * 4) rgba(23, 22, 28, 0.07);
}

/* ------------------------------------------------------------------ the footer */
.panel__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: calc(var(--u) * 10);
  margin-top: calc(var(--u) * 18);
  padding: calc(var(--u) * 14) calc(var(--u) * 14) calc(var(--u) * 14) calc(var(--u) * 22);
  border-top: 1px solid var(--line);
}

.panel__state {
  font-size: calc(var(--u) * 12);
  color: var(--muted);
  white-space: nowrap;
}

.save {
  position: relative;
  height: calc(var(--u) * 40);
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: none;
  cursor: pointer;
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

.save__face {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: calc(var(--u) * 6);
  height: 100%;
  min-width: calc(var(--u) * 92);
  padding: 0 calc(var(--u) * 18);
  border-radius: inherit;
  background: var(--save);
  color: var(--save-ink);
  font-size: calc(var(--u) * 13.5);
  font-weight: 600;
  font-stretch: 104%;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 1px 2px rgba(20, 18, 30, 0.2), 0 calc(var(--u) * 8) calc(var(--u) * 16) calc(var(--u) * -8) rgba(20, 18, 30, 0.45);
}

.save.is-idle .save__face {
  background: #e9e6e2;
  color: #9a96a2;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.save__icon {
  width: 0;
  height: calc(var(--u) * 15);
  overflow: visible;
}

.save__check {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

.save:focus-visible {
  outline: none;
}

.save:focus-visible .save__face {
  box-shadow: 0 0 0 calc(var(--u) * 2) var(--panel), 0 0 0 calc(var(--u) * 4) var(--ink);
}

@media (prefers-reduced-motion: reduce) {
  .swatch__face {
    transition: none;
  }
}
