/* Touch targets, dock, XP pill and theme toggle on phones (owned by the touch/dock agent) */

/* Phones and small tablets: coarse pointers get 44px targets */
@media (max-width: 620px) {
  body { padding-bottom: 96px; }

  /* The XP pill is a gimmick that crowds the first screen; desktop keeps it */
  .xp { display: none !important; }

  /* Dock: 6 x 44px buttons fit within 390px */
  .quick-dock { bottom: 12px; gap: 0.3rem; padding: 0.4rem; max-width: calc(100vw - 16px); }
  .quick-dock a, .quick-dock button { width: 44px; height: 44px; min-width: 44px; min-height: 44px; border-radius: 14px; }
  .quick-dock:after { margin-left: 0; }

  /* Theme toggle sits above the dock, right edge */
  .theme-toggle { width: 44px; height: 44px; right: 12px; bottom: calc(12px + 44px + 0.8rem + 10px); }

  /* Tap/focus shows the label tooltip; keep it inside the screen */
  .quick-dock [data-dock-label]:active:before,
  .quick-dock [data-dock-label]:focus:before { opacity: 1; transform: translate(-50%, 0); }
  .quick-dock [data-dock-label]:first-child:before { left: 0; transform: translate(0, 5px); }
  .quick-dock [data-dock-label]:first-child:active:before,
  .quick-dock [data-dock-label]:first-child:focus:before,
  .quick-dock [data-dock-label]:first-child:hover:before { transform: translate(0, 0); }
  .quick-dock [data-dock-label]:last-child:before { left: auto; right: 0; transform: translate(0, 5px); }
  .quick-dock [data-dock-label]:last-child:active:before,
  .quick-dock [data-dock-label]:last-child:focus:before,
  .quick-dock [data-dock-label]:last-child:hover:before { transform: translate(0, 0); }
}

/* Touch devices at any width */
@media (pointer: coarse) {
  .quick-dock a, .quick-dock button, .theme-toggle { min-width: 44px; min-height: 44px; }
  .site-search-button, .menu-button, .profile-download, .location-link, .location-map-link,
  .featured-project-repository, .event-source, .header-cta { min-height: 44px; }
  .featured-project-repository, .event-source, .location-link, .location-map-link {
    display: inline-flex; align-items: center; padding-block: 0.55rem;
  }
  .site-search-button, .menu-button, .profile-download { display: inline-flex; align-items: center; justify-content: center; }
  main p a, main li a, footer a, .site-footer a { display: inline-flex; align-items: center; min-height: 44px; }
  input:not([type=checkbox]):not([type=radio]), textarea, select { min-height: 44px; }
}

/* Focus rings on dock and toggle */
.quick-dock a:focus-visible, .quick-dock button:focus-visible, .theme-toggle:focus-visible {
  outline: 3px solid #405dea !important; outline-offset: 2px;
}
html[data-theme="dark"] .quick-dock a:focus-visible,
html[data-theme="dark"] .quick-dock button:focus-visible,
html[data-theme="dark"] .theme-toggle:focus-visible { outline-color: #9db0ff !important; }

@media (prefers-reduced-motion: reduce) {
  .quick-dock, .quick-dock *, .theme-toggle, .theme-toggle * { transition: none !important; animation: none !important; }
  .quick-dock a:hover, .quick-dock button:hover { transform: none !important; }
}

/* Specificity overrides for stubborn small targets */
@media (pointer: coarse) {
  .site-nav a { display: flex; align-items: center; min-height: 44px !important; }
  .profile-download, .location-link, .location-map-link { min-height: 44px !important; box-sizing: border-box; }
  .featured-project-actions a { display: inline-flex; align-items: center; min-height: 44px; padding-block: 0.5rem; }
}
@media (pointer: coarse) { button { min-height: 44px; } }
