/*
 * Hamrah Group 11.5A Dev1 R2 — mobile performance refinement.
 * Motion-only layer: no resting layout, color, typography, or feature changes.
 */
:root {
  --hm-motion-none: 0ms;
  --hm-motion-instant: 70ms;
  --hm-motion-micro: 100ms;
  --hm-motion-fast: 140ms;
  --hm-motion-standard: 190ms;
  --hm-motion-emphasized: 250ms;
  --hm-motion-page: 270ms;
  --hm-motion-sheet: 300ms;
  --hm-motion-skeleton-cycle: 1400ms;

  --hm-ease-linear: linear;
  --hm-ease-standard: cubic-bezier(.2, .72, .24, 1);
  --hm-ease-enter: cubic-bezier(.16, 1, .3, 1);
  --hm-ease-exit: cubic-bezier(.4, 0, 1, 1);
  --hm-ease-emphasized: cubic-bezier(.2, .9, .2, 1);
  --hm-ease-soft-spring: cubic-bezier(.2, 1.08, .32, 1);
  --hm-ease-responsive-spring: cubic-bezier(.18, 1.12, .28, 1);

  --hm-distance-micro: 2px;
  --hm-distance-subtle: 4px;
  --hm-distance-menu: 8px;
  --hm-distance-dialog: 12px;
  --hm-distance-page: 18px;
  --hm-scale-press: .985;
  --hm-scale-dialog: .975;
  --hm-scale-menu: .985;
  --hm-motion-multiplier: 1;

  /* Compatibility aliases: existing UI now consumes the same source of truth. */
  --g10-motion-fast: var(--hm-motion-fast);
  --g10-motion-control: var(--hm-motion-standard);
  --g10-motion-menu: var(--hm-motion-standard);
  --g10-motion-message: 220ms;
  --g10-motion-page: var(--hm-motion-page);
  --g10-motion-sheet: var(--hm-motion-sheet);
  --g10-ease: var(--hm-ease-standard);
  --g10-ease-out: var(--hm-ease-enter);
  --pc-motion: var(--hm-motion-standard) var(--hm-ease-standard);
}

html[data-g115-motion-platform="mobile"] {
  --hm-motion-instant: 60ms;
  --hm-motion-micro: 80ms;
  --hm-motion-fast: 110ms;
  --hm-motion-standard: 150ms;
  --hm-motion-emphasized: 180ms;
  --hm-motion-page: 190ms;
  --hm-motion-sheet: 210ms;
  --hm-motion-skeleton-cycle: 1800ms;
  --hm-distance-page: 8px;
  --hm-distance-dialog: 6px;
  --hm-distance-menu: 4px;
  --hm-scale-press: .99;
  --hm-scale-dialog: .988;
  --hm-scale-menu: .992;
}

html[data-g115-motion-platform="windows"] {
  --hm-motion-page: 210ms;
  --hm-motion-sheet: 240ms;
  --hm-distance-page: 6px;
  --hm-distance-dialog: 8px;
}

body[data-g114-style="minimal"],
body[data-g114-style="classic"] {
  --hm-distance-page: 8px;
  --hm-distance-dialog: 8px;
  --hm-scale-press: .992;
}

body[data-g114-style="soft"] {
  --hm-ease-standard: cubic-bezier(.18, .78, .2, 1);
  --hm-ease-enter: cubic-bezier(.16, 1, .26, 1);
}

/* Disable legacy duplicate entrances only after the Dev1 controller is ready. */
html[data-g115-motion-ready="true"] .view.active,
html[data-g115-motion-ready="true"] .view.active.view-forward,
html[data-g115-motion-ready="true"] .view.active.view-back,
html[data-g115-motion-ready="true"] .sheet-backdrop,
html[data-g115-motion-ready="true"] .sheet-backdrop .sheet,
html[data-g115-motion-ready="true"] .sheet-backdrop.opening .sheet-title,
html[data-g115-motion-ready="true"] .sheet-backdrop.opening .action-row,
html[data-g115-motion-ready="true"] .sheet-backdrop.opening .channel-preview,
html[data-g115-motion-ready="true"] .sheet-backdrop.opening .sheet > label,
html[data-g115-motion-ready="true"] .sheet-backdrop.opening .sheet > h3,
html[data-g115-motion-ready="true"] .sheet-backdrop.opening .sheet > .primary,
html[data-g115-motion-ready="true"] .pc-dialog,
html[data-g115-motion-ready="true"] .pc-panel,
html[data-g115-motion-ready="true"] .g114d3-studio:not(.hidden) .g114d3-shell,
html[data-g115-motion-ready="true"] .toast.show {
  animation: none !important;
}

/* WAAPI handles temporary compositor promotion. Avoid eager full-page will-change on mobile. */
[data-g115-overlay-state="leaving"] {
  pointer-events: none !important;
}

/* Shared interaction feedback is opt-in and scoped by the controller. */
[data-g115-motion-control="true"] {
  transition-property: transform, opacity, filter, background-color, border-color, box-shadow;
  transition-duration: var(--hm-motion-fast);
  transition-timing-function: var(--hm-ease-standard);
  transform-origin: center;
}

