/* The swipe actions inbox: a small inbox card on a white page, hairline borders and soft shadows, Mona Sans
   and one accent for Archive. */
:root {
  --page: #ffffff;          /* the page */
  --card: #ffffff;          /* the inbox card and the rows */
  --ink: #17171a;           /* names, subjects, the fake pointer */
  --muted: #8a8a93;         /* previews, times, the read rows */
  --line: rgba(23, 23, 26, 0.08); /* hairlines: the card border and the row dividers */
  --well: #f2f2f4;          /* under the rows: Snooze and the avatars */
  --accent: #2c5cff;        /* Archive */
  --accent-ink: #ffffff;    /* the words on Archive */
  --toast: #17171a;         /* the Undo toast */
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--ink);
  font-family: 'Mona Sans Variable', 'Mona Sans', 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: 24px 16px;
  overflow: hidden;
}

/* the wrap keeps the height of the full card, so the card does not jump when a row goes: the freed space below
   the card is where the toast lands */
.wrap {
  position: relative;
  width: min(372px, 100%);
}

/* ---------------------------------------------------------------- the card */
.inbox {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 1px 2px rgba(20, 20, 30, 0.04), 0 12px 32px -12px rgba(20, 20, 40, 0.14), 0 30px 60px -30px rgba(20, 20, 40, 0.12);
  overflow: hidden;
  isolation: isolate;
}

.inbox__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 16px 18px 10px;
}

.inbox__title {
  margin: 0;
  font-size: 17px;
  font-weight: 640;
  font-stretch: 104%;
  letter-spacing: -0.01em;
}

.inbox__count {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin: 0;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
}

/* rolling digits: each digit is a column 0 to 9 seen through a window one line tall */
.roll {
  display: inline-flex;
  align-items: flex-start;
  height: 1.2em;
  line-height: 1.2em;
  overflow: hidden;
  color: var(--ink);
  font-weight: 600;
}

.roll__col {
  display: flex;
  flex-direction: column;
  will-change: transform;
}

.roll__col span {
  display: block;
  height: 1.2em;
  text-align: center;
}

.inbox__list {
  position: relative;
  margin: 0;
  padding: 0 0 6px;
  list-style: none;
}

/* ---------------------------------------------------------------- a row */
.row {
  position: relative;
  overflow: hidden;
}

.row + .row::before {
  content: '';
  position: absolute;
  top: 0;
  left: 66px;
  right: 0;
  height: 1px;
  background: var(--line);
  z-index: 2;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.row.is-moving + .row::before,
.row.is-moving::before {
  opacity: 0;
}

.row.is-gone + .row::before {
  opacity: 1;
}

.row__card {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 18px 12px 18px;
  background: var(--card);
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
  outline: none;
  will-change: transform;
}

.row.is-moving .row__card {
  cursor: grabbing;
}

/* the soft shadow on the right edge of the card while it slides: it lifts off the actions under it */
.row__card::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  right: -1px;
  width: 18px;
  box-shadow: 8px 0 18px -6px rgba(20, 20, 40, 0.22);
  opacity: var(--lift, 0);
  pointer-events: none;
}

.row__card:focus-visible {
  box-shadow: inset 0 0 0 2px var(--accent);
  border-radius: 12px;
}

.ava {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-top: 1px;
  border-radius: 50%;
  background: var(--well);
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: 11.5px;
  font-weight: 620;
  font-stretch: 108%;
  letter-spacing: 0.02em;
  color: #55555e;
}

.row__body {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 1px;
}

.row__top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
}

.row__from {
  font-size: 13.5px;
  font-weight: 640;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row__time {
  flex: none;
  font-size: 11.5px;
  color: var(--muted);
}

.row__subj {
  font-size: 13px;
  font-weight: 560;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

/* read rows: lighter names and subjects instead of an unread mark */
.row.is-read .row__from,
.row.is-read .row__subj {
  font-weight: 460;
}

.row.is-read .row__subj {
  color: #4a4a52;
}

/* ---------------------------------------------------------------- the actions under the row */
.row__acts {
  position: absolute;
  inset: 0 0 0 auto;
  width: 100%;
  z-index: 0;
  pointer-events: none;
}

.row.is-open .row__acts,
.row.is-moving .row__acts {
  pointer-events: auto;
}

.act {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  width: 0;
  padding: 0;
  border: 0;
  margin: 0;
  overflow: hidden;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.act--snooze {
  background: var(--well);
  color: var(--ink);
}

.act--archive {
  background: var(--accent);
  color: var(--accent-ink);
}

.act__in {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  justify-items: center;
  gap: 4px;
  width: 64px;
  margin: -21px 0 0 -32px;
  will-change: transform;
}

.act svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.act__label {
  font-size: 11.5px;
  font-weight: 560;
  font-stretch: 100%;
  letter-spacing: 0.005em;
}

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

/* ---------------------------------------------------------------- the toast */
.toast {
  position: absolute;
  left: 50%;
  bottom: 10px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 8px 8px 16px;
  border-radius: 999px;
  background: var(--toast);
  color: #f4f4f6;
  font-size: 13px;
  font-weight: 520;
  box-shadow: 0 10px 30px -10px rgba(10, 10, 20, 0.45);
  transform: translate(-50%, 16px);
  opacity: 0;
  visibility: hidden;
  white-space: nowrap;
}

.toast__undo {
  padding: 6px 12px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

@media (hover: hover) {
  .row__card {
    transition: background-color 0.25s ease;
  }

  .row:not(.is-moving) .row__card:hover {
    background: #fbfbfc;
  }

  .toast__undo:hover {
    background: rgba(255, 255, 255, 0.2);
  }

  .act--snooze:hover {
    background: #e9e9ed;
  }
}

.toast__undo:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

/* ---------------------------------------------------------------- the fake pointer of the autopilot */
.hand {
  position: absolute;
  top: 0;
  left: 0;
  width: 22px;
  height: 22px;
  z-index: 10;
  fill: var(--ink);
  stroke: #ffffff;
  stroke-width: 1.4;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.18));
  opacity: 0;
  pointer-events: none;
  will-change: transform;
}

@media (max-width: 380px) {
  .inbox__head {
    padding: 14px 14px 8px;
  }

  .row__card {
    padding: 11px 14px;
    gap: 10px;
  }

  .row + .row::before {
    left: 58px;
  }
}

/* when every row is gone */
.inbox__empty {
  position: absolute;
  left: 0;
  right: 0;
  top: 64px;
  margin: 0;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  opacity: 0;
  visibility: hidden;
}
