/* The dashboard sign in form with the glass that unlocks: the window of an analytics app on a black page. The
   dashboard (.dash) sits at the back, blurred; over it a frosted veil (.veil) and the sign in card, a pane of dark
   glass with a grain and a light on its edge. Signing in, the veil opens from the middle, the blur goes and the
   dashboard comes alive. GSAP moves the outer elements, CSS styles their children. */
:root {
  --page: #000000;          /* the page */
  --app: #0a0b10;           /* the window of the app */
  --panel: #12141b;         /* the tiles of the dashboard */
  --glass: rgba(22, 24, 33, 0.56); /* the frosted card */
  --ink: #eceef4;           /* the words */
  --muted: #8a8fa0;         /* the small words */
  --accent: #8b93ff;        /* the light: focus, line, button */
  --good: #62e0b8;          /* figures going up */
  --bad: #ff7083;           /* the wrong password */
  --button: #eef0ff;        /* the Sign in button */
  --button-ink: #0b0c12;    /* the words on it */
}

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

p,
h1 {
  margin: 0;
}

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

.stage {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: min(12px, 2.4vh) min(12px, 3vw);
  overflow: hidden;
}

/* ------------------------------------------------------------------ the window */
.app {
  position: relative;
  width: min(680px, 94vw);
  height: min(540px, 94vh);
  border-radius: clamp(14px, 3vw, 22px);
  background: var(--app);
  overflow: hidden;
  isolation: isolate;
  container-type: inline-size;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.07),
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 40px 80px -40px rgba(80, 90, 255, 0.18),
    0 30px 60px -30px rgba(0, 0, 0, 0.9);
  opacity: 0;
}

/* ------------------------------------------------------------------ the dashboard */
.dash {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: clamp(38px, 8cqi, 52px) 1fr;
  transform-origin: 50% 50%;
}

.dash__side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(8px, 2.6vh, 14px);
  padding-top: clamp(12px, 3.4vh, 18px);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(255, 255, 255, 0.012);
}

.dash__side svg,
.dash__range svg,
.kpi__delta svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dash__logo,
.dash__ico {
  display: grid;
  place-items: center;
  width: clamp(24px, 5.4cqi, 30px);
  aspect-ratio: 1;
  border-radius: 8px;
  color: var(--muted);
}

.dash__logo {
  color: var(--ink);
  background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 70%, #fff), color-mix(in srgb, var(--accent) 60%, #000));
  margin-bottom: 4px;
}

.dash__logo svg {
  stroke-width: 2.2;
}

.dash__ico.is-on {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
}

.dash__logo svg,
.dash__ico svg {
  width: 58%;
}

.dash__main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 2.4vh, 14px);
  padding: clamp(12px, 3.4vh, 18px) clamp(12px, 3cqi, 20px);
}

.dash__top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
}

.dash__hello {
  font-size: 11px;
  color: var(--muted);
}

.dash__title {
  font-size: clamp(15px, 3.6cqi, 19px);
  font-weight: 620;
  font-variation-settings: 'wdth' 104;
  letter-spacing: -0.01em;
  margin-top: 2px;
}

.dash__range {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--muted);
  padding: 5px 9px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  white-space: nowrap;
}

.dash__range svg {
  width: 10px;
}

.dash__kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(6px, 1.6cqi, 10px);
}

.kpi {
  padding: clamp(8px, 2.2vh, 12px) clamp(9px, 2cqi, 12px);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  min-width: 0;
}

.kpi__label {
  font-size: 10.5px;
  color: var(--muted);
  white-space: nowrap;
}

.kpi__value {
  font-size: clamp(15px, min(4cqi, 5vh), 21px);
  font-weight: 640;
  font-variation-settings: 'wdth' 96;
  letter-spacing: -0.02em;
  margin-top: 3px;
  white-space: nowrap;
}

.kpi__delta {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 10.5px;
  font-weight: 560;
  margin-top: 2px;
}