[data-g115-motion-control="true"]:active:not(:disabled):not([aria-disabled="true"]) {
  transform: scale(var(--hm-scale-press));
}

html[data-g115-motion-platform="mobile"] [data-g115-motion-control="true"] {
  transition-property: transform, opacity, background-color, border-color;
  transition-duration: var(--hm-motion-micro);
}

html[data-g115-motion-platform="windows"] [data-g115-motion-control="true"]:hover:not(:disabled):not([aria-disabled="true"]) {
  filter: brightness(1.025);
}

[data-g115-motion-control="true"]:focus-visible {
  transition-duration: var(--hm-motion-fast);
}

/* Lightweight skeleton primitives for safe, geometry-matched loading states. */
.g115-skeleton {
  position: relative;
  overflow: hidden;
  color: transparent !important;
  background: color-mix(in srgb, var(--surface-2, #18283a) 88%, var(--primary, #168fd0) 12%);
  border-color: transparent !important;
  user-select: none;
}

.g115-skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(110%);
  background: linear-gradient(100deg, transparent 15%, color-mix(in srgb, #fff 13%, transparent) 45%, transparent 75%);
  animation: g115SkeletonSweep var(--hm-motion-skeleton-cycle) var(--hm-ease-linear) infinite;
}

.g115-skeleton-line { min-block-size: .78em; border-radius: 999px; }
.g115-skeleton-avatar { inline-size: 46px; block-size: 46px; border-radius: 50%; }
.g115-skeleton-card { min-block-size: 84px; border-radius: 18px; }

@keyframes g115SkeletonSweep {
  to { transform: translateX(-110%); }
}

/* Development diagnostics remain invisible unless explicitly enabled. */
.g115-motion-diagnostics {
  position: fixed;
  inset-inline-start: 10px;
  inset-block-start: calc(10px + env(safe-area-inset-top));
  z-index: 9999;
  display: none;
  max-inline-size: min(320px, 84vw);
  padding: 8px 10px;
  border: 1px solid color-mix(in srgb, var(--text, #fff) 18%, transparent);
  border-radius: 12px;
  color: var(--text, #fff);
  background: color-mix(in srgb, var(--surface, #101d2f) 92%, transparent);
  font: 600 11px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace;
  pointer-events: none;
  box-shadow: 0 10px 30px rgba(0,0,0,.22);
}
html[data-g115-motion-debug="true"] .g115-motion-diagnostics { display: block; }

/* Reduced Motion keeps state feedback, but removes translation, spring, and decorative loops. */
html[data-g115-motion-mode="reduced"] {
  --hm-motion-instant: 40ms;
  --hm-motion-micro: 55ms;
  --hm-motion-fast: 70ms;
  --hm-motion-standard: 85ms;
  --hm-motion-emphasized: 95ms;
  --hm-motion-page: 95ms;
  --hm-motion-sheet: 100ms;
  --hm-distance-page: 0px;
  --hm-distance-dialog: 0px;
  --hm-distance-menu: 0px;
  --hm-scale-press: 1;
  scroll-behavior: auto !important;
}

html[data-g115-motion-mode="reduced"] :is(
  .profile-pattern,
  .profile-hero::after,
  .profile-avatar-wrap,
  .profile-status i,
  .settings-intro > span,
  .about-logo,
  .sheet-handle,
  .mini-brand,
  .login-brand,
  .g115-skeleton::after
) {
  animation: none !important;
}

html[data-g115-motion-mode="reduced"] .g115-skeleton::after {
  content: none;
}

/* Motion Off is immediate. Essential static focus/selected/loading states remain visible. */
html[data-g115-motion-mode="off"] {
  --hm-motion-instant: 0ms;
  --hm-motion-micro: 0ms;
  --hm-motion-fast: 0ms;
  --hm-motion-standard: 0ms;
  --hm-motion-emphasized: 0ms;
  --hm-motion-page: 0ms;
  --hm-motion-sheet: 0ms;
  --hm-motion-skeleton-cycle: 0ms;
  --hm-distance-page: 0px;
  --hm-distance-dialog: 0px;
  --hm-distance-menu: 0px;
  --hm-scale-press: 1;
  scroll-behavior: auto !important;
}

html[data-g115-motion-mode="off"] *,
html[data-g115-motion-mode="off"] *::before,
html[data-g115-motion-mode="off"] *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0ms !important;
  scroll-behavior: auto !important;
}

html[data-g115-document="hidden"] .g115-skeleton::after,
html[data-g115-document="hidden"] :is(.profile-pattern, .profile-hero::after, .profile-avatar-wrap, .about-logo) {
  animation-play-state: paused !important;
}

@media (prefers-reduced-motion: reduce) {
  html:not([data-g115-motion-mode="full"]) {
    scroll-behavior: auto !important;
  }
}


@media (hover: none), (pointer: coarse) {
  [data-g115-motion-control="true"] {
    transition-property: transform, opacity, background-color, border-color;
  }
}
