

:root {
  --chr-css: 1;
  --chr-cast: hsl(165 30% 2% / 0.62);
  --chr-floor: hsl(165 30% 2% / 0.78);
}

.chr-cameo { position: relative; }
.chr-cameo__tilt { position: relative; z-index: 1; display: block; transform-origin: 50% 54%; }
.chr-cameo.is-live .chr-cameo__tilt { will-change: transform; }
.chr-cameo__img {
  display: block;
  -webkit-user-select: none; user-select: none; -webkit-user-drag: none;
  filter: drop-shadow(0 0.55rem 0.9rem var(--chr-cast));
}

.chr-cameo::before {
  content: ""; position: absolute; z-index: 0; pointer-events: none;
  left: 16%; right: 16%; bottom: -3.5%; height: 11%;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--chr-floor), hsl(165 30% 2% / 0.34) 62%, transparent 100%);
}
.chr-cameo::after {
  content: ""; position: absolute; z-index: 0; pointer-events: none;
  left: 9%; right: 9%; bottom: -1.5%; height: 9%;
  border-radius: 50%;
  border-bottom: 1px solid color-mix(in oklab, var(--teal) 55%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 30%, #000 70%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 30%, #000 70%, transparent);
  opacity: 0.8;
}
.chr-cameo--bare::before, .chr-cameo--bare::after { content: none; }
.on-paper .chr-cameo::after { border-bottom-color: color-mix(in oklab, var(--teal-p) 60%, transparent); }

.chr-eyes {
  position: absolute; left: 17.680%; top: 44.545%; width: 58.564%; height: 14.091%;
  pointer-events: none; visibility: hidden;
  -webkit-mask: url("../assets/character/eye-mask.png") 0 0 / 100% 100% no-repeat;
          mask: url("../assets/character/eye-mask.png") 0 0 / 100% 100% no-repeat;
}
.chr-eyes.is-on { visibility: visible; }
.chr-eyes > img { position: absolute; display: block; max-width: none; margin: 0; }
.chr-eyes__ground { left: 0; top: 0; width: 100%; height: 100%; }
.chr-eyes__iris { will-change: transform; }
.chr-eyes__iris--l { left: 17.554%; top: 28.065%; width: 18.305%; height: 62.594%; }
.chr-eyes__iris--r { left: 73.955%; top: 30.335%; width: 18.493%; height: 63.232%; }

.chr-switch {
  --chr-sw: 44px;
  --chr-sw-edge: 12px;
  position: fixed; z-index: 64;
  right: max(var(--chr-sw-edge), calc(env(safe-area-inset-right, 0px) + 8px));
  bottom: max(var(--chr-sw-edge), calc(env(safe-area-inset-bottom, 0px) + 8px));
  width: var(--chr-sw); height: var(--chr-sw);
  margin: 0; padding: 0; border: 0; border-radius: 50%;
  background: color-mix(in srgb, var(--g0) 92%, transparent);
  box-shadow: 0 0 0 1px var(--hair-strong), var(--e2), var(--edge);
  color: var(--ink);
  font: inherit; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  outline: 2px solid transparent; outline-offset: 3px;
  opacity: 0; transform: translateY(6px) scale(0.95);
  transition: opacity 240ms var(--ease), transform 180ms var(--ease), box-shadow 160ms var(--ease);
}
@media (min-width: 861px) { .chr-switch { --chr-sw: 48px; --chr-sw-edge: 16px; } }
.chr-switch.is-in { opacity: 1; transform: none; }
.chr-switch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--teal), var(--e2), var(--edge); }
.chr-switch::after {
  content: ""; position: absolute; right: -1px; top: -1px; width: 11px; height: 11px;
  border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 2px var(--g0);
  transform: scale(0.95); opacity: 0;
  transition: opacity 160ms var(--ease), transform 160ms var(--ease);
}
.chr-switch[aria-pressed="true"]::after { opacity: 1; transform: none; }
@media (hover: hover) and (pointer: fine) {
  .chr-switch.is-in:hover { transform: translateY(-1px); box-shadow: 0 0 0 1px var(--teal-hair), var(--e3), var(--edge); }
  .chr-switch.is-in[aria-pressed="true"]:hover { box-shadow: 0 0 0 2px var(--teal), var(--e3), var(--edge); }
}
.chr-switch.is-in:active { transform: scale(0.97); }

.chr-switch.is-in.is-tucked { transform: translate(var(--chr-tuck-x, 0px), var(--chr-tuck-y, 0px)); }
.chr-switch.is-in.is-tucked:active { transform: translate(var(--chr-tuck-x, 0px), var(--chr-tuck-y, 0px)) scale(0.97); }
.chr-switch.is-in.is-tucked:focus-visible { transform: none; }
@media (hover: hover) and (pointer: fine) {
  .chr-switch.is-in.is-tucked:hover { transform: none; }
}

.chr-switch:focus-visible,
.chr-switch[aria-pressed="true"]:focus-visible {
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--g0), 0 0 0 4px var(--teal), var(--e2);
}

