/* ==========================================================================
   Hands: input-mode popup, camera scan frame -> corner popup, ACCESS GRANTED,
   hand points and joystick (js/hands.js). Same light HUD language as the site.
   ========================================================================== */
:root { --hm-green: #12B857; }

.hm-br { position: absolute; width: 14px; height: 14px; border: 0 solid var(--ink); pointer-events: none; transition: border-color .3s; }
.hm-br--tl { left: -1px; top: -1px; border-left-width: 1px; border-top-width: 1px; }
.hm-br--tr { right: -1px; top: -1px; border-right-width: 1px; border-top-width: 1px; }
.hm-br--bl { left: -1px; bottom: -1px; border-left-width: 1px; border-bottom-width: 1px; }
.hm-br--br { right: -1px; bottom: -1px; border-right-width: 1px; border-bottom-width: 1px; }

/* tracking-skeleton hand (icon + guide) */
.hm-ico { width: 44px; height: 44px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.hm-ico--hand { width: 40px; height: 48px; }
.hm-ico--hand .bones line, .hm-guide .bones line { vector-effect: non-scaling-stroke; }
.hm-ico--hand .bones { stroke-width: 1.2; }
.hm-ico--hand .palm { stroke-width: .9; stroke-dasharray: 2 2; vector-effect: non-scaling-stroke; fill: none; }
.hm-ico--hand .joints circle { fill: currentColor; stroke: none; }
.hm-ico--hand .joints .tip { fill: none; stroke: currentColor; stroke-width: 1; vector-effect: non-scaling-stroke; }

/* ---------- input-mode popup (after the intro, see-through) ---------- */
.hm-gate { position: fixed; inset: 0; z-index: 95; display: grid; place-items: center; padding: 16px; pointer-events: none; opacity: 0; transition: opacity .45s; }
.hm-gate.is-in { opacity: 1; }
.hm-gate.is-out { opacity: 0; }
.hm-gate__box { position: relative; width: min(560px, 100%); padding: clamp(24px, 4vw, 38px); border: 1px solid var(--line); background: rgba(236, 237, 239, .58); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); text-align: center; pointer-events: auto; transform: translateY(14px) scale(.98); transition: transform .5s cubic-bezier(.2, .7, .2, 1); }
.hm-gate.is-in .hm-gate__box { transform: none; }
.hm-gate__x { position: absolute; right: 10px; top: 8px; width: 28px; height: 28px; border: 0; background: none; color: var(--ink-2); font: 300 22px/1 var(--mono); cursor: pointer; }
.hm-gate__x:hover, .hm-gate__x.hand-hover { color: var(--red); }
.hm-gate__eyebrow { display: inline-flex; align-items: center; gap: 10px; margin: 0 0 16px; font: 500 10px/1 var(--mono); letter-spacing: .2em; text-transform: uppercase; color: var(--red); }
.hm-gate__dot { width: 6px; height: 6px; background: var(--red); animation: px-blink 1.2s steps(1) infinite; }
.hm-gate__title { margin: 0; font: 400 clamp(28px, 4.2vw, 46px)/.95 var(--display); text-transform: uppercase; color: var(--ink); text-wrap: balance; }
.hm-gate__body { margin: 14px auto 0; max-width: 40ch; font: 400 12.5px/1.6 var(--mono); color: var(--ink); }
.hm-gate__opts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 26px; }
.hm-opt { position: relative; display: flex; flex-direction: column; align-items: center; gap: 9px; padding: 20px 12px 18px; border: 1px solid var(--line); background: rgba(236, 237, 239, .5); color: var(--ink); cursor: pointer; transition: border-color .2s, background-color .2s, color .2s; }
.hm-opt__name { font: 700 12px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; }
.hm-opt__desc { font: 400 10px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); }
.hm-opt:hover, .hm-opt:focus-visible, .hm-opt.hand-hover { border-color: var(--red); color: var(--red); background: rgba(253, 31, 15, .05); outline: none; }
.hm-gate__note { margin: 18px 0 0; font: 400 10px/1.5 var(--mono); letter-spacing: .08em; color: var(--ink-2); }

