/* The smart home notification stack that springs aside: dark glass cards on a near black page with a warm lamp glow
   behind. Each card is an .note placed by the script (its transform is written every frame by the springs); the
   glass inside it (.note__glass) holds the CSS states: the sheen that follows the tilt, the edge that catches the
   light, the lift while a finger holds it. */
:root {
  --page: #0b0b0d;                       /* the page */
  --glass: rgba(36, 37, 42, 0.84);       /* the glass of a card, top */
  --glass-low: rgba(21, 22, 25, 0.9);   /* the glass of a card, bottom */
  --edge: rgba(255, 255, 255, 0.11);     /* the 1 px edge at rest */
  --ink: #eeedf0;                        /* the titles */
  --muted: #8d8c95;                      /* the small words */
  --accent: #ffb25e;                     /* the warm lamp colour: icons, the glow, the new card's edge */
  --cool: #5c6b8a;                       /* the cool light far behind */
}

* {
  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 {
  position: relative;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 12px;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

/* ---------------------------------------------------------------- the lamp glow behind the glass */
.glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.glow__a,
.glow__b {
  position: absolute;
  left: 50%;
  top: 50%;
  border-radius: 50%;
  filter: blur(min(9vw, 60px));
}

.glow__a {
  width: min(70vw, 62vh, 360px);
  height: min(42vw, 36vh, 210px);
  margin: max(-21vw, -18vh, -105px) 0 0 max(-50vw, -44vh, -250px);
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 34%, transparent), transparent);
  animation: drift-a 14s ease-in-out infinite alternate;
}

.glow__b {
  width: min(60vw, 52vh, 300px);
  height: min(40vw, 34vh, 200px);
  margin: 0 0 0 max(-6vw, -5vh, -30px);
  background: radial-gradient(closest-side, color-mix(in srgb, var(--cool) 40%, transparent), transparent);
  animation: drift-b 17s ease-in-out infinite alternate;
}

@keyframes drift-a {
  to { transform: translate(18%, 12%) scale(1.08); }
}

@keyframes drift-b {
  to { transform: translate(-22%, -16%) scale(0.94); }
}

/* ---------------------------------------------------------------- the panel */
.panel {
  position: relative;
  width: var(--cw, 320px);
  display: flex;
  flex-direction: column;
  gap: var(--gap, 14px);
}

.head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
  font-size: 12.5px;
  letter-spacing: 0.01em;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-stretch: 108%;
  color: var(--ink);
}

.brand__mark {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.brand__door {
  stroke: var(--ink);
  opacity: 0.7;
}

.count {
  display: inline-flex;
  align-items: center;
  line-height: 1.25em;
  gap: 5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.count__win {
  position: relative;
  display: inline-block;
  height: 1.25em;
  min-width: 0.7em;
  overflow: hidden;
  color: var(--ink);
  font-weight: 600;
}

.count__roll {
  display: block;
  position: relative;
  height: 1.25em;
  line-height: 1.25em;
}

.count__digit {
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  text-align: right;
}

.stack {
  position: relative;
  height: var(--sh, 300px);
  touch-action: pan-y;
}

.stack__empty {
  position: absolute;
  left: 0;
  right: 0;
  top: var(--ey, 40%);
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  opacity: 0;
  pointer-events: none;
}

.stack__empty svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hint {
  margin: 0;
  text-align: center;
  font-size: 11.5px;
  letter-spacing: 0.02em;
  color: var(--muted);
  opacity: 0.75;
}

/* ---------------------------------------------------------------- one notification */
.note {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--cw, 320px);
  height: var(--ch, 72px);
  transform-origin: 50% 100%;
  will-change: transform, opacity;
  cursor: grab;
  --lift: 0;
  --sx: 30%;
  --new: 0;
  --hot: 0;
}

.note.is-held {
  cursor: grabbing;
}

.note__shadow {
  position: absolute;
  inset: 6px 10px 0;
  border-radius: 18px;
  box-shadow:
    0 1px 1px rgba(0, 0, 0, 0.35),
    0 calc(8px + var(--lift) * 14px) calc(18px + var(--lift) * 26px) rgba(0, 0, 0, calc(0.42 + var(--lift) * 0.16)),
    0 calc(22px + var(--lift) * 30px) calc(40px + var(--lift) * 40px) rgba(0, 0, 0, 0.32);
  pointer-events: none;
}

.note__glass {
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  border-radius: 18px;
  overflow: hidden;
  background: linear-gradient(180deg, var(--glass), var(--glass-low));
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  backdrop-filter: blur(18px) saturate(150%);
  transition: transform 0.35s cubic-bezier(0.3, 1.5, 0.5, 1);
}

/* the grain: a few pixels of noise in the glass */
.note__glass::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.05;
  background-image: 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%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
  pointer-events: none;
}

/* the sheen: a soft band of light that slides with the card's tilt and drag */
.note__sheen {
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent calc(var(--sx) - 26%), rgba(255, 255, 255, calc(0.05 + var(--lift) * 0.05)) var(--sx), transparent calc(var(--sx) + 26%));
  pointer-events: none;
}

/* the 1 px edge: brighter on top, warm for a moment when the card has just come in */
.note__edge {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(180deg,
      color-mix(in srgb, var(--accent) calc(var(--new) * 70%), rgba(255, 255, 255, 0.2)),
      var(--edge) 40%,
      rgba(255, 255, 255, 0.09));
  -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;
}

.note__icon,
.note__text {
  opacity: var(--inner, 1);
}

.note__icon {
  flex: none;
  position: relative;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 17%, transparent), color-mix(in srgb, var(--accent) 7%, transparent));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.note__icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.55;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.note__text {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.note__top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 10.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.note__title {
  font-size: 14px;
  font-weight: 600;
  font-stretch: 104%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.note__line {
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.note__time {
  font-variant-numeric: tabular-nums;
}

.is-small .note__glass {
  gap: 10px;
  padding: 0 12px;
}

.is-small .note__icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
}

.is-small .note__title {
  font-size: 13px;
}

.is-small .note__line {
  font-size: 11.5px;
}

@media (hover: hover) {
  .note:hover .note__glass {
    transform: translateY(-1px);
  }
}

.note.is-held .note__glass {
  transform: scale(1.015);
}

/* ---------------------------------------------------------------- the drawn pointer */
.pointer {
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  opacity: 0;
  pointer-events: none;
  z-index: 500;
  fill: #f6f5f2;
  stroke: #111;
  stroke-width: 1.1;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.5));
}

@media (prefers-reduced-motion: reduce) {
  .glow__a,
  .glow__b {
    animation: none;
  }

  .note__glass {
    transition: none;
  }
}
