/* era-polish.css — cross-surface interaction polish (admin + portal + public).
 * Pure CSS, zero JS, additive-only: nothing here changes layout or hides
 * content, so a browser that ignores any rule renders the site unchanged.
 * Every animation is wrapped in prefers-reduced-motion: no-preference.
 * Companion to era-ux.css/js (scroll progress, reveals) — no overlap. */

/* 1. Cross-document view transitions: MPA navigations get a subtle
 *    fade-and-rise instead of a white flash. Native, compositor-driven,
 *    60fps; browsers without support simply navigate normally. */
@media (prefers-reduced-motion: no-preference) {
  @view-transition {
    navigation: auto;
  }
  ::view-transition-old(root) {
    animation: era-vt-out 140ms ease both;
  }
  ::view-transition-new(root) {
    animation: era-vt-in 220ms ease both;
  }
}
@keyframes era-vt-out {
  to { opacity: 0; }
}
@keyframes era-vt-in {
  from { opacity: 0; transform: translateY(6px); }
}

/* 2. Consistent, accessible focus: keyboard users get a clear brand ring
 *    everywhere; mouse clicks do not trigger it (:focus-visible). */
:focus-visible {
  outline: 2px solid #FF4F00;
  outline-offset: 2px;
  border-radius: 4px;
}

/* 3. Micro-interactions: smooth state changes + tactile press feedback. */
@media (prefers-reduced-motion: no-preference) {
  a, button, [role="button"], input, select, textarea, summary, label {
    transition:
      color .15s ease,
      background-color .15s ease,
      border-color .15s ease,
      box-shadow .18s ease,
      opacity .15s ease,
      transform .12s ease;
  }
  button:not(:disabled):active,
  [role="button"]:active,
  input[type="submit"]:not(:disabled):active {
    transform: scale(0.98);
  }
  html {
    scroll-behavior: smooth;
  }
}

/* 4. Anchored headings never hide under sticky headers. */
:target {
  scroll-margin-top: 90px;
}

/* 5. Thin, theme-neutral scrollbars on both light and dark surfaces. */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(125, 125, 138, 0.45) transparent;
}
*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
*::-webkit-scrollbar-thumb {
  background: rgba(125, 125, 138, 0.4);
  border-radius: 8px;
}
*::-webkit-scrollbar-thumb:hover {
  background: rgba(125, 125, 138, 0.65);
}
*::-webkit-scrollbar-track {
  background: transparent;
}

/* 6. Brand text selection. */
::selection {
  background: rgba(255, 79, 0, 0.22);
}

/* 7. Skeleton shimmer utility — add .era-skeleton to any placeholder box
 *    while content loads (works on light and dark backgrounds). */
.era-skeleton {
  position: relative;
  overflow: hidden;
  background: rgba(127, 127, 140, 0.14);
  border-radius: 6px;
  color: transparent !important;
}
@media (prefers-reduced-motion: no-preference) {
  .era-skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.16), transparent);
    animation: era-shimmer 1.4s infinite;
  }
}
@keyframes era-shimmer {
  100% { transform: translateX(100%); }
}
