/* Muon Sortes interactive hero.
   Every selector is scoped under #muon-hero so nothing bleeds into the page. */

#muon-hero {
  --mh-walnut: #3a2e26;
  --mh-walnut-edge: #241b15;
  --mh-walnut-hi: #4b3c31;
  --mh-gap: #14100d;
  --mh-ink: #12100e;
  --mh-face: #d9d2c8;
  --mh-led-off: #4d4038;
  --mh-led-on: #f4efe6;
  --mh-caption: #3d3d3d;
  --mh-rule: #d6d6d6;
  display: block;
  width: 100%;
}

#muon-hero .mh-stage {
  max-width: 792px;
  margin: 0 auto;
  outline: none;
}

#muon-hero .mh-stage:focus-visible {
  outline: 2px solid #3f69b6;
  outline-offset: 6px;
}

/* Device frame */

#muon-hero .mh-device {
  background: var(--mh-walnut);
  border: 1px solid var(--mh-walnut-edge);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  align-items: stretch;
  gap: 16px;
}

#muon-hero .mh-gap {
  background: var(--mh-gap);
  border-radius: 5px;
  padding: 5px;
  flex: 1;
  min-width: 0;
  align-self: center;
  width: 100%;
}

#muon-hero .mh-screenbox {
  position: relative;
  width: 100%;
  aspect-ratio: 1448 / 1072;
  background: #f2f1ee;
  overflow: hidden;
}

#muon-hero .mh-screen {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

#muon-hero .mh-fallback {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 8px;
  margin: 0;
  text-align: center;
  font: 500 11px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #6c6c6c;
}

#muon-hero .mh-fallback[hidden] {
  display: none;
}

/* Control rail, right of the screen: oracle on top, arrows under it,
   wordmark and muon meter at the bottom. */

#muon-hero .mh-controls {
  flex: none;
  width: 126px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

#muon-hero .mh-plate {
  min-width: 0;
  margin-top: auto;
  text-align: center;
  font: 500 10px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #b7a898;
  font-variant-numeric: tabular-nums;
}

#muon-hero .mh-plate .mh-wordmark {
  display: block;
  color: #cfc2b2;
}

#muon-hero .mh-meter {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  white-space: nowrap;
}

#muon-hero .mh-led {
  width: 9px;
  height: 9px;
  flex: none;
  border-radius: 50%;
  background: var(--mh-led-off);
  border: 1px solid #2c231d;
  transition: background 220ms linear, box-shadow 220ms linear;
}

#muon-hero .mh-led.mh-on {
  background: var(--mh-led-on);
  box-shadow: 0 0 6px rgba(244, 239, 230, 0.75);
  transition: none;
}

#muon-hero .mh-led[hidden] {
  display: none;
}

/* Joystick cluster */

#muon-hero .mh-joy {
  display: grid;
  grid-template-columns: repeat(3, 42px);
  grid-template-rows: repeat(3, 42px);
  flex: none;
}

#muon-hero .mh-joy .mh-hub {
  grid-area: 2 / 2;
  align-self: center;
  justify-self: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #2b221c;
  border: 1px solid #1c1512;
}

#muon-hero button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

#muon-hero .mh-key {
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid #1f1813;
  border-radius: 8px;
  background: var(--mh-walnut-hi);
  color: #d3c6b7;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 120ms linear;
}

#muon-hero .mh-key:hover {
  background: #57463a;
}

#muon-hero .mh-key:active,
#muon-hero .mh-key.mh-press {
  background: #2f251e;
  color: #f0e7db;
}

#muon-hero .mh-key:focus-visible,
#muon-hero .mh-oracle:focus-visible {
  outline: 2px solid #f0e7db;
  outline-offset: 2px;
}

#muon-hero .mh-key svg {
  width: 13px;
  height: 13px;
  fill: currentColor;
}

#muon-hero .mh-up { grid-area: 1 / 2; }
#muon-hero .mh-down { grid-area: 3 / 2; }
#muon-hero .mh-left { grid-area: 2 / 1; }
#muon-hero .mh-right { grid-area: 2 / 3; }

/* Oracle button */

#muon-hero .mh-oracle {
  flex: none;
  margin-top: 4px;
  width: 92px;
  height: 92px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid #241b15;
  background: #cdbfae;
  color: #241b15;
  font: 600 10px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition: background 120ms linear, transform 120ms ease;
}

#muon-hero .mh-oracle:hover {
  background: #dccdba;
}

#muon-hero .mh-oracle:active,
#muon-hero .mh-oracle.mh-press {
  background: #a89985;
  transform: translateY(1px);
}

/* Nudge feedback for up/down */

#muon-hero .mh-nudge-up { transform: translateY(-2px); }
#muon-hero .mh-nudge-down { transform: translateY(2px); }
#muon-hero .mh-gap { transition: transform 130ms ease; }

/* Caption */

#muon-hero .mh-caption {
  margin: 12px 2px 0;
  padding-top: 8px;
  border-top: 1px solid var(--mh-rule);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  justify-content: space-between;
  font: 500 11px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mh-caption);
  font-variant-numeric: tabular-nums;
}

#muon-hero .mh-caption b {
  font-weight: 600;
  color: var(--mh-ink);
}

#muon-hero .mh-note {
  color: #6f6f6f;
  text-transform: none;
  letter-spacing: 0.04em;
}

@media (max-width: 560px) {
  /* Narrow screens: the rail would starve the screen, so the controls drop
     below it as a row (oracle first, still the biggest control). */
  #muon-hero .mh-device { padding: 10px; border-radius: 12px; flex-direction: column; gap: 10px; }
  #muon-hero .mh-controls { width: 100%; flex-direction: row; justify-content: space-between; gap: 12px; }
  #muon-hero .mh-plate { margin-top: 0; text-align: left; font-size: 9px; order: 3; }
  #muon-hero .mh-oracle { width: 64px; height: 64px; margin-top: 0; }
  #muon-hero .mh-joy { grid-template-columns: repeat(3, 40px); grid-template-rows: repeat(3, 40px); order: 2; }
  #muon-hero .mh-key { width: 40px; height: 40px; }
  #muon-hero .mh-caption { font-size: 10px; gap: 2px 10px; }
}

@media (max-width: 380px) {
  #muon-hero .mh-plate .mh-wordmark { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  #muon-hero .mh-gap,
  #muon-hero .mh-led,
  #muon-hero .mh-key,
  #muon-hero .mh-oracle {
    transition: none;
  }
  #muon-hero .mh-nudge-up,
  #muon-hero .mh-nudge-down { transform: none; }
}
