/* The floating notes behind every page of the site (2026-10-25, the user:
   "have the floating facts be the background for the whole website ...
   seamless in terms of how the facts flow from page to page"). Built by
   /assets/notes-field.js: the same notes in the same places on every page,
   drifting on the clock, so moving between pages carries straight on.
   z-index -1 puts it over the page's own colour and under everything else. */

.notes-field { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; view-transition-name: sr-notes; }
/* Shown at once on a new page, not faded in, so a page change is seamless. */
.notes-field.is-cold .mf-card { transition: none !important; }

/* Page changes crossfade, and the notes stay where they are (browsers with
   cross-document view transitions; elsewhere the same layout does the job). */
@view-transition { navigation: auto; }
::view-transition-group(sr-notes), ::view-transition-old(sr-notes), ::view-transition-new(sr-notes) { animation: none; }
::view-transition-old(sr-notes) { display: none; }

.mf {
  position: absolute;
  left: var(--x);
  top: var(--y);
  transform: translate3d(calc(var(--mx, 0) * var(--d) * 1px), calc(var(--my, 0) * var(--d) * 1px), 0) scale(var(--s));
  transition: transform 1.2s var(--ease);
  will-change: transform;
}
.mf.l2 { filter: blur(1px); }
.mf.l3 { filter: blur(2.4px); }

.mf-drift { animation: mf-drift var(--dur, 18s) ease-in-out var(--delay, 0s) infinite alternate; }
@keyframes mf-drift {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(var(--dx, 12px), var(--dy, -18px), 0); }
}

.mf-card {
  position: relative;
  width: clamp(168px, 16vw, 232px);
  padding: 12px 14px 13px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(28, 28, 28, 0.9), rgba(16, 16, 16, 0.9));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), 0 20px 40px -20px rgba(0, 0, 0, 0.9);
  font-size: 13px;
  line-height: 1.4;
  color: #e9e9e9;
  opacity: 0;
  transition: opacity 5.5s ease, filter 5.5s ease, box-shadow 0.6s ease;
}
.mf.l1 .mf-card { opacity: 0.95; }
.mf.l2 .mf-card { opacity: 0.6; }
.mf.l3 .mf-card { opacity: 0.32; }
.mf-cat {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c);
}
.mf-cat::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--c); }

/* Being forgotten: the note loses its edges and sinks into the dark. */
.mf.is-fading .mf-card { opacity: 0.06 !important; filter: blur(5px); }
.mf.is-fast .mf-card { transition-duration: 1.1s, 1.1s, 0.6s; }
/* Recalled: back at once, with a ring of light. */
.mf.is-recalled .mf-card {
  transition: opacity 0.35s ease, filter 0.35s ease, box-shadow 0.35s ease;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45), 0 0 44px -6px rgba(255, 255, 255, 0.4);
}
.mf.is-recalled .mf-card::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 17px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  animation: mf-ping 0.9s var(--ease) forwards;
  pointer-events: none;
}
@keyframes mf-ping { from { opacity: 1; transform: scale(1); } to { opacity: 0; transform: scale(1.18); } }

/* Over the words of a page on a phone, quieter. */
@media (max-width: 760px) {
  .mf-card { width: 176px; font-size: 11px; padding: 10px 11px; }
  .mf.l1 .mf-card { opacity: 0.5; }
  .mf.l2 .mf-card { opacity: 0.35; }
  .mf.l3 .mf-card { opacity: 0.2; }
}
@media (prefers-reduced-motion: reduce) {
  .mf-drift { animation: none; }
}
