/* The moments the game marks (js/ui/moments.js): a floor's name, a guardian's
   name, and a notice for a feat or a level. Inside #ui-overlay, so measured
   from the safe edges; none of them takes a tap. The cards are words over the
   scene, not panels - the corridor stays the picture. */

.moment-card {
  position: absolute; left: 50%; top: 36%; z-index: 58; transform: translate(-50%, -50%);
  display: grid; justify-items: center; gap: 4px; width: min(640px, calc(100% - 48px));
  padding: 26px 20px 22px; text-align: center; pointer-events: none;
  font-family: Georgia, "Times New Roman", serif; font-weight: 400; letter-spacing: 0;
  /* A pool of shadow behind the words, so they read on bright stonework. */
  background: radial-gradient(ellipse 60% 62% at 50% 50%, #05070999, #0507094d 55%, transparent 75%);
}
.moment-card[hidden] { display: none; }
.moment-card .moment-kicker {
  margin: 0; font: 600 12px "Segoe UI", system-ui, sans-serif; letter-spacing: 0.32em; text-transform: uppercase;
  color: #d8bf86; text-shadow: 0 1px 2px #000, 0 0 10px #000;
}
.moment-card .moment-title {
  margin: 0; font-size: clamp(28px, 4.6vw, 46px); line-height: 1.1; color: #f4e6c4;
  text-shadow: 0 2px 3px #000, 0 0 18px #000c, 0 0 28px #e0a14a33;
}
.moment-card .moment-rule {
  display: block; width: min(320px, 70%); height: 1px; margin-top: 8px;
  background: linear-gradient(90deg, transparent, #d6b06ad9, transparent);
  transform: scaleX(0);
}

/* In, held, and out over --moment-ms; the rule draws outwards under the name. */
.moment-card.playing { animation: moment-card var(--moment-ms, 3800ms) ease both; }
.moment-card.playing .moment-rule { animation: moment-rule var(--moment-ms, 3800ms) ease both; }
@keyframes moment-card {
  0% { opacity: 0; transform: translate(-50%, calc(-50% + 6px)); }
  14% { opacity: 1; transform: translate(-50%, -50%); }
  78% { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes moment-rule { 0%, 8% { transform: scaleX(0); } 30%, 100% { transform: scaleX(1); } }

/* A guardian's plate: the name larger, its title above in the colour of old
   blood, and a heavier rule. */
.guardian-plate { top: 34%; }
.guardian-plate .moment-kicker { color: #e49b7c; letter-spacing: 0.2em; font-size: 13px; }
.guardian-plate .moment-title { font-size: clamp(34px, 6vw, 60px); font-variant: small-caps; letter-spacing: 0.04em; color: #f6e2c0; }
.guardian-plate .moment-rule { height: 2px; width: min(420px, 80%); background: linear-gradient(90deg, transparent, #b5523acc 25%, #e2b56c 50%, #b5523acc 75%, transparent); }

/* A notice: a small panel at the top, below the compass in the corridors and
   at the very top in town, where nothing sits in the middle. */
.moment-toast {
  position: absolute; left: 50%; top: 106px; z-index: 59; transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px; width: max-content; max-width: min(380px, calc(100% - 32px));
  padding: 10px 16px 10px 12px; pointer-events: none;
  color: #efe2c4; background: linear-gradient(180deg, #171c1ef2, #0c1012f2);
  border: 1px solid #c8994866; border-left: 3px solid #d6a955; border-radius: 2px;
  box-shadow: 0 10px 28px #000a, inset 0 1px #ffffff0d;
  font-family: "Segoe UI", system-ui, sans-serif; letter-spacing: 0;
}
.moment-toast[hidden] { display: none; }
#viewport:has(#city-ui:not(.hidden)) .moment-toast { top: 14px; }
.moment-toast[data-kind="level"] { border-left-color: #8fc3d6; }
.moment-toast-icon { display: grid; place-items: center; width: 40px; height: 40px; flex: none; color: #e6bd6a;
  border-radius: 50%; background: radial-gradient(circle, #e0a94a33, transparent 70%); }
.moment-toast[data-kind="level"] .moment-toast-icon { color: #a9d6e6; background: radial-gradient(circle, #6fb3cc33, transparent 70%); }
.moment-toast-icon .utility-icon { width: 28px; height: 28px; }
.moment-toast-copy { display: grid; gap: 1px; min-width: 0; }
.moment-toast-kicker { font-size: 11px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; color: #c9a65f; }
.moment-toast[data-kind="level"] .moment-toast-kicker { color: #8fc3d6; }
.moment-toast-title { font: 400 18px/1.2 Georgia, "Times New Roman", serif; color: #f6ead0; }
.moment-toast-detail { font-size: 12.5px; font-weight: 500; line-height: 1.35; color: #b5a989; }
.moment-toast-detail:empty { display: none; }
.moment-toast.playing { animation: moment-toast var(--moment-ms, 4400ms) ease both; }
@keyframes moment-toast {
  0% { opacity: 0; transform: translate(-50%, -10px); }
  8% { opacity: 1; transform: translate(-50%, 0); }
  86% { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, -6px); }
}

/* Heard, never seen. */
.moment-announce { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }

@media (max-height: 440px) {
  /* Under the compass, which a short screen keeps at the top middle. */
  .moment-card { top: 44%; padding: 16px 16px 14px; }
  .moment-toast { top: 100px; }
}

@media (prefers-reduced-motion: reduce) {
  .moment-card.playing, .moment-toast.playing { animation-name: moment-fade; }
  .moment-card.playing .moment-rule { animation: none; transform: none; }
  @keyframes moment-fade { 0%, 100% { opacity: 0; } 6%, 90% { opacity: 1; } }
}
