/* The do not disturb switch with the light under the glass: the bedside panel of a hotel suite. The pad is smoked
   glass with a fine grain; under it a light (.glow) slides between the two keys, its bloom lighting the glass from
   below and a thin LED strip along the bottom. The edge of the glass (.pad__edge, a 1px ring cut with a mask) catches
   the light only where it sits. The colour of the light comes from JS as --lr --lg --lb. */
:root {
  --page: #000000;          /* the page */
  --panel: #0f0f11;         /* the panel around the glass */
  --glass-top: #19191c;     /* the smoked glass, top */
  --glass-bottom: #0c0c0e;  /* the smoked glass, bottom */
  --ink: #ececef;           /* the words */
  --muted: #7d7d86;         /* the small words */
  --dim: #5c5c64;           /* the keys that are off */
  --amber: #ffb054;         /* the light of Do not disturb */
  --ice: #9fd6ff;           /* the light of Make up 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: '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: 100svh;
  display: grid;
  place-items: center;
  padding: 16px;
  overflow: hidden;
}

/* ---------------------------------------------------------------- the panel */
.panel {
  --lr: 255;
  --lg: 176;
  --lb: 84;
  --li: 0;
  --lx: 50%;
  position: relative;
  width: min(88vw, 348px);
  padding: clamp(12px, 3.2vh, 16px);
  border-radius: 26px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0) 40%),
    var(--panel);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    inset 0 0 0 1px rgba(255, 255, 255, 0.05),
    0 1px 2px rgba(0, 0, 0, 0.6),
    0 24px 48px -20px rgba(0, 0, 0, 0.9),
    0 0 90px -30px rgba(var(--lr), var(--lg), var(--lb), calc(var(--li) * 0.35));
  opacity: 0;
}

.panel__head,
.panel__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 4px;
}

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

.panel__hotel {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-variation-settings: 'wdth' 118;
}

/* ---------------------------------------------------------------- the glass */
.pad {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: clamp(78px, 21vh, 96px);
  margin: clamp(10px, 2.6vh, 14px) 0;
  border-radius: 18px;
  overflow: hidden;
  isolation: isolate;
  background: linear-gradient(180deg, var(--glass-top), var(--glass-bottom));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    inset 0 -1px 0 rgba(0, 0, 0, 0.6),
    inset 0 10px 24px -14px rgba(0, 0, 0, 0.9),
    0 1px 0 rgba(255, 255, 255, 0.04);
}

.pad__grain {
  position: absolute;
  inset: 0;
  z-index: 3;
  opacity: 0.16;
  mix-blend-mode: overlay;
  pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* the light under the glass: JS moves it (x, width); its parts read the colour and the intensity */
.glow {
  position: absolute;
  left: 0;
  top: 0;
  width: 120px;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  will-change: transform;
}

.glow__bloom {
  position: absolute;
  left: -40%;
  right: -40%;
  top: 18%;
  bottom: -60%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(var(--lr), var(--lg), var(--lb), 0.42), rgba(var(--lr), var(--lg), var(--lb), 0.12) 55%, transparent);
  opacity: var(--li);
}

.glow__strip {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 7px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, rgba(var(--lr), var(--lg), var(--lb), 0.9) 22%, #fff 50%, rgba(var(--lr), var(--lg), var(--lb), 0.9) 78%, transparent);
  box-shadow: 0 0 12px 2px rgba(var(--lr), var(--lg), var(--lb), 0.55), 0 -6px 18px 0 rgba(var(--lr), var(--lg), var(--lb), 0.25);
  opacity: var(--li);
}

/* the edge of the glass catching the light: a 1px ring lit only around --lx */
.pad__edge {
  position: absolute;
  inset: 0;
  z-index: 4;
  padding: 1px;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(42% 120% at var(--lx) 100%, rgba(var(--lr), var(--lg), var(--lb), calc(var(--li) * 0.95)), 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);
}

/* the still reflection of the glass: a soft diagonal band, as on a real smoked plate */
.pad::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  border-radius: inherit;
  background: linear-gradient(112deg, transparent 18%, rgba(255, 255, 255, 0.045) 30%, rgba(255, 255, 255, 0.012) 40%, transparent 52%);
}

/* a faint reflection that follows the pointer over the glass */
.pad__sheen {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(160px 110px at var(--px, 50%) var(--py, 0%), rgba(255, 255, 255, 0.07), transparent 70%);
  transition: opacity 0.4s ease;
}

@media (hover: hover) {
  .pad:hover .pad__sheen {
    opacity: 1;
  }
}

/* the thin line between the two keys */
.pad__seam {
  position: absolute;
  left: 50%;
  top: 22%;
  bottom: 22%;
  width: 1px;
  z-index: 2;
  background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.08), transparent);
}

/* ---------------------------------------------------------------- the keys */
.key {
  position: relative;
  z-index: 5;
  display: block;
  height: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: var(--dim);
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
  border-radius: 18px;
}

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

.key:focus-visible .key__face {
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.35);
}

.key__face {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(6px, 1.6vh, 9px);
  height: 100%;
  border-radius: 16px;
  margin: 2px;
  height: calc(100% - 4px);
  transition: color 0.45s ease;
}

.key__icon {
  width: 20px;
  height: 20px;
  fill: currentColor;
  overflow: visible;
  transition: filter 0.45s ease;
}

.key__label {
  font-size: 13px;
  font-weight: 560;
  font-variation-settings: 'wdth' 100;
  letter-spacing: 0.005em;
  white-space: nowrap;
  transition: font-variation-settings 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), text-shadow 0.45s ease;
}

@media (hover: hover) {
  .key:hover {
    color: #9a9aa3;
  }
  .key:hover .key__label {
    font-variation-settings: 'wdth' 108;
  }
}

.key[aria-pressed='true'] {
  color: rgb(var(--kr), var(--kg), var(--kb));
}

.key[data-key='dnd'] {
  --kr: 255;
  --kg: 214;
  --kb: 168;
}

.key[data-key='mur'] {
  --kr: 214;
  --kg: 238;
  --kb: 255;
}

.key[aria-pressed='true'] .key__label {
  text-shadow: 0 0 14px rgba(var(--lr), var(--lg), var(--lb), 0.55);
}

.key[aria-pressed='true'] .key__icon {
  filter: drop-shadow(0 0 6px rgba(var(--lr), var(--lg), var(--lb), 0.7));
}

/* the ring of the touch, spreading under the glass */
.ripple {
  position: absolute;
  width: 120px;
  height: 120px;
  margin: -60px 0 0 -60px;
  border-radius: 50%;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
  background: radial-gradient(closest-side, rgba(255, 255, 255, 0.06), transparent);
}

/* ---------------------------------------------------------------- the line under */
.panel__foot {
  min-height: 18px;
}

.status {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 18px;
  overflow: hidden;
}

.status__line {
  position: absolute;
  left: 0;
  top: 0;
  max-width: 100%;
  font-size: 12px;
  line-height: 18px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.panel__door {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: none;
  height: 20px;
  padding: 0 8px 0 6px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.09);
  transition: color 0.45s ease, box-shadow 0.45s ease, background-color 0.45s ease;
}

.panel__door svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.panel__door.is-on {
  color: rgb(var(--lr), var(--lg), var(--lb));
  background-color: rgba(var(--lr), var(--lg), var(--lb), 0.08);
  box-shadow: inset 0 0 0 1px rgba(var(--lr), var(--lg), var(--lb), 0.35);
}
