/* ============================================================
   SwiftLife — Emilia's console, on any page
   /emilia/emilia.css

   The console itself (.emilia) is styled by the page's own sheet
   (placeholder.css today). This adds what Emilia brings to any
   page: the typing, and the ♥ and ↻ that emilia.js puts in. Colours
   come from the page's tokens, with fallbacks.
   ============================================================ */

.emilia .em-sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* typing (the same as the placeholder's, so either can do it) */
.emilia .shown { border-right: .55em solid var(--caret, #0b62b8); margin-right: -.55em; }
.emilia .rest { color: transparent; text-shadow: none; }
.emilia.typing .sig { opacity: 0; }
.emilia.typed .sig { opacity: 1; }
.emilia.typed .shown { animation: em-blink 1s step-end 1.5 forwards; }
@keyframes em-blink { 0%, 100% { border-right-color: var(--caret, #0b62b8); } 50% { border-right-color: transparent; } }

/* the ♥ and ↻ */
.emilia .em-tools {
  flex: none; align-self: center;
  display: inline-flex; gap: 2px;
  margin: -6px -10px -6px auto;
  opacity: 0; transition: opacity .6s ease;
  text-shadow: none;
}
.emilia.em-ready .em-tools { opacity: 1; }
/* Until her first line is typed the buttons keep their room but cannot
   be reached (display above would otherwise undo the hidden attribute). */
.emilia .em-tools[hidden] { visibility: hidden; }
.emilia .em-tools button[hidden] { display: none; }
.emilia .em-tools button {
  appearance: none; -webkit-appearance: none;
  width: 34px; height: 34px; padding: 0; margin: 0;
  display: grid; place-items: center;
  border: 0; border-radius: 50%;
  background: transparent; color: var(--ink-3, #6f685d);
  cursor: pointer;
  transition: color .2s ease, background-color .2s ease;
}
.emilia .em-tools button:hover { color: var(--caret, #0b62b8); background: var(--led-ring, rgba(11, 98, 184, .1)); }
.emilia .em-tools button:focus-visible { outline: 2px solid var(--focus, #0b62b8); outline-offset: 1px; }
.emilia .em-tools svg {
  width: 17px; height: 17px;
  fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.emilia .em-more[aria-disabled="true"] { cursor: progress; }
.emilia .em-like[aria-pressed="true"] { color: var(--warm, #8a4a1c); }
.emilia .em-like[aria-pressed="true"] svg { fill: currentColor; }
.emilia .em-like.em-pop svg { animation: em-pop .45s cubic-bezier(.3, 1.6, .5, 1); }
.emilia .em-more.em-spin svg { animation: em-spin .65s cubic-bezier(.4, 0, .2, 1); }
@keyframes em-pop { 0% { transform: scale(1); } 45% { transform: scale(1.38); } 100% { transform: scale(1); } }
@keyframes em-spin { to { transform: rotate(360deg); } }

/* a short note under her line (the arrow could not fetch one) */
.emilia .em-oops {
  display: block; margin-top: 4px;
  font-size: .8125rem; color: var(--ink-3, #6f685d); text-shadow: none;
}
.emilia .em-oops[hidden] { display: none; }

/* her form warning again, right under the message box: on a phone the
   console is out of sight above the keyboard */
.em-cue-note {
  margin: 8px 0 0; padding: 10px 12px;
  border: 1px solid var(--rule-2, #dcd3c3); border-left: 3px solid var(--warm, #8a4a1c);
  border-radius: 8px;
  background: var(--console, #fffbf2); color: var(--console-ink, #3b362f);
  font: 400 .875rem/1.5 var(--mono, ui-monospace, "SF Mono", Menlo, Consolas, monospace);
}
.em-cue-note::after {
  content: " \2014\00a0 Emilia";
  font-family: var(--serif, Georgia, serif); font-style: italic; color: var(--ink-2, #5b554c);
}

@media (prefers-reduced-motion: reduce) {
  .emilia .em-tools { transition: none; }
  .emilia.typed .shown { animation: none; border-right-color: transparent; }
  .emilia .em-like.em-pop svg, .emilia .em-more.em-spin svg { animation: none; }
}
