/* Local interaction feedback. Pointer replacement is enabled only by initialized JS. */

/* Translation stays on the two children; their fine geometry never rotates. */
.motion-cursor {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 2147483647;
  color: var(--ui-accent, #bcefff);
  pointer-events: none;
  opacity: 0;
}

.motion-cursor-dot,
.motion-cursor-ring {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  pointer-events: none;
}

.motion-cursor-dot {
  width: 3px;
  height: 3px;
  margin: -1.5px;
  background: var(--ui-white, #eefaff);
  box-shadow: 0 0 5px color-mix(in srgb, currentColor 22%, transparent);
}

.motion-cursor-dot::before,
.motion-cursor-dot::after {
  content: "";
  position: absolute;
  background: currentColor;
  opacity: .65;
}
.motion-cursor-dot::before { width: 9px; height: 1px; left: -3px; top: 1px; }
.motion-cursor-dot::after { width: 1px; height: 9px; left: 1px; top: -3px; }

.motion-cursor-ring { width: 34px; height: 34px; margin: -17px; }
.motion-cursor-ring::before,
.motion-cursor-ring::after {
  content: "";
  position: absolute;
  pointer-events: none;
  transition: inset 150ms ease, opacity 150ms ease, border-color 150ms ease;
}
.motion-cursor-ring::before {
  inset: 4px;
  border: 1px solid color-mix(in srgb, currentColor 68%, transparent);
  opacity: .72;
  clip-path: polygon(0 0, calc(100% - 4px) 0, 100% 4px, 100% 100%, 4px 100%, 0 calc(100% - 4px));
}
.motion-cursor-ring::after {
  inset: -2px;
  opacity: .65;
  background:
    linear-gradient(currentColor, currentColor) center top / 1px 4px no-repeat,
    linear-gradient(currentColor, currentColor) center bottom / 1px 4px no-repeat,
    linear-gradient(currentColor, currentColor) left center / 4px 1px no-repeat,
    linear-gradient(currentColor, currentColor) right center / 4px 1px no-repeat;
}
.motion-cursor[data-target="true"] .motion-cursor-ring::before { inset: 1px; opacity: 1; border-color: currentColor; }
.motion-cursor[data-target="true"] .motion-cursor-ring::after { inset: -4px; opacity: .85; }
.motion-cursor[data-pressed="true"] .motion-cursor-ring::before { inset: 7px; opacity: 1; transition-duration: 80ms; }
.motion-cursor[data-pressed="true"] .motion-cursor-ring::after { inset: 1px; opacity: 1; transition-duration: 80ms; }

/* A fine text reticle replaces the system I-beam; the real input caret is untouched. */
.motion-cursor[data-kind="text"] .motion-cursor-dot { opacity: 0; }
.motion-cursor[data-kind="text"] .motion-cursor-ring::before {
  inset: 6px 16px;
  border-width: 0 0 0 1px;
  opacity: .95;
  clip-path: none;
}
.motion-cursor[data-kind="text"] .motion-cursor-ring::after {
  inset: 6px 11px;
  border-top: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  background: none;
  opacity: .95;
}

@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  html[data-ui-motion="active"] .motion-cursor[data-visible="true"] { display: block; opacity: 1; }
  html[data-cursor-active="true"],
  html[data-cursor-active="true"] body,
  html[data-cursor-active="true"] body *,
  html[data-cursor-active="true"] body *::before,
  html[data-cursor-active="true"] body *::after { cursor: none !important; }
}

/* A single sweep on entry; the label and arrow stay above its clipped light band. */
.hero .motion-cta {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  --cta-lift: 0px;
  transform: translate3d(var(--magnet-x, 0px), calc(var(--magnet-y, 0px) + var(--cta-lift, 0px)), 0);
  transition: background 200ms ease, border-color 200ms ease, box-shadow 200ms ease, transform 180ms cubic-bezier(.2, .7, .2, 1);
}

.hero .motion-cta > span { position: relative; z-index: 1; }

.hero .motion-cta::before {
  content: "";
  position: absolute;
  inset: -50% -45%;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(112deg, transparent 38%, color-mix(in srgb, var(--accent) 8%, transparent) 44%, color-mix(in srgb, var(--accent) 42%, transparent) 50%, color-mix(in srgb, var(--accent) 8%, transparent) 56%, transparent 62%);
  transform: translate3d(-65%, 0, 0);
}

.hero .motion-cta:is(:hover, :focus-visible, [data-tap="active"]) {
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 84%, transparent);
  background: linear-gradient(145deg, color-mix(in srgb, var(--accent) 26%, transparent), color-mix(in srgb, var(--accent) 12%, transparent));
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--accent) 40%, transparent), 0 0 0 1px color-mix(in srgb, var(--accent) 13%, transparent), 0 5px 20px color-mix(in srgb, var(--accent) 12%, transparent);
  transform: translate3d(var(--magnet-x, 0px), calc(var(--magnet-y, 0px) + var(--cta-lift, 0px)), 0);
}