/* ---------- camera: big scan frame first, then the bottom-left popup ---------- */
.hm-veil { position: fixed; inset: 0; z-index: 92; background: rgba(222, 222, 222, .55); -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); opacity: 0; transition: opacity .6s; pointer-events: none; }
.hm-veil.is-in { opacity: 1; }
.hm-cam { position: fixed; z-index: 93; left: var(--edge, 24px); bottom: 24px; width: clamp(190px, 16vw, 260px); display: flex; flex-direction: column; padding: 8px; border: 1px solid var(--line); background: rgba(236, 237, 239, .92); opacity: 0; transition: opacity .45s; }
.hm-cam.is-in { opacity: 1; }
.hm-cam__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; font: 500 9px/1 var(--mono); letter-spacing: .18em; text-transform: uppercase; }
.hm-cam__rec { width: 6px; height: 6px; border-radius: 50%; background: var(--red); animation: px-blink 1.2s steps(1) infinite; }
.hm-cam__view { position: relative; flex: none; aspect-ratio: 16 / 9; overflow: hidden; background: #cfd2d6; }
.hm-cam__view video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); filter: grayscale(.55) contrast(1.05); }
.hm-cam__view canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.hm-cam__state { position: absolute; left: 6px; bottom: 6px; padding: 3px 6px; background: rgba(17, 17, 17, .72); color: #fff; font: 500 8.5px/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; }
.hm-cam__btn { align-self: flex-start; margin-top: 7px; padding: 4px 0; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--ink-2); cursor: pointer; font: 500 9px/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; }
.hm-cam__btn:hover, .hm-cam__btn.hand-hover { color: var(--red); border-color: var(--red); }
/* parts that only live in the big scan frame */
.hm-guide, .hm-cam__scan, .hm-cam__view > .hm-br, .hm-cam__eyebrow, .hm-cam__readout { display: none; }

