/* Timed events: the card in town and the badge on the floor panel
 * (js/ui/timed-events.js). The card's surface is the party lesson card's, which
 * follows the shared window (windows.css). In the stacked town it sits in the
 * flow above the title; where the town is one painted screen it floats along
 * the top of the scene, clear of the places on it, and below the party lesson
 * card when that is showing. It is information only: it takes no clicks, so
 * nothing painted under it stops answering. */
.timed-event-card {
  display: flex; align-items: flex-start; gap: 10px;
  position: relative; z-index: 4; pointer-events: none; text-align: left;
  width: 100%; margin: 0 0 8px; padding: 7px 12px 8px 10px;
  background: url('../assets/ui/character-surface.svg') repeat, linear-gradient(135deg, #262821, #121a1b 70%);
  border: 1px solid #6e6047; border-radius: 9px;
  box-shadow: 0 6px 18px #0005, inset 0 0 0 3px #101612;
  color: #e8dcc5; font: 400 12px/1.3 "Segoe UI", system-ui, sans-serif; letter-spacing: 0;
}
.timed-event-card[hidden] { display: none; }
.timed-event-card-icon { flex: none; display: flex; padding-top: 2px; color: var(--ember); }
.timed-event-card-icon .px-icon { width: 27px; height: 27px; }
/* The event's painting (assets/ui/timed-events): a 128px icon on transparency,
 * shown at a quarter, an eighth on the badge. */
.timed-event-card-icon .timed-event-art { display: block; width: 32px; height: 32px; margin: -2px 0 -3px; }
.timed-event-card-copy {
  min-width: 0; flex: 1; display: grid; gap: 1px 10px;
  grid-template-columns: minmax(0, 1fr) auto; align-items: baseline;
}
#timed-event-card-name { grid-column: 1; grid-row: 1; color: var(--gold); font-weight: 600; font-size: 14px; }
.timed-event-card-when {
  grid-column: 2; grid-row: 1; white-space: nowrap; color: #f0e3c3;
  font-weight: 600; font-variant-numeric: tabular-nums;
}
.timed-event-card-reach { grid-column: 1 / -1; color: #b9ae94; }
.timed-event-card-effect { grid-column: 1 / -1; }
.timed-event-card-effect b { font-weight: 600; margin-right: 2px; }
.timed-event-card-threat b { color: #e0806c; }
.timed-event-card-boon b { color: #a7c77f; }
/* The next event, named ahead of time: what and where, not yet the terms. */
.timed-event-card[data-state="upcoming"] .timed-event-card-icon { color: var(--muted); }
.timed-event-card[data-state="upcoming"] .timed-event-art { filter: saturate(.45) brightness(.8); }
.timed-event-card[data-state="upcoming"] .timed-event-card-effect { display: none; }
.timed-event-card[data-state="upcoming"] .timed-event-card-when { color: var(--muted); font-weight: 400; }

@media (min-width: 701px), (min-width: 561px) and (orientation: landscape) {
  .timed-event-card {
    position: absolute; top: 6px; left: 50%; transform: translateX(-50%);
    width: min(560px, calc(100% - 170px)); margin: 0;
  }
  .party-lesson-card:not([hidden]) ~ .timed-event-card { top: 82px; }
}
/* A short landscape phone: where it reaches moves up beside the name, so the
 * card is three lines over the painted town rather than four. */
@media (orientation: landscape) and (max-height: 540px) {
  .timed-event-card { padding: 5px 10px 6px 8px; gap: 8px; font-size: 11px; }
  .timed-event-card-icon .px-icon { width: 18px; height: 18px; }
  .timed-event-card-icon .timed-event-art { width: 22px; height: 22px; margin: -2px 0; }
  .timed-event-card-copy { grid-template-columns: auto minmax(0, 1fr) auto; }
  #timed-event-card-name { font-size: 13px; white-space: nowrap; }
  .timed-event-card-reach { grid-column: 2; grid-row: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .timed-event-card-when { grid-column: 3; }
  /* Under the party lesson's card there is room for its title line alone:
   * the terms would cover the places painted below. */
  .party-lesson-card:not([hidden]) ~ .timed-event-card { top: 70px; }
  .party-lesson-card:not([hidden]) ~ .timed-event-card .timed-event-card-effect { display: none; }
}

/* The floor panel's badge: the event's icon and the time it has left. */
#timed-event-status { color: #c9a86a; }
#timed-event-status[data-here="yes"] { color: #e8935f; }
#timed-event-status .timed-event-status-icon { display: flex; }
#timed-event-status .timed-event-status-icon .px-icon { width: 14px; height: 14px; }
#timed-event-status .timed-event-status-icon .timed-event-art { display: block; width: 16px; height: 16px; margin: -1px; }
#timed-event-status .timed-event-status-caption { font-size: 10px; }
#timed-event-status .timed-event-status-time { font-variant-numeric: tabular-nums; color: #e9dcc0; }
/* Running, but not on this floor: there, and quieter. */
#timed-event-status[data-here="no"] { color: #9d927a; }
#timed-event-status[data-here="no"] .timed-event-status-time { color: #b3a98f; }
#timed-event-status[aria-expanded="true"] :is(.timed-event-status-icon, .timed-event-status-time) { display: none; }
#timed-event-status[aria-expanded="true"] .hud-badge-text { display: inline; text-align: left; }
#navigation-hud #timed-event-status[aria-expanded="true"] .timed-event-status-caption { display: none; }

/* The floor panel grows by the badge's row. Report and Chat, in the corner
 * above it, move down by as much when the panel would reach them: with
 * Miasma showing too, or the badge opened. Upright on a phone the panel sits
 * elsewhere and they are not in its way. */
@media (orientation: landscape), (min-width: 601px) {
  #viewport:has(#timed-event-status:not(.hidden)):has(#miasma-status:not(.hidden)) :is(#btn-report-field, #btn-chat-field),
  #viewport:has(#timed-event-status[aria-expanded="true"]:not(.hidden)) :is(#btn-report-field, #btn-chat-field) { top: 236px; }
}
@media (orientation: landscape) and (max-height: 540px) {
  #viewport:has(#timed-event-status:not(.hidden)):has(#miasma-status:not(.hidden)) :is(#btn-report-field, #btn-chat-field),
  #viewport:has(#timed-event-status[aria-expanded="true"]:not(.hidden)) :is(#btn-report-field, #btn-chat-field) { top: 212px; }
}