html[data-ui-motion="active"] .hero .motion-cta:focus-visible { --cta-lift: -2px; }
html[data-ui-motion="active"] .hero .motion-cta:focus-visible::before { animation: motion-cta-sweep 560ms ease-out both; }

@media (hover: hover) and (pointer: fine) {
  html[data-ui-motion="active"] .hero .motion-cta:hover { --cta-lift: -2px; }
  html[data-ui-motion="active"] .hero .motion-cta:hover::before { animation: motion-cta-sweep 560ms ease-out both; }
}

.hero .motion-cta[data-tap="active"] {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 42%, transparent), 0 0 16px color-mix(in srgb, var(--accent) 14%, transparent);
}

@keyframes motion-cta-sweep {
  0% { opacity: 0; transform: translate3d(-65%, 0, 0); }
  15% { opacity: .8; }
  80% { opacity: .65; }
  100% { opacity: 0; transform: translate3d(65%, 0, 0); }
}

/* Brackets are inset and pointer-transparent, including on the clipped K90U links. */
.project-placeholder.motion-card,
.cocoa-feature.motion-card {
  position: relative;
  transition: border-color 220ms ease, box-shadow 220ms ease;
}

.motion-card::before,
.motion-card::after {
  content: "";
  position: absolute;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  transition: opacity 220ms ease;
}

.motion-card::before {
  inset: 14px;
  color: var(--accent);
  background:
    linear-gradient(currentColor, currentColor) left top / 8px 1px no-repeat,
    linear-gradient(currentColor, currentColor) left top / 1px 8px no-repeat,
    linear-gradient(currentColor, currentColor) right top / 8px 1px no-repeat,
    linear-gradient(currentColor, currentColor) right top / 1px 8px no-repeat,
    linear-gradient(currentColor, currentColor) left bottom / 8px 1px no-repeat,
    linear-gradient(currentColor, currentColor) left bottom / 1px 8px no-repeat,
    linear-gradient(currentColor, currentColor) right bottom / 8px 1px no-repeat,
    linear-gradient(currentColor, currentColor) right bottom / 1px 8px no-repeat;
}

.motion-card::after {
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 24%, transparent), inset 0 0 22px color-mix(in srgb, var(--accent) 6%, transparent);
}

.project-placeholder.motion-card:is(:hover, :focus-within, [data-tap="active"]),
.cocoa-feature.motion-card:is(:hover, :focus-within, [data-tap="active"]) {
  border-color: color-mix(in srgb, var(--accent) 76%, transparent);
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--accent) 30%, transparent), 0 16px 50px rgba(0, 0, 0, .12), 0 0 18px color-mix(in srgb, var(--accent) 8%, transparent);
}

.motion-card:is(:hover, :focus-within, [data-tap="active"])::before { opacity: .82; }
.motion-card:is(:hover, :focus-within, [data-tap="active"])::after { opacity: 1; }

/* The source title remains in normal flow; only its aria-hidden copy is clipped. */
.hero-dimensional .hero-copy::before,
.hero-dimensional .hero-copy::after { transition: transform 260ms ease, border-color 260ms ease; }
@media (hover: hover) and (pointer: fine) {
  html[data-ui-motion="active"] .hero-dimensional .hero-copy:hover::before { transform: translate(-3px,-3px); border-color: var(--accent); }
  html[data-ui-motion="active"] .hero-dimensional .hero-copy:hover::after { transform: translate(3px,3px); border-color: var(--accent); }
}
.hero-dimensional .hero-copy:focus-within::before,
.hero-dimensional .hero-copy:focus-within::after { border-color: var(--accent); }
.hero-copy .outline-text { position: relative; }

