/* Style note: this layer adds a restrained grainy galaxy atmosphere to the preserved portfolio; original content remains above it with readable contrast. */
:root {
  --pointer-x: 0;
  --pointer-y: 0;
}

html,
body {
  background: #080c12;
  overflow-x: hidden;
}

#galaxy-field {
  position: fixed;
  inset: 0;
  z-index: 4;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  opacity: 0.34;
  mix-blend-mode: screen;
}

#root {
  position: relative;
  z-index: 3;
  transform: translate3d(calc(var(--pointer-x) * 5px), calc(var(--pointer-y) * 3px), 0);
  will-change: transform;
  transition: transform 180ms cubic-bezier(0.23, 1, 0.32, 1);
}

@media (prefers-reduced-motion: reduce) {
  #galaxy-field {
    opacity: 0.2;
  }

  #root {
    transform: none;
    transition: none;
  }
}

@media (max-width: 700px) {
  #galaxy-field {
    opacity: 0.28;
  }

  #root {
    transform: translate3d(calc(var(--pointer-x) * 2px), calc(var(--pointer-y) * 2px), 0);
  }
}

#motion-toggle {
  position: fixed;
  top: 20px;
  left: 212px;
  z-index: 7;
  min-width: 150px;
  padding: 11px 16px;
  border: 1px solid rgba(168, 255, 218, 0.48);
  border-radius: 999px;
  background: rgba(8, 12, 18, 0.72);
  color: #a8ffd9;
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.24), 0 0 24px rgba(135, 255, 214, 0.08);
  backdrop-filter: blur(14px);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: lowercase;
  cursor: pointer;
  transition: background 180ms cubic-bezier(0.23, 1, 0.32, 1), color 180ms cubic-bezier(0.23, 1, 0.32, 1), transform 160ms cubic-bezier(0.23, 1, 0.32, 1), border-color 180ms cubic-bezier(0.23, 1, 0.32, 1);
}

#motion-toggle::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 12px currentColor;
  vertical-align: 1px;
}

#motion-toggle:hover {
  background: rgba(168, 255, 218, 0.12);
  border-color: rgba(168, 255, 218, 0.82);
}

#motion-toggle:active {
  transform: scale(0.97);
}

#motion-toggle:focus-visible {
  outline: 2px solid #a8ffd9;
  outline-offset: 4px;
}

#motion-toggle[data-state="off"] {
  border-color: rgba(175, 190, 198, 0.42);
  color: #aab9c0;
  background: rgba(17, 23, 29, 0.82);
}

#motion-toggle[data-state="off"]::before {
  box-shadow: none;
}

@media (max-width: 700px) {
  #motion-toggle {
    top: 78px;
    right: 16px;
    min-width: 148px;
    padding: 10px 14px;
    font-size: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #motion-toggle {
    opacity: 0.84;
  }
}

/* Hero CTA motion button: intentionally mirrors the existing green "say hi" action. */
.hero-actions .hero-motion-toggle {
  position: relative;
  top: auto;
  left: auto;
  right: auto;
  bottom: auto;
  z-index: 7;
  min-width: 0;
  margin-left: 12px;
  padding: 13px 16px;
  border: 0;
  border-radius: 0;
  background: #a8ffd9;
  color: #0a1214;
  box-shadow: none;
  backdrop-filter: none;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.04em;
  line-height: 1;
  text-transform: lowercase;
  transform: translateZ(0);
}

.hero-actions .hero-motion-toggle::before {
  background: currentColor;
  box-shadow: 0 0 10px rgba(10, 18, 20, 0.32);
}

.hero-actions .hero-motion-toggle:hover {
  background: #c4ffe7;
  border-color: transparent;
  color: #0a1214;
}

.hero-actions .hero-motion-toggle[data-state="off"] {
  border-color: transparent;
  background: rgba(168, 255, 217, 0.18);
  color: #a8ffd9;
}

.hero-actions .hero-motion-toggle[data-state="off"]::before {
  background: currentColor;
  box-shadow: 0 0 10px rgba(168, 255, 217, 0.38);
}

