/* ─────────────────────────────────────────────────────────────
   Caret project page: the framed still he breaks out of, the live
   Caret actor (js/caret.js) and his stops.
   The face itself (.cg-char, eyes, mouth) is styled by
   content/caret/caret-guide.css.
   ───────────────────────────────────────────────────────────── */

/* ── the framed still ── */
.cs-photo { position: absolute; right: 9%; top: 8%; width: clamp(170px, 23vw, 340px); margin: 0; z-index: 3; will-change: transform; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.cs-photo__card { padding: 10px 10px 0; background: #fff; color: #111; transform: rotate(-5deg); box-shadow: 0 34px 60px -30px rgba(40, 20, 90, .5), 0 2px 0 rgba(0, 0, 0, .04); }
.cs-photo__in { position: relative; aspect-ratio: 4 / 5; background: radial-gradient(120% 90% at 50% 30%, #d9ceff, #c2b1fb 60%, #b3a0f5); overflow: hidden; }
.cs-photo__caret { position: absolute; left: 13%; top: 20%; width: 74%; transform-origin: 50% 70%; will-change: transform; }
.cs-photo__glass { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(118deg, rgba(255, 255, 255, .5) 0%, rgba(255, 255, 255, 0) 26%, rgba(255, 255, 255, 0) 58%, rgba(255, 255, 255, .22) 74%, rgba(255, 255, 255, 0) 88%); mix-blend-mode: screen; }
.cs-photo__fx { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.cs-photo__fx .crack { fill: none; stroke: #fff; stroke-width: 1.3; stroke-linejoin: bevel; stroke-linecap: round; filter: drop-shadow(0 0 1px rgba(50, 20, 110, .65)); }
.cs-photo__fx .crack--hair { stroke-width: .7; opacity: .8; }
.cs-photo__fx .remain { fill: url(#ckGlass); stroke: rgba(255, 255, 255, .95); stroke-width: 1; stroke-linejoin: bevel; }
.cs-photo__gone { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: var(--lime); font-size: 11px; line-height: 1.5; opacity: 0; }
.cs-photo figcaption { display: flex; justify-content: space-between; gap: 8px; padding: 8px 0 9px; font-size: 10px; white-space: nowrap; overflow: hidden; }
.cs-photo.is-broken { cursor: default; }
.cs-photo.is-broken .cs-photo__in { background: #17102b; box-shadow: inset 0 0 26px rgba(0, 0, 0, .7); }
.cs-photo.is-broken .cs-photo__caret, .cs-photo.is-broken .cs-photo__glass, .cs-photo.is-broken .crack { display: none; }
.cs-photo.is-broken .cs-photo__gone { opacity: 1; transition: opacity .3s ease .12s; }
@media (max-width: 1023px) { .cs-photo { right: 5%; top: 11%; } }

/* ── stops: boxes he parks on (their width is his size there) ── */
.ck-stop { position: relative; width: clamp(92px, 11vw, 158px); aspect-ratio: 1085 / 929; pointer-events: none; }
.cs-intro, .cs-extra { position: relative; }
.ck-stop--intro { position: absolute; left: 8px; bottom: 1.2vh; }
.cs-intro--caret { padding-bottom: calc(10vh + 110px); }   /* room for him under the facts list */
.ck-stop--gal { position: absolute; right: 8px; top: -8px; width: clamp(72px, 8vw, 118px); transform: translateY(-64%); }
.ck-stop--end { margin: 0 0 6vh 8px; }
/* reduced motion: a still Caret and his first line instead of the live one */
.ck-stop img { position: absolute; left: 0; bottom: 0; width: 100%; height: auto; }
.ck-stop figcaption, .ck-stop span { position: absolute; left: 104%; bottom: 40%; width: max-content; max-width: 220px; padding: 8px 10px; background: var(--l1); color: var(--bg); font: 13px/1.35 var(--mono); }
.ck-stop--gal span { left: auto; right: 104%; }

/* ── the live actor ── */
.ck { position: fixed; left: 0; top: 0; z-index: 40; pointer-events: none; will-change: transform, width; opacity: 0; transition: opacity .18s linear; }
.ck.is-on { opacity: 1; }
.ck-rig { position: relative; width: 100%; aspect-ratio: 1085 / 929; transform-origin: 50% 92%; will-change: transform; }
.ck-breathe, .ck-bob, .ck-face { position: absolute; inset: 0; transform-origin: 50% 92%; }
.ck-breathe { animation: ck-breathe 3.3s ease-in-out infinite alternate; }
@keyframes ck-breathe { from { transform: translateY(0) rotate(-.5deg) scale(1); } to { transform: translateY(-4px) rotate(.6deg) scale(1.014); } }
.ck.is-busy .ck-breathe { animation-play-state: paused; }
.ck-face { transition: transform .32s cubic-bezier(.16, 1, .3, 1); filter: drop-shadow(0 16px 14px rgba(60, 30, 140, .18)); }
.ck.is-flip .ck-face { transform: scaleX(-1); }
.ck-live { position: absolute; inset: 0; transition: opacity .12s linear; }
.ck-pose { position: absolute; left: 50%; bottom: 0; width: 100%; height: auto; transform: translateX(-50%); opacity: 0; transition: opacity .12s linear; pointer-events: none; user-select: none; }
.ck.is-pose .ck-live { opacity: 0; }
.ck.is-pose .ck-pose { opacity: 1; }
.ck-shadow { position: absolute; left: 12%; right: 12%; bottom: -5%; height: 12%; border-radius: 50%; background: rgba(40, 20, 90, .32); filter: blur(5px); transform: scale(var(--sh, 1)); opacity: var(--sho, .8); }
:root[data-theme="dark"] .ck-shadow { background: rgba(0, 0, 0, .6); }
.ck-hit { position: absolute; inset: 6% 9% 0 9%; pointer-events: auto; cursor: grab; border-radius: 40% 40% 50% 50%; background: none; border: 0; padding: 0; touch-action: pan-y; -webkit-tap-highlight-color: transparent; }
.ck.is-drag .ck-hit { cursor: grabbing; }

/* speech bubble: typed out, follows him everywhere */
.ck-say { position: absolute; left: 62%; bottom: 100%; margin-bottom: 8px; width: max-content; max-width: min(250px, 62vw); padding: 9px 12px; background: var(--l1); color: var(--bg); font: 13px/1.4 var(--mono); opacity: 0; transform: translateY(6px) scale(.9); transform-origin: 8% 100%; transition: opacity .16s ease, transform .3s cubic-bezier(.2, 1.4, .4, 1); pointer-events: none; }
.ck-say::after { content: ""; position: absolute; left: 14px; bottom: -5px; width: 10px; height: 10px; background: inherit; transform: rotate(45deg); }
.ck-say.is-on { opacity: 1; transform: none; }
.ck.is-left .ck-say { left: auto; right: 62%; transform-origin: 92% 100%; }
.ck.is-left .ck-say::after { left: auto; right: 14px; }
.ck-say i { font-style: normal; display: inline-block; width: .6em; animation: ck-caret .7s steps(2) infinite; }
@keyframes ck-caret { 50% { opacity: 0; } }

/* full-screen canvas for glass, dust and landing puffs */
.ck-fx { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 41; pointer-events: none; }