.hm-cam.is-big { padding: 0; border-color: rgba(17, 17, 17, .3); background: #E4E5E8; }
.hm-cam.is-big .hm-cam__view { background: #E4E5E8; }
.hm-cam.is-big video { opacity: .22; filter: grayscale(1) contrast(1.1); }   /* faint, so nobody gets a fright */
.hm-cam.is-big .hm-cam__head, .hm-cam.is-big .hm-cam__btn, .hm-cam.is-big .hm-cam__state { display: none; }
.hm-cam.is-big .hm-cam__view { flex: 1 1 auto; aspect-ratio: auto; }
.hm-cam.is-big .hm-guide, .hm-cam.is-big .hm-cam__view > .hm-br, .hm-cam.is-big .hm-cam__eyebrow, .hm-cam.is-big .hm-cam__readout { display: block; }
.hm-cam.is-big .hm-cam__view > .hm-br { width: 26px; height: 26px; border-color: var(--ink); z-index: 3; }
.hm-cam.is-big .hm-cam__view > .hm-br--tl { left: 12px; top: 12px; } .hm-cam.is-big .hm-cam__view > .hm-br--tr { right: 12px; top: 12px; }
.hm-cam.is-big .hm-cam__view > .hm-br--bl { left: 12px; bottom: 12px; } .hm-cam.is-big .hm-cam__view > .hm-br--br { right: 12px; bottom: 12px; }
.hm-cam.is-locked .hm-cam__view > .hm-br { border-color: var(--red); }
.hm-cam.is-done .hm-cam__view > .hm-br { border-color: var(--hm-green); }

/* the hand guide: 80% of the screen height (set by JS), centred on the camera */
.hm-guide { position: absolute; left: 50%; top: 50%; z-index: 1; width: auto; transform: translate(-50%, -50%); fill: none; stroke: rgba(17, 17, 17, .7); stroke-linecap: round; pointer-events: none; transition: stroke .3s; }
.hm-guide .bones { stroke-width: 1.3; stroke-dasharray: 6 5; }
.hm-guide .palm { stroke-width: 1; stroke-dasharray: 3 6; vector-effect: non-scaling-stroke; }
.hm-guide .joints circle { fill: rgba(17, 17, 17, .75); stroke: none; }
.hm-guide .joints .tip { fill: none; stroke: rgba(17, 17, 17, .75); stroke-width: 1.2; vector-effect: non-scaling-stroke; }
.hm-cam.is-locked .hm-guide { stroke: var(--red); }
.hm-cam.is-locked .hm-guide .joints circle { fill: var(--red); }
.hm-cam.is-locked .hm-guide .joints .tip { fill: none; stroke: var(--red); }
.hm-cam.is-done .hm-guide { stroke: var(--hm-green); }
.hm-cam.is-done .hm-guide .joints circle { fill: var(--hm-green); }
.hm-cam.is-done .hm-guide .joints .tip { fill: none; stroke: var(--hm-green); }
.hm-cam__view canvas { z-index: 2; }

.hm-cam__scan { position: absolute; left: 0; right: 0; top: 0; z-index: 3; height: 30%; background: linear-gradient(to bottom, rgba(253, 31, 15, 0), rgba(253, 31, 15, .18) 82%, rgba(253, 31, 15, .75) 100%); border-bottom: 1px solid rgba(253, 31, 15, .95); transform: translateY(-110%); pointer-events: none; }
.hm-cam.is-scanning .hm-cam__scan { display: block; animation: hm-scan 1.1s cubic-bezier(.45, 0, .55, 1) 2; }
@keyframes hm-scan { 0% { transform: translateY(-110%); } 100% { transform: translateY(340%); } }

.hm-cam__eyebrow { position: absolute; left: 0; right: 0; top: 18px; z-index: 3; margin: 0; text-align: center; font: 500 10px/1 var(--mono); letter-spacing: .22em; text-transform: uppercase; color: var(--red); }
.hm-cam__readout { position: absolute; left: 50%; bottom: 22px; z-index: 3; transform: translateX(-50%); min-width: 72%; padding: 10px 16px 12px; border: 1px solid var(--line); background: rgba(236, 237, 239, .9); text-align: center; }
.hm-cam__text { margin: 0; min-height: 1.4em; font: 500 11px/1.4 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--ink); }
.hm-cam__pct { margin: 2px 0 0; font: 400 26px/1 var(--display); color: var(--red); }
.hm-cam.is-done .hm-cam__pct { color: var(--hm-green); }

/* the camera as a faint full-screen mirror over the whole site (you see yourself) */
.hm-cam.is-mirror { left: 0; top: 0; bottom: auto; width: 100%; height: 100%; z-index: 90; padding: 0; border: 0; background: transparent; pointer-events: none; }
.hm-cam.is-mirror .hm-cam__head, .hm-cam.is-mirror .hm-cam__btn, .hm-cam.is-mirror .hm-cam__state { display: none; }
.hm-cam.is-mirror .hm-cam__view { flex: 1 1 auto; aspect-ratio: auto; background: transparent; }
.hm-cam.is-mirror video { opacity: .13; filter: grayscale(1) contrast(1.1); transform: translateY(var(--hm-ty, 0px)) scale(var(--hm-zoom, 1.47)) scaleX(-1); transition: opacity .8s; }
.hm-cam.is-mirror canvas { opacity: .4; }

/* status chip + way back to the mouse */
.hm-chip { position: fixed; z-index: 94; left: var(--edge, 24px); bottom: 16px; display: flex; align-items: center; gap: 10px; padding: 7px 10px; border: 1px solid var(--line); background: rgba(236, 237, 239, .85); font: 500 9px/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; opacity: 0; transform: translateY(8px); transition: opacity .4s, transform .4s; }
.hm-chip.is-in { opacity: 1; transform: none; }
.hm-chip__rec { width: 6px; height: 6px; border-radius: 50%; background: var(--red); animation: px-blink 1.2s steps(1) infinite; }
.hm-chip__btn { padding: 0 0 2px; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--ink-2); cursor: pointer; font: inherit; letter-spacing: inherit; text-transform: inherit; }
.hm-chip__btn:hover, .hm-chip__btn.hand-hover { color: var(--red); border-color: var(--red); }
.hm-live .watch { bottom: calc(clamp(26px, 6vh, 60px) + 34px); }

/* grabbing an empty spot: a small joystick right where the hand grabbed */
.hm-drag { position: fixed; left: 0; top: 0; z-index: 98; width: 0; height: 0; pointer-events: none; opacity: 0; transition: opacity .2s; }
.hm-drag.is-on { opacity: 1; }
.hm-drag__ring, .hm-drag__knob { position: absolute; left: 0; top: 0; transform: translate(-50%, -50%); border-radius: 50%; }
.hm-drag__ring { width: 120px; height: 120px; border: 1px dashed rgba(253, 31, 15, .7); background: rgba(236, 237, 239, .35); }
.hm-drag__knob { width: 30px; height: 30px; border: 1.5px solid var(--red); background: rgba(253, 31, 15, .25); }

/* ---------- ACCESS GRANTED (full width, green) ---------- */
.hm-granted { position: fixed; left: 0; right: 0; top: 50%; z-index: 96; transform: translateY(-50%); padding: 2vh 0; border-top: 1px solid var(--hm-green); border-bottom: 1px solid var(--hm-green); background: rgba(236, 237, 239, .88); text-align: center; pointer-events: none; opacity: 0; transition: opacity .35s; }
.hm-granted.is-in { opacity: 1; }
.hm-granted.is-out { opacity: 0; }
.hm-granted__txt { display: block; min-height: 1em; font: 400 clamp(44px, 10.5vw, 210px)/.9 var(--display); letter-spacing: .02em; color: var(--hm-green); white-space: nowrap; }

