/* The flaring bell: a dark round button on a black page, with a warm white bell in it; the bell, the preview of a new
   notification and the panel are the same warm white shape, drawn by script.js. Unread notifications are lit in
   yellow, like the badge. */
:root {
  --page: #000000;          /* the page */
  --button: #161618;        /* the bell's button */
  --button-hover: #202023;  /* the button under the pointer */
  --button-line: rgba(255, 255, 255, 0.09);   /* the button's edge */
  --ghost: rgba(255, 255, 255, 0.16);         /* the bell's print in the button while the bell is out */
  --sheet: #fbfaf6;         /* the bell, the preview and the panel */
  --ink: #18171c;           /* the words */
  --muted: #77757d;         /* the quieter words */
  --line: #ebe9e2;          /* the line under the heading */
  --hover: #f2f0ea;         /* a row under the pointer */
  --accent: #ffd43a;        /* the badge */
  --accent-ink: #1d1704;    /* the number on the badge */
  --wash: #fff2bf;          /* an unread row */
  --wash-hover: #ffeca6;    /* an unread row under the pointer */
  --face-1: #f3d2c6;        /* the people's initials, five tints */
  --face-2: #cfe3d4;
  --face-3: #d6d8f4;
  --face-4: #f0e2b6;
  --face-5: #cfe2ee;
  --face-ink: #26242b;
  --room: 64px;             /* the room the shape has round the panel to overshoot into */
}

* {
  box-sizing: border-box;
}

/* a tap is a click at once: no wait for a double tap, no zoom */
html {
  touch-action: manipulation;
}

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

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--ink);
  font-family: 'Recursive Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

/* the button sits at the top of the room the panel opens into */
.stage {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  overflow-x: clip;
}

.inbox {
  position: relative;
  width: min(360px, 100%);
  height: 540px;
}

/* ---------------------------------------------------------------- the button */
.bell {
  position: absolute;
  top: 0;
  left: calc(50% - 28px);
  z-index: 1;
  width: 56px;
  height: 56px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--button);
  box-shadow: inset 0 0 0 1px var(--button-line), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  transition: background-color 0.2s ease, transform 0.16s cubic-bezier(0.23, 1, 0.32, 1);
}

@media (hover: hover) and (pointer: fine) {
  .bell:hover {
    background: var(--button-hover);
  }
}

.bell:active {
  transform: scale(0.96);
}

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

/* the bell's print, while the bell itself is out being the preview or the panel */
.bell__ghost {
  display: block;
  width: 56px;
  height: 56px;
  opacity: 0;
}

.bell__ghost path {
  fill: var(--ghost);
}

/* ---------------------------------------------------------------- the shape */
/* all of it is painted warm white, and the script cuts it to the bell, the preview or the panel with a path; it is
   wider and taller than the panel so the flare has room to overshoot */
.sheet {
  position: absolute;
  top: 0;
  left: calc(-1 * var(--room));
  z-index: 2;
  width: calc(100% + 2 * var(--room));
  height: calc(100% + var(--room));
  background: var(--sheet);
  clip-path: inset(0 0 100% 0);
  pointer-events: none;
}

/* ---------------------------------------------------------------- the preview */
.peek {
  position: absolute;
  top: 68px;
  left: 50%;
  translate: -50% 0;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - 2 * var(--room) - 16px);
  height: 34px;
  margin: 0;
  padding: 0 14px 0 6px;
  font-size: 13px;
  font-weight: 520;
  white-space: nowrap;
  opacity: 0;
}

.peek__face {
  flex: none;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  font-size: 9.5px;
  font-weight: 720;
  letter-spacing: 0.02em;
}

.peek__text {
  overflow: hidden;
  text-overflow: ellipsis;
}

.peek__text b {
  font-weight: 720;
}

/* ---------------------------------------------------------------- the panel */
.panel {
  position: absolute;
  top: 68px;
  left: var(--room);
  width: calc(100% - 2 * var(--room));
  visibility: hidden;
}

.inbox.is-open .panel {
  visibility: visible;
  pointer-events: auto;
}

.panel__head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 10px 10px 18px;
  border-bottom: 1px solid var(--line);
}

.panel__title {
  margin: 0;
  font-size: 16px;
  line-height: 24px;
  font-weight: 720;
  letter-spacing: -0.01em;
}

