/* Dock: flat, slightly translucent platinum tray (no glossy Aqua bubbles). Semantic tokens only.
   <nav aria-label="Dock"><ul class="os-dock">
     <li><a class="os-dock__item" href="/" aria-label="Home" data-label="Home"><img src="…" alt=""></a></li>
   </ul></nav>
   Hover/focus: icon grows a little (no bounce) + chrome-font tooltip from data-label.
   aria-current="page" (set by tools/build.py, then components/site-nav.js) draws the indicator under the icon.
   Phones (< 700px): becomes a bottom tab bar, icons only, scrolls sideways if needed.
   --dock-scale sizes the desktop dock (tray, icons, spacing, tooltip) in one go. --dock-h is the
   dock's height + 6px; os-browser.css ends the window at --dock-h + 20px, so the window always sits
   16px above the dock and takes over any height the dock gives up. The 10px below the dock is fixed. */

:root {
  --dock-scale: 0.85;
  --dock-h: calc(8px + 66px * var(--dock-scale)); /* 1px borders + (6 + 50 + 10)px scaled + 6px */
}

.os-dock {
  position: fixed;
  bottom: 10px;
  left: 50%;
  z-index: var(--z-os-menubar); /* under the CRT overlay, so it gets scanlines too */
  display: flex;
  align-items: flex-end;
  gap: calc(8px * var(--dock-scale));
  margin: 0;
  padding: calc(6px * var(--dock-scale)) calc(12px * var(--dock-scale)) calc(10px * var(--dock-scale));
  list-style: none;
  transform: translateX(-50%);
  background: color-mix(in srgb, var(--os-face) 84%, transparent);
  border: 1px solid var(--os-outline);
  border-radius: calc(5px * var(--dock-scale));
  box-shadow: inset 1px 1px 0 var(--os-hi), inset -1px -1px 0 var(--os-lo), var(--os-win-shadow);
}

.os-dock__item {
  position: relative;
  display: grid;
  place-items: center;
  width: calc(50px * var(--dock-scale));
  height: calc(50px * var(--dock-scale));
  border-radius: calc(4px * var(--dock-scale));
  transform-origin: 50% 100%;
  transition: transform 0.12s ease-out;
}

.os-dock__item img {
  width: calc(44px * var(--dock-scale));
  height: calc(44px * var(--dock-scale));
  object-fit: contain;
  filter: var(--sticker-filter);
  pointer-events: none;
}

.os-dock__item:hover,
.os-dock__item:focus-visible {
  transform: scale(1.14) translateY(calc(-2px * var(--dock-scale)));
}

.os-dock__item:focus-visible {
  outline: 2px solid var(--os-focus);
  outline-offset: 3px;
}

/* Active page indicator */
.os-dock__item[aria-current="page"]::after {
  content: "";
  position: absolute;
  bottom: calc(-8px * var(--dock-scale));
  left: 50%;
  width: 5px;
  height: 5px;
  margin-left: -2.5px;
  background: var(--os-text);
  box-shadow: 1px 1px 0 var(--os-hi);
}

/* Tooltip in the chrome font */
.os-dock__item::before {
  content: attr(data-label);
  position: absolute;
  bottom: calc(100% + 12px * var(--dock-scale));
  left: 50%;
  padding: calc(3px * var(--dock-scale)) calc(8px * var(--dock-scale));
  transform: translateX(-50%);
  background: var(--os-content);
  color: var(--os-text);
  border: 1px solid var(--os-outline);
  box-shadow: var(--os-win-shadow);
  font-family: var(--font-chrome);
  font-size: calc(var(--os-size) * var(--dock-scale));
  line-height: 1.2;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
}

.os-dock__item:hover::before,
.os-dock__item:focus-visible::before { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .os-dock__item { transition: none; }
}

/* ---- Phones: bottom tab bar ---- */
@media (max-width: 43.75rem) {
  :root { --dock-h: calc(54px + env(safe-area-inset-bottom, 0px)); }

  .os-dock {
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--dock-h);
    align-items: center;
    gap: 4px;
    padding: 4px 8px env(safe-area-inset-bottom, 0px);
    overflow-x: auto;
    overscroll-behavior-x: contain;
    transform: none;
    background: var(--os-face);
    border-width: 1px 0 0;
    border-radius: 0;
    box-shadow: inset 0 1px 0 var(--os-hi);
  }

  /* center when it fits, scroll from the start when it doesn't */
  .os-dock > :first-child { margin-left: auto; }
  .os-dock > :last-child { margin-right: auto; }

  .os-dock__item { width: 44px; height: 44px; }
  .os-dock__item img { width: 32px; height: 32px; }
  .os-dock__item:hover,
  .os-dock__item:focus-visible { transform: none; }
  .os-dock__item::before { display: none; }
  .os-dock__item:focus-visible { outline-offset: -2px; }
  .os-dock__item[aria-current="page"]::after { bottom: 0; }
}