.kpi__delta svg {
  width: 10px;
  stroke-width: 1.8;
}

.kpi__delta.is-up {
  color: var(--good);
}

.kpi__delta.is-down {
  color: var(--bad);
}

.dash__charts {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: clamp(6px, 1.6cqi, 10px);
}

.chart,
.bars {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: clamp(8px, 2.2vh, 12px);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.chart__label {
  font-size: 11px;
  font-weight: 560;
}

.chart__label span {
  color: var(--muted);
  font-weight: 450;
  margin-left: 4px;
}

.chart__svg {
  flex: 1;
  width: 100%;
  min-height: 0;
  margin-top: 6px;
  overflow: visible;
}

.chart__grid {
  stroke: rgba(255, 255, 255, 0.05);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: 2 4;
}

.chart__line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 4px 8px color-mix(in srgb, var(--accent) 50%, transparent));
}

.chart__dot {
  position: absolute;
  left: 0;
  top: 0;
  width: 9px;
  height: 9px;
  margin: -4.5px 0 0 -4.5px;
  border-radius: 50%;
  background: var(--app);
  box-shadow: inset 0 0 0 2px var(--accent), 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}

.chart__tip {
  position: absolute;
  left: 0;
  top: 0;
  padding: 4px 7px;
  border-radius: 7px;
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
  background: rgba(30, 33, 44, 0.92);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), 0 8px 18px -6px rgba(0, 0, 0, 0.7);
  transform-origin: 100% 100%;
}

.chart__tip b {
  color: var(--ink);
  font-weight: 620;
  margin-left: 2px;
}

.bars__row {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: flex-end;
  gap: 6%;
  margin-top: 8px;
}

.bar {
  flex: 1;
  height: calc(var(--h) * 100%);
  border-radius: 4px 4px 2px 2px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.05));
  transform-origin: 50% 100%;
}

.bar.is-today {
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 90%, #fff), color-mix(in srgb, var(--accent) 40%, transparent));
}

/* narrow windows: two figures and the line only */
@container (max-width: 420px) {
  .kpi--third,
  .bars {
    display: none;
  }

  .dash__kpis {
    grid-template-columns: repeat(2, 1fr);
  }

  .dash__charts {
    grid-template-columns: 1fr;
  }
}

/* ------------------------------------------------------------------ the frosted veil and the ring of the unlock */
.veil {
  --r: 0px;
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 90% at 50% 40%, rgba(10, 11, 18, 0.18), rgba(4, 5, 9, 0.5)),
    radial-gradient(60% 50% at 50% 0%, color-mix(in srgb, var(--accent) 14%, transparent), transparent);
  -webkit-mask-image: radial-gradient(circle at 50% 50%, transparent var(--r), #000 calc(var(--r) + 140px));
  mask-image: radial-gradient(circle at 50% 50%, transparent var(--r), #000 calc(var(--r) + 140px));
  pointer-events: none;
}

.ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 120px;
  height: 120px;
  margin: -60px 0 0 -60px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 80%, #fff), 0 0 24px color-mix(in srgb, var(--accent) 40%, transparent), inset 0 0 24px color-mix(in srgb, var(--accent) 30%, transparent);
  opacity: 0;
  pointer-events: none;
}

/* ------------------------------------------------------------------ the sign in card */
.lock {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 10px;
}

.card {
  --mx: 50%;
  --my: 0%;
  position: relative;
  width: min(304px, 100%);
  display: flex;
  flex-direction: column;
  padding: clamp(14px, 3.6vh, 24px) clamp(16px, 4.6cqi, 24px) clamp(14px, 3.4vh, 22px);
  border-radius: 18px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  backdrop-filter: blur(16px) saturate(150%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.09),
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    0 1px 1px rgba(0, 0, 0, 0.3),
    0 12px 24px -10px rgba(0, 0, 0, 0.6),
    0 40px 70px -30px rgba(0, 0, 0, 0.85);
}