.chr-switch__seat { position: absolute; inset: 0; border-radius: 50%; overflow: hidden; }
.chr-switch__face, .chr-switch__seat::before {
  position: absolute; left: 3%; top: -9%; width: 94%; height: auto; aspect-ratio: 905 / 1100;
  max-width: none;
}
.chr-switch__face {
  display: block; opacity: 0; transform: translateY(12%);
  transition: opacity 200ms var(--ease), transform 240ms var(--ease);
}

.chr-switch__seat::before {
  content: "";
  background: color-mix(in oklab, var(--teal) 26%, transparent);
  -webkit-mask: url("../assets/character/daniel-160.webp") center / 100% 100% no-repeat;
          mask: url("../assets/character/daniel-160.webp") center / 100% 100% no-repeat;
  transition: opacity 200ms var(--ease);
}
html.chr-home .chr-switch__face { opacity: 1; transform: none; }
html.chr-home .chr-switch__seat::before { opacity: 0; }

.chr-switch__label {
  position: absolute; right: calc(100% + 10px); top: 50%;
  display: inline-flex; align-items: center; gap: 0.6em;
  padding: 0.5em 0.75em 0.5em 0.85em; border-radius: var(--r-md);
  background: color-mix(in srgb, var(--g0) 95%, transparent);
  box-shadow: 0 0 0 1px var(--hair-strong), var(--e2);
  font-family: var(--f-display); font-weight: 500; font-size: var(--t-sm); line-height: 1.1;
  letter-spacing: 0.02em; color: var(--ink); white-space: nowrap;
  opacity: 0; transform: translate(6px, -50%); pointer-events: none;
  transition: opacity 160ms var(--ease), transform 160ms var(--ease);
}
.chr-switch__track {
  position: relative; flex: none; width: 1.9em; height: 1.1em; border-radius: 1em;
  background: var(--g3); box-shadow: inset 0 0 0 1px var(--hair-strong);
  transition: background-color 160ms var(--ease);
}
.chr-switch__track::after {
  content: ""; position: absolute; left: 0.18em; top: 0.18em; width: 0.74em; height: 0.74em;
  border-radius: 50%; background: var(--ink-soft);
  transition: transform 160ms var(--ease), background-color 160ms var(--ease);
}
.chr-switch[aria-pressed="true"] .chr-switch__track { background: var(--teal); box-shadow: none; }
.chr-switch[aria-pressed="true"] .chr-switch__track::after { transform: translateX(0.8em); background: var(--teal-ink); }
@media (hover: hover) and (pointer: fine) {
  .chr-switch:hover .chr-switch__label { opacity: 1; transform: translate(0, -50%); }
}
.chr-switch:focus-visible .chr-switch__label { opacity: 1; transform: translate(0, -50%); }

.chr-switch.is-named .chr-switch__label { opacity: 1; transform: translate(0, -50%); }
.chr-switch.is-name-up .chr-switch__label { top: auto; right: 0; bottom: calc(100% + 10px); transform: translate(0, 6px); }
.chr-switch.is-name-up.is-named .chr-switch__label,
.chr-switch.is-name-up:focus-visible .chr-switch__label { transform: none; }
@media (hover: hover) and (pointer: fine) { .chr-switch.is-name-up:hover .chr-switch__label { transform: none; } }
.chr-switch.is-cut .chr-switch__label { transition: none; }

.chr-walker {
  position: fixed; left: 0; top: 0; z-index: 58;
  width: 84px; pointer-events: none;
  transform-origin: 0 0;
  contain: layout style;
}
.chr-walker__body {
  opacity: 0; transform: scale(0.95); transform-origin: 50% 90%;
  transition: opacity 240ms var(--ease), transform 240ms var(--ease);
}
.chr-walker.is-shown:not(.is-ducked) .chr-walker__body { opacity: 1; transform: none; }

.chr-walker.is-ducked .chr-walker__body { transition: none; }
.chr-walker.is-flying .chr-walker__body { transition: none; opacity: 1; transform: none; }
.chr-walker .chr-cameo__img { width: 100%; height: auto; filter: drop-shadow(0 5px 7px var(--chr-cast)); }
html.panel-open .chr-walker { visibility: hidden; }

@media (prefers-reduced-motion: reduce) {
  .chr-switch, .chr-switch::after, .chr-switch__face, .chr-switch__seat::before,
  .chr-switch__label, .chr-switch__track, .chr-switch__track::after,
  .chr-walker__body { transition: none !important; }
  .chr-switch.is-in:not(.is-tucked), .chr-switch.is-in:not(.is-tucked):hover, .chr-switch.is-in:not(.is-tucked):active { transform: none; }
  .chr-switch__face { transform: none; }
  .chr-switch__label { transform: translate(0, -50%); }
  .chr-switch.is-name-up .chr-switch__label { transform: none; }
  .chr-walker__body { transform: none !important; }
}

@media print { .chr-switch, .chr-walker { display: none !important; } }
