:root {
  --fondo: #ffffff;
  --carta: #ffffff;
  --testo: #18181b;
  --testo-2: #6b6b73;
  --testo-3: #a1a1aa;
  --bordo: rgba(17, 17, 19, 0.1);
  --riga: rgba(17, 17, 19, 0.07);
  --lit: #f4f4f5;
  --accento: #e2662b;
  --accento-tenue: #fdf1ea;
  --faccia: #e9e4f6;
  --faccia-testo: #5b4a8b;
  --focus: #6d5efc;
}

* { box-sizing: border-box; margin: 0; }

html, body { height: 100%; }

body {
  background: var(--fondo);
  color: var(--testo);
  font-family: "Mona Sans Variable", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

.stage {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 12px;
}

/* the row plus the room the menu needs under it, so the open menu always stays inside the frame */
.inbox {
  position: relative;
  width: min(420px, 94vw);
  height: 318px;
}

/* GSAP owns the slot's height when the email folds into the notice */
.slot {
  position: relative;
  height: 78px;
  border-radius: 16px;
  background: var(--carta);
  border: 1px solid var(--bordo);
  box-shadow: 0 1px 2px rgba(17, 17, 19, 0.04), 0 8px 24px -14px rgba(17, 17, 19, 0.18);
  overflow: hidden;
}

.mail {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px 0 14px;
}

.mail__face {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--faccia);
  color: var(--faccia-testo);
  font-size: 12.5px;
  font-weight: 620;
  letter-spacing: 0.02em;
}

.mail__body { flex: 1; min-width: 0; }

.mail__top {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 13.5px;
  line-height: 1.25;
}
.mail__from { font-weight: 640; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail__at { flex: none; color: var(--testo-3); font-size: 12px; }
.mail__subject {
  font-size: 13px;
  line-height: 1.3;
  font-weight: 520;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mail__preview {
  font-size: 12.5px;
  line-height: 1.3;
  color: var(--testo-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* the Snooze button: GSAP squeezes the inner span, the CSS colours the outer one */
.snooze {
  flex: none;
  height: 36px;
  padding: 0;
  border: 1px solid var(--bordo);
  border-radius: 10px;
  background: var(--carta);
  color: var(--testo);
  font: inherit;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}
.snooze__press {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 100%;
  padding: 0 11px 0 9px;
  font-size: 13px;
  font-weight: 560;
}
.snooze.is-on,
.snooze[aria-expanded="true"] {
  background: var(--accento-tenue);
  border-color: color-mix(in srgb, var(--accento) 32%, transparent);
  color: var(--accento);
}
@media (hover: hover) {
  .snooze:hover { background: #fafafa; box-shadow: 0 1px 0 rgba(17, 17, 19, 0.04); }
  .snooze[aria-expanded="true"]:hover { background: var(--accento-tenue); }
}
.snooze:focus-visible, .item:focus-visible, .undo:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.clock {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  overflow: visible;
}

/* the notice the email folds into */
.notice {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px 0 14px;
  visibility: hidden;
}
.notice__row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  font-size: 13px;
  color: var(--testo-2);
}
.notice__clock {
  flex: none;
  width: 17px;
  height: 17px;
  fill: none;
  stroke: var(--accento);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.notice__text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notice__text b { color: var(--testo); font-weight: 600; }
.undo {
  flex: none;
  height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--testo);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease;
}
@media (hover: hover) {
  .undo:hover { background: var(--lit); }
}
.undo.is-pressed { background: var(--lit); }

/* the menu: GSAP owns the outer box (scale, y, opacity), the inner holds the lines */
.menu {
  position: absolute;
  top: 86px;
  right: 6px;
  width: min(236px, 74vw);
  border-radius: 14px;
  background: var(--carta);
  border: 1px solid var(--bordo);
  box-shadow: 0 2px 4px rgba(17, 17, 19, 0.04), 0 18px 40px -16px rgba(17, 17, 19, 0.28);
  transform-origin: 88% 0%;
  visibility: hidden;
  opacity: 0;
  z-index: 2;
}
.menu__inner { position: relative; padding: 6px; }
.menu__head {
  padding: 6px 10px 6px;
  font-size: 11.5px;
  font-weight: 560;
  letter-spacing: 0.02em;
  color: var(--testo-3);
}

/* one highlight that slides between the lines */
.menu__lit {
  position: absolute;
  left: 6px;
  right: 6px;
  top: 0;
  height: 36px;
  border-radius: 9px;
  background: var(--lit);
  opacity: 0;
  pointer-events: none;
}

.item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--testo);
  font: inherit;
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
}
.item__name { font-weight: 520; }
.item__time {
  display: inline-block;
  font-size: 12.5px;
  color: var(--testo-3);
}
.item__cal {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--testo-3);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.menu__rule { display: block; height: 1px; margin: 4px 10px; background: var(--riga); }

.ghost {
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  fill: #18181b;
  stroke: #ffffff;
  stroke-width: 1.3;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.22));
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  z-index: 5;
}

@media (max-width: 360px) {
  .mail__preview { display: none; }
  .slot { height: 66px; }
  .menu { top: 74px; }
}

@media (prefers-reduced-motion: reduce) {
  .snooze, .undo { transition: none; }
}
