html,
body {
  margin: 0;
  padding: 0;
  overflow: hidden;
  height: 100%;
  background: white;
  /* touch: no pull-to-refresh or rubber-banding, no grey tap flash */
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

canvas {
  display: block;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  /* the visible area on phones, where the address bar comes and goes */
  height: 100dvh;
  /* a finger steers the particles: no scrolling, zooming, text selection or long-press menu */
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

#mode-toggle {
  display: none; /* hidden by default */
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  background: white;
  border: 2px solid black;
  border-radius: 50%;
  cursor: pointer;
  z-index: 100;
}

/* Show only on mobile devices */
@media (hover: none) and (pointer: coarse) {
  #mode-toggle {
      display: block;
  }
}

/* Portfolio links. With the script running they are the labels of the three shapes:
   placed along the bottom under their shapes (.placed, left set by core/Steering.js).
   Without it they are a plain row at the bottom right. */
.portfolio-links {
  position: fixed;
  right: 20px;
  bottom: max(16px, env(safe-area-inset-bottom));
  display: flex;
  gap: 18px;
  z-index: 200;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

.portfolio-links a {
  color: #111;
  text-decoration: none;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 6px 0;
}

.portfolio-links.placed {
  left: 0;
  right: 0;
  bottom: max(var(--label-bottom, 28px), env(safe-area-inset-bottom));
  height: 0;
  display: block;
}

.portfolio-links.placed a {
  position: absolute;
  bottom: -6px;
  transform: translateX(-50%);
  white-space: nowrap;
  text-align: center;
  padding: 6px 10px;
  opacity: 0.45;
}

.portfolio-links a:focus-visible {
  outline: none;
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* Hide the links while the page transition plays */
body.leaving .portfolio-links {
  opacity: 0;
  transition: opacity 0.3s ease;
}

@media (hover: none) and (pointer: coarse) {
  .portfolio-links:not(.placed) {
    left: 0;
    right: 0;
    justify-content: center;
    gap: 4px;
    bottom: max(4px, env(safe-area-inset-bottom));
  }
  /* finger-sized tap targets */
  .portfolio-links a {
    padding: 14px 8px;
    touch-action: manipulation;
  }
  .portfolio-links.placed a {
    bottom: -14px;
  }
}

/* narrow screens: long labels wrap within their third of the width */
@media (max-width: 600px) {
  .portfolio-links.placed a {
    white-space: normal;
    width: calc(100vw / 3 - 8px);
    box-sizing: border-box;
  }
}

@media (prefers-reduced-motion: reduce) {
  .portfolio-links a { color: #111; }
}
