/*
 * Genio — "Révision / Revision" card animation, version 12.
 * Drops into a carousel card's .visual slot and draws straight onto the card,
 * in the card's own ink. Two pages sit side by side, each the size of the
 * card: the app's clinical note, then its transcript. revision.js moves the
 * camera between them, and scrolls, zooms and focuses both. Everything is sized in container
 * units (cqw).
 */

.gr {
  --gr-ink: currentColor;
  /* Text knocked out of the ink, in the card's paper colour. */
  --gr-paper: #f7f5ef;
  /* The app's own UI font, for the note and the transcript. */
  --gr-app-font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --gr-mono-font: "DM Mono", ui-monospace, monospace;

  position: absolute;
  inset: 0;
  display: block;
  overflow: hidden;
  container-type: size;
  pointer-events: none;
  color: inherit;
}

.card-blue .gr {
  --gr-paper: #1747e8;
}

/* The two pages, side by side, with a gutter between them. */
.gr-world {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  width: 212cqw;
  height: 100cqh;
  transform-origin: 0 0;
}

.gr-page {
  position: absolute;
  top: 0;
  display: block;
  width: 100cqw;
  height: 100cqh;
}

.gr-page-note {
  left: 0;
}

.gr-page-tr {
  left: 112cqw;
}

.gr-divider {
  position: absolute;
  top: 7.2cqw;
  bottom: 22cqw;
  left: 106cqw;
  display: block;
  width: max(1px, 0.25cqw);
  background: var(--gr-ink);
  opacity: 0.28;
}

/* Page heading: an icon, the page's name, and a note at its end. */
.gr-head {
  position: absolute;
  /* On the card's top margin, where the card number used to be. */
  top: 7.2cqw;
  right: 7.2cqw;
  left: 7.2cqw;
  display: flex;
  align-items: center;
  gap: 2.2cqw;
  font-family: var(--gr-mono-font);
  font-size: 3.4cqw;
  font-weight: 500;
  letter-spacing: 0.14em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}

.gr-head svg {
  flex: none;
  width: 5.2cqw;
  height: 5.2cqw;
  overflow: visible;
}

.gr-head svg * {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

/* The note's date; "1 source", as in the app. */
.gr-date,
.gr-found {
  margin-left: auto;
  font-size: 3cqw;
}

.gr-date {
  opacity: 0.55;
}

.gr-found {
  opacity: 0;
}

.gr-rule {
  position: absolute;
  top: 14.7cqw;
  right: 7.2cqw;
  left: 7.2cqw;
  display: block;
  height: max(1px, 0.25cqw);
  background: var(--gr-ink);
  opacity: 0.28;
}

/* ---------- Both documents: a window that scrolls ---------- */

.gr-win {
  position: absolute;
  top: 16.7cqw;
  right: 10cqw;
  bottom: 21cqw;
  /* A little room on the left, so a highlight's padding isn't clipped. */
  left: 5.6cqw;
  display: block;
  overflow: hidden;
  font-family: var(--gr-app-font);
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 11%, #000 89%, transparent);
  mask-image: linear-gradient(to bottom, transparent, #000 11%, #000 89%, transparent);
}

/* Scrolled and zoomed about the window's dock line by revision.js. */
.gr-content {
  display: block;
  padding: 3cqw 0 6cqw 1.6cqw;
  transform-origin: 0 0;
}

/* The chosen line or source, copied sharp over the page and lifted from it in focus. */
.gr-lift {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  width: 100%;
  /* Laid over the window by revision.js, so it needs the window's font too. */
  font-family: var(--gr-app-font);
  transform-origin: 0 0;
}

.gr-lift > * {
  position: absolute;
  margin: 0;
}

/* The clinical note, line by line, as the app writes it. */
.gr-l {
  display: block;
  font-size: 4.8cqw;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 8cqw;
  white-space: nowrap;
}

.gr-gap {
  display: block;
  height: 3.6cqw;
}

/* The transcript, paragraph by paragraph; small talk greyed, as in the app. */
.gr-p {
  display: block;
  margin-bottom: 3.8cqw;
  /* Room on the right, so a lifted source clears the scrollbar. */
  padding-right: 2.4cqw;
  font-size: 4.4cqw;
  font-weight: 400;
  letter-spacing: -0.005em;
  line-height: 7cqw;
  /* No word left alone on a paragraph's (or a source's) last line. */
  text-wrap: pretty;
}

/* The clicked line and its source share one highlight: solid ink. The fill is
   set on .gr-src from the ink; the words inside turn paper. */
.gr-src {
  margin: 0 -0.2em;
  padding: 0.1em 0.2em;
  border-radius: 0.24em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

/* Scrollbars, as in the app; the transcript's marks where the source is. */
.gr-track {
  position: absolute;
  top: 19.2cqw;
  right: 7.2cqw;
  bottom: 23cqw;
  display: block;
  width: max(1px, 0.3cqw);
  margin-right: max(-0.5px, -0.15cqw);
}

.gr-track::before {
  position: absolute;
  inset: 0;
  border-radius: 1cqw;
  background: var(--gr-ink);
  content: "";
  opacity: 0.22;
}

.gr-thumb,
.gr-mark {
  position: absolute;
  top: 0;
  left: 50%;
  display: block;
  border-radius: 1cqw;
  background: var(--gr-ink);
}

.gr-thumb {
  width: 1cqw;
  margin-left: -0.5cqw;
}

.gr-mark {
  width: 2.6cqw;
  height: max(2px, 0.6cqw);
  margin-top: max(-1px, -0.3cqw);
  margin-left: -1.3cqw;
  opacity: 0;
}

/* ---------- The thread, from a line to its source ---------- */

.gr-links {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.gr-thread {
  fill: none;
  stroke: var(--gr-ink);
  stroke-dasharray: 1 1;
  stroke-linecap: round;
}

.gr-dot {
  fill: var(--gr-ink);
}

.gr-ring,
.gr-ripple {
  fill: none;
  stroke: var(--gr-ink);
  opacity: 0;
}

/* ---------- Cursor ---------- */

.gr-cursor {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 3;
  display: block;
  width: 5.4cqw;
  height: 5.4cqw;
  opacity: 0;
  filter: drop-shadow(0 0.25cqw 0.35cqw rgba(0, 0, 0, 0.28));
  transform-origin: 0 0;
}

.gr-cursor svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.gr-arrow path {
  fill: #111;
  stroke: #fff;
  stroke-linejoin: round;
  stroke-width: 1.3;
}

.gr-hand path {
  fill: #fff;
  stroke: #111;
  stroke-linejoin: round;
  stroke-width: 1.15;
}

.gr-hand .gr-hand-lines {
  fill: none;
  stroke-linecap: round;
  stroke-width: 0.9;
}

.gr-hand,
.gr-cursor.is-hand .gr-arrow {
  visibility: hidden;
}

.gr-cursor.is-hand .gr-hand {
  visibility: visible;
}