/* a very fine grain on the glass */
.card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  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='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.07;
  mix-blend-mode: overlay;
  pointer-events: none;
}

/* the light on the top edge of the glass, brighter where the pointer is */
.card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: radial-gradient(160px 80px at var(--mx) var(--my), rgba(255, 255, 255, 0.5), transparent 70%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.16), transparent 40%);
  -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 exclude, linear-gradient(#000 0 0);
  pointer-events: none;
}

.card__sheen {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(220px 160px at var(--mx) var(--my), rgba(255, 255, 255, 0.05), transparent 70%);
  pointer-events: none;
}

.card__brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card__mark {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 70%, #fff), color-mix(in srgb, var(--accent) 55%, #000));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 4px 10px -3px color-mix(in srgb, var(--accent) 60%, transparent);
}

.card__mark svg {
  width: 13px;
  fill: none;
  stroke: #fff;
  stroke-width: 2.4;
  stroke-linecap: round;
}

.card__name {
  font-size: 12px;
  font-weight: 600;
  font-variation-settings: 'wdth' 106;
  letter-spacing: 0.01em;
}

.card__title {
  font-size: clamp(16px, 4.4vh, 20px);
  font-weight: 620;
  font-variation-settings: 'wdth' 100;
  letter-spacing: -0.015em;
  line-height: 1.15;
  margin-top: clamp(10px, 2.8vh, 18px);
}

.card__sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

/* ------------------------------------------------------------------ the fields */
.field {
  display: block;
  margin-top: clamp(8px, 2.4vh, 14px);
}

.card__sub + .field {
  margin-top: clamp(10px, 3vh, 18px);
}

.field__top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 11px;
  margin-bottom: 5px;
}

.field__label {
  color: #b7bbc8;
  font-weight: 500;
}

.field__note {
  position: relative;
  color: var(--muted);
}

.field__error {
  position: absolute;
  right: 0;
  top: 0;
  color: var(--bad);
  white-space: nowrap;
  opacity: 0;
}

.field__box {
  --lx: 30%;
  --lit: 0;
  position: relative;
  display: flex;
  align-items: center;
  height: clamp(32px, 8.6vh, 40px);
  border-radius: 10px;
  background: rgba(6, 7, 12, 0.5);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), inset 0 1px 2px rgba(0, 0, 0, 0.35);
  transition: background-color 0.3s;
}

/* the edge that catches the light where the caret is */
.field__box::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: radial-gradient(90px 46px at var(--lx) 0%, color-mix(in srgb, var(--accent) 100%, #fff), color-mix(in srgb, var(--accent) 34%, transparent) 70%);
  -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 exclude, linear-gradient(#000 0 0);
  opacity: var(--lit);
  pointer-events: none;
}

.field__box::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 11px;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent), 0 0 18px -4px color-mix(in srgb, var(--accent) 50%, transparent);
  opacity: var(--lit);
  pointer-events: none;
}

.field__box.is-wrong {
  background: color-mix(in srgb, var(--bad) 7%, rgba(6, 7, 12, 0.5));
}

.field__box.is-wrong::before {
  opacity: 1;
  background: color-mix(in srgb, var(--bad) 80%, transparent);
}

.field__box.is-wrong::after {
  opacity: 1;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 16%, transparent);
}

.field__input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0 12px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  letter-spacing: 0.005em;
  caret-color: var(--accent);
}

.field__input[type='password'] {
  letter-spacing: 0.14em;
}

.field__input::placeholder {
  color: #5d6272;
  letter-spacing: 0.005em;
}

.field__eye {
  display: grid;
  place-items: center;
  width: 34px;
  height: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
  border-radius: 0 10px 10px 0;
  transition: color 0.2s;
}

.field__eye svg {
  width: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  overflow: visible;
}

.eye__pupil {
  transform-box: fill-box;
  transform-origin: 50% 50%;
}