/* ---------- hand points (01 red, 02 ink) ---------- */
.hm-cursor { position: fixed; left: 0; top: 0; z-index: 99; width: 0; height: 0; pointer-events: none; transition: opacity .25s; --c: var(--red); --cf: rgba(253, 31, 15, .08); }
.hm-cursor--2 { --c: var(--ink); --cf: rgba(17, 17, 17, .08); }
.hm-cursor.is-hidden { opacity: 0; }
.hm-cursor__ring, .hm-cursor__dot, .hm-cursor__dwell { position: absolute; left: 0; top: 0; transform: translate(-50%, -50%); }
.hm-cursor__ring { width: 40px; height: 40px; border: 1.5px solid var(--c); border-radius: 50%; background: var(--cf); transition: width .18s, height .18s, background-color .18s; }
.hm-cursor__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--c); }
.hm-cursor__no { position: absolute; left: 24px; top: -22px; font: 600 9px/1 var(--mono); letter-spacing: .12em; color: var(--c); }
.hm-cursor.is-press .hm-cursor__ring { width: 22px; height: 22px; background: color-mix(in srgb, var(--c) 45%, transparent); }
.hm-cursor__dwell { width: 60px; height: 60px; transform: translate(-50%, -50%) rotate(-90deg); opacity: 0; transition: opacity .2s; }
.hm-cursor__dwell circle { fill: none; stroke: var(--c); stroke-width: 3; stroke-dasharray: 163.4; stroke-dashoffset: 163.4; }
.hm-cursor.is-dwell .hm-cursor__dwell { opacity: 1; }
.hm-cursor.is-click .hm-cursor__ring { animation: hm-click .45s ease-out; }
@keyframes hm-click { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--c) 55%, transparent); } 100% { box-shadow: 0 0 0 22px transparent; } }

