/* The digital room key button that unlocks the door. One rounded box of smoked glass (.rk__glass, moved only by GSAP):
   a dark warm base, the warm door light that spreads from the lock (.rk__door), the light under the pointer
   (.rk__shine) and a frosted pane with grain and a 1px edge on top (.rk__frost). On the left the lock sits in a
   champagne metal well with a ring of light around it; the words and the contactless sign sit on top. */
:root {
  --page: #0b0a09;            /* the page */
  --glass: #17151a;           /* the body of the button */
  --ink: #f4efe6;             /* the words */
  --muted: rgba(244, 239, 230, 0.56); /* the small words */
  --brass: #d8b47a;           /* the champagne metal of the lock */
  --amber: #ffb35a;           /* the warm light of the open door */
  --edge: rgba(255, 255, 255, 0.1);   /* the edge of the glass at rest */
}

* {
  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;
}

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

/* the page: near black, a faint warm glow behind the button and a fine grain, never flat */
.stage {
  position: relative;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 16px;
  overflow: hidden;
  background:
    radial-gradient(min(70vw, 520px) min(36vh, 260px) at 50% 52%, rgba(216, 180, 122, 0.075), transparent 70%),
    var(--page);
}

.stage::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.5;
  background: 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.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.06 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

.rk {
  position: relative;
  display: grid;
  place-items: center;
}

/* the light the button throws on the floor: faint champagne at rest, warm amber when the door is open */
.rk__spill {
  position: absolute;
  left: 50%;
  top: 100%;
  width: 110%;
  height: 44px;
  margin: -16px 0 0 -55%;
  border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--amber) 55%, transparent), color-mix(in srgb, var(--brass) 18%, transparent) 55%, transparent);
  filter: blur(14px);
  opacity: 0.16;
  pointer-events: none;
}

.rk__btn {
  appearance: none;
  border: 0;
  padding: 0;
  margin: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  border-radius: 999px;
  -webkit-tap-highlight-color: transparent;
}

.rk__btn:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--brass) 80%, white);
  outline-offset: 5px;
}

.rk__glass {
  --mx: 30%;
  --my: 50%;
  position: relative;
  display: block;
  width: min(86vw, 304px);
  height: 60px;
  border-radius: 999px;
  isolation: isolate;
  box-shadow:
    0 1px 1px rgba(0, 0, 0, 0.8),
    0 8px 18px -10px rgba(0, 0, 0, 0.9),
    0 26px 50px -26px rgba(0, 0, 0, 1),
    0 0 0 0.5px rgba(0, 0, 0, 0.6);
}

.rk__base,
.rk__rim,
.rk__door,
.rk__shine,
.rk__frost {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  pointer-events: none;
}

.rk__base {
  background:
    radial-gradient(120px 70px at 12% 50%, rgba(216, 180, 122, 0.1), transparent 70%),
    linear-gradient(180deg, #1d1b20, var(--glass) 55%, #121014);
}

/* the warm light of the door: a wedge that grows from the lock to the right, with a bright edge that leads it */
.rk__door-light {
  position: absolute;
  inset: 0;
  transform-origin: 30px 50%;
  background:
    radial-gradient(140px 90px at 30px 50%, color-mix(in srgb, var(--amber) 62%, transparent), transparent 75%),
    linear-gradient(90deg, color-mix(in srgb, var(--amber) 34%, transparent) 0%, color-mix(in srgb, var(--amber) 16%, transparent) 55%, color-mix(in srgb, var(--amber) 6%, transparent) 100%);
  opacity: 0;
}

.rk__door-edge {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 26px;
  background: linear-gradient(90deg, transparent, rgba(255, 220, 170, 0.5) 50%, transparent);
  filter: blur(3px);
  opacity: 0;
}

.rk__shine {
  background: radial-gradient(96px 64px at var(--mx) var(--my), rgba(255, 244, 226, 0.13), rgba(255, 244, 226, 0.03) 50%, transparent 72%);
  opacity: 0;
}

/* the frosted pane: grain, a 1px edge, the top edge catching the light and a darker one below */
.rk__frost {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.16 0'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E"),
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0) 50%, rgba(0, 0, 0, 0.18));
  background-size: 120px 120px, 100% 100%;
  box-shadow:
    inset 0 0 0 1px var(--edge),
    inset 0 1px 0 rgba(255, 246, 230, 0.2),
    inset 0 -1px 0 rgba(0, 0, 0, 0.5),
    inset 0 -12px 18px -14px rgba(0, 0, 0, 0.7);
}

