/* Home hero - rotating demo showcase.
 *
 * A self-cycling panel beside the hero copy that previews a few live entries as
 * pure-CSS miniatures. The rotation, hover/focus pausing and the pause control
 * live in hero-stage.js; everything visual lives here.
 *
 * Named `.showcase` (not `.stage`) on purpose: `.stage` is already the entry
 * demo arena in global.css. Unlayered here, so these rules win over the .hero
 * rules in @layer components.
 *
 * Motion is decorative: each scene rests in a legible state, so reduced-motion
 * users (global guard in global.css zeroes animation) still see a sensible still.
 */

/* --- Hero becomes two columns once there's room ----------------------- */
@media (min-width: 60rem) {
  .hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 26rem);
    align-items: center;
    gap: var(--space-2xl);
  }
}
.hero__copy {
  min-inline-size: 0;
}

/* --- Showcase shell --------------------------------------------------- */
.showcase {
  margin-block-start: var(--space-xl);
}
@media (min-width: 60rem) {
  .showcase {
    margin-block-start: 0;
  }
}

.showcase__viewport {
  position: relative;
  min-block-size: 16rem;
  padding: var(--space-s);
  border-radius: var(--radius-l);
  background: var(--surface);
  border: 1px solid var(--line);
}

.showcase__slide {
  position: absolute;
  inset: var(--space-s);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease;
}
.showcase__slide.is-active {
  opacity: 1;
  visibility: visible;
}

.showcase__link {
  display: flex;
  flex-direction: column;
  gap: var(--space-s);
  block-size: 100%;
  text-decoration: none;
  color: inherit;
}

.showcase__scene {
  position: relative;
  flex: 1 1 auto;
  min-block-size: 0;
  overflow: hidden;
  border-radius: var(--radius-m);
  background: var(--paper);
  border: 1px solid var(--line);
}

.showcase__caption {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  align-content: start;
  column-gap: var(--space-s);
  row-gap: 0.3rem;
  /* Reserve room for a two-line term so the scene height never jumps as the
     showcase rotates between short and long names. */
  min-block-size: 4.25rem;
}
.showcase__cat {
  grid-column: 1 / -1;
  color: var(--accent-strong);
}
.showcase__term {
  font-family: var(--font-display);
  font-size: var(--step-2);
  font-weight: 600;
  line-height: var(--leading-tight);
  color: var(--ink);
}
.showcase__cue {
  align-self: center;
  font-size: var(--step--1);
  font-weight: 600;
  white-space: nowrap;
  color: var(--accent-strong);
  transition: transform 0.15s ease;
}
.showcase__link:hover .showcase__term {
  color: var(--accent-strong);
}
.showcase__link:hover .showcase__cue {
  transform: translateX(3px);
}

/* --- Controls: pause toggle + dots ----------------------------------- */
.showcase__controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-s);
  margin-block-start: var(--space-s);
  padding-inline: var(--space-3xs);
}

.showcase__toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.6ch;
  padding: var(--space-3xs) var(--space-xs);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--muted);
  font-family: var(--font-body);
  font-size: var(--step--1);
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.showcase__toggle:hover {
  color: var(--ink);
  border-color: var(--divider);
}
/* Glyph: two bars (pause) by default, a triangle (play) when stopped. */
.showcase__toggle-icon {
  inline-size: 9px;
  block-size: 10px;
  border-inline: 3px solid currentColor;
}
.showcase__toggle.is-paused .showcase__toggle-icon {
  inline-size: 0;
  block-size: 0;
  border: 5px solid transparent;
  border-inline-start: 8px solid currentColor;
  border-inline-end: 0;
}
/* Nothing to pause when motion is off. */
@media (prefers-reduced-motion: reduce) {
  .showcase__toggle {
    display: none;
  }
}

.showcase__dots {
  display: flex;
  gap: 0;
}
.showcase__dot {
  inline-size: 1.5rem;
  block-size: 1.5rem;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}
.showcase__dot::before {
  content: "";
  inline-size: 8px;
  block-size: 8px;
  border-radius: 50%;
  background: var(--divider);
  transition: background 0.15s ease, transform 0.15s ease;
}
.showcase__dot:hover::before {
  background: var(--muted);
}
.showcase__dot.is-active::before {
  background: var(--accent);
  transform: scale(1.3);
}