/* ---------- joystick (right) ---------- */
.hm-joy { position: fixed; z-index: 92; right: calc(var(--edge, 24px) + 34px); top: 50%; display: flex; flex-direction: column; align-items: center; gap: 8px; transform: translate(16px, -50%); opacity: 0; transition: opacity .45s, transform .45s cubic-bezier(.2, .7, .2, 1); pointer-events: none; }
.hm-joy.is-in { opacity: 1; transform: translate(0, -50%); }
.hm-joy__label, .hm-joy__arrow, .hm-joy__tip { font: 500 9px/1 var(--mono); letter-spacing: .2em; text-transform: uppercase; color: var(--ink-2); }
.hm-joy__base { position: relative; width: 112px; height: 112px; border: 1px solid var(--line); border-radius: 50%; background: rgba(236, 237, 239, .75); transition: border-color .2s; }
.hm-joy__ticks { position: absolute; inset: 10px; border: 1px dashed rgba(17, 17, 17, .18); border-radius: 50%; }
.hm-joy__knob { position: absolute; left: 50%; top: 50%; width: 42px; height: 42px; border: 1.5px solid var(--red); border-radius: 50%; background: var(--bg-hi, #ECEDEF); transform: translate(-50%, -50%); transition: transform .35s cubic-bezier(.2, .9, .3, 1.3), background-color .2s; }
.hm-joy.is-grabbed .hm-joy__knob { background: var(--red); transition: background-color .2s; }
.hm-joy.is-near .hm-joy__base, .hm-joy.is-grabbed .hm-joy__base { border-color: var(--red); }
.hm-joy__tip { max-width: 130px; text-align: center; line-height: 1.4; opacity: 0; transition: opacity .2s; }
.hm-joy.is-near .hm-joy__tip { opacity: 1; color: var(--red); }

@media (max-width: 760px) {
  .hm-gate__opts { grid-template-columns: 1fr; }
  .hm-joy { right: 14px; }
  .hm-joy__base { width: 88px; height: 88px; }
  .hm-cam:not(.is-big) { width: 150px; }
}
@media (prefers-reduced-motion: reduce) {
  .hm-cam.is-scanning .hm-cam__scan { animation: none; display: none; }
  .hm-gate__dot, .hm-cam__rec { animation: none; }
}
.hm-ico--hand .palm { display: none; }
/* holding the page: the point turns into a vertical grip */
.hm-cursor.is-drag .hm-cursor__ring { border-style: dashed; }
.hm-cursor.is-drag .hm-cursor__dot { width: 2px; height: 26px; border-radius: 2px; }

/* ---------- exit (left): X circle mirroring the joystick ---------- */
.hm-exit { position: fixed; z-index: 92; left: calc(var(--edge, 24px) + 34px); top: 50%; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 0; border: 0; background: none; color: var(--ink); cursor: pointer; transform: translate(-16px, -50%); opacity: 0; transition: opacity .45s, transform .45s cubic-bezier(.2, .7, .2, 1); }
.hm-exit.is-in { opacity: 1; transform: translate(0, -50%); }
.hm-exit__label, .hm-exit__tip { font: 500 9px/1 var(--mono); letter-spacing: .2em; text-transform: uppercase; color: var(--ink-2); }
.hm-exit__base { position: relative; width: 112px; height: 112px; border: 1px solid var(--line); border-radius: 50%; background: rgba(236, 237, 239, .75); transition: border-color .2s, background-color .2s; }
.hm-exit__base::before { content: ""; position: absolute; inset: 10px; border: 1px dashed rgba(17, 17, 17, .18); border-radius: 50%; }
.hm-exit__x { position: absolute; left: 50%; top: 50%; width: 42px; height: 42px; border: 1.5px solid var(--ink); border-radius: 50%; transform: translate(-50%, -50%); transition: border-color .2s, background-color .2s; }
.hm-exit__x::before, .hm-exit__x::after { content: ""; position: absolute; left: 50%; top: 50%; width: 16px; height: 1.5px; background: var(--ink); transition: background-color .2s; }
.hm-exit__x::before { transform: translate(-50%, -50%) rotate(45deg); }
.hm-exit__x::after { transform: translate(-50%, -50%) rotate(-45deg); }
.hm-exit__tip { max-width: 130px; text-align: center; line-height: 1.4; opacity: 0; transition: opacity .2s; }
.hm-exit:hover .hm-exit__base, .hm-exit:focus-visible .hm-exit__base { border-color: var(--red); }
.hm-exit:hover .hm-exit__x, .hm-exit:focus-visible .hm-exit__x { border-color: var(--red); background: var(--red); }
.hm-exit:hover .hm-exit__x::before, .hm-exit:hover .hm-exit__x::after, .hm-exit:focus-visible .hm-exit__x::before, .hm-exit:focus-visible .hm-exit__x::after { background: #fff; }
.hm-exit:hover .hm-exit__tip, .hm-exit:focus-visible .hm-exit__tip { opacity: 1; color: var(--red); }
.hm-exit:focus-visible { outline: none; }

/* closing: IMMERSIVE MODE CLOSED (red) while everything fades out together */
.hm-closed { border-color: var(--red); }
.hm-closed .hm-granted__txt { color: var(--red); font-size: clamp(32px, 6.6vw, 130px); }
.hm-closing .hm-cam, .hm-closing .hm-joy, .hm-closing .hm-exit, .hm-closing .hm-chip, .hm-closing .hm-cursor { opacity: 0 !important; transition: opacity .7s !important; }
@media (max-width: 760px) { .hm-exit { left: 14px; } .hm-exit__base { width: 88px; height: 88px; } }

/* bottom-right: turn immersive mode (back) on */
.hm-reenter { position: fixed; z-index: 94; right: var(--edge, 24px); bottom: 16px; display: inline-flex; align-items: center; gap: 9px; padding: 7px 12px 7px 9px; border: 1px solid var(--line); background: rgba(236, 237, 239, .85); color: var(--ink); cursor: pointer; font: 600 9.5px/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; opacity: 0; transform: translateY(8px); pointer-events: none; transition: opacity .4s, transform .4s, border-color .2s, color .2s; }
.hm-reenter.is-in { opacity: 1; transform: none; pointer-events: auto; }
.hm-reenter .hm-ico--hand { width: 18px; height: 22px; }
.hm-reenter:hover, .hm-reenter:focus-visible { border-color: var(--red); color: var(--red); outline: none; }
.hm-reenter-on .readout { display: none; }
.hm-reenter-on .sector { bottom: calc(clamp(26px, 6vh, 60px) + 34px); }

/* pinch (click) vs fist (grab): a small tight ring for the pinch */
.hm-cursor.is-pinch .hm-cursor__ring { width: 12px; height: 12px; background: var(--c); }
.hm-joy.is-zoom .hm-joy__arrow { font-size: 14px; letter-spacing: 0; color: var(--ink); }