.rk__frost::after {
  content: '';
  position: absolute;
  left: 7%;
  right: 7%;
  top: 1px;
  height: 44%;
  border-radius: 999px 999px 40% 40%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0));
}

/* the edge of the glass catching the warm light of the open door, stronger near the lock */
.rk__rim {
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--amber) 22%, transparent),
    inset 0 1px 0 color-mix(in srgb, var(--amber) 55%, transparent);
  -webkit-mask-image: linear-gradient(90deg, #000 0%, rgba(0, 0, 0, 0.6) 45%, rgba(0, 0, 0, 0.15) 100%);
  mask-image: linear-gradient(90deg, #000 0%, rgba(0, 0, 0, 0.6) 45%, rgba(0, 0, 0, 0.15) 100%);
}

.rk__row {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 14px 0 7px;
  gap: 12px;
}

/* the lock well: a ring of light around a champagne metal rim and a dark face */
.rk__well {
  position: relative;
  flex: none;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
}

.rk__ring {
  position: absolute;
  left: -6px;
  top: -6px;
  width: 58px;
  height: 58px;
  overflow: visible;
}

.rk__ring circle {
  fill: none;
}

.rk__ring-track {
  stroke: rgba(255, 255, 255, 0.06);
  stroke-width: 1;
}

.rk__ring-line,
.rk__ring-glow {
  stroke: url(#rk-grad);
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

.rk__ring-line {
  stroke-width: 2;
}

.rk__ring-glow {
  stroke-width: 5;
  filter: blur(3px);
  opacity: 0.7;
}

.rk__metal {
  --ang: 210deg;
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  padding: 2px;
  background: conic-gradient(from var(--ang), #8c7148, #f3dcb0 12%, #b8945e 26%, #6e5636 42%, #caa66d 58%, #fff0cf 70%, #9a7b4d 84%, #8c7148);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.06),
    0 4px 10px -3px rgba(0, 0, 0, 0.8),
    0 0 0 0.5px rgba(0, 0, 0, 0.7);
}

.rk__face {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background:
    radial-gradient(30px 22px at 50% 18%, rgba(255, 255, 255, 0.09), transparent 70%),
    radial-gradient(circle at 50% 60%, #221f22, #0f0e10 75%);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.9), inset 0 -1px 0 rgba(255, 255, 255, 0.05);
}

.rk__lock {
  width: 22px;
  height: 22px;
  overflow: visible;
}

.rk__shackle {
  fill: none;
  stroke: var(--brass);
  stroke-width: 2;
  stroke-linecap: round;
}

.rk__shackle--open {
  opacity: 0;
}

.rk__body {
  fill: var(--brass);
}

.rk__body-hi {
  fill: rgba(255, 246, 225, 0.55);
}

.rk__hole {
  fill: #141215;
}

.rk__words {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 2px;
  text-align: left;
}

.rk__stack {
  display: grid;
  min-width: 0;
}

.rk__label,
.rk__sub {
  grid-area: 1 / 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rk__label {
  font-size: 15.5px;
  font-weight: 580;
  font-variation-settings: 'wdth' 102;
  letter-spacing: 0.004em;
  line-height: 1.2;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.4);
}

.rk__label--open {
  color: #fff3e0;
}

.rk__sub {
  font-size: 11.5px;
  font-weight: 480;
  font-variation-settings: 'wdth' 96;
  letter-spacing: 0.012em;
  line-height: 1.25;
  color: var(--muted);
}

/* the seconds roll: the old digit goes up, the new one comes from below */
.rk__count {
  position: relative;
  display: inline-grid;
  height: 1.25em;
  overflow: hidden;
  vertical-align: bottom;
  font-variant-numeric: tabular-nums;
  color: color-mix(in srgb, var(--amber) 70%, var(--ink));
}

.rk__digit {
  grid-area: 1 / 1;
}

.rk__nfc {
  flex: none;
  width: 24px;
  height: 24px;
  display: grid;
}

.rk__nfc svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.rk__arc {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.7;
  stroke-linecap: round;
  opacity: 0.32;
}

/* before the script runs, only the rest state shows */
.rk__label + .rk__label,
.rk__sub + .rk__sub {
  opacity: 0;
}