/* ===================================================================== */
/* Scenes - shared canvas (fills the scene, centres its content)         */
.fx {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- Fitts's law: a pointer glides to a target that resizes each loop - */
.fx-fitts__target,
.fx-fitts__cursor {
  position: absolute;
  inset-block-start: 50%;
  inset-inline-start: 50%;
  border-radius: 50%;
}
.fx-fitts__target {
  inline-size: 60px;
  block-size: 60px;
  background: var(--accent-soft);
  border: 2px solid var(--accent);
  transform: translate(calc(-50% - 70px), calc(-50% - 24px)) scale(1.1);
  animation: fxFittsTarget 4.6s ease-in-out infinite;
}
.fx-fitts__cursor {
  inline-size: 12px;
  block-size: 12px;
  background: var(--accent-strong);
  transform: translate(calc(-50% - 70px), calc(-50% - 24px));
  animation: fxFittsCursor 4.6s ease-in-out infinite;
}
.fx-fitts__cursor::after {
  content: "";
  position: absolute;
  inset-block-start: 50%;
  inset-inline-start: 50%;
  inline-size: 12px;
  block-size: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 50%;
  border: 2px solid var(--accent-strong);
  opacity: 0;
  animation: fxFittsRipple 4.6s ease-out infinite;
}
@keyframes fxFittsTarget {
  0%, 16% {
    transform: translate(calc(-50% - 70px), calc(-50% - 24px)) scale(1.1);
  }
  44%, 62% {
    transform: translate(calc(-50% + 66px), calc(-50% + 28px)) scale(0.42);
  }
  90%, 100% {
    transform: translate(calc(-50% - 70px), calc(-50% - 24px)) scale(1.1);
  }
}
@keyframes fxFittsCursor {
  0%, 6% {
    transform: translate(calc(-50% - 70px), calc(-50% - 24px));
  }
  40%, 66% {
    transform: translate(calc(-50% + 66px), calc(-50% + 28px));
  }
  96%, 100% {
    transform: translate(calc(-50% - 70px), calc(-50% - 24px));
  }
}
@keyframes fxFittsRipple {
  0%, 38% {
    opacity: 0;
    transform: scale(0.5);
  }
  42% {
    opacity: 0.85;
    transform: scale(0.5);
  }
  58%, 100% {
    opacity: 0;
    transform: scale(2.6);
  }
}

/* --- Von Restorff: one bar pops out of a quiet stack ------------------ */
.fx-vr {
  display: flex;
  flex-direction: column;
  gap: 12px;
  inline-size: 58%;
}
.fx-vr__bar {
  block-size: 14px;
  border-radius: 999px;
  background: var(--surface-2);
}
.fx-vr__bar--isolate {
  background: var(--accent);
  transform-origin: left center;
  animation: fxVrPop 3.4s ease-in-out infinite;
}
@keyframes fxVrPop {
  0%, 100% {
    transform: scaleX(1);
    filter: brightness(1);
  }
  45%, 60% {
    transform: scaleX(1.06);
    filter: brightness(1.12);
  }
}

/* --- Whitespace: a card breathes from cramped to airy ----------------- */
.fx-ws {
  inline-size: 62%;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  border-radius: var(--radius-s);
  background: var(--surface);
  border: 1px solid var(--line);
  animation: fxWsBreathe 4.6s ease-in-out infinite;
}
.fx-ws__row {
  block-size: 9px;
  border-radius: 999px;
  background: var(--surface-2);
}
.fx-ws__row--title {
  inline-size: 60%;
  block-size: 12px;
  background: var(--accent);
}
.fx-ws__row--short {
  inline-size: 72%;
}
@keyframes fxWsBreathe {
  0%, 14% {
    gap: 14px;
    padding: 18px;
  }
  48%, 64% {
    gap: 4px;
    padding: 7px;
  }
  100% {
    gap: 14px;
    padding: 18px;
  }
}

/* --- Gestalt proximity: even dots collapse into two groups ------------ */
.fx-prox {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  animation: fxProxOuter 4.4s ease-in-out infinite;
}
.fx-prox__grp {
  display: flex;
  gap: 14px;
  animation: fxProxInner 4.4s ease-in-out infinite;
}
.fx-prox__dot {
  inline-size: 16px;
  block-size: 16px;
  border-radius: 50%;
  background: var(--accent);
}
@keyframes fxProxOuter {
  0%, 14% {
    gap: 14px;
  }
  50%, 66% {
    gap: 46px;
  }
  100% {
    gap: 14px;
  }
}
@keyframes fxProxInner {
  0%, 14% {
    gap: 14px;
  }
  50%, 66% {
    gap: 6px;
  }
  100% {
    gap: 14px;
  }
}