@media (max-width: 700px) {
  .hero-actions .hero-motion-toggle {
    margin-left: 0;
    margin-top: 14px;
    flex-basis: 100%;
    width: max-content;
  }
}

#motion-toggle.hero-motion-toggle {
  position: absolute;
  margin: 0;
  top: 0;
  left: 0;
  z-index: 8;
}

#motion-toggle.hero-motion-toggle[data-state="on"] {
  background: #a8ffd9;
  color: #0a1214;
}

#motion-toggle.hero-motion-toggle[data-state="off"] {
  background: rgba(168, 255, 217, 0.18);
  color: #a8ffd9;
}

@media (max-width: 700px) {
  #motion-toggle.hero-motion-toggle {
    top: 0;
    left: 16px;
  }
}

/* Motion controls: green CTA treatment with an explicit state icon and orbit-speed range. */
#motion-toggle.hero-motion-toggle {
  position: relative !important;
  top: auto !important;
  right: auto !important;
  bottom: auto !important;
  left: auto !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 154px;
  margin: 0 0 0 12px;
  padding: 13px 16px;
  border: 0;
  border-radius: 0;
  background: #a8ffd9;
  color: #0a1214;
  box-shadow: none;
  backdrop-filter: none;
}

#motion-toggle::before {
  display: none;
}

#motion-toggle .motion-icon {
  position: relative;
  display: inline-block;
  width: 12px;
  height: 14px;
  flex: 0 0 12px;
}

#motion-toggle .motion-icon[data-state="pause"]::before,
#motion-toggle .motion-icon[data-state="pause"]::after {
  content: "";
  position: absolute;
  top: 1px;
  width: 3px;
  height: 12px;
  border-radius: 1px;
  background: currentColor;
}

#motion-toggle .motion-icon[data-state="pause"]::before {
  left: 1px;
}

#motion-toggle .motion-icon[data-state="pause"]::after {
  right: 1px;
}

#motion-toggle .motion-icon[data-state="play"]::before {
  content: "";
  position: absolute;
  top: 1px;
  left: 2px;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 9px solid currentColor;
}

#motion-toggle[data-state="off"] {
  border-color: transparent;
  background: rgba(168, 255, 217, 0.18);
  color: #a8ffd9;
}

#orbit-speed-control.hero-orbit-speed {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 174px;
  margin-left: 4px;
  padding: 8px 11px;
  border: 1px solid rgba(168, 255, 217, 0.28);
  border-radius: 999px;
  background: rgba(8, 12, 18, 0.66);
  color: #a8ffd9;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(12px);
}

#orbit-speed-control.hero-orbit-speed label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 9px;
  letter-spacing: 0.05em;
  text-transform: lowercase;
}

#orbit-speed-control.hero-orbit-speed output {
  color: #eafff5;
}

#orbit-speed-control.hero-orbit-speed input {
  width: 82px;
  min-width: 0;
  accent-color: #a8ffd9;
  cursor: pointer;
}

#orbit-speed-control.hero-orbit-speed input:focus-visible {
  outline: 2px solid #a8ffd9;
  outline-offset: 3px;
}

@media (max-width: 700px) {
  #motion-toggle.hero-motion-toggle {
    margin-left: 0;
    min-width: 150px;
  }

  #orbit-speed-control.hero-orbit-speed {
    min-width: 0;
    flex: 1 1 168px;
    margin-left: 0;
  }

  #orbit-speed-control.hero-orbit-speed input {
    flex: 1 1 auto;
    width: auto;
  }
}

/* Keep the speed control compact on narrow screens instead of stretching into the hero column. */
#orbit-speed-control.hero-orbit-speed {
  height: 40px;
  width: 188px;
  flex: 0 0 auto;
  box-sizing: border-box;
  border-radius: 999px;
}

@media (max-width: 700px) {
  #orbit-speed-control.hero-orbit-speed {
    width: min(220px, 100%);
    height: 40px;
    flex: 0 0 auto;
    align-self: flex-start;
    margin-top: 0;
    border-radius: 999px;
  }
}
