/*
 * Genio — "Temps / Time" card animation, version 8.
 * Drops into a carousel card's .visual slot and draws straight onto the card,
 * in the card's own ink: a day in a schedule, the month it belongs to, and
 * the month's total for one practitioner. time.js places, zooms and counts everything.
 * Everything is sized in container units (cqw).
 */

.gh {
  --gh-ink: currentColor;
  /* Text knocked out of the ink, in the card's paper colour. */
  --gh-paper: #f7f5ef;
  /* The app's own UI font. */
  --gh-app-font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --gh-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 .gh {
  --gh-paper: #1747e8;
}

.gh-page {
  position: absolute;
  inset: 0;
  display: block;
  transform-origin: 0 0;
  will-change: transform, opacity, filter;
}

.gh-page > span,
.gh-page > svg {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
}

/* ---------- Heading, as on the other cards ---------- */

.gh-page > .gh-head {
  /* 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(--gh-mono-font);
  font-size: 3.4cqw;
  font-weight: 500;
  letter-spacing: 0.14em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}

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

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

/* The day, the month and the practitioner, stacked, so one can roll away and the
   next in. The padding keeps accents inside the clip. */
.gh-name {
  display: grid;
  overflow: hidden;
  margin-block: -0.35em;
  padding-block: 0.35em;
}

.gh-name > span {
  grid-area: 1 / 1;
  will-change: transform, opacity;
}

.gh-read {
  margin-left: auto;
  text-transform: none;
  font-size: 3.4cqw;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
}

.gh-page > .gh-rule {
  top: 14.7cqw;
  right: 7.2cqw;
  left: 7.2cqw;
  height: max(1px, 0.25cqw);
  background: var(--gh-ink);
  opacity: 0.28;
}

/* ---------- The day ---------- */

.gh-page > .gh-day {
  inset: 0;
  transform-origin: 0 0;
  will-change: transform;
}

.gh-day span {
  position: absolute;
  display: block;
}

.gh-hours,
.gh-visits {
  inset: 0;
}

.gh-hours {
  opacity: var(--gh-detail, 1);
}

.gh-line {
  height: max(1px, 0.2cqw);
  background: var(--gh-ink);
  opacity: 0.14;
  transform: translateY(-50%);
}

.gh-line.is-close {
  height: max(1px, 0.3cqw);
  opacity: 0.6;
}

.gh-label {
  font-family: var(--gh-mono-font);
  font-size: 3.1cqw;
  font-weight: 500;
  letter-spacing: 0.06em;
  line-height: 1;
  opacity: 0.5;
  transform: translateY(-50%);
  white-space: nowrap;
}

.gh-label.is-close {
  opacity: 1;
}

.gh-visit {
  overflow: hidden;
  border-radius: 1cqw;
  background: color-mix(in srgb, currentColor 12%, transparent);
}

/* The visit's accent, down its left edge. */
.gh-visit::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 0.7cqw;
  background: var(--gh-ink);
  content: "";
}

.gh-stroke {
  height: 0.9cqw;
  border-radius: 0.45cqw;
  background: var(--gh-ink);
  opacity: calc(0.3 * var(--gh-detail, 1));
  transform: translateY(-50%);
}

.gh-check {
  position: absolute;
  width: 2.6cqw;
  height: 2.6cqw;
  overflow: visible;
  opacity: var(--gh-detail, 1);
  transform: translateY(-50%);
}

.gh-check * {
  fill: none;
  stroke: currentColor;
  stroke-dasharray: 1 1;
  stroke-dashoffset: 1;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.3;
}

/* After closing: the notes still to write, hatched, then the hour won back,
   solid, which fills in over them. */
.gh-notes {
  border-radius: 1cqw;
  background: repeating-linear-gradient(
    -45deg,
    color-mix(in srgb, currentColor 34%, transparent) 0 0.3cqw,
    transparent 0.3cqw 1.5cqw
  );
  box-shadow: inset 0 0 0 max(1px, 0.25cqw) color-mix(in srgb, currentColor 45%, transparent);
  transform-origin: 50% 50%;
}

.gh-day .gh-fill {
  inset: 0;
  border-radius: inherit;
  background: var(--gh-ink);
  clip-path: inset(0 100% 0 0);
}

.gh-day .gh-notes-label {
  top: 50%;
  left: 3cqw;
  display: grid;
  overflow: hidden;
  padding-block: 0.3em;
  font-family: var(--gh-app-font);
  font-size: 3.8cqw;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1;
  opacity: var(--gh-detail, 1);
  transform: translateY(-50%);
  white-space: nowrap;
}

.gh-day .gh-notes-label > span {
  position: static;
  grid-area: 1 / 1;
  will-change: transform, opacity;
}

.gh-notes-b {
  color: var(--gh-paper);
  font-weight: 600;
}

/* The clock's line, and its dot on the left. */
.gh-now {
  height: max(1px, 0.35cqw);
  background: var(--gh-ink);
  will-change: transform, opacity;
}

.gh-now i {
  position: absolute;
  top: 50%;
  left: -1.1cqw;
  width: 2.2cqw;
  height: 2.2cqw;
  border-radius: 50%;
  background: var(--gh-ink);
  transform: translateY(-50%);
}

/* ---------- The month ---------- */

.gh-page > .gh-grid {
  width: 100%;
  height: 100%;
  overflow: visible;
  fill: currentColor;
  will-change: transform, opacity, filter;
}

.gh-grid rect {
  fill: currentColor;
}

.gh-grid .gh-cell-page {
  fill-opacity: 0.07;
}

.gh-grid .gh-cell-visit {
  fill-opacity: 0.14;
}

.gh-page > .gh-weekdays {
  inset: 0;
}

.gh-weekdays span {
  position: absolute;
  font-family: var(--gh-mono-font);
  font-size: 3.1cqw;
  font-weight: 500;
  line-height: 1;
  transform: translate(-50%, -50%);
}

/* ---------- The count ---------- */

.gh-page > .gh-count {
  display: flex;
  align-items: baseline;
  font-family: var(--gh-app-font);
  font-size: 12cqw;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  letter-spacing: -0.05em;
  line-height: 1;
  white-space: nowrap;
  transform-origin: 0 50%;
  will-change: transform, opacity;
}

.gh-roll {
  display: grid;
  overflow: hidden;
  margin-block: -0.12em;
  padding-block: 0.12em;
}

.gh-roll > span {
  grid-area: 1 / 1;
  text-align: right;
}

.gh-unit {
  margin-left: 0.14em;
}

.gh-page > .gh-caption {
  display: grid;
  font-family: var(--gh-mono-font);
  font-size: 3.1cqw;
  font-weight: 500;
  letter-spacing: 0.12em;
  line-height: 1.35;
  text-transform: uppercase;
  white-space: nowrap;
  transform-origin: 0 50%;
  will-change: transform, opacity;
}

.gh-page > .gh-foot {
  right: 7.2cqw;
  left: 7.2cqw;
  font-family: var(--gh-mono-font);
  font-size: 3cqw;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1.5;
}
