/* The interactive charging dock: used on the home page and /charging.
   Markup lives in each page; the behaviour is in dock.js. */
.dock-visual {
  display: flex; flex-direction: column; align-items: center;
  gap: 20px; position: relative;
}
.dock-stage {
  width: 100%; max-width: 540px;
  position: relative; overflow: hidden;
  background: radial-gradient(ellipse 90% 70% at 50% 30%, #35353A 0%, #252528 70%);
  border-radius: var(--radius, 20px);
  padding: 22px 14px 16px;
  box-shadow: 0 14px 44px rgba(46,58,87,0.22);
}
.dock-stage::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse 60% 45% at 50% 24%, rgba(255,196,110,0.34), rgba(255,196,110,0) 70%);
  opacity: 0; transition: opacity 0.9s ease;
}
.dock-stage.is-charging::before { opacity: 1; }
.dock-base { position: relative; width: 100%; user-select: none; -webkit-user-select: none; container-type: inline-size; }
.dock-base > img { position: relative; width: 100%; height: auto; display: block; pointer-events: none; }
.dock-base > img.dock-lit { position: absolute; inset: 0; opacity: 0; transition: opacity 0.9s ease; }
.is-charging .dock-base > img.dock-lit { opacity: 1; }
/* soft floor shadow so the dock sits on a surface */
.dock-floor {
  position: absolute; left: 4%; right: 4%; bottom: -4%; height: 14%;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0) 70%);
  pointer-events: none;
}
.dock-glow {
  position: absolute; left: 50.6%; top: 20%; width: 72%; aspect-ratio: 1 / 1;
  transform: translate(-50%, -50%); pointer-events: none;
  background: radial-gradient(circle, rgba(255,222,150,0.55) 0%, rgba(255,196,110,0.2) 32%, rgba(255,196,110,0) 62%);
  mix-blend-mode: screen; opacity: 0; transition: opacity 0.9s ease;
}
.is-charging .dock-glow { opacity: 1; animation: dockglow 3.2s ease-in-out 0.9s infinite; }
@keyframes dockglow {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.7; }
}
.shield-piece {
  position: absolute; left: 13%; top: 17%; width: 16%;
  background: none; border: 0; padding: 0; margin: 0;
  cursor: grab; touch-action: none; z-index: 3;
  transform: translate(-50%, -50%) rotate(-10deg);
  transition: left 0.45s ease, top 0.45s ease, width 0.45s ease, transform 0.45s ease;
  -webkit-tap-highlight-color: transparent;
}
.shield-piece img { width: 100%; height: auto; display: block; pointer-events: none; filter: drop-shadow(0 6px 8px rgba(0,0,0,0.4)); }
.shield-piece:not(.docked) img { animation: shieldbob 2.6s ease-in-out infinite; }
@keyframes shieldbob {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-6%); }
}
.shield-piece.docked { left: 50.6%; top: 18.6%; width: 20.6%; transform: translate(-50%, -50%); }
.shield-piece.docked img { filter: drop-shadow(0 0 10px rgba(255,214,140,0.55)); }
.shield-piece:focus-visible { outline: 2px solid var(--yellow, #FFC93C); outline-offset: 3px; border-radius: 10px; }

/* Magnet drawer */
.drawer-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 20px;
}
.drawer-tabs { display: flex; gap: 4px; background: rgba(255,255,255,0.06); border-radius: 100px; padding: 3px; }
.drawer-tab, .dock-clear {
  background: none; color: rgba(255,255,255,0.7);
  border: 0; border-radius: 100px; padding: 6px 14px;
  font: inherit; font-size: 0.82rem; font-weight: 600; cursor: pointer;
}
.drawer-tab[aria-selected="true"] { background: rgba(255,255,255,0.14); color: var(--white, #FFFFFF); }
.dock-clear { background: rgba(255,255,255,0.08); color: var(--white, #FFFFFF); flex-shrink: 0; }
.dock-clear:hover, .drawer-tab:hover { background: rgba(255,255,255,0.18); }
.magnet-tray {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px 6px;
  margin-top: 10px; padding: 10px;
  background: rgba(0,0,0,0.22); border-radius: 14px;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.35);
}
.magnet-tray[hidden] { display: none; }
@media (max-width: 420px) { .magnet-tray { grid-template-columns: repeat(5, 1fr); } }
.tray-slot {
  aspect-ratio: 1 / 1; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}
.tray-slot:empty { box-shadow: inset 0 0 0 1.5px rgba(255,255,255,0.08); }
@media (max-width: 420px) {
  .drawer-tab, .dock-clear { padding: 6px 10px; font-size: 0.78rem; }
  .drawer-bar { gap: 6px; }
}
/* A few letter magnets lying on the floor in front of the dock */
.floor-letters { position: relative; height: clamp(46px, 13vw, 64px); margin-top: 6px; }
.floor-slot {
  position: absolute; transform: translate(-50%, -50%) rotate(var(--rot, 0deg)) scaleY(0.62);
}
.floor-slot .glyph { font-size: clamp(32px, 9vw, 40px) !important; }

.magnet {
  background: none; border: 0; padding: 4px; margin: 0;
  cursor: grab; touch-action: none;
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%;
  -webkit-tap-highlight-color: transparent;
}
.magnet img {
  width: 100%; height: auto; display: block; pointer-events: none;
  filter: drop-shadow(0 3px 3px rgba(0,0,0,0.35));
}
/* Letter magnets: chunky foam letters built in code */
.magnet.letter .glyph {
  font-family: 'Outfit', sans-serif; font-weight: 800; line-height: 1;
  font-size: 30px; color: var(--c);
  text-shadow: 0 1px 0 var(--d), 0 2px 0 var(--d), 0 3px 0 var(--d), 0 5px 4px rgba(0,0,0,0.35);
  pointer-events: none;
}
.magnet:focus-visible { outline: 2px solid var(--yellow, #FFC93C); outline-offset: 2px; border-radius: 8px; }
/* On the dock: follow the curve of the front, with a tight contact shadow so they read as stuck on */
.magnet.placed {
  position: absolute; width: 13%; height: auto; padding: 0;
  transform: translate(-50%, -50%) perspective(420px) rotateY(var(--ry, 0deg)) scaleY(var(--sy, 1));
  z-index: 2;
}
.magnet.placed img { filter: drop-shadow(1px 2px 1px rgba(40,30,20,0.45)) drop-shadow(0 5px 6px rgba(0,0,0,0.14)); }
.magnet.placed.letter { width: auto; }
.magnet.placed.letter .glyph {
  font-size: 10.5cqw;
  text-shadow: 0 1px 0 var(--d), 0 2px 0 var(--d), 1px 3px 1px rgba(40,30,20,0.45), 0 5px 6px rgba(0,0,0,0.14);
}
.magnet.snap img, .magnet.snap .glyph { animation: magnetsnap 0.32s cubic-bezier(.3,1.6,.5,1); }
@keyframes magnetsnap {
  0%   { transform: scale(1.18) translateY(-8%); filter: brightness(1.08); }
  55%  { transform: scale(0.95, 0.9) translateY(2%); }
  100% { transform: scale(1) translateY(0); }
}
.magnet.dragging, .shield-piece.dragging {
  position: fixed; z-index: 1000; cursor: grabbing;
  transition: none;
  transform: translate(-50%, -50%) scale(1.12);
  pointer-events: none;
}
.magnet.dragging img { filter: drop-shadow(0 10px 10px rgba(0,0,0,0.35)); }
@media (prefers-reduced-motion: reduce) {
  .magnet.snap img, .magnet.snap .glyph, .shield-piece img, .is-charging .dock-glow { animation: none; }
  .shield-piece { transition: none; }
}
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.battery-popup {
  display: flex; align-items: center; gap: 8px;
  background: var(--navy, #2E3A57);
  color: var(--white, #FFFFFF);
  padding: 10px 18px;
  border-radius: 100px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 6px 24px rgba(46,58,87,0.18);
  animation: floatup 3s ease-in-out infinite;
}
@keyframes floatup {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-5px); }
}
