/* Motion is a removable layer over the accepted still design. */
html[data-design-theme="optical"][data-optical-motion="on"] .op-motion-entry-edge { position: relative; }
html[data-design-theme="optical"][data-optical-motion="on"] .op-motion-entry-edge::after {
  content: "";
  position: absolute;
  inset: -1px;
  padding: 1px;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(115deg, transparent 34%, #d9e4dbb3 50%, transparent 66%) -150% 0 / 250% 100% no-repeat;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: op-entry-edge 1600ms cubic-bezier(.22,.7,.2,1) both;
}
html[data-design-theme="optical"][data-optical-motion="on"] .op-motion-entry-title { animation: op-entry-content 900ms cubic-bezier(.18,.67,.2,1) both; }
html[data-design-theme="optical"][data-optical-motion="on"] .op-motion-entry-copy { animation: op-entry-content 1000ms cubic-bezier(.18,.67,.2,1) 120ms both; }
html[data-design-theme="optical"][data-optical-motion="on"] :is(#focus-question, .focus-brand).op-motion-focus-expand { --op-motion-focus-shift: 24px; animation: op-focus-expand 1000ms cubic-bezier(.18,.67,.2,1) both; }
html[data-design-theme="optical"][data-optical-motion="on"] .op-motion-record-expand { animation: op-record-expand 620ms cubic-bezier(.18,.67,.2,1) both; }
html[data-design-theme="optical"][data-optical-motion="on"] .op-motion-selection-light { animation: op-selection-light 900ms ease-out both; }
html[data-design-theme="optical"][data-optical-motion="on"] .op-motion-evidence-light { animation: op-evidence-light 1000ms ease-out both; }
html[data-design-theme="optical"][data-optical-motion="on"] .op-motion-dialog-open { animation: op-dialog-open 240ms cubic-bezier(.18,.67,.2,1) both; }
html[data-design-theme="optical"][data-optical-motion="on"] .op-motion-dialog-return { animation: op-control-return 280ms ease-out both; }
html[data-design-theme="optical"][data-optical-motion="on"] .op-motion-details-open { animation: op-details-open 300ms ease-out both; }

html[data-design-theme="optical"][data-optical-motion="on"] :is(button, .button) {
  transition: border-color 160ms ease, box-shadow 180ms ease, transform 160ms ease, background-color 160ms ease;
}
html[data-design-theme="optical"][data-optical-motion="on"] button:hover:enabled {
  transform: translateY(-2px);
  border-color: var(--op-faint, #91a9ad);
  box-shadow: inset 0 0 0 1px #c8dad533;
}
html[data-design-theme="optical"][data-optical-motion="on"] button:focus-visible {
  box-shadow: inset 0 0 0 1px #e4e8db66;
}
html[data-design-theme="optical"][data-optical-motion="on"] button:active:enabled {
  transform: translateY(1px);
  box-shadow: inset 0 1px 3px #07131844;
}
html[data-design-theme="optical"][data-optical-motion="reduced"] button:hover:enabled {
  border-color: var(--op-faint, #91a9ad);
}

@keyframes op-entry-edge {
  0% { background-position: -150% 0; opacity: 0; }
  20% { opacity: .8; }
  76% { opacity: .7; }
  100% { background-position: 150% 0; opacity: 0; }
}
@keyframes op-entry-content {
  from { transform: translateY(32px); opacity: .2; }
  to { transform: translateY(0); opacity: 1; }
}
@keyframes op-focus-expand {
  0%, 34% { transform: translateX(var(--op-motion-focus-shift)); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}
@keyframes op-record-expand {
  from { transform: translateY(16px); opacity: .65; }
  to { transform: translateY(0); opacity: 1; }
}
@keyframes op-selection-light {
  0% { box-shadow: inset 2px 0 #e3e8dc, 0 0 0 1px #d1e1d577; }
  100% { box-shadow: inset 2px 0 var(--op-human, #b5d0bf), 0 0 0 1px transparent; }
}
@keyframes op-evidence-light {
  0% { box-shadow: 0 0 0 2px #dce7d9, 0 0 0 8px #bdd7ca33; }
  45% { box-shadow: 0 0 0 2px #c9e0d2, 0 0 15px 4px #bdd7ca26; }
  100% { box-shadow: 0 0 0 2px var(--op-human, #b5d0bf), 0 0 0 0 transparent; }
}
@keyframes op-dialog-open {
  from { transform: translateY(12px); opacity: .92; }
  to { transform: translateY(0); opacity: 1; }
}
@keyframes op-control-return {
  from { box-shadow: 0 0 0 2px #cfdfd480; }
  to { box-shadow: 0 0 0 2px transparent; }
}
@keyframes op-details-open {
  from { box-shadow: inset 1px 0 #b5d0bf; }
  to { box-shadow: inset 1px 0 transparent; }
}

@media (max-width: 700px) {
  html[data-design-theme="optical"][data-optical-motion="on"] :is(#focus-question, .focus-brand).op-motion-focus-expand { --op-motion-focus-shift: 8px; }
}

/* OS preference is a second guard before/without the runtime's change event. */
@media (prefers-reduced-motion: reduce) {
  html[data-design-theme="optical"] :is(.op-motion-entry-title, .op-motion-entry-copy, .op-motion-focus-expand, .op-motion-record-expand, .op-motion-selection-light, .op-motion-evidence-light, .op-motion-dialog-open, .op-motion-dialog-return, .op-motion-details-open),
  html[data-design-theme="optical"] .op-motion-entry-edge::after { animation: none !important; }
  html[data-design-theme="optical"] button { transition: none !important; transform: none !important; }
}
/* Quoted words stay still while their rim reacts. */
html[data-design-theme="optical"][data-optical-motion="on"] button.evidence-quote:is(:hover,:active){transform:none}
@media(hover:none){html[data-design-theme="optical"][data-optical-motion="on"] button:hover:not(:active){transform:none}}

/* Match the control-family specificity without changing the static theme. */
@media (prefers-reduced-motion: no-preference) {
  @media (hover: hover) {
    html[data-design-theme="optical"][data-optical-motion="on"] :is(.button.secondary, .small-button, .icon-button):not(.evidence-quote):hover:enabled {
      transform: translateY(-2px);
      box-shadow: inset 0 0 0 1px #c8dad533;
    }
  }
  html[data-design-theme="optical"][data-optical-motion="on"] :is(.button.secondary, .small-button, .icon-button):not(.evidence-quote):active:enabled {
    transform: translateY(1px);
    box-shadow: inset 0 1px 3px #07131844;
  }
}