/* the place where the badge lands */
.panel__slot {
  flex: none;
  width: 52px;
  height: 18px;
}

.panel__all {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  margin-left: auto;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.18s ease, color 0.2s ease, transform 0.16s cubic-bezier(0.23, 1, 0.32, 1);
}

@media (hover: hover) and (pointer: fine) {
  .panel__all:hover {
    background: var(--hover);
  }
}

.panel__all:active {
  transform: scale(0.97);
}

.panel__all:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}

.panel__all[aria-disabled='true'] {
  color: var(--muted);
  cursor: default;
  background: transparent;
}

.panel__tick {
  display: none;
  width: 16px;
  height: 16px;
  margin-left: -2px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.panel__all[aria-disabled='true'] .panel__tick {
  display: block;
}

/* ---------------------------------------------------------------- the rows */
.notes {
  margin: 0;
  padding: 6px 6px 8px;
  list-style: none;
}

.note-item + .note-item {
  margin-top: 3px;
}

.note {
  position: relative;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 0 12px;
  align-items: start;
  width: 100%;
  padding: 11px 12px 11px 10px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.18s ease, transform 0.16s cubic-bezier(0.23, 1, 0.32, 1);
}

.note:active {
  transform: scale(0.985);
}

@media (hover: hover) and (pointer: fine) {
  .note:hover {
    background: var(--hover);
  }

  .note:hover .note__wash {
    background: var(--wash-hover);
  }
}

/* the keyboard's ring lies over the yellow of an unread row */
.note::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 12px;
  pointer-events: none;
}

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

.note:focus-visible::after {
  box-shadow: inset 0 0 0 2px var(--ink);
}

/* the yellow of an unread row: the reading sweeps it away from the left, through a mask with a soft edge */
.note__wash {
  --f: -80px;
  position: absolute;
  inset: 0;
  border-radius: 12px;
  background: var(--wash);
  opacity: 0;
  -webkit-mask-image: linear-gradient(90deg, transparent var(--f), #000 calc(var(--f) + 80px));
  mask-image: linear-gradient(90deg, transparent var(--f), #000 calc(var(--f) + 80px));
  transition: background-color 0.18s ease;
}

.note-item[data-unread] .note__wash {
  opacity: 1;
}

.note__face,
.note__text,
.note__time {
  position: relative;
}

.note__face {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  color: var(--face-ink);
  font-size: 12px;
  font-weight: 720;
  letter-spacing: 0.02em;
}

.face-1 { background: var(--face-1); }
.face-2 { background: var(--face-2); }
.face-3 { background: var(--face-3); }
.face-4 { background: var(--face-4); }
.face-5 { background: var(--face-5); }

.note__face--app {
  background: var(--ink);
  color: var(--sheet);
}

.note__face svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.note__text {
  display: block;
  min-width: 0;
}

/* Recursive keeps every letter as wide at every weight: the weight can change letter by letter with nothing moving */
.note__line {
  display: block;
  font-size: 14px;
  line-height: 20px;
  font-weight: 420;
}

.note__line b {
  font-weight: 640;
}

.note-item[data-unread] .note__line {
  font-weight: 560;
}

.note-item[data-unread] .note__line b {
  font-weight: 780;
}

.note__line .w,
.note__line b {
  white-space: nowrap;
}

.note__said {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  line-height: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note__time {
  color: var(--muted);
  font-size: 12px;
  line-height: 20px;
  font-variant-numeric: tabular-nums;
  transition: color 0.3s ease;
}

.note-item[data-unread] .note__time {
  color: var(--ink);
  font-weight: 600;
}

/* ---------------------------------------------------------------- the badge */
.badge {
  --ring: var(--page);
  position: absolute;
  top: 0;
  left: 0;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 0 0 2.5px var(--ring);
  font-size: 11px;
  font-weight: 780;
  font-variant-numeric: tabular-nums;
  line-height: 18px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  will-change: transform;
}

/* the number rolls: the old one leaves upwards and the new one comes from below (the other way when it goes down) */
.badge__num {
  position: relative;
  display: inline-block;
  height: 18px;
  overflow: hidden;
}

.badge__num span {
  display: block;
}

.badge__num span + span {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  text-align: center;
}

.badge__word {
  display: inline-block;
  max-width: 0;
  overflow: hidden;
  opacity: 0;
  font-weight: 700;
}
