/* The toolbox from the live site (styles.css), plus a skin for dark layouts. */

.toolbox-btn {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  z-index: 2;
  transform: translateY(calc(-20% + 15px));
  transition: transform 180ms ease;
}

.toolbox-btn:hover {
  transform: translateY(calc(-20% + 15px)) scale(1.06);
}

.toolbox-svg {
  width: 216px;
  height: auto;
  overflow: visible;
  position: relative;
  z-index: 2;
}

.toolbox-cavity {
  opacity: 0;
  transform: translateY(3px);
  transition: opacity 180ms ease, transform 220ms ease;
}

.toolbox-lid {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  transition: transform 260ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.toolbox-btn:focus-visible .toolbox-cavity,
.toolbox-btn:hover .toolbox-cavity,
.toolbox-btn.is-open .toolbox-cavity,
.toolbox-btn.is-drop-target .toolbox-cavity {
  opacity: 0.78;
  transform: translateY(0);
}

.toolbox-btn:focus-visible .toolbox-lid,
.toolbox-btn:hover .toolbox-lid,
.toolbox-btn.is-open .toolbox-lid,
.toolbox-btn.is-drop-target .toolbox-lid {
  transform: translateY(-4px) rotate(-0.7deg);
}

@keyframes toolbox-pop {
  0%   { transform: translateY(0) rotate(0deg); }
  25%  { transform: translateY(-7px) rotate(-4deg); }
  55%  { transform: translateY(-10px) rotate(4deg); }
  80%  { transform: translateY(-4px) rotate(-1deg); }
  100% { transform: translateY(0) rotate(0deg); }
}

.toolbox-btn.is-open .toolbox-svg {
  animation: toolbox-pop 0.3s ease-out;
}

.toolbox-hint {
  font-size: 0.6rem;
  color: #9a9590;
  letter-spacing: 0.04em;
  font-family: "SF Pro Display", -apple-system, sans-serif;
  transition: opacity 0.4s;
}

.toolbox-btn.all-out .toolbox-hint {
  opacity: 0.4;
}

.toolbox-broom {
  position: absolute;
  top: clamp(18px, 3vw, 30px);
  right: clamp(18px, 3vw, 30px);
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(205, 205, 205, 0.18);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.035);
  color: #CDCDCD;
  opacity: 0;
  cursor: pointer;
  pointer-events: none;
  transform: translateY(-5px) scale(0.86);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.08);
  transition:
    background 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    color 160ms ease,
    opacity 180ms ease,
    transform 240ms cubic-bezier(0.18, 0.72, 0.22, 1);
  z-index: 12;
}

.toolbox-broom.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.toolbox-broom.is-visible:hover {
  border-color: rgba(205, 205, 205, 0.34);
  background: rgba(255, 255, 255, 0.075);
  box-shadow:
    0 10px 26px rgba(0, 0, 0, 0.16),
    inset 0 1px rgba(255, 255, 255, 0.14);
  transform: translateY(0) scale(1.08);
}

.toolbox-broom:disabled {
  cursor: default;
  pointer-events: none;
}

.toolbox-broom svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.toolbox-broom .broom-head {
  fill: currentColor;
  stroke: none;
}

.toolbox-broom .broom-bristle {
  stroke: rgba(61, 61, 61, 0.46);
  stroke-width: 1.45;
}

.toolbox-broom.is-sweeping svg {
  animation: broom-sweep 520ms ease-in-out infinite;
}

@keyframes broom-sweep {
  0%, 100% { transform: rotate(-8deg) translateX(-1px); }
  50% { transform: rotate(10deg) translateX(1px); }
}

/* Physics icons */
.physics-icon {
  position: absolute;
  width: 54px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  user-select: none;
  touch-action: none;
  z-index: 10;
}

.physics-icon:active,
.physics-icon.is-dragging {
  cursor: grabbing;
  z-index: 20;
}

.physics-icon.is-returning {
  cursor: default;
  pointer-events: none;
  will-change: transform, opacity, filter;
}

.physics-icon img,
.physics-icon svg {
  width: 39px;
  height: 39px;
  pointer-events: none;
  fill: #3D3D3D;
  flex-shrink: 0;
  filter: brightness(0) invert(1) brightness(0.239);
  opacity: 0.85;
}

.physics-icon .icon-tooltip {
  position: absolute;
  bottom: calc(100% + 5px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(28, 28, 28, 0.84);
  color: #fff;
  font-size: 0.58rem;
  padding: 3px 7px;
  border-radius: 4px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  font-family: "SF Pro Display", -apple-system, sans-serif;
  letter-spacing: 0.03em;
}

.physics-icon:hover .icon-tooltip,
.physics-icon.is-dragging .icon-tooltip {
  opacity: 1;
}

/* ── on the dark editorial layouts ──────────────────────────────────────── */
.editorial .tools-card { position: static; display: grid; justify-items: center; align-content: center; gap: 6px; border-top-color: transparent !important; }
.editorial .toolbox-btn { width: min(190px, 70%); }
.editorial .toolbox-svg rect,
.editorial .toolbox-svg path { transition: fill 300ms ease, stroke 300ms ease; }
/* the box itself in the mist blue of the aura, so it reads on dark glass */
.editorial .toolbox-svg > rect:not(.toolbox-cavity),
.editorial .toolbox-lid > rect:first-of-type { fill: #b9c9dc; }
.editorial .toolbox-lid > path { stroke: #b9c9dc; }
.editorial .toolbox-cavity { fill: #0f1824; }
.editorial .toolbox-hint { display: block; color: var(--label, var(--faint-white)); font-size: 0.66rem; letter-spacing: 0.14em; text-transform: uppercase; }
/* tools come out as bare floating marks: no tile behind them, recoloured pale so they read on dark glass */
.editorial .physics-icon { background: none; border: 0; box-shadow: none; }
.editorial .physics-icon img,
.editorial .physics-icon svg { fill: #dfe7f1; filter: brightness(0) invert(0.9) drop-shadow(0 8px 14px rgba(0, 0, 0, 0.5)); opacity: 0.96; }
.editorial #skills { position: relative; }
.editorial .toolbox-latch { fill: #2c4a70; }
.editorial .toolbox-latch-in { fill: #16263a; }
.editorial #toolboxStage { position: relative; min-height: 300px; }
.editorial .toolbox-broom { color: var(--white); border-color: rgba(255, 255, 255, 0.3); background: rgba(17, 27, 40, 0.7); }

/* The clean-up control is the words "Clean up" in the same button shape as the
   rest of the page, not a round broom icon. It still appears only once every
   tool is out, and still puts them all back. */
.toolbox-broom { width: auto; height: auto; display: inline-flex; align-items: center; padding: 8px 13px; border-radius: 4px; font: inherit; font-size: 0.78rem; white-space: nowrap; }
.toolbox-broom.is-sweeping { opacity: 0.6; }
