/* The monogram's two original paths remain visible through the entire morph. */
.identity {
  --identity-open: 0;
  --identity-ease: cubic-bezier(.22, .8, .2, 1);
  position: relative;
  display: grid;
  align-items: center;
  justify-items: start;
  gap: 0;
  flex: 0 0 176px;
  inline-size: 176px;
  block-size: 48px;
  line-height: 1;
}

.identity .brand-signature {
  display: block;
  width: 176px;
  height: 48px;
  overflow: visible;
  pointer-events: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: color-mix(in srgb, #becdba calc(100% * (1 - var(--identity-open))), #f4f1df);
  transition: color 600ms ease;
}

.brand-initial {
  transform-box: view-box;
  transform-origin: 0 0;
  transform: matrix(.75, 0, 0, .75, 0, 6);
  opacity: 1;
  transition: transform 620ms var(--identity-ease);
  /* On leave the smaller letters gather before the initials recombine. */
  transition-delay: calc((1 - var(--identity-open)) * 100ms);
}

.brand-initial path {
  stroke-width: calc(2.25px - var(--identity-open) * .45px);
  transition: stroke-width 620ms ease;
}

.brand-initial-t { stroke-linecap: square; }

/* T keeps its vertical stem; the C travels to become the surname's initial. */
.brand-initial-t {
  transform: matrix(
    calc(.75 + .375 * var(--identity-open)), 0, 0,
    calc(.75 + .7983871 * var(--identity-open)),
    calc(-17.125 * var(--identity-open)),
    calc(6 - 21.096774 * var(--identity-open))
  );
}

.brand-initial-c {
  transform: matrix(
    calc(.75 - .11 * var(--identity-open)), 0, 0,
    calc(.75 - .11 * var(--identity-open)),
    calc(107 * var(--identity-open)),
    calc(6 + 2.64 * var(--identity-open))
  );
}

.brand-extra {
  opacity: var(--identity-open);
  transform: translateX(calc(-3px * (1 - var(--identity-open))));
  transition: opacity 180ms ease, transform 380ms var(--identity-ease);
  transition-delay: calc(var(--identity-open) * (190ms + var(--letter-index) * 32ms));
}

.brand-extra path {
  stroke-dasharray: 1;
  stroke-dashoffset: calc(1 - var(--identity-open));
  transition: stroke-dashoffset 420ms var(--identity-ease);
  transition-delay: calc(var(--identity-open) * (190ms + var(--letter-index) * 32ms));
}

.identity:focus-visible {
  --identity-open: 1;
  outline: 1px solid #becdba;
  outline-offset: 7px;
  border-radius: 2px;
}

/* Touch retains the compact monogram and a normal single-tap home link. */
@media (hover: hover) and (pointer: fine) {
  .identity:hover { --identity-open: 1; }
}

@media (max-width: 360px) {
  .identity { flex-basis: 144px; inline-size: 144px; }
  .identity .brand-signature { width: 144px; height: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  .identity .brand-signature,
  .brand-initial,
  .brand-initial path,
  .brand-extra,
  .brand-extra path { transition: none; }
}