.hero h1 .motion-title-scan {
  position: absolute;
  inset: 0;
  display: block;
  z-index: 1;
  visibility: hidden;
  opacity: 0;
  color: transparent;
  -webkit-text-fill-color: transparent;
  -webkit-text-stroke: 1px var(--accent);
  font: inherit;
  letter-spacing: inherit;
  line-height: inherit;
  pointer-events: none;
  user-select: none;
  clip-path: polygon(-28% 0, -14% 0, -30% 100%, -44% 100%);
}

html[data-ui-motion="active"] .hero-copy[data-title-scan="active"] .motion-title-scan {
  visibility: visible;
  animation: motion-title-scan 840ms cubic-bezier(.2, .6, .3, 1) both;
}

@keyframes motion-title-scan {
  0% { opacity: 0; clip-path: polygon(-28% 0, -14% 0, -30% 100%, -44% 100%); }
  10% { opacity: .95; }
  85% { opacity: .95; }
  100% { opacity: 0; clip-path: polygon(142% 0, 156% 0, 140% 100%, 126% 100%); }
}

/* Scrambling changes an overlay only, never the original accessible text or its width. */
.motion-scramble { position: relative; display: inline-block; }

.motion-scramble-layer {
  position: absolute;
  inset: 0;
  display: block;
  visibility: hidden;
  opacity: 0;
  color: var(--accent);
  font: inherit;
  letter-spacing: inherit;
  line-height: inherit;
  white-space: pre;
  pointer-events: none;
  user-select: none;
}

html[data-ui-motion="active"] .motion-scramble[data-scrambling="active"] { color: transparent; }
html[data-ui-motion="active"] .motion-scramble[data-scrambling="active"] .motion-scramble-layer { visibility: visible; opacity: 1; }

/* Existing reflection and click-pulse pseudos remain owned by the cube styles. */
.volume-interaction .volume-face { transition: border-color 200ms ease, box-shadow 200ms ease; }

.volume-interaction[data-cube-hover="true"]:not([data-pulse="active"]) .volume-face,
.volume-interaction:focus-visible:not([data-pulse="active"]) .volume-face {
  border-color: color-mix(in srgb, var(--accent) 90%, transparent);
  box-shadow: inset 1px 1px 0 color-mix(in srgb, var(--accent) 25%, transparent), inset -1px -1px 0 color-mix(in srgb, var(--accent) 12%, transparent);
}

.volume-interaction:focus-visible { outline-color: var(--accent); }

/* Pausing removes animated feedback while leaving useful static focus and edge cues. */
html[data-ui-motion="paused"] .motion-cursor { display: none; }
html[data-ui-motion="paused"] .hero .motion-cta { transform: none; }
html[data-ui-motion="paused"] .hero .motion-cta::before,
html[data-ui-motion="paused"] .hero h1 .motion-title-scan { animation: none; visibility: hidden; opacity: 0; }
html[data-ui-motion="paused"] .motion-scramble-layer { visibility: hidden; opacity: 0; }

.hero-volume[data-motion="paused"] .volume-cube,
.hero-volume[data-motion="paused"] .volume-face::after,
html[data-ui-motion="paused"] .hero-volume .volume-cube,
html[data-ui-motion="paused"] .hero-volume .volume-face::after { animation-play-state: paused !important; }

.hero-volume[data-motion="paused"] .volume-face::before,
html[data-ui-motion="paused"] .hero-volume .volume-face::before { animation: none !important; opacity: 0; }

@media (prefers-reduced-motion: reduce) {
  .motion-cursor { display: none !important; }
  .hero .motion-cta,
  .hero .motion-cta:is(:hover, :focus-visible, [data-tap="active"]) { transform: none !important; transition: none; }
  .hero .motion-cta::before,
  .hero h1 .motion-title-scan { animation: none !important; visibility: hidden !important; opacity: 0 !important; }
  .motion-scramble[data-scrambling="active"] { color: inherit !important; }
  .motion-scramble-layer { visibility: hidden !important; opacity: 0 !important; }
  .motion-card,
  .motion-card::before,
  .motion-card::after,
  .hero-dimensional .hero-copy::before,
  .hero-dimensional .hero-copy::after,
  .volume-interaction .volume-face { transition: none !important; }
}