.eye__slash {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

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

/* ------------------------------------------------------------------ remember me */
.remember {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: clamp(8px, 2.4vh, 14px);
  font-size: 11.5px;
  color: #b7bbc8;
  cursor: pointer;
  align-self: flex-start;
}

.remember__input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.remember__box {
  display: grid;
  place-items: center;
  width: 15px;
  height: 15px;
  border-radius: 4.5px;
  background: rgba(6, 7, 12, 0.5);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
  transition: background-color 0.25s, box-shadow 0.25s;
}

.remember__box svg {
  width: 11px;
  fill: none;
  stroke: var(--button-ink);
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.remember__box path {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

.remember__input:checked + .remember__box {
  background: var(--accent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 60%, #fff), 0 0 12px -2px color-mix(in srgb, var(--accent) 70%, transparent);
}

.remember__input:focus-visible + .remember__box {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ------------------------------------------------------------------ sign in */
.submit {
  display: flex;
  justify-content: center;
  margin-top: clamp(10px, 2.8vh, 16px);
}

.signin {
  --a: 0deg;
  --beam: 0;
  position: relative;
  width: 100%;
  height: clamp(32px, 8.6vh, 40px);
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: var(--button);
  color: var(--button-ink);
  font: inherit;
  font-size: 13px;
  font-weight: 620;
  font-variation-settings: 'wdth' 100;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -1px 0 rgba(0, 0, 0, 0.12),
    0 1px 2px rgba(0, 0, 0, 0.4),
    0 10px 24px -10px color-mix(in srgb, var(--accent) 70%, transparent);
  transition: font-variation-settings 0.35s cubic-bezier(0.3, 1.6, 0.5, 1), background-color 0.3s;
}

.signin.is-busy {
  background: #1c1f2b;
  cursor: progress;
}

/* the light that runs around the edge while it signs in */
.signin__beam {
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 2px;
  background: conic-gradient(from var(--a), transparent 0deg, transparent 200deg, color-mix(in srgb, var(--accent) 40%, transparent) 260deg, var(--accent) 320deg, #ffffff 352deg, transparent 360deg);
  -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 exclude, linear-gradient(#000 0 0);
  opacity: var(--beam);
  filter: drop-shadow(0 0 4px var(--accent));
  pointer-events: none;
}

.signin__face {
  position: relative;
  display: grid;
  place-items: center;
  height: 100%;
}

.signin__words,
.signin__done {
  grid-area: 1 / 1;
  white-space: nowrap;
}

.signin__done {
  width: 16px;
  fill: none;
  stroke: var(--good);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.signin__done path {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

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

.or {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: clamp(8px, 2.2vh, 14px);
  font-size: 10.5px;
  color: #5d6272;
}

.or::before,
.or::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
}

.sso {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: clamp(32px, 8.6vh, 40px);
  margin-top: clamp(8px, 2.2vh, 14px);
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--ink);
  font: inherit;
  font-size: 12.5px;
  font-weight: 540;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: background-color 0.25s, box-shadow 0.25s;
}

.sso svg {
  width: 16px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.5;
  stroke-linecap: round;
  transition: stroke 0.25s;
}

@media (hover: hover) {
  .signin:not(.is-busy):hover {
    font-variation-settings: 'wdth' 112;
    background: #ffffff;
  }

  .sso:hover {
    background: rgba(255, 255, 255, 0.07);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  }

  .sso:hover svg {
    stroke: var(--accent);
  }

  .field__eye:hover {
    color: var(--ink);
  }

  .field__box:hover:not(:focus-within) {
    background: rgba(12, 13, 20, 0.6);
  }
}

/* small heights: the subtitle steps aside */
@media (max-height: 560px) {
  .card__sub {
    display: none;
  }
}

/* ------------------------------------------------------------------ the pointer of the walk */
.pointer {
  position: absolute;
  left: 0;
  top: 0;
  width: 18px;
  z-index: 5;
  fill: #ffffff;
  stroke: #0b0c12;
  stroke-width: 1.2;
  stroke-linejoin: round;
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.5));
  opacity: 0;
  pointer-events: none;
}
