Files
juanatsap ca758882ef fix: Position theme switcher and info button tooltips on TOP for mobile
The theme switcher and info button tooltips were appearing on the RIGHT
in mobile view instead of on TOP (like macOS Dock style) because they
didn't have the .fixed-btn class and weren't included in the mobile
media query rules.

Changes:
- static/css/04-interactive/_tooltips.css: Add .color-theme-switcher and
  .info-button selectors to mobile @media (max-width: 900px) rules
- Now tooltips appear ABOVE these buttons on mobile with bottom: calc(100% + 8px)

Testing:
- Added mobile tooltip position test
- Verified theme switcher and info tooltips now positioned on top on mobile
- Desktop behavior unchanged (tooltips still on right)

Mobile tooltip positioning now consistent across ALL buttons:
 All bottom dock buttons show tooltips on TOP (macOS Dock style)
2025-11-20 20:01:57 +00:00

220 lines
6.2 KiB
CSS

/* ============================================================================
MACOS DOCK-STYLE TOOLTIPS
Modern tooltips with smooth fade and scale animations
============================================================================ */
/* Tooltip Container */
.has-tooltip {
position: relative;
}
/* Tooltip Base Styles - Using ::before for the bubble */
.has-tooltip::before {
content: attr(data-tooltip);
position: absolute;
/* macOS Dock styling */
background: rgba(0, 0, 0, 0.85);
color: white;
font-size: 11px;
font-weight: 600;
padding: 4px 8px;
border-radius: 6px;
white-space: nowrap;
letter-spacing: 0.01em;
line-height: 1.3;
/* Shadow for depth */
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
/* Hidden by default */
opacity: 0;
visibility: hidden;
/* Smooth fade + scale animation */
transition: opacity 0.2s ease,
transform 0.2s cubic-bezier(0.16, 1, 0.3, 1),
visibility 0.2s ease;
/* Start scaled down slightly */
transform: scale(0.8);
/* Prevent tooltip from blocking interactions */
pointer-events: none;
/* Layer above content */
z-index: 1000;
}
/* Show tooltip on hover */
.has-tooltip:hover::before {
opacity: 1;
visibility: visible;
transform: scale(1);
}
/* ============================================================================
POSITIONING VARIANTS
============================================================================ */
/* DEFAULT: Right position (for vertical action bar buttons in desktop) */
.has-tooltip::before {
left: calc(100% + 12px); /* 12px gap from button */
top: 50%;
transform: translateY(-50%) scale(0.8);
}
.has-tooltip:hover::before {
transform: translateY(-50%) scale(1);
}
/* LEFT position (for back-to-top button) */
.has-tooltip.tooltip-left::before {
right: calc(100% + 12px); /* 12px gap from button */
left: auto;
top: 50%;
transform: translateY(-50%) scale(0.8);
}
.has-tooltip.tooltip-left:hover::before {
transform: translateY(-50%) scale(1);
}
/* TOP position (for mobile view - like macOS Dock) */
.has-tooltip.tooltip-top::before {
bottom: calc(100% + 12px); /* 12px gap above button */
left: 50%;
top: auto;
right: auto;
transform: translateX(-50%) scale(0.8);
}
.has-tooltip.tooltip-top:hover::before {
transform: translateX(-50%) scale(1);
}
/* BOTTOM position (alternative) */
.has-tooltip.tooltip-bottom::before {
top: calc(100% + 12px); /* 12px gap below button */
left: 50%;
bottom: auto;
right: auto;
transform: translateX(-50%) scale(0.8);
}
.has-tooltip.tooltip-bottom:hover::before {
transform: translateX(-50%) scale(1);
}
/* ============================================================================
MOBILE RESPONSIVE BEHAVIOR
============================================================================ */
/* Mobile: Switch all tooltips to TOP position (like macOS Dock) */
@media (max-width: 900px) {
/* Action bar buttons get TOP tooltips on mobile */
.action-btn.has-tooltip::before {
bottom: calc(100% + 8px); /* 8px gap above button */
left: 50%;
top: auto;
right: auto;
transform: translateX(-50%) scale(0.8);
}
.action-btn.has-tooltip:hover::before {
transform: translateX(-50%) scale(1);
}
/* Fixed buttons (left side) get TOP tooltips on mobile - like macOS Dock */
.fixed-btn.has-tooltip::before,
.color-theme-switcher.has-tooltip::before,
.info-button.has-tooltip::before {
bottom: calc(100% + 8px); /* 8px gap above button */
left: 50%;
top: auto;
right: auto;
transform: translateX(-50%) scale(0.8);
}
.fixed-btn.has-tooltip:hover::before,
.color-theme-switcher.has-tooltip:hover::before,
.info-button.has-tooltip:hover::before {
transform: translateX(-50%) scale(1);
}
/* Back-to-top button keeps LEFT position on mobile */
.back-to-top.has-tooltip.tooltip-left::before {
right: calc(100% + 8px);
left: auto;
top: 50%;
bottom: auto;
transform: translateY(-50%) scale(0.8);
}
.back-to-top.has-tooltip.tooltip-left:hover::before {
transform: translateY(-50%) scale(1);
}
}
/* Very narrow mobile - Adjust back-to-top tooltip for higher position */
@media (max-width: 483px) {
/* Back-to-top moves up, tooltip stays with it */
.back-to-top.has-tooltip.tooltip-left::before {
right: calc(100% + 8px);
top: 50%;
transform: translateY(-50%) scale(0.8);
}
.back-to-top.has-tooltip.tooltip-left:hover::before {
transform: translateY(-50%) scale(1);
}
}
/* ============================================================================
ACCESSIBILITY & PERFORMANCE
============================================================================ */
/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
.has-tooltip::before {
transition: opacity 0.1s ease, visibility 0.1s ease;
transform: scale(1) !important; /* No scale animation */
}
.has-tooltip:hover::before {
transform: scale(1) !important;
}
.has-tooltip.tooltip-left::before,
.has-tooltip.tooltip-left:hover::before {
transform: translateY(-50%) scale(1) !important;
}
.has-tooltip.tooltip-top::before,
.has-tooltip.tooltip-top:hover::before {
transform: translateX(-50%) scale(1) !important;
}
}
/* Hide tooltips on touch devices (avoid sticky tooltips) */
@media (hover: none) and (pointer: coarse) {
.has-tooltip::before {
display: none;
}
}
/* ============================================================================
THEME SUPPORT
============================================================================ */
/* Dark theme - slightly lighter tooltip for better contrast */
[data-color-theme="dark"] .has-tooltip::before {
background: rgba(40, 40, 40, 0.95);
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
}
/* Light theme - keep default dark tooltip (better contrast) */
[data-color-theme="light"] .has-tooltip::before {
background: rgba(0, 0, 0, 0.85);
}